cryptoe commented on code in PR #15032:
URL: https://github.com/apache/druid/pull/15032#discussion_r1341167063
##########
processing/src/main/java/org/apache/druid/query/IterableRowsCursorHelper.java:
##########
@@ -55,8 +64,10 @@ public static RowBasedCursor<Object[]>
getCursorFromIterable(Iterable<Object[]>
}
return row -> row[columnIndex];
};
- RowWalker<Object[]> rowWalker = new RowWalker<>(Sequences.simple(rows),
rowAdapter);
- return new RowBasedCursor<>(
+
+ RowWalker<Object[]> rowWalker = new RowWalker<>(rows, rowAdapter);
Review Comment:
Since you need to close the RowWalker, why don't you change `RowBasedCursor`
and add a closeable to it.
In its close method, call rowWalker.close().
##########
processing/src/main/java/org/apache/druid/query/CloseableCursor.java:
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.query;
+
+import org.apache.druid.segment.ColumnSelectorFactory;
+import org.apache.druid.segment.Cursor;
+import org.joda.time.DateTime;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+/**
+ * {@link Cursor} that also has a {@link #close()}. Used for cursors that hold
some resources and need to be closed by
+ * the caller
+ */
+public interface CloseableCursor extends Cursor, Closeable
+{
+ static CloseableCursor cursorWithCloseable(Cursor cursor, Closeable
closeable)
Review Comment:
I would expect this interface to have a cursor which can be closed.
From this close call, it seems like the cursor is untouched but we want to
close the rowWalker ?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]