[ https://issues.apache.org/jira/browse/DRILL-425?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Venki Korukanti updated DRILL-425: ---------------------------------- Description: Following plan outputs empty values for nullableStr1 column after 1st row. {code} { head:{ type:"APACHE_DRILL_PHYSICAL", version:"1", generator:{ type:"manual" } }, graph:[ { @id:1, pop:"mock-sub-scan", url: "http://apache.org", entries:[ {records: 100, types: [ {name: "nullableStr1", type: "VARCHAR", mode: "OPTIONAL"} ]} ] }, { @id:2, child: 1, pop:"project", exprs: [ { ref: "nullableStr1", expr: "nullableStr1" } ] }, { @id: 3, child: 2, pop: "screen" } ] } {code} After transferring the ValueVector from 'scan' to 'project', ProjectRecordBatch calls NullableVarCharVector.setValueCount. As part of this method, all records from "lastSet +1" to "count" are set to empty byte array, because 'lastSet' is not set as part of the mock-sub-scan (default to 0), all but the first record have empty string data. {code} public void setValueCount(int valueCount) { ..... for (int i = lastSet + 1; i < valueCount; i++) { values.getMutator().set(i, new byte[]{}); } .... } {code} was: Following plan outputs empty values for nullableStr1 column after 1st row. { head:{ type:"APACHE_DRILL_PHYSICAL", version:"1", generator:{ type:"manual" } }, graph:[ { @id:1, pop:"mock-sub-scan", url: "http://apache.org", entries:[ {records: 100, types: [ {name: "nullableStr1", type: "VARCHAR", mode: "OPTIONAL"}, ]} ] }, { @id:2, child: 1, pop:"project", exprs: [ { ref: "nullableStr1", expr: "nullableStr1" } ] }, { @id: 3, child: 2, pop: "screen" } ] } After transferring the ValueVector from 'scan' to 'project', ProjectRecordBatch calls NullableVarCharVector.setValueCount. As part of this method, all records from "lastSet +1" to "count" are set to empty byte array, because 'lastSet' is not set as part of the mock-sub-scan (default to 0), all but the first record have empty string data. {code} public void setValueCount(int valueCount) { ..... for (int i = lastSet + 1; i < valueCount; i++) { values.getMutator().set(i, new byte[]{}); } .... } {code} > mock-sub-scan is not setting 'lastSet' in NullableVarCharVector or > NullableVar16CharVector > ------------------------------------------------------------------------------------------ > > Key: DRILL-425 > URL: https://issues.apache.org/jira/browse/DRILL-425 > Project: Apache Drill > Issue Type: Bug > Reporter: Venki Korukanti > Assignee: Steven Phillips > > Following plan outputs empty values for nullableStr1 column after 1st row. > {code} > { > head:{ > type:"APACHE_DRILL_PHYSICAL", > version:"1", > generator:{ > type:"manual" > } > }, > graph:[ > { > @id:1, > pop:"mock-sub-scan", > url: "http://apache.org", > entries:[ > {records: 100, types: [ > {name: "nullableStr1", type: "VARCHAR", mode: "OPTIONAL"} > ]} > ] > }, > { > @id:2, > child: 1, > pop:"project", > exprs: [ > { ref: "nullableStr1", expr: "nullableStr1" } > ] > }, > { > @id: 3, > child: 2, > pop: "screen" > } > ] > } > {code} > After transferring the ValueVector from 'scan' to 'project', > ProjectRecordBatch calls NullableVarCharVector.setValueCount. As part of this > method, all records from "lastSet +1" to "count" are set to empty byte array, > because 'lastSet' is not set as part of the mock-sub-scan (default to 0), all > but the first record have empty string data. > {code} > public void setValueCount(int valueCount) { > ..... > for (int i = lastSet + 1; i < valueCount; i++) { > values.getMutator().set(i, new byte[]{}); > } > .... > } > {code} -- This message was sent by Atlassian JIRA (v6.2#6252)