Skip to content

fix(table): handle missing or nil stats + metadata field nil comparison - #460

Merged
zeroshade merged 2 commits into
apache:mainfrom
James-Gilbert-:fix/nilcheck-parquet-stats
Jun 20, 2025
Merged

zeroshade merged 2 commits into
apache:mainfrom
James-Gilbert-:fix/nilcheck-parquet-stats

Conversation

@James-Gilbert-

Copy link
Copy Markdown
Contributor

Handles a few potential nil dereferences

@laskoviymishka laskoviymishka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! Looks good.
From what I understand, these are just hypothetical panics, but maybe it's possible to add a test here?

@zeroshade zeroshade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great, just a few quirks

Comment thread table/evaluators.go
Comment on lines +735 to +737
if stats == nil {
continue
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

does the Statistics() method ever return nil if err is not nil?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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


stats, err := colChunk.Statistics()
if err != nil {
if err != nil || stats == nil {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same question as above

Comment thread table/metadata.go Outdated
Comment on lines +880 to +885
((c.LastPartitionID == other.LastPartitionID) || (*c.LastPartitionID == *other.LastPartitionID)) &&
((c.CurrentSnapshotID == other.CurrentSnapshotID) || (*c.CurrentSnapshotID == *other.CurrentSnapshotID)) &&
equalPtr(c.LastPartitionID, other.LastPartitionID) &&
equalPtr(c.CurrentSnapshotID, other.CurrentSnapshotID) &&

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

there's no nil dereference possibility here due to the cases handled above. Either both are nil (thus they will not get dereferenced) or both are non-nil (and we're safe).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should we leave this as it was instead since there's no possibility of the nil dereference?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thoughts @James-Gilbert- ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍 removed the change here

@zeroshade
zeroshade merged commit 8647882 into apache:main Jun 20, 2025
@zeroshade

Copy link
Copy Markdown
Member

Thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants