You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/10/14 21:20:43 UTC

[GitHub] [pinot] walterddr commented on a diff in pull request #9597: [hotfix][multistage] support filter boolean literal

walterddr commented on code in PR #9597:
URL: https://github.com/apache/pinot/pull/9597#discussion_r996167264


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/operands/FilterOperand.java:
##########
@@ -95,6 +106,22 @@ public Boolean apply(Object[] row) {
   @Override
   public abstract Boolean apply(Object[] row);
 
+  private static class BooleanInputRef extends FilterOperand {
+    private final RexExpression.InputRef _inputRef;
+
+    public BooleanInputRef(RexExpression.InputRef inputRef, DataSchema dataSchema) {
+      Preconditions.checkState(dataSchema.getColumnDataType(inputRef.getIndex())
+          == DataSchema.ColumnDataType.BOOLEAN);
+      _inputRef = inputRef;
+    }
+
+    @Override
+    public Boolean apply(Object[] row) {
+      // DataSchema.ColumnDataType.BOOLEAN.getStoredType() == INT
+      return (int) row[_inputRef.getIndex()] != 0;

Review Comment:
   b/c the underlying row object in pinot is stored as integer
   - directly return `Object` as a boolean will do a null check
   - but I was also thinking it could've been an actual boolean object, in which case this will work but not efficient



-- 
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: commits-unsubscribe@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org