You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/03/11 09:24:55 UTC

[GitHub] [iotdb] Alima777 commented on a change in pull request #5184: [IOTDB-2602] Add the new feature of the null value filter to support filtering based on partial columns

Alima777 commented on a change in pull request #5184:
URL: https://github.com/apache/iotdb/pull/5184#discussion_r824515614



##########
File path: server/src/main/java/org/apache/iotdb/db/qp/physical/crud/AggregationPlan.java
##########
@@ -178,6 +178,10 @@ public String getColumnForReaderFromPath(PartialPath path, int pathIndex) {
   public String getColumnForDisplay(String columnForReader, int pathIndex) {
     String columnForDisplay = columnForReader;
     if (isGroupByLevel()) {
+      if (resultColumns.get(pathIndex).hasAlias()) {
+        return resultColumns.get(pathIndex).getAlias();
+      }

Review comment:
       Use `groupByLevelController.getAlias(aggregatePath)` below.

##########
File path: integration/src/test/java/org/apache/iotdb/db/integration/without_null_filter/IoTDBWithoutNullAllFilterIT.java
##########
@@ -0,0 +1,1973 @@
+/*
+ * 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.iotdb.db.integration.without_null_filter;

Review comment:
       用驼峰命名法吧

##########
File path: server/src/main/java/org/apache/iotdb/db/qp/physical/crud/QueryPlan.java
##########
@@ -40,9 +42,13 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 public abstract class QueryPlan extends PhysicalPlan {
 
+  public static final String WITHOUT_NULL_FILTER_ERROR_MESSAGE =
+      "The without null columns don't match the columns queried.If has alias, please use the alias.";

Review comment:
       ```suggestion
         "The without null columns don't match the columns queried. If there is an alias, please use the alias.";
   ```

##########
File path: server/src/main/java/org/apache/iotdb/db/utils/QueryDataSetUtils.java
##########
@@ -67,13 +67,15 @@ public static TSQueryDataSet convertQueryDataSetByFetchSize(
       if (queryDataSet.hasNext()) {
         RowRecord rowRecord = queryDataSet.next();
         // filter rows whose columns are null according to the rule
-        if ((queryDataSet.isWithoutAllNull() && rowRecord.isAllNull())
-            || (queryDataSet.isWithoutAnyNull() && rowRecord.hasNullField())) {
-          // if the current RowRecord doesn't satisfy, we should also decrease AlreadyReturnedRowNum
+        if (queryDataSet.withoutNullFilter(
+            rowRecord, queryDataSet.isWithoutAllNull(), queryDataSet.isWithoutAnyNull())) {

Review comment:
       `queryDataSet.isWithoutAllNull(), queryDataSet.isWithoutAnyNull()` is not needed.

##########
File path: server/src/main/java/org/apache/iotdb/db/qp/logical/crud/QueryOperator.java
##########
@@ -346,6 +363,21 @@ protected AlignByDevicePlan generateAlignByDevicePlan(PhysicalGenerator generato
     return alignByDevicePlan;
   }
 
+  private void checkWithoutNullColumnValid(AlignByDevicePlan alignByDevicePlan)
+      throws QueryProcessException {
+    if (specialClauseComponent != null) {
+      // meta consistence check
+      for (Expression expression : specialClauseComponent.getWithoutNullColumns()) {
+        if (!alignByDevicePlan.isValidWithoutNullColumn(expression.getExpressionString())) {
+          throw new QueryProcessException(QueryPlan.WITHOUT_NULL_FILTER_ERROR_MESSAGE);
+        }
+      }
+    }

Review comment:
       Honest to say, why don't you combine the check valid method and the calculate index method? They both need to traverse the WithoutNullColumns.

##########
File path: server/src/main/java/org/apache/iotdb/db/query/dataset/AlignByDeviceDataSet.java
##########
@@ -58,6 +58,7 @@
   private QueryContext context;
   private IExpression expression;
 
+  // contains original measurement, no include alias

Review comment:
       ```suggestion
     // contains only original measurement, alias not included
   ```




-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org