This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 672e72dece7 Fix the issue that querying exact device with some fuzzy
filter may failed
672e72dece7 is described below
commit 672e72dece7c1a7dd8ff6c5e1347869143e0b90a
Author: shuwenwei <[email protected]>
AuthorDate: Thu Jul 17 18:34:42 2025 +0800
Fix the issue that querying exact device with some fuzzy filter may failed
---
.../query/recent/IoTDBQueryAttributeTableIT.java | 71 ++++++++++++++++++++++
.../ConvertSchemaPredicateToFilterVisitor.java | 8 ++-
2 files changed, 77 insertions(+), 2 deletions(-)
diff --git
a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBQueryAttributeTableIT.java
b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBQueryAttributeTableIT.java
new file mode 100644
index 00000000000..ea03478fdb3
--- /dev/null
+++
b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBQueryAttributeTableIT.java
@@ -0,0 +1,71 @@
+/*
+ * 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.relational.it.query.recent;
+
+import org.apache.iotdb.it.env.EnvFactory;
+import org.apache.iotdb.it.framework.IoTDBTestRunner;
+import org.apache.iotdb.itbase.category.TableClusterIT;
+import org.apache.iotdb.itbase.category.TableLocalStandaloneIT;
+import org.apache.iotdb.rpc.IoTDBConnectionException;
+import org.apache.iotdb.rpc.StatementExecutionException;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+import static org.apache.iotdb.db.it.utils.TestUtils.prepareTableData;
+import static org.apache.iotdb.db.it.utils.TestUtils.tableResultSetEqualTest;
+
+@RunWith(IoTDBTestRunner.class)
+@Category({TableLocalStandaloneIT.class, TableClusterIT.class})
+public class IoTDBQueryAttributeTableIT {
+ protected static final String DATABASE_NAME = "test_db";
+ protected static final String[] createSqls =
+ new String[] {
+ "CREATE DATABASE " + DATABASE_NAME,
+ "USE " + DATABASE_NAME,
+ "create table t1(device STRING TAG, a1 STRING ATTRIBUTE, s1 INT32
FIELD)",
+ "insert into t1 (time, device, a1, s1) values (1, 'd1', 'ATTR1', 1)"
+ };
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ EnvFactory.getEnv().initClusterEnvironment();
+ prepareTableData(createSqls);
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ EnvFactory.getEnv().cleanClusterEnvironment();
+ }
+
+ @Test
+ public void test1() throws IoTDBConnectionException,
StatementExecutionException {
+ String[] expectedHeader = new String[] {"time", "device", "a1", "s1"};
+ String[] retArray = new String[] {"1970-01-01T00:00:00.001Z,d1,ATTR1,1,"};
+ tableResultSetEqualTest(
+ "select * from t1 where lower(a1) = 'attr1' and device = 'd1'",
+ expectedHeader,
+ retArray,
+ DATABASE_NAME);
+ }
+}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/predicate/schema/ConvertSchemaPredicateToFilterVisitor.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/predicate/schema/ConvertSchemaPredicateToFilterVisitor.java
index acb06e3b178..f356ff79a7b 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/predicate/schema/ConvertSchemaPredicateToFilterVisitor.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/predicate/schema/ConvertSchemaPredicateToFilterVisitor.java
@@ -158,12 +158,16 @@ public class ConvertSchemaPredicateToFilterVisitor
final boolean isOrdered;
if (node.getLeft() instanceof Literal) {
value = ((StringLiteral) (node.getLeft())).getValue();
- checkArgument(isSymbolReference(node.getRight()));
+ if (!isSymbolReference(node.getRight())) {
+ return null;
+ }
columnName = ((SymbolReference) (node.getRight())).getName();
isOrdered = false;
} else if (node.getRight() instanceof Literal) {
value = ((StringLiteral) (node.getRight())).getValue();
- checkArgument(isSymbolReference(node.getLeft()));
+ if (!isSymbolReference(node.getLeft())) {
+ return null;
+ }
columnName = ((SymbolReference) (node.getLeft())).getName();
isOrdered = true;
} else {