-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-1558] Struct Stream Source Support Spark3 #4586
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
Conversation
|
Hi, @xushiyan, can you review this fix? |
|
@xushiyan @leesf @zhedoubushishi gentle ping... |
| mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) | ||
| mapper.registerModule(DefaultScalaModule) | ||
|
|
||
| lazy val mapper: ObjectMapper = { |
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.
here we just need to remove the with ScalaObjectMapper in line#48 before?
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.
Yes, as scalaObjectMapper we can replaced with ClassTag, we can safely and simply solve the conflict issue with different scala version(or Jackson-scala version to be more accurate)
|
|
||
| def fromJson(json: String): HoodieSourceOffset = { | ||
| mapper.readValue[HoodieSourceOffset](json) | ||
| mapper.readValue(json, classOf[HoodieSourceOffset]) |
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.
is the change necessary? I was thinking the meaning after the changing is same as before.
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 remove ScalaObjectMapper, we need ClassTag to readValue.
| case class HoodieSourceOffset(commitTime: String) extends Offset { | ||
|
|
||
| override def json(): String = { | ||
| override val json: String = { |
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.
also the change is necessary? would you please clarify?
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.
This just is an improve change, json no need to recalculate when calling this again, as it's value can not be changed.
Co-authored-by: Hui An <[email protected]>
Co-authored-by: Hui An <[email protected]>
Co-authored-by: Hui An <[email protected]>
Tips
What is the purpose of the pull request
When using structure streaming in spark3, the error would throw:
This is the incompatible issue of ScalaObjectMapper under scala_2.11 and scala_2.12, so simply remove this.
before the patch:
After this patch
Brief change log
(for example:)
Verify this pull request
(Please pick either of the following options)
This pull request is a trivial rework / code cleanup without any test coverage.
(or)
This pull request is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Committer checklist
Has a corresponding JIRA in PR title & commit
Commit message is descriptive of the change
CI is green
Necessary doc changes done or have another open PR
For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.