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

sum(cast(columns[0] as int)) fails if column contains empty value

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 0.6.0
    • 0.6.0
    • Execution - Data Types
    • None

    Description

      code base
      #Fri Sep 12 14:08:02 PDT 2014
      git.commit.id.abbrev=9e16466

      I have a simple tsv file that contains an empty row in one of the columns:

      [root@qa-node120 tmp]# hadoop fs -cat /user/root/mondrian/tmp.tbl
      1|1
      2|2

      3
      4
      4

      0: jdbc:drill:schema=dfs> select * from `tmp.tbl`;
      ------------

      columns

      ------------

      ["1","1"]
      ["2","2"]
      ["","3"]
      ["4","4"]

      ------------
      4 rows selected (0.183 seconds)
      0: jdbc:drill:schema=dfs> select columns[0], columns[1] from `tmp.tbl`;
      ----------------------+

      EXPR$0 EXPR$1

      ----------------------+

      1 1
      2 2
        3
      4 4

      ----------------------+
      4 rows selected (0.217 seconds)

      sum over the column that is full works fine, but sum over the column that contains empty row fails:

      0: jdbc:drill:schema=dfs> select sum(cast(columns[1] as int)) from `tmp.tbl`;
      ------------

      EXPR$0

      ------------

      10

      ------------
      1 row selected (0.283 seconds)
      0: jdbc:drill:schema=dfs> select sum(cast(columns[0] as int)) from `tmp.tbl`;
      Query failed: Failure while running fragment. [a9d8771f-aeb3-4226-9623-fc2b635365f8]

      Error: exception while executing query: Failure while trying to get next result batch. (state=,code=0)
      0: jdbc:drill:schema=dfs>

      drillbit.log
      11:44:19.450 [9d14d90c-128c-4549-b77f-9b0051bc3d5c:frag:0:0] DEBUG o.a.d.e.w.fragment.FragmentExecutor - Error while initializing or executing fragment
      java.lang.NumberFormatException:
      at org.apache.drill.exec.test.generated.ProjectorGen18.doEval(ProjectorTemplate.java:40) ~[na:na]
      at org.apache.drill.exec.test.generated.ProjectorGen18.projectRecords(ProjectorTemplate.java:64) ~[na:na]

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              cchang@maprtech.com Chun Chang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: