druid/codestyle
Laksh Singla 4bfc186153
Support sorting on complex columns in MSQ (#16322)
MSQ sorts the columns in a highly specialized manner by byte comparisons. As such the values are serialized differently. This works well for the primitive types and primitive arrays, however complex types cannot be serialized specially.

This PR adds the support for sorting the complex columns by deserializing the value from the field and comparing it via the type strategy. This is a lot slower than the byte comparisons, however, it's the only way to support sorting on complex columns that can have arbitrary serialization not optimized for MSQ.

The primitives and the arrays are still compared via the byte comparison, therefore this doesn't affect the performance of the queries supported before the patch. If there's a sorting key with mixed complex and primitive/primitive array types, for example: longCol1 ASC, longCol2 ASC, complexCol1 DESC, complexCol2 DESC, stringCol1 DESC, longCol3 DESC, longCol4 ASC, the comparison will happen like:

    longCol1, longCol2 (ASC) - Compared together via byte-comparison, since both are byte comparable and need to be sorted in ascending order
    complexCol1 (DESC) - Compared via deserialization, cannot be clubbed with any other field
    complexCol2 (DESC) - Compared via deserialization, cannot be clubbed with any other field, even though the prior field was a complex column with the same order
    stringCol1, longCol3 (DESC) - Compared together via byte-comparison, since both are byte comparable and need to be sorted in descending order
    longCol4 (ASC) - Compared via byte-comparison, couldn't be coalesced with the previous fields as the direction was different

This way, we only deserialize the field wherever required
2024-05-13 15:07:05 +05:30
..
LICENSE.txt Update license headers. (#5976) 2018-07-11 09:55:18 -07:00
checkstyle-suppressions.xml fix rat and checkstyle issue (#15530) 2023-12-14 09:33:01 +08:00
checkstyle.xml Add Checkstyle check for String literal equality (#8386) 2019-08-28 17:53:42 +03:00
druid-forbidden-apis.txt Support sorting on complex columns in MSQ (#16322) 2024-05-13 15:07:05 +05:30
joda-time-forbidden-apis.txt Introduce SegmentId class (#6370) 2019-01-21 11:11:10 -08:00
pmd-ruleset.xml Remove use of deprecated PMD ruleset (#12044) 2021-12-09 13:04:27 -08:00
spotbugs-exclude.xml Add "stringEncoding" parameter to DataSketches HLL. (#11201) 2023-06-30 12:45:55 -07:00