{
  "data": {
    "debug": {
      "durationMs": 3,
      "extra": {
        "aggSql": "WITH stage1 AS (\nselect\tstrftime('%Y-%m', t1.InvoiceDate) \"invoiceDate$yearMonth\",\tSUM(t1.Total) \"totalAmount\",\tCOUNT(t1.InvoiceId) \"billCount\"\tfrom Invoice t1\t where  1=1  and \tt1.InvoiceDate >=?  and \tt1.InvoiceDate <? \tgroup by strftime('%Y-%m', t1.InvoiceDate)\n)\nselect\tnull \"invoiceDate$yearMonth\",\tnull \"totalAmount\",\tnull \"billCount\",\tnull \"previousAmount\",\tcount(*) \"total\"\tfrom (SELECT \"invoiceDate$yearMonth\" AS \"invoiceDate$yearMonth\",\n       \"totalAmount\" AS \"totalAmount\",\n       \"billCount\" AS \"billCount\",\n       LAG(\"totalAmount\", 1) OVER (ORDER BY \"invoiceDate$yearMonth\" ASC) AS \"previousAmount\"\nFROM stage1) tx\t",
        "params": [
          "2012-01-01",
          "2013-01-01"
        ],
        "sql": "WITH stage1 AS (\nselect\tstrftime('%Y-%m', t1.InvoiceDate) \"invoiceDate$yearMonth\",\tSUM(t1.Total) \"totalAmount\",\tCOUNT(t1.InvoiceId) \"billCount\"\tfrom Invoice t1\t where  1=1  and \tt1.InvoiceDate >=?  and \tt1.InvoiceDate <? \tgroup by strftime('%Y-%m', t1.InvoiceDate)\n)\nSELECT \"invoiceDate$yearMonth\" AS \"invoiceDate$yearMonth\",\n       \"totalAmount\" AS \"totalAmount\",\n       \"billCount\" AS \"billCount\",\n       LAG(\"totalAmount\", 1) OVER (ORDER BY \"invoiceDate$yearMonth\" ASC) AS \"previousAmount\"\nFROM stage1\nORDER BY \"invoiceDate$yearMonth\" asc"
      },
      "normalized": {
        "groupBy": [
          {
            "field": "invoiceDate$yearMonth"
          },
          {
            "agg": "SUM",
            "field": "totalAmount"
          },
          {
            "agg": "COUNT",
            "field": "billCount"
          },
          {
            "field": "previousAmount"
          }
        ],
        "orderBy": [
          {
            "dir": "asc",
            "field": "invoiceDate$yearMonth",
            "nullFirst": false,
            "nullLast": false
          }
        ],
        "slice": [
          {
            "field": "invoiceDate$id",
            "op": "[)",
            "value": [
              "2012-01-01",
              "2013-01-01"
            ]
          }
        ]
      }
    },
    "hasNext": false,
    "items": [
      {
        "billCount": 7,
        "invoiceDate$yearMonth": "2012-01",
        "totalAmount": 37.62
      },
      {
        "billCount": 7,
        "invoiceDate$yearMonth": "2012-02",
        "previousAmount": 37.62,
        "totalAmount": 37.62
      },
      {
        "billCount": 7,
        "invoiceDate$yearMonth": "2012-03",
        "previousAmount": 37.62,
        "totalAmount": 37.62
      },
      {
        "billCount": 7,
        "invoiceDate$yearMonth": "2012-04",
        "previousAmount": 37.62,
        "totalAmount": 37.62
      },
      {
        "billCount": 7,
        "invoiceDate$yearMonth": "2012-05",
        "previousAmount": 37.62,
        "totalAmount": 37.62
      },
      {
        "billCount": 7,
        "invoiceDate$yearMonth": "2012-06",
        "previousAmount": 37.62,
        "totalAmount": 37.62
      },
      {
        "billCount": 7,
        "invoiceDate$yearMonth": "2012-07",
        "previousAmount": 37.62,
        "totalAmount": 39.62
      },
      {
        "billCount": 7,
        "invoiceDate$yearMonth": "2012-08",
        "previousAmount": 39.62,
        "totalAmount": 47.62
      },
      {
        "billCount": 6,
        "invoiceDate$yearMonth": "2012-09",
        "previousAmount": 47.62,
        "totalAmount": 46.71
      },
      {
        "billCount": 7,
        "invoiceDate$yearMonth": "2012-10",
        "previousAmount": 46.71,
        "totalAmount": 42.62
      },
      {
        "billCount": 7,
        "invoiceDate$yearMonth": "2012-11",
        "previousAmount": 42.62,
        "totalAmount": 37.62
      },
      {
        "billCount": 7,
        "invoiceDate$yearMonth": "2012-12",
        "previousAmount": 37.62,
        "totalAmount": 37.62
      }
    ],
    "pagination": {
      "hasMore": false,
      "limit": 100,
      "rangeDescription": "显示第 1-12 条",
      "returned": 12,
      "start": 0
    },
    "schema": {
      "columns": [
        {
          "dataType": "STRING",
          "name": "invoiceDate$yearMonth",
          "title": "账单年月"
        },
        {
          "name": "totalAmount"
        },
        {
          "name": "billCount"
        },
        {
          "name": "previousAmount"
        }
      ],
      "summary": "按 账单年月、previousAmount 分组，统计 totalAmount、billCount，返回 12 条数据"
    },
    "total": 0
  },
  "diagnostics": {
    "attributes": {},
    "warnings": []
  },
  "engine": "java",
  "runtimeApiVersion": "foggy-runtime-api/v1",
  "success": true
}
