Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/984#discussion_r144147623 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/TopN/TopNBatch.java --- @@ -335,20 +333,32 @@ private void purge() throws SchemaChangeException { logger.debug("Took {} us to purge", watch.elapsed(TimeUnit.MICROSECONDS)); } - public PriorityQueue createNewPriorityQueue(FragmentContext context, List<Ordering> orderings, - VectorAccessible batch, MappingSet mainMapping, MappingSet leftMapping, MappingSet rightMapping) - throws ClassTransformationException, IOException, SchemaChangeException{ - CodeGenerator<PriorityQueue> cg = CodeGenerator.get(PriorityQueue.TEMPLATE_DEFINITION, context.getFunctionRegistry(), context.getOptions()); + private PriorityQueue createNewPriorityQueue(VectorAccessible batch, int limit) + throws SchemaChangeException, ClassTransformationException, IOException { + return createNewPriorityQueue(context.getOptionSet(), context.getFunctionRegistry(), context.getDrillbitContext().getCompiler(), + config.getOrderings(), batch, unionTypeEnabled, codegenDump, limit, oContext.getAllocator(), schema.getSelectionVectorMode()); + } + + public static PriorityQueue createNewPriorityQueue( + OptionSet optionSet, FunctionLookupContext functionLookupContext, CodeCompiler codeCompiler, + List<Ordering> orderings, VectorAccessible batch, boolean unionTypeEnabled, boolean codegenDump, + int limit, BufferAllocator allocator, SelectionVectorMode mode) + throws ClassTransformationException, IOException, SchemaChangeException { + final MappingSet mainMapping = new MappingSet((String) null, null, ClassGenerator.DEFAULT_SCALAR_MAP, ClassGenerator.DEFAULT_SCALAR_MAP); + final MappingSet leftMapping = new MappingSet("leftIndex", null, ClassGenerator.DEFAULT_SCALAR_MAP, ClassGenerator.DEFAULT_SCALAR_MAP); + final MappingSet rightMapping = new MappingSet("rightIndex", null, ClassGenerator.DEFAULT_SCALAR_MAP, ClassGenerator.DEFAULT_SCALAR_MAP); --- End diff -- Not sure these should be inside the method. Can we still grab hold of the variable for testing or debugging? Might we want to leave this in the class name space?
---