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

extractHeader attribute not working with the table function

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.0
    • 1.16.0
    • Storage - Text & CSV
    • None

    Description

      I have the following table with line delimiter as \r\n:
      Id,col1,col2
      1,aaa,bbb
      2,ccc,ddd
      3,eee
      4,fff,ggg

      The following queries work fine:
      select * from table(`drill-3149/header.csv`(type=>'text',lineDelimiter=>'\r\n',fieldDelimiter=>','));
      -----------------------

      columns

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

      ["Id","col1","col2"]
      ["1","aaa","bbb"]
      ["2","ccc","ddd"]
      ["3","eee"]
      ["4","fff","ggg"]

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

      select * from table(`drill-3149/header.csv`(type=>'text',lineDelimiter=>'\r\n',fieldDelimiter=>',',skipFirstLine=>true));
      --------------------

      columns

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

      ["1","aaa","bbb"]
      ["2","ccc","ddd"]
      ["3","eee"]
      ["4","fff","ggg"]

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

      The following query fail with extractHeader attribute:
      select * from table(`drill-3149/header.csv`(type=>'text',lineDelimiter=>'\r\n',fieldDelimiter=>',',extractHeader=>true));

      java.lang.IndexOutOfBoundsException: index: 254, length: 3 (expected: range(0, 256))
      	at io.netty.buffer.AbstractByteBuf.checkIndex(AbstractByteBuf.java:1134)
      	at io.netty.buffer.PooledUnsafeDirectByteBuf.getBytes(PooledUnsafeDirectByteBuf.java:136)
      	at io.netty.buffer.WrappedByteBuf.getBytes(WrappedByteBuf.java:289)
      	at io.netty.buffer.UnsafeDirectLittleEndian.getBytes(UnsafeDirectLittleEndian.java:30)
      	at io.netty.buffer.DrillBuf.getBytes(DrillBuf.java:629)
      	at org.apache.drill.exec.vector.VarCharVector$Accessor.get(VarCharVector.java:441)
      	at org.apache.drill.exec.vector.accessor.VarCharAccessor.getBytes(VarCharAccessor.java:125)
      	at org.apache.drill.exec.vector.accessor.VarCharAccessor.getString(VarCharAccessor.java:146)
      	at org.apache.drill.exec.vector.accessor.VarCharAccessor.getObject(VarCharAccessor.java:136)
      	at org.apache.drill.exec.vector.accessor.VarCharAccessor.getObject(VarCharAccessor.java:94)
      	at org.apache.drill.exec.vector.accessor.BoundCheckingAccessor.getObject(BoundCheckingAccessor.java:148)
      	at org.apache.drill.jdbc.impl.TypeConvertingSqlAccessor.getObject(TypeConvertingSqlAccessor.java:795)
      	at org.apache.drill.jdbc.impl.AvaticaDrillSqlAccessor.getObject(AvaticaDrillSqlAccessor.java:179)
      	at net.hydromatic.avatica.AvaticaResultSet.getObject(AvaticaResultSet.java:351)
      	at org.apache.drill.jdbc.impl.DrillResultSetImpl.getObject(DrillResultSetImpl.java:420)
      	at sqlline.Rows$Row.<init>(Rows.java:157)
      	at sqlline.IncrementalRows.hasNext(IncrementalRows.java:63)
      	at sqlline.TableOutputFormat$ResizingRowsProvider.next(TableOutputFormat.java:87)
      	at sqlline.TableOutputFormat.print(TableOutputFormat.java:118)
      	at sqlline.SqlLine.print(SqlLine.java:1593)
      	at sqlline.Commands.execute(Commands.java:852)
      	at sqlline.Commands.sql(Commands.java:751)
      	at sqlline.SqlLine.dispatch(SqlLine.java:746)
      	at sqlline.SqlLine.begin(SqlLine.java:621)
      	at sqlline.SqlLine.start(SqlLine.java:375)
      	at sqlline.SqlLine.main(SqlLine.java:268)
      

      Attachments

        Issue Links

          Activity

            People

              paul-rogers Paul Rogers
              knguyen Krystal
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: