Slackbot
03/01/2024, 1:00 PMJohn Kowtko
03/01/2024, 1:42 PMselect a.*, b.*
from (select channel, count(page) NumPages from wikipedia where flags = 'N' group by channel) a
join (select channel, sum(added) NumAdded from wikipedia where flags = 'N' group by channel) b
on a.channel = b.channel
generates the following native query:
{
"queryType": "scan",
"dataSource": {
"type": "join",
"left": {
"type": "query",
"query": {
"queryType": "groupBy",
"dataSource": {
"type": "table",
"name": "wikipedia"
},
"intervals": {
"type": "intervals",
"intervals": [
"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z"
]
},
"filter": {
"type": "equals",
"column": "flags",
"matchValueType": "STRING",
"matchValue": "N"
},
"granularity": {
"type": "all"
},
"dimensions": [
{
"type": "default",
"dimension": "channel",
"outputName": "d0",
"outputType": "STRING"
}
],
"aggregations": [
{
"type": "filtered",
"aggregator": {
"type": "count",
"name": "a0"
},
"filter": {
"type": "not",
"field": {
"type": "null",
"column": "page"
}
},
"name": "a0"
}
],
"limitSpec": {
"type": "NoopLimitSpec"
},
"context": {
"enableWindowing": true,
"maxNumTasks": 3,
"queryId": "abd92aea-cce6-40f2-a072-3a175402e026",
"sqlOuterLimit": 1001,
"sqlQueryId": "abd92aea-cce6-40f2-a072-3a175402e026",
"taskLockTypeX": "APPEND",
"useNativeQueryExplain": true
}
}
},
"right": {
"type": "query",
"query": {
"queryType": "groupBy",
"dataSource": {
"type": "table",
"name": "wikipedia"
},
"intervals": {
"type": "intervals",
"intervals": [
"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z"
]
},
"filter": {
"type": "equals",
"column": "flags",
"matchValueType": "STRING",
"matchValue": "N"
},
"granularity": {
"type": "all"
},
"dimensions": [
{
"type": "default",
"dimension": "channel",
"outputName": "d0",
"outputType": "STRING"
}
],
"aggregations": [
{
"type": "longSum",
"name": "a0",
"fieldName": "added"
}
],
"limitSpec": {
"type": "NoopLimitSpec"
},
"context": {
"enableWindowing": true,
"maxNumTasks": 3,
"queryId": "abd92aea-cce6-40f2-a072-3a175402e026",
"sqlOuterLimit": 1001,
"sqlQueryId": "abd92aea-cce6-40f2-a072-3a175402e026",
"taskLockTypeX": "APPEND",
"useNativeQueryExplain": true
}
}
},
"rightPrefix": "j0.",
"condition": "(\"d0\" == \"j0.d0\")",
"joinType": "INNER"
},
"intervals": {
"type": "intervals",
"intervals": [
"-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z"
]
},
"resultFormat": "compactedList",
"limit": 1001,
"columns": [
"a0",
"d0",
"j0.a0",
"j0.d0"
],
"legacy": false,
"context": {
"enableWindowing": true,
"maxNumTasks": 3,
"queryId": "abd92aea-cce6-40f2-a072-3a175402e026",
"sqlOuterLimit": 1001,
"sqlQueryId": "abd92aea-cce6-40f2-a072-3a175402e026",
"taskLockTypeX": "APPEND",
"useNativeQueryExplain": true
},
"granularity": {
"type": "all"
}
}
and both work for me, producing expected output 🙂.
Please try this approach and let us know if it still doesn't work. And if it does then you should be able to identify the difference from what you wrote.Saicharan Poleboina
03/02/2024, 10:46 AMSaicharan Poleboina
03/04/2024, 9:52 AMJohn Kowtko
03/05/2024, 1:07 PM