jihoonson commented on a change in pull request #6094: Introduce SystemSchema
tables (#5989)
URL: https://github.com/apache/incubator-druid/pull/6094#discussion_r223202521
##########
File path:
sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidPlanner.java
##########
@@ -309,19 +314,88 @@ private PlannerResult planWithBindableConvention(
} else {
final BindableRel theRel = bindableRel;
final DataContext dataContext =
plannerContext.createDataContext((JavaTypeFactory) planner.getTypeFactory());
- final Supplier<Sequence<Object[]>> resultsSupplier = new
Supplier<Sequence<Object[]>>()
- {
- @Override
- public Sequence<Object[]> get()
- {
- final Enumerable enumerable = theRel.bind(dataContext);
- return Sequences.simple(enumerable);
- }
- };
+
+ final Supplier<Sequence<Object[]>> resultsSupplier = () -> new
BaseSequence<>(
+ new BaseSequence.IteratorMaker<Object[],
CloseableEnumerableIterator>()
+ {
+ @Override
+ public CloseableEnumerableIterator make()
+ {
+ final Enumerable enumerable = theRel.bind(dataContext);
+ final Enumerator enumerator = enumerable.enumerator();
+ return new CloseableEnumerableIterator(new Iterator<Object[]>()
Review comment:
I'm not saying closing the iterator is not needed. The same algorithm can be
implemented using `Sequences.withBaggage()` , so `CloseableEnumerableIterator`
itself is not needed. `Sequences.withBaggage()` wraps the underlying sequence
and calls the given `closeable` after iterating all elements in the sequence.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]