peterxcli commented on code in PR #3369:
URL: https://github.com/apache/datafusion-comet/pull/3369#discussion_r2763447180
##########
spark/src/main/scala/org/apache/comet/serde/maps.scala:
##########
@@ -89,3 +89,20 @@ object CometMapFromArrays extends
CometExpressionSerde[MapFromArrays] {
optExprWithInfo(mapFromArraysExpr, expr, expr.children: _*)
}
}
+
+object CometMapContainsKey extends CometExpressionSerde[MapContainsKey] {
+
+ override def convert(
+ expr: MapContainsKey,
+ inputs: Seq[Attribute],
+ binding: Boolean): Option[ExprOuterClass.Expr] = {
+ // Replace with array_has(map_keys(map), key)
+ val mapExpr = exprToProtoInternal(expr.left, inputs, binding)
+ val keyExpr = exprToProtoInternal(expr.right, inputs, binding)
+
+ val mapKeysExpr = scalarFunctionExprToProto("map_keys", mapExpr)
+
+ val mapContainsKeyExpr = scalarFunctionExprToProto("array_has",
mapKeysExpr, keyExpr)
Review Comment:
I was trying to add the spark reference link as comment, but the scala style
check was still failing even after I ran `make format`. so i think I would just
leave it in the PR description.
https://github.com/apache/spark/blob/branch-4.0/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala#L233
--
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]