{
  "data": {
    "basis": "RECOMPILED",
    "compilationTrace": {
      "events": [
        {
          "confidence": "EXACT",
          "decision": "NORMALIZED",
          "details": {
            "requestedFieldCount": 6
          },
          "event": "SEMANTIC_DSL_NORMALIZED",
          "observedAt": "2026-10-20T05:19:55.600102800Z",
          "reasonCode": "DSL_NORMALIZED",
          "sequence": 1,
          "stage": "NORMALIZATION",
          "status": "EVALUATED"
        },
        {
          "confidence": "EXACT",
          "decision": "RAW",
          "details": {},
          "event": "PRE_AGGREGATION_ROUTING",
          "observedAt": "2026-10-20T05:19:55.602172700Z",
          "reasonCode": "PREAGG_NOT_CONFIGURED",
          "sequence": 2,
          "stage": "MATERIALIZATION",
          "status": "EVALUATED"
        },
        {
          "confidence": "EXACT",
          "decision": "RAW",
          "details": {},
          "event": "PRE_AGGREGATION_ROUTING",
          "observedAt": "2026-10-20T05:19:55.603231200Z",
          "reasonCode": "PREAGG_NOT_CONFIGURED",
          "sequence": 3,
          "stage": "MATERIALIZATION",
          "status": "EVALUATED"
        },
        {
          "confidence": "OBSERVED",
          "decision": "COMPOSED_SQL",
          "details": {
            "parameterCount": 4
          },
          "event": "TIME_WINDOW_PLAN_COMPILED",
          "observedAt": "2026-10-20T05:19:55.603231200Z",
          "reasonCode": "TIME_WINDOW_COMPOSE_PLAN_COMPILED",
          "sequence": 4,
          "stage": "TIME_WINDOW",
          "status": "EVALUATED"
        }
      ],
      "fieldResolution": [
        {
          "confidence": "EXACT",
          "requested": "invoiceDate$year",
          "resolved": "invoiceDate$year",
          "tableField": "invoiceDate$id",
          "tableModel": "ChinookInvoiceTimeModel"
        },
        {
          "confidence": "EXACT",
          "requested": "invoiceDate$month",
          "resolved": "invoiceDate$month",
          "tableField": "invoiceDate$id",
          "tableModel": "ChinookInvoiceTimeModel"
        },
        {
          "confidence": "EXACT",
          "requested": "invoiceAmount",
          "resolved": "invoiceAmount",
          "tableField": "invoiceAmount",
          "tableModel": "ChinookInvoiceTimeModel"
        },
        {
          "confidence": "OBSERVED",
          "requested": "invoiceAmount__prior",
          "resolved": "invoiceAmount__prior"
        },
        {
          "confidence": "OBSERVED",
          "requested": "invoiceAmount__diff",
          "resolved": "invoiceAmount__diff"
        },
        {
          "confidence": "OBSERVED",
          "requested": "invoiceAmount__ratio",
          "resolved": "invoiceAmount__ratio"
        }
      ],
      "normalizedConditions": [],
      "normalizedDsl": {
        "autoFixDimCaption": false,
        "autoGroupBy": true,
        "columns": [
          "invoiceDate$year",
          "invoiceDate$month",
          "invoiceAmount",
          "invoiceAmount__prior",
          "invoiceAmount__diff",
          "invoiceAmount__ratio"
        ],
        "distinct": false,
        "groupBy": [
          {
            "agg": "null",
            "field": "invoiceDate$year"
          },
          {
            "agg": "null",
            "field": "invoiceDate$month"
          }
        ],
        "optimizeAggSqlEnabled": true,
        "orderBy": [
          {
            "dir": "asc",
            "field": "invoiceDate$year",
            "nullFirst": false,
            "nullLast": false
          },
          {
            "dir": "asc",
            "field": "invoiceDate$month",
            "nullFirst": false,
            "nullLast": false
          }
        ],
        "queryModel": "ChinookInvoiceTimeQueryModel",
        "returnTotal": false,
        "strictColumns": true,
        "withSubtotals": false
      },
      "originalDsl": {
        "captionMatchMode": "EXACT",
        "columns": [
          "invoiceDate$year",
          "invoiceDate$month",
          "invoiceAmount",
          "invoiceAmount__prior",
          "invoiceAmount__diff",
          "invoiceAmount__ratio"
        ],
        "distinct": false,
        "groupBy": [
          {
            "field": "invoiceDate$year"
          },
          {
            "field": "invoiceDate$month"
          }
        ],
        "limit": 100,
        "mismatchHandleStrategy": "ABORT",
        "orderBy": [
          {
            "dir": "asc",
            "field": "invoiceDate$year",
            "nullFirst": false,
            "nullLast": false
          },
          {
            "dir": "asc",
            "field": "invoiceDate$month",
            "nullFirst": false,
            "nullLast": false
          }
        ],
        "pivotMode": false,
        "returnTotal": false,
        "start": 0,
        "timeWindow": {
          "comparison": "***",
          "field": "***",
          "grain": "***",
          "range": "***",
          "targetMetrics": [
            "***"
          ],
          "value": [
            "***",
            "***"
          ]
        },
        "withSubtotals": false
      }
    },
    "definitionTrace": {
      "fields": [
        {
          "dataType": "INTEGER",
          "fieldType": "property",
          "lineage": [
            {
              "confidence": "EXACT",
              "from": "ChinookInvoiceTimeQueryModel.invoiceId",
              "reasonCode": "QM_TO_TM_MODEL_STRUCTURE",
              "to": "ChinookInvoiceTimeModel.invoiceId"
            },
            {
              "column": "InvoiceId",
              "confidence": "EXACT",
              "from": "ChinookInvoiceTimeModel.invoiceId",
              "reasonCode": "TABLE_COLUMN_MODEL_STRUCTURE",
              "relation": "Invoice",
              "to": "Invoice.InvoiceId"
            }
          ],
          "queryField": "ChinookInvoiceTimeQueryModel.invoiceId",
          "references": [],
          "tableField": "invoiceId",
          "tableModel": "ChinookInvoiceTimeModel"
        },
        {
          "dataType": "DAY",
          "fieldType": "dimension",
          "lineage": [
            {
              "confidence": "EXACT",
              "from": "ChinookInvoiceTimeQueryModel.invoiceDate$id",
              "reasonCode": "QM_TO_TM_MODEL_STRUCTURE",
              "to": "ChinookInvoiceTimeModel.invoiceDate$id"
            },
            {
              "column": "InvoiceDate",
              "confidence": "EXACT",
              "from": "ChinookInvoiceTimeModel.invoiceDate$id",
              "reasonCode": "TABLE_COLUMN_MODEL_STRUCTURE",
              "relation": "Invoice",
              "to": "Invoice.InvoiceDate"
            }
          ],
          "queryField": "ChinookInvoiceTimeQueryModel.invoiceDate$id",
          "references": [],
          "tableField": "invoiceDate$id",
          "tableModel": "ChinookInvoiceTimeModel"
        },
        {
          "dataType": "DAY",
          "fieldType": "dimension",
          "lineage": [
            {
              "confidence": "EXACT",
              "from": "ChinookInvoiceTimeQueryModel.invoiceDate$caption",
              "reasonCode": "QM_TO_TM_MODEL_STRUCTURE",
              "to": "ChinookInvoiceTimeModel.invoiceDate$caption"
            },
            {
              "column": "InvoiceDate",
              "confidence": "EXACT",
              "from": "ChinookInvoiceTimeModel.invoiceDate$caption",
              "reasonCode": "TABLE_COLUMN_MODEL_STRUCTURE",
              "relation": "Invoice",
              "to": "Invoice.InvoiceDate"
            }
          ],
          "queryField": "ChinookInvoiceTimeQueryModel.invoiceDate$caption",
          "references": [],
          "tableField": "invoiceDate$caption",
          "tableModel": "ChinookInvoiceTimeModel"
        },
        {
          "dataType": "DAY",
          "fieldType": "dimension",
          "lineage": [
            {
              "confidence": "EXACT",
              "from": "ChinookInvoiceTimeQueryModel.invoiceDate",
              "reasonCode": "QM_TO_TM_MODEL_STRUCTURE",
              "to": "ChinookInvoiceTimeModel.invoiceDate$caption"
            },
            {
              "column": "InvoiceDate",
              "confidence": "EXACT",
              "from": "ChinookInvoiceTimeModel.invoiceDate$caption",
              "reasonCode": "TABLE_COLUMN_MODEL_STRUCTURE",
              "relation": "Invoice",
              "to": "Invoice.InvoiceDate"
            }
          ],
          "queryField": "ChinookInvoiceTimeQueryModel.invoiceDate",
          "references": [],
          "tableField": "invoiceDate$caption",
          "tableModel": "ChinookInvoiceTimeModel"
        },
        {
          "dataType": "INTEGER",
          "fieldType": "property",
          "lineage": [
            {
              "confidence": "EXACT",
              "from": "ChinookInvoiceTimeQueryModel.invoiceDate$year",
              "reasonCode": "QM_TO_TM_MODEL_STRUCTURE",
              "to": "ChinookInvoiceTimeModel.invoiceDate$id"
            },
            {
              "column": "InvoiceDate",
              "confidence": "EXACT",
              "from": "ChinookInvoiceTimeModel.invoiceDate$id",
              "reasonCode": "TABLE_COLUMN_MODEL_STRUCTURE",
              "relation": "Invoice",
              "to": "Invoice.InvoiceDate"
            }
          ],
          "queryField": "ChinookInvoiceTimeQueryModel.invoiceDate$year",
          "references": [],
          "tableField": "invoiceDate$id",
          "tableModel": "ChinookInvoiceTimeModel"
        },
        {
          "dataType": "INTEGER",
          "fieldType": "property",
          "lineage": [
            {
              "confidence": "EXACT",
              "from": "ChinookInvoiceTimeQueryModel.invoiceDate$month",
              "reasonCode": "QM_TO_TM_MODEL_STRUCTURE",
              "to": "ChinookInvoiceTimeModel.invoiceDate$id"
            },
            {
              "column": "InvoiceDate",
              "confidence": "EXACT",
              "from": "ChinookInvoiceTimeModel.invoiceDate$id",
              "reasonCode": "TABLE_COLUMN_MODEL_STRUCTURE",
              "relation": "Invoice",
              "to": "Invoice.InvoiceDate"
            }
          ],
          "queryField": "ChinookInvoiceTimeQueryModel.invoiceDate$month",
          "references": [],
          "tableField": "invoiceDate$id",
          "tableModel": "ChinookInvoiceTimeModel"
        },
        {
          "dataType": "STRING",
          "fieldType": "property",
          "lineage": [
            {
              "confidence": "EXACT",
              "from": "ChinookInvoiceTimeQueryModel.invoiceDate$yearMonth",
              "reasonCode": "QM_TO_TM_MODEL_STRUCTURE",
              "to": "ChinookInvoiceTimeModel.invoiceDate$id"
            },
            {
              "column": "InvoiceDate",
              "confidence": "EXACT",
              "from": "ChinookInvoiceTimeModel.invoiceDate$id",
              "reasonCode": "TABLE_COLUMN_MODEL_STRUCTURE",
              "relation": "Invoice",
              "to": "Invoice.InvoiceDate"
            }
          ],
          "queryField": "ChinookInvoiceTimeQueryModel.invoiceDate$yearMonth",
          "references": [],
          "tableField": "invoiceDate$id",
          "tableModel": "ChinookInvoiceTimeModel"
        },
        {
          "aggregationFormula": "SUM(Total)",
          "dataType": "MONEY",
          "fieldType": "measure",
          "lineage": [
            {
              "confidence": "EXACT",
              "from": "ChinookInvoiceTimeQueryModel.invoiceAmount",
              "reasonCode": "QM_TO_TM_MODEL_STRUCTURE",
              "to": "ChinookInvoiceTimeModel.invoiceAmount"
            },
            {
              "confidence": "EXACT",
              "expression": "SUM(Total)",
              "from": "ChinookInvoiceTimeModel.invoiceAmount",
              "reasonCode": "AGGREGATION_MODEL_STRUCTURE",
              "to": "SUM(Total)"
            },
            {
              "column": "Total",
              "confidence": "EXACT",
              "from": "ChinookInvoiceTimeModel.invoiceAmount",
              "reasonCode": "TABLE_COLUMN_MODEL_STRUCTURE",
              "relation": "Invoice",
              "to": "Invoice.Total"
            }
          ],
          "queryField": "ChinookInvoiceTimeQueryModel.invoiceAmount",
          "references": [],
          "tableField": "invoiceAmount",
          "tableModel": "ChinookInvoiceTimeModel"
        },
        {
          "aggregationFormula": "COUNT(InvoiceId)",
          "dataType": "INTEGER",
          "fieldType": "measure",
          "lineage": [
            {
              "confidence": "EXACT",
              "from": "ChinookInvoiceTimeQueryModel.invoiceCount",
              "reasonCode": "QM_TO_TM_MODEL_STRUCTURE",
              "to": "ChinookInvoiceTimeModel.invoiceCount"
            },
            {
              "confidence": "EXACT",
              "expression": "COUNT(InvoiceId)",
              "from": "ChinookInvoiceTimeModel.invoiceCount",
              "reasonCode": "AGGREGATION_MODEL_STRUCTURE",
              "to": "COUNT(InvoiceId)"
            },
            {
              "column": "InvoiceId",
              "confidence": "EXACT",
              "from": "ChinookInvoiceTimeModel.invoiceCount",
              "reasonCode": "TABLE_COLUMN_MODEL_STRUCTURE",
              "relation": "Invoice",
              "to": "Invoice.InvoiceId"
            }
          ],
          "queryField": "ChinookInvoiceTimeQueryModel.invoiceCount",
          "references": [],
          "tableField": "invoiceCount",
          "tableModel": "ChinookInvoiceTimeModel"
        }
      ],
      "joins": [],
      "model": {
        "dependencies": [
          {
            "kind": "TABLE",
            "name": "ChinookInvoiceTimeModel"
          }
        ],
        "kind": "QUERY",
        "name": "ChinookInvoiceTimeQueryModel",
        "namespace": "chinook",
        "revision": "source:1ce0e063-902b-4150-ab27-d627a42e531b:g0:n1",
        "source": "chinook-teaching:练习目录\\lab\\models\\query\\ChinookInvoiceTimeQueryModel.qm"
      },
      "queryModel": "ChinookInvoiceTimeQueryModel"
    },
    "executionTrace": {
      "jdbc": "NOT_EVALUATED",
      "l1Cache": "NOT_EVALUATED",
      "l2Cache": "NOT_EVALUATED",
      "route": "NOT_EVALUATED"
    },
    "limitations": [
      {
        "code": "RECOMPILED_NOT_EXECUTED_TRACE",
        "confidence": "EXACT",
        "message": "This evidence was produced by a fresh governed compilation. It is not the historical trace of an earlier execution."
      },
      {
        "code": "PARAMETER_ORIGIN_PARTIALLY_OPAQUE",
        "confidence": "OPAQUE",
        "message": "Generated parameter cardinality could not be correlated one-to-one with normalized conditions; parameter origins were not guessed."
      }
    ],
    "materializationTrace": {
      "decision": "NOT_EVALUATED",
      "definitions": [],
      "reasonCode": "PREAGG_NOT_EVALUATED_FOR_TIME_WINDOW_COMPOSE",
      "route": "NOT_EVALUATED",
      "status": "NOT_EVALUATED"
    },
    "schemaVersion": "foggy-semantic-explain/v1",
    "securityTrace": {
      "affectedFields": [],
      "affectsFieldVisibility": false,
      "affectsJoin": false,
      "affectsPreAggregation": false,
      "conditions": [],
      "effect": "ALLOW",
      "policyId": "PUBLIC",
      "policyVersion": "PUBLIC",
      "publicDecision": true,
      "status": "EVALUATED"
    },
    "sqlTrace": {
      "confidence": "OBSERVED",
      "exposed": true,
      "finalPhysicalSql": "SELECT \"invoiceDate$year\", \"invoiceDate$month\", \"invoiceAmount\", \"invoiceAmount__prior\", \"invoiceAmount__diff\", \"invoiceAmount__ratio\"\nFROM (SELECT \"invoiceDate$year\", \"invoiceDate$month\", \"invoiceAmount\", \"invoiceAmount__prior\", (\"invoiceAmount\" - \"invoiceAmount__prior\") AS \"invoiceAmount__diff\", ((1.0E0 * (\"invoiceAmount\" - \"invoiceAmount__prior\")) / NULLIF(\"invoiceAmount__prior\", 0)) AS \"invoiceAmount__ratio\"\nFROM (WITH cte_0 AS (select\tCAST(strftime('%Y', t1.InvoiceDate) AS INTEGER) \"invoiceDate$year\",\tCAST(strftime('%m', t1.InvoiceDate) AS INTEGER) \"invoiceDate$month\",\tSUM(t1.Total) \"invoiceAmount\",\t(CAST(strftime('%Y', t1.InvoiceDate) AS INTEGER) * 12 + CAST(strftime('%m', t1.InvoiceDate) AS INTEGER) - 1) \"__tw_period_key\"\tfrom Invoice t1\t where  1=1  and \tt1.InvoiceDate >=?  and \tt1.InvoiceDate <? \tgroup by CAST(strftime('%Y', t1.InvoiceDate) AS INTEGER),\tCAST(strftime('%m', t1.InvoiceDate) AS INTEGER),\t(CAST(strftime('%Y', t1.InvoiceDate) AS INTEGER) * 12 + CAST(strftime('%m', t1.InvoiceDate) AS INTEGER) - 1)),\ncte_2 AS (SELECT (__tw_period_key + 12) AS __tw_period_key, \"invoiceAmount\" AS \"invoiceAmount__prior\"\nFROM (select\tCAST(strftime('%Y', t1.InvoiceDate) AS INTEGER) \"invoiceDate$year\",\tCAST(strftime('%m', t1.InvoiceDate) AS INTEGER) \"invoiceDate$month\",\tSUM(t1.Total) \"invoiceAmount\",\t(CAST(strftime('%Y', t1.InvoiceDate) AS INTEGER) * 12 + CAST(strftime('%m', t1.InvoiceDate) AS INTEGER) - 1) \"__tw_period_key\"\tfrom Invoice t1\t where  1=1  and \tt1.InvoiceDate >=?  and \tt1.InvoiceDate <? \tgroup by CAST(strftime('%Y', t1.InvoiceDate) AS INTEGER),\tCAST(strftime('%m', t1.InvoiceDate) AS INTEGER),\t(CAST(strftime('%Y', t1.InvoiceDate) AS INTEGER) * 12 + CAST(strftime('%m', t1.InvoiceDate) AS INTEGER) - 1)) AS cte_1)\nSELECT cte_0.\"invoiceDate$year\", cte_0.\"invoiceDate$month\", cte_0.\"invoiceAmount\", cte_0.__tw_period_key, cte_2.\"invoiceAmount__prior\"\nFROM cte_0\nLEFT JOIN cte_2 ON cte_0.__tw_period_key = cte_2.__tw_period_key) AS cte_3) AS cte_4\nORDER BY \"invoiceDate$year\" ASC, \"invoiceDate$month\" ASC\nLIMIT 100",
      "logicalSql": "",
      "parameters": [
        {
          "confidence": "OBSERVED",
          "index": 1,
          "origin": "UNKNOWN",
          "redactedValue": "***",
          "valueType": "String"
        },
        {
          "confidence": "OBSERVED",
          "index": 2,
          "origin": "UNKNOWN",
          "redactedValue": "***",
          "valueType": "String"
        },
        {
          "confidence": "OBSERVED",
          "index": 3,
          "origin": "UNKNOWN",
          "redactedValue": "***",
          "valueType": "String"
        },
        {
          "confidence": "OBSERVED",
          "index": 4,
          "origin": "UNKNOWN",
          "redactedValue": "***",
          "valueType": "String"
        }
      ],
      "reasonCode": "SQL_CAPTURED_FROM_COMPOSE_COMPILER",
      "sourceOfTruth": "ComposeSqlCompiler.output"
    }
  },
  "diagnostics": {
    "attributes": {},
    "warnings": []
  },
  "engine": "java",
  "runtimeApiVersion": "foggy-runtime-api/v1",
  "success": true
}
