JackieTien97 commented on code in PR #13677:
URL: https://github.com/apache/iotdb/pull/13677#discussion_r1794520904
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/binary/LogicAndColumnTransformer.java:
##########
@@ -31,6 +31,50 @@ public LogicAndColumnTransformer(
super(returnType, leftTransformer, rightTransformer);
}
+ @Override
+ public void evaluateWithSelection(boolean[] selection) {
+ boolean[] selectionCopy = selection.clone();
+
+ leftTransformer.evaluateWithSelection(selectionCopy);
+ Column leftColumn = leftTransformer.getColumn();
+ int positionCount = leftTransformer.getColumnCachePositionCount();
+
+ for (int i = 0; i < positionCount; i++) {
+ if (!leftColumn.isNull(i) && !leftColumn.getBoolean(i)) {
+ selectionCopy[i] = false;
+ }
+ }
+
+ rightTransformer.evaluateWithSelection(selectionCopy);
+ Column rightColumn = rightTransformer.getColumn();
+
+ ColumnBuilder builder = returnType.createColumnBuilder(positionCount);
+ for (int i = 0; i < positionCount; i++) {
+ if (selection[i]) {
+ if (selectionCopy[i]) {
+ if (leftColumn.getBoolean(i)) {
+ builder.write(rightColumn, i);
+ } else {
+ if (!rightColumn.getBoolean(i)) {
+ returnType.writeBoolean(builder, false);
+ } else {
+ builder.appendNull();
+ }
+ }
Review Comment:
```suggestion
if (rightColumn.isNull(i)) {
// right is null, whether left is null or left is true, result
is null
builder.appendNull();
} else if (!rightColumn.getBoolean(i)) {
// right is false, whether left is null or left is true, result
is false
returnType.writeBoolean(builder, false);
} else {
// right is true
// if left is null, result is null
// if left is true, result is true
if (leftColumn.isNull(i)) {
builder.appendNull();
} else {
returnType.writeBoolean(builder, true);
}
}
```
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/transformation/dag/column/binary/LogicOrColumnTransformer.java:
##########
@@ -31,6 +31,51 @@ public LogicOrColumnTransformer(
super(returnType, leftTransformer, rightTransformer);
}
+ @Override
+ public void evaluateWithSelection(boolean[] selection) {
+ boolean[] selectionCopy = selection.clone();
+
+ leftTransformer.evaluateWithSelection(selectionCopy);
+ Column leftColumn = leftTransformer.getColumn();
+ int positionCount = leftTransformer.getColumnCachePositionCount();
+
+ for (int i = 0; i < positionCount; i++) {
+ if (!leftColumn.isNull(i) && leftColumn.getBoolean(i)) {
+ selectionCopy[i] = false;
+ }
+ }
+
+ rightTransformer.evaluateWithSelection(selectionCopy);
+ Column rightColumn = rightTransformer.getColumn();
+
+ ColumnBuilder builder = returnType.createColumnBuilder(positionCount);
+
+ for (int i = 0; i < positionCount; i++) {
+ if (selection[i]) {
+ if (selectionCopy[i]) {
+ if (!leftColumn.getBoolean(i)) {
+ builder.write(rightColumn, i);
+ } else {
+ if (rightColumn.getBoolean(i)) {
+ returnType.writeBoolean(builder, true);
+ } else {
+ builder.appendNull();
+ }
+ }
Review Comment:
rethink about it, make the same mistakes as `AND`.
--
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]