Repository navigation
Remove kql_array_sort_asc and kql_array_sort_desc - #108101
Algunenano merged 2 commits into
Conversation
Remove the KQL compatibility functions array_sort_asc / array_sort_desc and their SQL backends kql_array_sort_asc / kql_array_sort_desc entirely, together with all associated complications. These functions are experimental (KQL / Kusto dialect) and were implemented with low quality. They returned Tuple(Array, ...), which forced two special cases elsewhere: * a subscript-rewrite hack in ParserExpressionImpl (ExpressionListParsers.cpp) that turned arrayElement into tupleElement on their results. This was the source of the inconsistent AST formatting bug STID 1941-1bfa. * tuple-aware alias handling in ParserKQLQuery (the array_sort-only [1] suffix and the multi-alias "(a, b) = ..." branch). Removed: * src/Functions/Kusto/KqlArraySort.cpp (the whole Functions/Kusto directory, it had no other sources) and its CMake registration. * The ArraySortAsc / ArraySortDesc KQL parser classes, their enum values, and factory entries. * The subscript-rewrite special case in ExpressionListParsers.cpp. * The array_sort-specific alias handling in ParserKQLQuery.cpp. * Tests, fuzzer dictionary entries, and KQL conformance sub-cases that used these functions. An unknown function name now produces a normal UNKNOWN_FUNCTION error in both the SQL and KQL dialects, and the rest of KQL is unaffected. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate
Session id: cron:clickhouse-worker-slot-4:20260622-035600 |
|
cc @alexey-milovidov @yakov-olkhovskiy could you review this? It removes the experimental KQL functions |
|
Workflow [PR], commit [f130bf5] Summary: ✅
AI ReviewSummaryThis PR removes the experimental KQL Missing context / blind spots
Final VerdictStatus: ✅ Approve |
Covers the post-removal behavior of removing kql_array_sort_asc / kql_array_sort_desc and the KQL array_sort_asc / array_sort_desc names: - SELECT kql_array_sort_asc/desc([1]) now reports UNKNOWN_FUNCTION. - KQL print array_sort_asc/desc(dynamic([1])) is rejected by the parser (clientError UNKNOWN_FUNCTION). - The ClickHouse#106850 repro round-trips: with the arrayElement -> tupleElement subscript rewrite gone, formatQuerySingleLine is idempotent for both the trailing-subscript and the subscript-followed-by-operator forms. On master the latter was not idempotent (the format1 != format2 mismatch aborted executeQueryImpl with an inconsistent-AST LOGICAL_ERROR). The backward-incompatible removal and the parser-hack cleanup are now covered so they cannot regress silently. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate (HEAD f130bf5, regression test for the KQL array_sort removal)
Session id: cron:clickhouse-worker-slot-1:20260622-064100 |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 23/25 (92.00%) | Lost baseline coverage (was covered on master, now uncovered in this PR): 6 line(s) · Uncovered code |
be3417e
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Removed the experimental KQL (Kusto) functions
array_sort_ascandarray_sort_desc, and their SQL backendskql_array_sort_ascandkql_array_sort_desc. These functions were experimental, implemented with low quality, and the source of correctness and parser bugs. Queries using these names now returnUNKNOWN_FUNCTION.Description
Per maintainer request (#107634), this removes
kql_array_sort_asc/kql_array_sort_descand the KQLarray_sort_asc/array_sort_descthat map to them, with all associated complications.These functions returned
Tuple(Array, ...), which required two special cases that are also removed here:ParserExpressionImpl(ExpressionListParsers.cpp) that turnedarrayElementintotupleElementon their results. It was the source of the inconsistent AST formattingLOGICAL_ERROR(Logical error: 'Inconsistent AST formatting: the original AST: (STID: 1941-1bfa) #106850, STID 1941-1bfa).array_sort-specific alias handling inParserKQLQuery.cpp(the[1]suffix and the multi-alias(a, b) = ...branch).Also fixes #101259 (the
null_last=falseper-row bug) by removing the affected functions.Removed:
src/Functions/Kusto/KqlArraySort.cpp(the wholeFunctions/Kustodirectory had no other sources) and its CMake registration; theArraySortAsc/ArraySortDescKQL parser classes, enum values and factory entries; the subscript-rewrite special case; thearray_sortalias handling; affected tests, fuzzer dictionary entries, and KQL conformance sub-cases.Verified locally (debug build): the SQL and KQL names now produce
UNKNOWN_FUNCTION; all 22 KQL stateless tests pass; the rest of KQL is unaffected.Version info
26.6.1.1135