[ISSUE-11199] Pipe: fix NPE when casting from null values in InsertRowNode deserialization#11200
Merged
SteveYurongSu merged 2 commits intoapache:masterfrom Sep 24, 2023
Merged
Conversation
MiniSho
approved these changes
Sep 22, 2023
Contributor
MiniSho
left a comment
There was a problem hiding this comment.
YOU MAKE PIPE GREAT AGAIN ! 🚀
… in IoTDBPipeDataSyncIT
SteveYurongSu
approved these changes
Sep 24, 2023
Member
SteveYurongSu
left a comment
There was a problem hiding this comment.
Good job. Please cheery pick it to rel/1.2 :)
VGalaxies
added a commit
to VGalaxies/iotdb
that referenced
this pull request
Sep 24, 2023
…wNode deserialization (apache#11200) * fix: allow casting from null when deserializing InsertRowNode
VGalaxies
added a commit
to VGalaxies/iotdb
that referenced
this pull request
Sep 24, 2023
…s in InsertRowNode deserialization (apache#11200) * fix: allow casting from null when deserializing InsertRowNode
VGalaxies
added a commit
to VGalaxies/iotdb
that referenced
this pull request
Sep 24, 2023
… in InsertRowNode deserialization (apache#11200) * fix: allow casting from null when deserializing InsertRowNode
This file contains hidden or 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
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.
Description
Fix #11199, allow casting from null when deserializing InsertRowNode.
For this insert statement:
The source-side pipe stream processing engine will convert it into the following RPC sent to the target-side:
The focus here is on the deserialization logic of its
body.The deserialization logic is in
org.apache.iotdb.db.pipe.connector.payload.evolvable.request.PipeTransferTabletBatchReq#fromTPipeTransferReq.root.sg.d1s0s11So, it can be observed that after deserialization, the
InsertRowStatementobject hasdataTypesmember with values of[null, TSDataType.FLOAT]. This leads to a NullPointerException inorg.apache.iotdb.db.utils.CommonUtils#checkCanCastType. Similarly, thevaluesmember has values of[null, 25.34], also leads to NPE inorg.apache.iotdb.db.utils.CommonUtils#castValue.One natural idea is to check in
checkCanCastTypeandcastValuewhether the source type or source value is null. If so, allow further deserialization (i.e., pass type checking or return a null value).Since the utility methods
checkCanCastTypeandcastValueappear to be used only byInsertRowStatementandInsertTabletStatement, the logic changes resulting from the above modification are manageable.This PR has:
for an unfamiliar reader.
for code coverage.
Key changed/added classes (or packages if there are too many classes) in this PR