Checking a Doris array_sort alias: ordering and element preservation are separate
Successfully registering a function does not establish that its comparator arguments retain their intended meaning.
What registration does not establish
Successful sort-function registration is not proof that comparator semantics were preserved. The Truthound boundary is the array actually returned by the call, not the syntax of the definition. Check both ordering and retention of all original elements. [1, 2, 3]
Colliding comparator argument names
The public Doris report describes copying the second array_sort comparator argument while retaining the first argument's name. Nested lambdas and alias calls can then refer to the wrong value. Because a direct call and a stored alias can differ, compare the exact deployed function path. [1]
Keep a genuinely unsorted control
Run direct and alias calls on the same unsorted array. Verify ascending order and element preservation before replacing a stored function. In an illustrative result, 0 adjacent inversions passes the ordering condition and 1 fails. Dropping elements can reduce inversions too, so retain length and multiset checks. [1, 3]
Preserve array boundaries in Truthound inputs
Flatten arrays into case identity, position and value, then apply Truthound Core's IncreasingValidator in each array's positional order. Concatenating different arrays into one column can create a false inversion between arrays. The feature does not repair lambda scope or a stored alias body. A verified direct-comparator alternative still needs the same unsorted input and element-preservation checks. [1, 2, 3]
Application conditions
Flatten the same source arrays into case_id, element_position, original_value and sorted_value, preserving each array boundary.
Alternatives
Use a verified direct-comparator path instead of the alias.
Limitations
Truthound does not repair lambda scope or stored alias bodies. Do not check concatenated arrays as one ordered column.
Evidence
- Event checked
- Subject checked
- Modified
