Jackie-Jiang commented on a change in pull request #7295:
URL: https://github.com/apache/pinot/pull/7295#discussion_r688815948
##########
File path: pinot-core/src/main/java/org/apache/pinot/core/util/QueryOptions.java
##########
@@ -33,6 +33,7 @@
private final boolean _responseFormatSQL;
private final boolean _preserveType;
private final boolean _skipUpsert;
+ private final boolean _prefetchBuffers;
Review comment:
We don't really need this memory variable. Eventually we might want to
make this class a util class
##########
File path:
pinot-core/src/main/java/org/apache/pinot/core/operator/SegmentOperator.java
##########
@@ -0,0 +1,65 @@
+/**
+ * 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.pinot.core.operator;
+
+import java.util.Set;
+import org.apache.pinot.core.common.Block;
+import org.apache.pinot.core.common.Operator;
+import org.apache.pinot.segment.spi.IndexSegment;
+
+
+/**
+ * A common wrapper around the segment-level operator
+ */
+public class SegmentOperator extends BaseOperator {
Review comment:
Let's make the name more explicit on the purpose (integrate acquire and
release) of this operator
##########
File path:
pinot-core/src/main/java/org/apache/pinot/core/plan/maker/InstancePlanMakerImplV2.java
##########
@@ -140,9 +142,21 @@ public InstancePlanMakerImplV2(QueryExecutorConfig
queryExecutorConfig) {
@Override
public Plan makeInstancePlan(List<IndexSegment> indexSegments, QueryContext
queryContext,
ExecutorService executorService, long endTimeMs) {
+ boolean prefetch =
Review comment:
I'd suggest adding an instance config to enable `prefetch, acquire,
release`, and make it false by default. If it is false, we skip the column
calculation to avoid the overhead because most use cases don't need this feature
##########
File path:
pinot-core/src/main/java/org/apache/pinot/core/operator/SegmentOperator.java
##########
@@ -0,0 +1,65 @@
+/**
+ * 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.pinot.core.operator;
+
+import java.util.Set;
+import org.apache.pinot.core.common.Block;
+import org.apache.pinot.core.common.Operator;
+import org.apache.pinot.segment.spi.IndexSegment;
+
+
+/**
+ * A common wrapper around the segment-level operator
+ */
+public class SegmentOperator extends BaseOperator {
+ private static final String OPERATOR_NAME = "SegmentOperator";
+
+ private final Operator _childOperator;
+ private final IndexSegment _indexSegment;
+ private final Set<String> _columns;
+
+ public SegmentOperator(Operator childOperator, IndexSegment indexSegment,
Set<String> columns) {
+ _childOperator = childOperator;
+ _indexSegment = indexSegment;
+ _columns = columns;
+ }
+
+ /**
+ * Makes a call to acquire column buffers from {@link IndexSegment} before
getting nextBlock from childOperator,
+ * and
+ * a call to release the column buffers from {@link IndexSegment} after.
+ */
+ @Override
+ protected Block getNextBlock() {
+ _indexSegment.acquire(_columns);
+ Block nextBlock = _childOperator.nextBlock();
+ _indexSegment.release(_columns);
Review comment:
this should be in the `finally` block to avoid resource leak
--
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]