{
  "data": {
    "diagnostics": {
      "datasourceType": "sqlite",
      "defaultDialect": "sqlite",
      "dialectSource": "namespace-datasource-type",
      "namespace": "time-business",
      "namespaceDatasourceId": "time-business-sqlite",
      "namespaceDatasourceStatus": "active",
      "resolvedDialect": "sqlite"
    },
    "mode": "preview",
    "params": [],
    "scriptKind": "compose",
    "valid": true,
    "value": {
      "plans": {
        "members": {
          "params": [
            "2009-07-01 00:00:00"
          ],
          "sql": "WITH cte_1 AS (SELECT cohort_customer, first_month\nFROM (select\tt1.CustomerId \"cohort_customer\",\tMIN(t1.MonthIndex) \"first_month\"\tfrom Purchase t1\t where  1=1  and \tt1.InvoiceDate <? \tgroup by t1.CustomerId) AS cte_0\nORDER BY cohort_customer ASC\nLIMIT 1000)\nSELECT cte_1.cohort_customer, cte_1.first_month\nFROM cte_1"
        },
        "retained": {
          "params": [
            "2009-07-01 00:00:00",
            "2009-07-01 00:00:00",
            2
          ],
          "sql": "SELECT first_month, month_offset, COUNT(cohort_customer) AS active_customers\nFROM (SELECT cohort_customer, first_month, active_month, active_month - first_month AS month_offset\nFROM (WITH cte_0 AS (select\tt1.CustomerId \"cohort_customer\",\tMIN(t1.MonthIndex) \"first_month\"\tfrom Purchase t1\t where  1=1  and \tt1.InvoiceDate <? \tgroup by t1.CustomerId),\ncte_1 AS (select\tt1.CustomerId \"active_customer\",\tt1.MonthIndex \"active_month\"\tfrom Purchase t1\t where  1=1  and \tt1.InvoiceDate <? \tgroup by t1.CustomerId,\tt1.MonthIndex)\nSELECT cte_0.cohort_customer, cte_0.first_month, cte_1.active_customer, cte_1.active_month\nFROM cte_0\nINNER JOIN cte_1 ON cte_0.cohort_customer = cte_1.active_customer) AS cte_2) AS cte_3\nWHERE cte_3.month_offset <= ?\nGROUP BY first_month, month_offset\nORDER BY first_month ASC, month_offset ASC\nLIMIT 1000"
        },
        "sizes": {
          "params": [
            "2009-07-01 00:00:00"
          ],
          "sql": "WITH cte_1 AS (SELECT first_month, COUNT(cohort_customer) AS cohort_size\nFROM (select\tt1.CustomerId \"cohort_customer\",\tMIN(t1.MonthIndex) \"first_month\"\tfrom Purchase t1\t where  1=1  and \tt1.InvoiceDate <? \tgroup by t1.CustomerId) AS cte_0\nGROUP BY first_month\nORDER BY first_month ASC\nLIMIT 1000)\nSELECT cte_1.first_month, cte_1.cohort_size\nFROM cte_1"
        }
      }
    },
    "warnings": []
  },
  "diagnostics": {
    "attributes": {
      "datasourceType": "sqlite",
      "defaultDialect": "sqlite",
      "dialectSource": "namespace-datasource-type",
      "namespace": "time-business",
      "namespaceDatasourceId": "time-business-sqlite",
      "namespaceDatasourceStatus": "active",
      "resolvedDialect": "sqlite"
    },
    "warnings": []
  },
  "engine": "java",
  "runtimeApiVersion": "foggy-runtime-api/v1",
  "success": true
}
