{
  "queryType": "timeseries",
  "dataSource": {
    "type": "join",
    "left": {
      "type": "join",
      "left": {
        "type": "table",
        "name": "datasource1"
      },
      "right": {
        "type": "query",
        "query": {
          "queryType": "groupBy",
          "dataSource": {
            "type": "query",
            "query": {
              "queryType": "groupBy",
              "dataSource": {
                "type": "table",
                "name": "datasource2"
              },
              "intervals": {
                "type": "intervals",
                "intervals": [
                  "2024-12-01T00:00:00.000Z/2025-01-04T00:00:00.000Z"
                ]
              },
              "granularity": {
                "type": "all"
              },
              "dimensions": [
                {
                  "type": "default",
                  "dimension": "Id",
                  "outputName": "d0",
                  "outputType": "STRING"
                }
              ],
              "limitSpec": {
                "type": "NoopLimitSpec"
              },
              "context": {
                "maxSubqueryRows": 2000000,
                "queryId": "a79b54c6-0330-4276-a868-32ec2f611b52",
                "sqlQueryId": "a79b54c6-0330-4276-a868-32ec2f611b52",
                "sqlStringifyArrays": false,
                "useNativeQueryExplain": true
              }
            }
          },
          "intervals": {
            "type": "intervals",
            "intervals": [
              "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z"
            ]
          },
          "granularity": {
            "type": "all"
          },
          "dimensions": [],
          "aggregations": [
            {
              "type": "count",
              "name": "a0"
            },
            {
              "type": "filtered",
              "aggregator": {
                "type": "count",
                "name": "a1"
              },
              "filter": {
                "type": "not",
                "field": {
                  "type": "null",
                  "column": "d0"
                }
              },
              "name": "a1"
            }
          ],
          "limitSpec": {
            "type": "NoopLimitSpec"
          },
          "context": {
            "maxSubqueryRows": 2000000,
            "queryId": "a79b54c6-0330-4276-a868-32ec2f611b52",
            "sqlQueryId": "a79b54c6-0330-4276-a868-32ec2f611b52",
            "sqlStringifyArrays": false,
            "useNativeQueryExplain": true
          }
        }
      },
      "rightPrefix": "j0.",
      "condition": "1",
      "joinType": "INNER"
    },
    "right": {
      "type": "query",
      "query": {
        "queryType": "groupBy",
        "dataSource": {
          "type": "table",
          "name": "datasource2"
        },
        "intervals": {
          "type": "intervals",
          "intervals": [
            "2024-12-01T00:00:00.000Z/2025-01-04T00:00:00.000Z"
          ]
        },
        "granularity": {
          "type": "all"
        },
        "dimensions": [
          {
            "type": "default",
            "dimension": "Id",
            "outputName": "d0",
            "outputType": "STRING"
          }
        ],
        "postAggregations": [
          {
            "type": "expression",
            "name": "p0",
            "expression": "1",
            "outputType": "LONG"
          }
        ],
        "limitSpec": {
          "type": "NoopLimitSpec"
        },
        "context": {
          "maxSubqueryRows": 2000000,
          "queryId": "a79b54c6-0330-4276-a868-32ec2f611b52",
          "sqlQueryId": "a79b54c6-0330-4276-a868-32ec2f611b52",
          "sqlStringifyArrays": false,
          "useNativeQueryExplain": true
        }
      }
    },
    "rightPrefix": "_j0.",
    "condition": "(\"Id\" == \"_j0.d0\")",
    "joinType": "LEFT"
  },
  "intervals": {
    "type": "intervals",
    "intervals": [
      "2024-12-01T00:00:00.000Z/2025-01-01T00:00:00.000Z"
    ]
  },
  "filter": {
    "type": "or",
    "fields": [
      {
        "type": "equals",
        "column": "j0.a0",
        "matchValueType": "LONG",
        "matchValue": 0
      },
      {
        "type": "and",
        "fields": [
          {
            "type": "null",
            "column": "_j0.p0"
          },
          {
            "type": "expression",
            "expression": "(\"j0.a1\" >= \"j0.a0\")"
          },
          {
            "type": "not",
            "field": {
              "type": "null",
              "column": "Id"
            }
          }
        ]
      }
    ]
  },
  "granularity": {
    "type": "all"
  },
  "aggregations": [
    {
      "type": "longSum",
      "name": "a0",
      "fieldName": "count"
    }
  ],
  "context": {
    "maxSubqueryRows": 2000000,
    "queryId": "a79b54c6-0330-4276-a868-32ec2f611b52",
    "sqlQueryId": "a79b54c6-0330-4276-a868-32ec2f611b52",
    "sqlStringifyArrays": false,
    "useNativeQueryExplain": true
  }
}