-
Notifications
You must be signed in to change notification settings - Fork 28.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-50370][SQL] Codegen Support for json_tuple
#48908
Open
panbingkun
wants to merge
10
commits into
apache:master
Choose a base branch
from
panbingkun:SPARK-50370
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+205
−92
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
panbingkun
commented
Nov 22, 2024
@@ -273,8 +273,9 @@ class JsonExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper with | |||
} | |||
|
|||
test("json_tuple escaping") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- after implementing codegen for
json_tuple
, it seems that this usage (GenerateUnsafeProjection.generate(JsonTuple(...))
) is no longer supported, such as the following:
spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala
Lines 255 to 256 in d5da49d
override protected def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = { // Rows - we write these into an array.
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
The pr aims to add
Codegen
Support forJsonTuple
(json_tuple
).Why are the changes needed?
Does this PR introduce any user-facing change?
No.
How was this patch tested?
*json_tuple*
, JsonExpressionsSuite#*json_tuple*
)Was this patch authored or co-authored using generative AI tooling?
No.