From 9fdb59127cf1282a4ddc6d26e037dc75cbb5a482 Mon Sep 17 00:00:00 2001 From: FearfulTomcat27 <1471335448@qq.com> Date: Fri, 11 Oct 2024 11:06:45 +0800 Subject: [PATCH 1/6] fix: Exception when casewhen function meets two conditions --- .../db/it/query/IoTDBCaseWhenThenIT.java | 20 +++++++++++++++++++ ...AbstractCaseWhenThenColumnTransformer.java | 12 ++++++----- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBCaseWhenThenIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBCaseWhenThenIT.java index 5fbf93c6b3b4e..e1a548ff6c1e8 100644 --- a/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBCaseWhenThenIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/db/it/query/IoTDBCaseWhenThenIT.java @@ -887,4 +887,24 @@ public void testKind2CaseInCase() { }; resultSetEqualTest(sql, expectedHeader, retArray); } + + @Test + public void testMultipleSatisfyCase() { + // Test the result when two when clause are satisfied + String sql = + "select case when s3 < 20 or s4 > 60 then \"just so so~~~\" when s3 > 20 or s4 < 60 then \"very well~~~\" end from root.sg.d2"; + String[] expectedHeader = + new String[] { + TIMESTAMP_STR, + "CASE WHEN root.sg.d2.s3 < 20 | root.sg.d2.s4 > 60 THEN \"just so so~~~\" WHEN root.sg.d2.s3 > 20 | root.sg.d2.s4 < 60 THEN \"very well~~~\" END" + }; + String[] retArray = + new String[] { + "0,just so so~~~,", + "1000000,just so so~~~,", + "20000000,just so so~~~,", + "210000000,just so so~~~,", + }; + resultSetEqualTest(sql, expectedHeader, retArray); + } } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/AbstractCaseWhenThenColumnTransformer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/AbstractCaseWhenThenColumnTransformer.java index 56561a18423b3..c8584ba6b3c31 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/AbstractCaseWhenThenColumnTransformer.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/AbstractCaseWhenThenColumnTransformer.java @@ -101,11 +101,13 @@ private void doTransform(int[] branch) { } for (int j = 0; j < positionCount; j++) { - if (!whenColumn.isNull(j) && whenColumn.getBoolean(j)) { - branchIndexForEachRow[j] = i; - selection[j] = true; - } else { - selection[j] = false; + if (branchIndexForEachRow[j] == -1) { + if (!whenColumn.isNull(j) && whenColumn.getBoolean(j)) { + branchIndexForEachRow[j] = i; + selection[j] = true; + } else { + selection[j] = false; + } } } From 5d4c5d5bf3413647fd7e4982cc569440733fa108 Mon Sep 17 00:00:00 2001 From: FearfulTomcat27 <1471335448@qq.com> Date: Fri, 11 Oct 2024 20:12:43 +0800 Subject: [PATCH 2/6] fix: Fix the logic of CaseWhen when short-circuiting, and fix the bug of TimeColumnTransformer short-circuiting. --- .../scalar/IoTDBCastFunctionTableIT.java | 14 ++ ...AbstractCaseWhenThenColumnTransformer.java | 187 ++++++++++++------ .../column/leaf/TimeColumnTransformer.java | 1 + 3 files changed, 146 insertions(+), 56 deletions(-) diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBCastFunctionTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBCastFunctionTableIT.java index c390fd33f9281..55f31a5e09b64 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBCastFunctionTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBCastFunctionTableIT.java @@ -35,6 +35,7 @@ import java.sql.SQLException; import java.sql.Statement; +import static org.apache.iotdb.db.it.utils.TestUtils.tableAssertTestFail; import static org.apache.iotdb.db.it.utils.TestUtils.tableResultSetEqualTest; import static org.apache.iotdb.itbase.constant.TestConstant.TIMESTAMP_STR; import static org.junit.Assert.fail; @@ -93,6 +94,12 @@ public class IoTDBCastFunctionTableIT { "INSERT INTO special(Time, device_id ,s6) values(2, 'd1', '1.1')", "INSERT INTO special(Time, device_id ,s6) values(3, 'd1', '4e60')", "INSERT INTO special(Time, device_id ,s6) values(4, 'd1', '4e60000')", + "flush", + + // special cases for date and timestamp + "create table dateType(device_id STRING ID, s1 DATE MEASUREMENT, s2 TIMESTAMP MEASUREMENT)", + "INSERT INTO dateType(Time,device_id, s1, s2) values(1,'d1', '9999-12-31', 253402300800)", + "INSERT INTO dateType(Time,device_id, s1, s2) values(1,'d1', '1000-01-01', -30610310400)", }; @BeforeClass @@ -776,5 +783,12 @@ public void testCastWithTextSource() { } } + @Test + public void testDateOutOfRange() { + tableAssertTestFail("select CAST(s1 + AS TIMESTAMP) from dateType", "752", DATABASE_NAME); + + tableAssertTestFail("select CAST(s2 AS DATE) from dateType", "752", DATABASE_NAME); + } + // endregion } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/AbstractCaseWhenThenColumnTransformer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/AbstractCaseWhenThenColumnTransformer.java index c8584ba6b3c31..6dde0cca7db2c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/AbstractCaseWhenThenColumnTransformer.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/AbstractCaseWhenThenColumnTransformer.java @@ -55,15 +55,92 @@ public ColumnTransformer getElseTransformer() { @Override public void evaluate() { - int[] branchIndexForEachRow = new int[elseTransformer.getColumnCachePositionCount()]; + + List thenColumnList = new ArrayList<>(); + + // region evaluate first when + ColumnTransformer firstWhenColumnTransformer = whenThenTransformers.get(0).left; + firstWhenColumnTransformer.evaluate(); + Column firstWhenColumn = firstWhenColumnTransformer.getColumn(); + + int positionCount = firstWhenColumn.getPositionCount(); + boolean[] selection = new boolean[positionCount]; + Arrays.fill(selection, true); + + int[] branchIndexForEachRow = new int[positionCount]; Arrays.fill(branchIndexForEachRow, -1); - doTransform(branchIndexForEachRow); + boolean[] selectionForThen = selection.clone(); + + // 根据第一个 whenColumn更新 branchIndexForEachRow + for (int i = 0; i < positionCount; i++) { + // 当前行没有匹配的 whenTransformer 时,才更新 selectionForThen 和 branchIndexForEachRow + if (branchIndexForEachRow[i] == -1) { + if (!firstWhenColumn.isNull(i) && firstWhenColumn.getBoolean(i)) { + branchIndexForEachRow[i] = 0; + selectionForThen[i] = true; + } else { + selectionForThen[i] = false; + } + } + } + + ColumnTransformer firstThenColumnTransformer = whenThenTransformers.get(0).right; + firstThenColumnTransformer.evaluateWithSelection(selectionForThen); + Column firstThenColumn = firstThenColumnTransformer.getColumn(); + thenColumnList.add(firstThenColumn); + + // endregion + + // when and then columns + for (int i = 1; i < whenThenTransformers.size(); i++) { + ColumnTransformer whenColumnTransformer = whenThenTransformers.get(i).left; + whenColumnTransformer.evaluateWithSelection(selection); + Column whenColumn = whenColumnTransformer.getColumn(); + + selectionForThen = selection.clone(); + + // 初始化 selectionForThen + for (int j = 0; j < positionCount; j++) { + if (branchIndexForEachRow[j] == -1 + || branchIndexForEachRow[j] == whenThenTransformers.size()) { + selectionForThen[j] = false; + } + } + + // 根据第一个 whenColumn更新 branchIndexForEachRow + for (int j = 0; j < positionCount; j++) { + // 当前行没有匹配的 whenTransformer 时,才更新 selectionForThen 和 branchIndexForEachRow + if (branchIndexForEachRow[j] == -1) { + if (!whenColumn.isNull(j) && whenColumn.getBoolean(j)) { + branchIndexForEachRow[j] = i; + selectionForThen[j] = true; + } else { + selectionForThen[j] = false; + } + } + } + + ColumnTransformer thenColumnTransformer = whenThenTransformers.get(i).right; + thenColumnTransformer.evaluateWithSelection(selectionForThen); + Column thenColumn = thenColumnTransformer.getColumn(); + thenColumnList.add(thenColumn); + } + + // elseColumn + doTransform(branchIndexForEachRow, positionCount, thenColumnList); } @Override public void evaluateWithSelection(boolean[] selection) { + + // region initialize branchIndexForEachRow. + // branchIndexForEachRow indicates the index of the WhenTransformer matched by each row. int[] branchIndexForEachRow = new int[selection.length]; + // positionCount indicates the length of column + int positionCount = selection.length; + + // 赋值为-1表示需要进行求值,否则表示不需要进行求值 for (int i = 0; i < selection.length; i++) { if (selection[i]) { branchIndexForEachRow[i] = -1; @@ -71,94 +148,92 @@ public void evaluateWithSelection(boolean[] selection) { branchIndexForEachRow[i] = whenThenTransformers.size(); } } - doTransform(branchIndexForEachRow); - } + // endregion - private void doTransform(int[] branch) { - int[] branchIndexForEachRow = null; List thenColumnList = new ArrayList<>(); // when and then columns for (int i = 0; i < whenThenTransformers.size(); i++) { ColumnTransformer whenColumnTransformer = whenThenTransformers.get(i).left; - whenColumnTransformer.tryEvaluate(); + whenColumnTransformer.evaluateWithSelection(selection); Column whenColumn = whenColumnTransformer.getColumn(); - int positionCount = whenColumn.getPositionCount(); - boolean[] selection = new boolean[positionCount]; + boolean[] selectionForThen = selection.clone(); - if (branchIndexForEachRow == null) { - // init branchIndexForEachRow if it is null - branchIndexForEachRow = new int[positionCount]; - Arrays.fill(branchIndexForEachRow, -1); - } else { - // update selection with branchIndexForEachRow - for (int j = 0; j < branchIndexForEachRow.length; j++) { - if (branchIndexForEachRow[j] != -1) { - selection[j] = true; - } + // 初始化 selectionForThen + for (int j = 0; j < positionCount; j++) { + if (branchIndexForEachRow[j] == -1 + || branchIndexForEachRow[j] == whenThenTransformers.size()) { + selectionForThen[j] = false; } } + // 根据第一个 whenColumn更新 branchIndexForEachRow for (int j = 0; j < positionCount; j++) { + // 当前行没有匹配的 whenTransformer 时,才更新 selectionForThen 和 branchIndexForEachRow if (branchIndexForEachRow[j] == -1) { + // 满足第 i 个 when 条件 if (!whenColumn.isNull(j) && whenColumn.getBoolean(j)) { branchIndexForEachRow[j] = i; - selection[j] = true; + selectionForThen[j] = true; } else { - selection[j] = false; + selectionForThen[j] = false; } } } ColumnTransformer thenColumnTransformer = whenThenTransformers.get(i).right; - thenColumnTransformer.evaluateWithSelection(selection); + thenColumnTransformer.evaluateWithSelection(selectionForThen); Column thenColumn = thenColumnTransformer.getColumn(); thenColumnList.add(thenColumn); } // elseColumn - if (branchIndexForEachRow != null) { - int positionCount = branchIndexForEachRow.length; - boolean[] selectionForElse = new boolean[positionCount]; - for (int i = 0; i < branchIndexForEachRow.length; i++) { - if (branchIndexForEachRow[i] == -1) { - selectionForElse[i] = true; - } + // when selectionForElse[i] is false represent the rows that do not need to evaluate + doTransform(branchIndexForEachRow, positionCount, thenColumnList); + } + + private void doTransform( + int[] branchIndexForEachRow, int positionCount, List thenColumnList) { + boolean[] selectionForElse = new boolean[positionCount]; + for (int i = 0; i < branchIndexForEachRow.length; i++) { + if (branchIndexForEachRow[i] == -1) { + selectionForElse[i] = true; } - elseTransformer.evaluateWithSelection(selectionForElse); + } + elseTransformer.evaluateWithSelection(selectionForElse); - ColumnBuilder builder = returnType.createColumnBuilder(positionCount); - Column elseColumn = elseTransformer.getColumn(); + ColumnBuilder builder = returnType.createColumnBuilder(positionCount); + Column elseColumn = elseTransformer.getColumn(); - for (int i = 0; i < positionCount; i++) { - Column resultColumn = null; - if (branchIndexForEachRow[i] == -1) { - resultColumn = elseColumn; - } else if (branchIndexForEachRow[i] < whenThenTransformers.size()) { - resultColumn = thenColumnList.get(branchIndexForEachRow[i]); - } - - if (resultColumn == null || resultColumn.isNull(i)) { - builder.appendNull(); - } else { - writeToColumnBuilder( - branchIndexForEachRow[i] == -1 - ? elseTransformer.getType() - : whenThenTransformers.get(branchIndexForEachRow[i]).right.getType(), - resultColumn, - i, - builder); - } + for (int i = 0; i < positionCount; i++) { + Column resultColumn = null; + if (branchIndexForEachRow[i] == -1) { + resultColumn = elseColumn; + } else if (branchIndexForEachRow[i] < whenThenTransformers.size()) { + resultColumn = thenColumnList.get(branchIndexForEachRow[i]); } - initializeColumnCache(builder.build()); - for (Pair whenThenColumnTransformer : - whenThenTransformers) { - whenThenColumnTransformer.left.clearCache(); - whenThenColumnTransformer.right.clearCache(); + if (resultColumn == null || resultColumn.isNull(i)) { + builder.appendNull(); + } else { + writeToColumnBuilder( + branchIndexForEachRow[i] == -1 + ? elseTransformer.getType() + : whenThenTransformers.get(branchIndexForEachRow[i]).right.getType(), + resultColumn, + i, + builder); } } + + initializeColumnCache(builder.build()); + for (Pair whenThenColumnTransformer : + whenThenTransformers) { + whenThenColumnTransformer.left.clearCache(); + whenThenColumnTransformer.right.clearCache(); + elseTransformer.clearCache(); + } } protected abstract void writeToColumnBuilder( diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/leaf/TimeColumnTransformer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/leaf/TimeColumnTransformer.java index 10e53a268f3ae..d8fe028bf092f 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/leaf/TimeColumnTransformer.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/leaf/TimeColumnTransformer.java @@ -46,5 +46,6 @@ public void evaluateWithSelection(boolean[] selection) { builder.write(timeColumn, i); } } + initializeColumnCache(builder.build()); } } From e82df5e37fcc9f7e63f2e559a60480a7db439766 Mon Sep 17 00:00:00 2001 From: FearfulTomcat27 <1471335448@qq.com> Date: Fri, 11 Oct 2024 20:18:56 +0800 Subject: [PATCH 3/6] fix: Restore Cast's IT --- .../scalar/IoTDBCastFunctionTableIT.java | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBCastFunctionTableIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBCastFunctionTableIT.java index 55f31a5e09b64..c390fd33f9281 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBCastFunctionTableIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/old/builtinfunction/scalar/IoTDBCastFunctionTableIT.java @@ -35,7 +35,6 @@ import java.sql.SQLException; import java.sql.Statement; -import static org.apache.iotdb.db.it.utils.TestUtils.tableAssertTestFail; import static org.apache.iotdb.db.it.utils.TestUtils.tableResultSetEqualTest; import static org.apache.iotdb.itbase.constant.TestConstant.TIMESTAMP_STR; import static org.junit.Assert.fail; @@ -94,12 +93,6 @@ public class IoTDBCastFunctionTableIT { "INSERT INTO special(Time, device_id ,s6) values(2, 'd1', '1.1')", "INSERT INTO special(Time, device_id ,s6) values(3, 'd1', '4e60')", "INSERT INTO special(Time, device_id ,s6) values(4, 'd1', '4e60000')", - "flush", - - // special cases for date and timestamp - "create table dateType(device_id STRING ID, s1 DATE MEASUREMENT, s2 TIMESTAMP MEASUREMENT)", - "INSERT INTO dateType(Time,device_id, s1, s2) values(1,'d1', '9999-12-31', 253402300800)", - "INSERT INTO dateType(Time,device_id, s1, s2) values(1,'d1', '1000-01-01', -30610310400)", }; @BeforeClass @@ -783,12 +776,5 @@ public void testCastWithTextSource() { } } - @Test - public void testDateOutOfRange() { - tableAssertTestFail("select CAST(s1 + AS TIMESTAMP) from dateType", "752", DATABASE_NAME); - - tableAssertTestFail("select CAST(s2 AS DATE) from dateType", "752", DATABASE_NAME); - } - // endregion } From 8370f90431565d32fd13455ea7f7dbd6a8863c4c Mon Sep 17 00:00:00 2001 From: FearfulTomcat27 <1471335448@qq.com> Date: Wed, 16 Oct 2024 17:14:20 +0800 Subject: [PATCH 4/6] Fix: fix a logic error in casewhen --- ...AbstractCaseWhenThenColumnTransformer.java | 62 ++++++------------- 1 file changed, 20 insertions(+), 42 deletions(-) diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/AbstractCaseWhenThenColumnTransformer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/AbstractCaseWhenThenColumnTransformer.java index 6dde0cca7db2c..9afcfc0d3d4f6 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/AbstractCaseWhenThenColumnTransformer.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/AbstractCaseWhenThenColumnTransformer.java @@ -79,6 +79,7 @@ public void evaluate() { if (!firstWhenColumn.isNull(i) && firstWhenColumn.getBoolean(i)) { branchIndexForEachRow[i] = 0; selectionForThen[i] = true; + selection[i] = false; } else { selectionForThen[i] = false; } @@ -100,27 +101,17 @@ public void evaluate() { selectionForThen = selection.clone(); - // 初始化 selectionForThen for (int j = 0; j < positionCount; j++) { - if (branchIndexForEachRow[j] == -1 - || branchIndexForEachRow[j] == whenThenTransformers.size()) { + if (selection[j] && !whenColumn.isNull(j) && whenColumn.getBoolean(j)) { + branchIndexForEachRow[j] = i; + selectionForThen[j] = true; + // also update selection array + selection[j] = false; + } else { selectionForThen[j] = false; } } - // 根据第一个 whenColumn更新 branchIndexForEachRow - for (int j = 0; j < positionCount; j++) { - // 当前行没有匹配的 whenTransformer 时,才更新 selectionForThen 和 branchIndexForEachRow - if (branchIndexForEachRow[j] == -1) { - if (!whenColumn.isNull(j) && whenColumn.getBoolean(j)) { - branchIndexForEachRow[j] = i; - selectionForThen[j] = true; - } else { - selectionForThen[j] = false; - } - } - } - ColumnTransformer thenColumnTransformer = whenThenTransformers.get(i).right; thenColumnTransformer.evaluateWithSelection(selectionForThen); Column thenColumn = thenColumnTransformer.getColumn(); @@ -139,6 +130,7 @@ public void evaluateWithSelection(boolean[] selection) { int[] branchIndexForEachRow = new int[selection.length]; // positionCount indicates the length of column int positionCount = selection.length; + boolean[] selectionForWhen = selection.clone(); // 赋值为-1表示需要进行求值,否则表示不需要进行求值 for (int i = 0; i < selection.length; i++) { @@ -155,33 +147,22 @@ public void evaluateWithSelection(boolean[] selection) { // when and then columns for (int i = 0; i < whenThenTransformers.size(); i++) { ColumnTransformer whenColumnTransformer = whenThenTransformers.get(i).left; - whenColumnTransformer.evaluateWithSelection(selection); + whenColumnTransformer.evaluateWithSelection(selectionForWhen); Column whenColumn = whenColumnTransformer.getColumn(); - boolean[] selectionForThen = selection.clone(); + boolean[] selectionForThen = selectionForWhen.clone(); - // 初始化 selectionForThen for (int j = 0; j < positionCount; j++) { - if (branchIndexForEachRow[j] == -1 - || branchIndexForEachRow[j] == whenThenTransformers.size()) { + if (selectionForWhen[j] && !whenColumn.isNull(j) && whenColumn.getBoolean(j)) { + branchIndexForEachRow[j] = i; + selectionForThen[j] = true; + // also update selection array + selectionForWhen[j] = false; + } else { selectionForThen[j] = false; } } - // 根据第一个 whenColumn更新 branchIndexForEachRow - for (int j = 0; j < positionCount; j++) { - // 当前行没有匹配的 whenTransformer 时,才更新 selectionForThen 和 branchIndexForEachRow - if (branchIndexForEachRow[j] == -1) { - // 满足第 i 个 when 条件 - if (!whenColumn.isNull(j) && whenColumn.getBoolean(j)) { - branchIndexForEachRow[j] = i; - selectionForThen[j] = true; - } else { - selectionForThen[j] = false; - } - } - } - ColumnTransformer thenColumnTransformer = whenThenTransformers.get(i).right; thenColumnTransformer.evaluateWithSelection(selectionForThen); Column thenColumn = thenColumnTransformer.getColumn(); @@ -208,22 +189,19 @@ private void doTransform( for (int i = 0; i < positionCount; i++) { Column resultColumn = null; + Type thenColumnType = null; if (branchIndexForEachRow[i] == -1) { resultColumn = elseColumn; + thenColumnType = elseTransformer.getType(); } else if (branchIndexForEachRow[i] < whenThenTransformers.size()) { resultColumn = thenColumnList.get(branchIndexForEachRow[i]); + thenColumnType = whenThenTransformers.get(branchIndexForEachRow[i]).right.getType(); } if (resultColumn == null || resultColumn.isNull(i)) { builder.appendNull(); } else { - writeToColumnBuilder( - branchIndexForEachRow[i] == -1 - ? elseTransformer.getType() - : whenThenTransformers.get(branchIndexForEachRow[i]).right.getType(), - resultColumn, - i, - builder); + writeToColumnBuilder(thenColumnType, resultColumn, i, builder); } } From eea19b58ab08594430edc95b911c08967661c41a Mon Sep 17 00:00:00 2001 From: FearfulTomcat27 <1471335448@qq.com> Date: Wed, 16 Oct 2024 20:43:04 +0800 Subject: [PATCH 5/6] fix: replace the note with english --- .../dag/column/AbstractCaseWhenThenColumnTransformer.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/AbstractCaseWhenThenColumnTransformer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/AbstractCaseWhenThenColumnTransformer.java index 9afcfc0d3d4f6..30a571deae8f6 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/AbstractCaseWhenThenColumnTransformer.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/AbstractCaseWhenThenColumnTransformer.java @@ -72,9 +72,10 @@ public void evaluate() { boolean[] selectionForThen = selection.clone(); - // 根据第一个 whenColumn更新 branchIndexForEachRow + // Update branchIndexForEachRow based on first whenColumn for (int i = 0; i < positionCount; i++) { - // 当前行没有匹配的 whenTransformer 时,才更新 selectionForThen 和 branchIndexForEachRow + // Update selectionForThen and branchIndexForEachRow when there is no matching whenTransformer + // for the current row. if (branchIndexForEachRow[i] == -1) { if (!firstWhenColumn.isNull(i) && firstWhenColumn.getBoolean(i)) { branchIndexForEachRow[i] = 0; @@ -132,7 +133,8 @@ public void evaluateWithSelection(boolean[] selection) { int positionCount = selection.length; boolean[] selectionForWhen = selection.clone(); - // 赋值为-1表示需要进行求值,否则表示不需要进行求值 + // An assignment of -1 means that evaluation is required, otherwise it means that evaluation is + // not required. for (int i = 0; i < selection.length; i++) { if (selection[i]) { branchIndexForEachRow[i] = -1; From 4841c54e5bebfa9b40a3bef287974a80a853cbd5 Mon Sep 17 00:00:00 2001 From: FearfulTomcat27 <1471335448@qq.com> Date: Thu, 17 Oct 2024 14:11:21 +0800 Subject: [PATCH 6/6] Empty commit for rerun CI