diff --git a/src/Parsers/Kusto/KQL_ReleaseNote.md b/src/Parsers/Kusto/KQL_ReleaseNote.md index dfed2104846..ad399427214 100644 --- a/src/Parsers/Kusto/KQL_ReleaseNote.md +++ b/src/Parsers/Kusto/KQL_ReleaseNote.md @@ -654,7 +654,7 @@ https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/make-seriesoper `Customers | summarize t = make_list_if(FirstName, Age > 10) by FirstName` `Customers | summarize t = make_list_if(FirstName, Age > 10, 10) by FirstName` - [make_list_with_nulls()](https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/make-list-with-nulls-aggfunction) - `Customers | summarize t = make_list_with_nulls(FirstName) by FirstName` + `Customers | summarize t = make_list_with_nulls(Age) by FirstName` - [make_set()](https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/makeset-aggfunction) `Customers | summarize t = make_set(FirstName) by FirstName` `Customers | summarize t = make_set(FirstName, 10) by FirstName` diff --git a/src/Parsers/Kusto/KustoFunctions/KQLAggregationFunctions.cpp b/src/Parsers/Kusto/KustoFunctions/KQLAggregationFunctions.cpp index 8e4403753e4..7d87ed7a37d 100644 --- a/src/Parsers/Kusto/KustoFunctions/KQLAggregationFunctions.cpp +++ b/src/Parsers/Kusto/KustoFunctions/KQLAggregationFunctions.cpp @@ -152,7 +152,14 @@ bool MakeListIf::convertImpl(String & out,IParser::Pos & pos) bool MakeListWithNulls::convertImpl(String & out,IParser::Pos & pos) { - return directMapping(out,pos,"groupArray"); + String fn_name = getKQLFunctionName(pos); + + if (fn_name.empty()) + return false; + ++pos; + const auto column_name = getConvertedArgument(fn_name,pos); + out = "arrayConcat(groupArray(" + column_name + ") AS ga, arrayMap(x -> null, range(0, toUInt32(count(*)-length(ga)),1)))"; + return true; } bool MakeSet::convertImpl(String & out,IParser::Pos & pos) diff --git a/src/Parsers/tests/KQL/gtest_KQL_AggregateFunctions.cpp b/src/Parsers/tests/KQL/gtest_KQL_AggregateFunctions.cpp index a51052000bf..84bc08a26be 100644 --- a/src/Parsers/tests/KQL/gtest_KQL_AggregateFunctions.cpp +++ b/src/Parsers/tests/KQL/gtest_KQL_AggregateFunctions.cpp @@ -53,5 +53,9 @@ INSTANTIATE_TEST_SUITE_P(ParserKQLQuery, ParserTest, { "DataTable | summarize t = percentilew(Bucket, Frequency, 50)", "SELECT quantileExactWeighted(50 / 100)(Bucket, Frequency) AS t\nFROM DataTable" + }, + { + "Customers | summarize t = make_list_with_nulls(Age) by FirstName", + "SELECT\n FirstName,\n arrayConcat(groupArray(Age) AS ga, arrayMap(x -> NULL, range(0, toUInt32(count(*) - length(ga)), 1))) AS t\nFROM Customers\nGROUP BY FirstName" } })));