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

Order by clause works inconsistently when sorting columns with NaN

    XMLWordPrintableJSON

    Details

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

      Description

      AFFECTED_VERSION: drill-1.13.0-SNAPSHOT

      AFFECTED_FUNCTIONALITY: ORDER BY, DESC

      ISSUE_DESCRIPTION: 'ORDER BY/DESC' clause behaves in different ways when sorting columns containing NaN values. In one case it considers NaN to be the largest value, in another - the smallest one.
      Steps:

      • Select from the attached test file (orderBy.json, attached)
        SELECT name, attr4 from dfs.tmp.`orderBy.json` order by name, attr4
      • Check the attached screen shot (orderByIssue.jpg):
        EXPECTED_RESULT: It was expected the 'ORDER BY' clause to sort attr4 columns data in the same way (most probably NaN should be the largest, see NB)
        ACTUAL_RESULT: attr4 column's values were sorted in different ways: for 'obj1'/'obj3' NaN is the largest, for 'obj2'/'obj4' NaN is the smallest.

      NB: Postgres as well as Java's sorting (Collection.sort() / Arrays.sort() methods) treats NaN as the largest value

        Attachments

        1. orderByIssue.jpg
          60 kB
          Alexander Malashevsky
        2. orderBy.json
          1 kB
          Alexander Malashevsky

          Issue Links

            Activity

              People

              • Assignee:
                volodymyr.tkach Volodymyr Tkach
                Reporter:
                malexx8 Alexander Malashevsky
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: