surekhasaharan commented on a change in pull request #6094: Introduce 
SystemSchema tables (#5989)
URL: https://github.com/apache/incubator-druid/pull/6094#discussion_r221496352
 
 

 ##########
 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:
   It was needed, since we found that earlier the iterator was not being closed 
which could cause a potential leak. I need to better understand, how does 
`Sequences.withBaggage()` works.

----------------------------------------------------------------
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]

Reply via email to