Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-7510

Incorrect String/number comparison with union types

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

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

          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");
      

      The string values sort after the numbers.

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

          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);
      

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Paul.Rogers Paul Rogers
                Reporter:
                Paul.Rogers Paul Rogers
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: