Github user ppadma commented on a diff in the pull request:
https://github.com/apache/drill/pull/611#discussion_r84951720
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/VarLenBinaryReader.java
---
@@ -41,43 +51,149 @@ public VarLenBinaryReader(ParquetRecordReader
parentReader, List<VarLengthColumn
public long readFields(long recordsToReadInThisPass, ColumnReader<?>
firstColumnStatus) throws IOException {
long recordsReadInCurrentPass = 0;
- int lengthVarFieldsInCurrentRecord;
- long totalVariableLengthData = 0;
- boolean exitLengthDeterminingLoop = false;
+
// write the first 0 offset
for (VarLengthColumn<?> columnReader : columns) {
columnReader.reset();
}
+ recordsReadInCurrentPass =
determineSizesSerial(recordsToReadInThisPass);
+ if(useAsyncTasks){
+ readRecordsParallel(recordsReadInCurrentPass);
+ }else{
+ readRecordsSerial(recordsReadInCurrentPass);
+ }
+ return recordsReadInCurrentPass;
+ }
+
+
+ private long determineSizesSerial(long recordsToReadInThisPass) throws
IOException {
+ int lengthVarFieldsInCurrentRecord = 0;
+ boolean exitLengthDeterminingLoop = false;
+ long totalVariableLengthData = 0;
+ long recordsReadInCurrentPass = 0;
do {
- lengthVarFieldsInCurrentRecord = 0;
for (VarLengthColumn<?> columnReader : columns) {
- if ( !exitLengthDeterminingLoop ) {
- exitLengthDeterminingLoop =
columnReader.determineSize(recordsReadInCurrentPass,
lengthVarFieldsInCurrentRecord);
+ if (!exitLengthDeterminingLoop) {
+ exitLengthDeterminingLoop =
+ columnReader.determineSize(recordsReadInCurrentPass,
lengthVarFieldsInCurrentRecord);
} else {
break;
}
}
// check that the next record will fit in the batch
- if (exitLengthDeterminingLoop || (recordsReadInCurrentPass + 1) *
parentReader.getBitWidthAllFixedFields() + totalVariableLengthData
- + lengthVarFieldsInCurrentRecord > parentReader.getBatchSize()) {
+ if (exitLengthDeterminingLoop ||
+ (recordsReadInCurrentPass + 1) *
parentReader.getBitWidthAllFixedFields()
+ + totalVariableLengthData + lengthVarFieldsInCurrentRecord >
parentReader.getBatchSize()) {
break;
}
- for (VarLengthColumn<?> columnReader : columns ) {
+ for (VarLengthColumn<?> columnReader : columns) {
columnReader.updateReadyToReadPosition();
columnReader.currDefLevel = -1;
}
recordsReadInCurrentPass++;
totalVariableLengthData += lengthVarFieldsInCurrentRecord;
} while (recordsReadInCurrentPass < recordsToReadInThisPass);
+ return recordsReadInCurrentPass;
+ }
+
+
+ public long determineSizesParallel(long recordsToReadInThisPass ) throws
IOException {
--- End diff --
Seems like this function is not used anywhere. Do you still want to keep it
?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---