andygrove commented on code in PR #7750:
URL: https://github.com/apache/datafusion-comet/pull/7750#discussion_r4745903136


##########
spark/src/main/scala/org/apache/comet/serde/literals.scala:
##########
@@ -49,7 +49,9 @@ object CometLiteral extends CometExpressionSerde[Literal] 
with CometTypeShim wit
           expr.dataType,
           allowComplex = true,
           allowDuplicateStructFieldNames = false)
-      case ArrayType(elementType, _) => 
listLiteralElementSupported(elementType)
+      case arrayType: ArrayType =>
+        listLiteralElementSupported(arrayType.elementType) &&
+        supportedDataType(arrayType, allowComplex = true, allowIntervals = 
true)

Review Comment:
   This array arm now rejects the scale, but a map literal does not get the 
same check. With `spark.sql.legacy.allowNegativeScaleOfDecimal=true`, `SELECT 
id, map(1, CAST('1e256' AS DECIMAL(10,-256))) FROM <parquet table>` still fails 
natively with `C Data interface error: The decimal type requires an integer 
scale`, where Spark returns `Map(1 -> 1E+256)`. `getSupportLevel` returns 
`Compatible` for this map literal through `canExpandComplexLiteral`, and the 
rebuilt `CreateMap` then goes to the codegen dispatcher, which serializes the 
type with `serializeDataType`. Main fails the same way, but #7748 asks for a 
fallback for any literal with a scale below -128, so this PR leaves part of it 
open. Could we reject the scale in `serializeDataType`, as comphead suggested, 
or in the map arm here? The new tests call `getSupportLevel` directly and never 
run a projection, so an end-to-end test that compares a map literal against 
Spark would also be worth adding.



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