Paul Rogers created DRILL-7510:
----------------------------------

             Summary: Incorrect String/number comparison with union types
                 Key: DRILL-7510
                 URL: https://issues.apache.org/jira/browse/DRILL-7510
             Project: Apache Drill
          Issue Type: Bug
            Reporter: Paul Rogers
            Assignee: Paul Rogers


Run the following test: {{TestTopNSchemaChanges.testUnionTypes()}}. It will 
pass. Look at the expected output:

{code:java}
    builder.baselineValues(0l, 0l);
    builder.baselineValues(1.0d, 1.0d);
    builder.baselineValues(3l, 3l);
    builder.baselineValues(4.0d, 4.0d);
    builder.baselineValues(6l, 6l);
    builder.baselineValues(7.0d, 7.0d);
    builder.baselineValues(9l, 9l);
    builder.baselineValues("2", "2");
{code}

The string values sort after the numbers.

After the fix for DRILL-7502, we get the following output:

{code:java}
    builder.baselineValues(0l, 0l);
    builder.baselineValues(1.0d, 1.0d);
    builder.baselineValues("2", "2");
    builder.baselineValues(3l, 3l);
    builder.baselineValues(4.0d, 4.0d);
    builder.baselineValues("5", "5");
    builder.baselineValues(6l, 6l);
    builder.baselineValues(7.0d, 7.0d);
{code}

This accidental fix suggests that the original design was to convert values to 
the same type, then compare them. Converting numbers to strings, say, would 
cause them to be lexically ordered, as in the second output.

The {{UNION}} type is poorly supported, so it is likely that this bug does not 
affect actual users.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to