[ https://issues.apache.org/jira/browse/DRILL-5993?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16296037#comment-16296037 ]
ASF GitHub Bot commented on DRILL-5993: --------------------------------------- Github user Ben-Zvi commented on a diff in the pull request: https://github.com/apache/drill/pull/1057#discussion_r157646058 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/svremover/CopierTemplate2.java --- @@ -53,17 +51,32 @@ public int copyRecords(int index, int recordCount) throws SchemaChangeException } } - int outgoingPosition = 0; + return insertRecords(0, index, recordCount); + } + + @Override + public int appendRecord(int index) throws SchemaChangeException { + return appendRecords(index, 1); + } + + @Override + public int appendRecords(int index, int recordCount) throws SchemaChangeException { + return insertRecords(outgoing.getRecordCount(), index, recordCount); + } + + private int insertRecords(int outgoingPosition, int index, int recordCount) throws SchemaChangeException { + final int endIndex = index + recordCount; - for(int svIndex = index; svIndex < index + recordCount; svIndex++, outgoingPosition++){ + for(int svIndex = index; svIndex < endIndex; svIndex++, outgoingPosition++){ doEval(sv2.getIndex(svIndex), outgoingPosition); } + + outgoing.setRecordCount(outgoingPosition); return outgoingPosition; } - public abstract void doSetup(@Named("context") FragmentContext context, - @Named("incoming") RecordBatch incoming, - @Named("outgoing") RecordBatch outgoing) + public abstract void doSetup(@Named("incoming") RecordBatch incoming, + @Named("outgoing") VectorContainer outgoing) --- End diff -- As the "generated code" methods are replaced with "in line" methods, we should remove these abstract signatures (both *doSetup* and *doEval*) to avoid generating code, and to distinguish these methods. Maybe we should _rename_ them as well to make the distinction clear. Then probably also eliminate the "code generation" code in **getGenerated2Copier()** and **getGenerated4Copier()**. > Allow Copier to Copy a Record and Append to the End of an Outgoing Batch > ------------------------------------------------------------------------ > > Key: DRILL-5993 > URL: https://issues.apache.org/jira/browse/DRILL-5993 > Project: Apache Drill > Issue Type: New Feature > Reporter: Timothy Farkas > Assignee: Timothy Farkas > > Currently the copier can only copy record from an incoming batch to the > beginning of an outgoing batch. We need to be able to copy a record and > append it to the end of the outgoing batch. -- This message was sent by Atlassian JIRA (v6.4.14#64029)