panbingkun commented on code in PR #48908:
URL: https://github.com/apache/spark/pull/48908#discussion_r1853810592
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/JsonExpressionsSuite.scala:
##########
@@ -273,8 +273,9 @@ class JsonExpressionsSuite extends SparkFunSuite with
ExpressionEvalHelper with
}
test("json_tuple escaping") {
Review Comment:
- after implementing codegen for `json_tuple`, it seems that this usage
(`GenerateUnsafeProjection.generate(JsonTuple(...))`) is no longer supported,
such as the following:
```scala
test("stack") {
GenerateUnsafeProjection.generate(
Stack(Seq(2, 1, 2, 3).map(Literal(_))) :: Nil)
}
```
- which is also not supported and throw an exception.
```
19:59:59.933 ERROR
org.apache.spark.sql.catalyst.expressions.codegen.CodeGenerator: Failed to
compile the generated Java code.
org.codehaus.commons.compiler.CompileException: File 'generated.java', Line
78, Column 30: Assignment conversion not possible from type
"scala.collection.mutable.ArraySeq" to type
"org.apache.spark.sql.catalyst.util.ArrayData"
at
org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:13014)
at
org.codehaus.janino.UnitCompiler.assignmentConversion(UnitCompiler.java:11263)
at org.codehaus.janino.UnitCompiler.access$3900(UnitCompiler.java:236)
at
org.codehaus.janino.UnitCompiler$7.visitRvalue(UnitCompiler.java:2764)
at
org.codehaus.janino.UnitCompiler$7.visitRvalue(UnitCompiler.java:2754)
at org.codehaus.janino.Java$Rvalue.accept(Java.java:4498)
at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:2754)
19:59:59.940 ERROR
org.apache.spark.sql.catalyst.expressions.codegen.CodeGenerator:
/* 001 */ public java.lang.Object generate(Object[] references) {
/* 002 */ return new SpecificUnsafeProjection(references);
/* 003 */ }
/* 004 */
/* 005 */ class SpecificUnsafeProjection extends
org.apache.spark.sql.catalyst.expressions.UnsafeProjection {
/* 006 */
/* 007 */ private Object[] references;
/* 008 */ private
org.apache.spark.sql.catalyst.expressions.codegen.UnsafeArrayWriter[]
mutableStateArray_2 = new
org.apache.spark.sql.catalyst.expressions.codegen.UnsafeArrayWriter[1];
/* 009 */ p...
```
- therefore, the testing approach has been modified here with the same
ultimate goal.
--
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]