pepijnve commented on code in PR #18183:
URL: https://github.com/apache/datafusion/pull/18183#discussion_r2529993322


##########
datafusion/physical-expr/src/expressions/case.rs:
##########
@@ -1269,6 +1312,28 @@ impl CaseExpr {
             self.body.expr_or_expr(batch, when_value)
         }
     }
+
+    fn with_lookup_table(
+        &self,
+        batch: &RecordBatch,
+        scalars_or_null_lookup: &LiteralLookupTable,
+    ) -> Result<ColumnarValue> {
+        let expr = self.body.expr.as_ref().unwrap();
+        let evaluated_expression = expr.evaluate(batch)?;
+
+        let is_scalar = matches!(evaluated_expression, 
ColumnarValue::Scalar(_));
+        let evaluated_expression = evaluated_expression.to_array(1)?;
+
+        let output = 
scalars_or_null_lookup.evaluate_input(&evaluated_expression)?;

Review Comment:
   Still struggling a bit with this line. It doesn't really read like 'perform 
lookup in table'. `lookup_table.get(...)` similar to `HashMap::get` would seem 
to be better describe what we're doing here.



##########
datafusion/physical-expr/src/expressions/case.rs:
##########
@@ -1269,6 +1312,28 @@ impl CaseExpr {
             self.body.expr_or_expr(batch, when_value)
         }
     }
+
+    fn with_lookup_table(
+        &self,
+        batch: &RecordBatch,
+        scalars_or_null_lookup: &LiteralLookupTable,

Review Comment:
   Maybe just call this `lookup_table`? I found the name 
`scalars_or_null_lookup` overly specific. It cause me to wonder what the 
significance of 'scalar or null' is here, but as far as I can tell there is 
none.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to