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

Fix parsing of partial result when corrupted record field is present #518

Merged
merged 1 commit into from
Feb 11, 2021

Conversation

srowen
Copy link
Collaborator

@srowen srowen commented Feb 10, 2021

Closes #517

@srowen srowen added the bug label Feb 10, 2021
@srowen srowen added this to the 0.12.0 milestone Feb 10, 2021
@srowen srowen self-assigned this Feb 10, 2021
var i = 0
while (i < actualSchema.length) {
val from = actualSchema(i)
resultRow(schema.fieldIndex(from.name)) = partialResult.map(_.get(i)).orNull
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@HyukjinKwon this was the bug. I call your attention to it because as the comment above says, this is copied from Spark's CSV parser. If I'm really right about this I need to fix a similar problem in Spark.

The bug is basically: actualSchema is the schema without the corrupt record field. We iterate over those (index i) and set the field in the partial result according to its real fieldIndex. But we read from partialResult at i, which is an index into actualSchema, which has one less field, while partialResult has the same schema as the resulting Row. If it's in the middle, then everything after is off by 1 when returned to catalyst.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm tracking a similar fix in Spark in https://issues.apache.org/jira/browse/SPARK-34422

@srowen srowen merged commit f8d200c into databricks:master Feb 11, 2021
@srowen srowen deleted the Issue517 branch February 11, 2021 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Detection of corrupted rows in XML
1 participant