Skip to content
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-42093][SQL] Move JavaTypeInference to AgnosticEncoders #39615

Closed
wants to merge 24 commits into from

Conversation

hvanhovell
Copy link
Contributor

What changes were proposed in this pull request?

This PR makes JavaTypeInference produce an AgnosticEncoder. The expression generation for these encoders is moved to ScalaReflection.

Why are the changes needed?

For the Spark Connect Scala Client we also want to be able to use Java Bean based results.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

I have added a lot of tests to JavaTypeInferenceSuite.

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check Scala 2.13 too? The original AgnosticEncoders PR broke Scala 2.13 with Kafka SQL module.

@cloud-fan
Copy link
Contributor

yea let's fix scala 2.13 first

@hvanhovell
Copy link
Contributor Author

@cloud-fan @dongjoon-hyun can you take another look please?

@cloud-fan
Copy link
Contributor

cloud-fan commented Feb 2, 2023

thanks, merging to master/3.4 (the PR was merged before 3.4 cut due to scala 2.13 issues)!

@cloud-fan cloud-fan closed this in 0d93bb2 Feb 2, 2023
cloud-fan pushed a commit that referenced this pull request Feb 2, 2023
### What changes were proposed in this pull request?
This PR makes `JavaTypeInference` produce an `AgnosticEncoder`. The expression generation for these encoders is moved to `ScalaReflection`.

### Why are the changes needed?
For the Spark Connect Scala Client we also want to be able to use Java Bean based results.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
I have added a lot of tests to `JavaTypeInferenceSuite`.

Closes #39615 from hvanhovell/SPARK-42093.

Authored-by: Herman van Hovell <herman@databricks.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
(cherry picked from commit 0d93bb2)
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
snmvaughan pushed a commit to snmvaughan/spark that referenced this pull request Jun 20, 2023
### What changes were proposed in this pull request?
This PR makes `JavaTypeInference` produce an `AgnosticEncoder`. The expression generation for these encoders is moved to `ScalaReflection`.

### Why are the changes needed?
For the Spark Connect Scala Client we also want to be able to use Java Bean based results.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
I have added a lot of tests to `JavaTypeInferenceSuite`.

Closes apache#39615 from hvanhovell/SPARK-42093.

Authored-by: Herman van Hovell <herman@databricks.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
(cherry picked from commit 0d93bb2)
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
Invoke(inputObject, "name", ObjectType(classOf[String]), returnNullable = false))

case other =>
val properties = getJavaBeanReadableAndWritableProperties(other)
Copy link
Member

@viirya viirya May 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'm not sure if this has been discussed, but this is a breaking change causing customer issue like https://issues.apache.org/jira/browse/SPARK-48073 when upgrading from Spark 3.2 to Spark 3.4.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an intentional change? @hvanhovell

Copy link
Member

@viirya viirya May 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No matter what, this change has been there for a while. It seems difficult to change it back to old behavior. As discussed with @HeartSaVioR in the JIRA, I'd like to see if we can add a SQL conf to fall back to previous behavior of Encoder.bean().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior was apparently there before I got to it, this is PR that fixed it later: #42829

For the record there is no specification here, only tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. After more internal discussion with the customer, we decided not to make a change to previous behavior with a config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants