paul-rogers commented on a change in pull request #1928: DRILL-7486: Refactor
row set reader builders
URL: https://github.com/apache/drill/pull/1928#discussion_r358429109
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/physical/resultSet/model/hyper/HyperReaderBuilder.java
##########
@@ -71,30 +72,26 @@
* the outer vector accessor.)
*/
-public abstract class BaseReaderBuilder extends AbstractReaderBuilder {
+public class HyperReaderBuilder extends ReaderBuilder {
- /**
- * Read-only row index into the hyper row set with batch and index
- * values mapping via an SV4.
- */
-
- public static class HyperRowIndex extends ReaderIndex {
+ private static final HyperReaderBuilder INSTANCE = new HyperReaderBuilder();
- private final SelectionVector4 sv4;
-
- public HyperRowIndex(SelectionVector4 sv4) {
- super(sv4.getCount());
- this.sv4 = sv4;
- }
+ private HyperReaderBuilder() { }
- @Override
- public int offset() {
- return AccessorUtilities.sv4Index(sv4.get(position));
- }
+ public static RowSetReaderImpl build(VectorContainer container,
TupleMetadata schema, SelectionVector4 sv4) {
+ HyperRowIndex rowIndex = new HyperRowIndex(sv4);
+ return new RowSetReaderImpl(schema, rowIndex,
+ INSTANCE.buildContainerChildren(container, schema));
+ }
- @Override
- public int hyperVectorIndex( ) {
- return AccessorUtilities.sv4Batch(sv4.get(position));
+ public static RowSetReaderImpl build(BatchAccessor batch) {
+ VectorContainer container = batch.container();
+ try {
+ return build(container,
+ new HyperSchemaInference().infer(container),
+ batch.selectionVector4());
+ } catch (SchemaChangeException e) {
+ throw new UnsupportedOperationException(e);
Review comment:
Revised and added comment.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services