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 NPE in Iceberg stats reader #9719

Merged
merged 1 commit into from
Oct 26, 2021

Conversation

findepi
Copy link
Member

@findepi findepi commented Oct 20, 2021

Fixes #9714 but follow up #9716 is due

Currently based on #9711, #9712, #9706, #9705, #9757

Comment on lines +72 to +77
this.minValues = new HashMap<>();
this.maxValues = new HashMap<>();
this.nullCounts = new HashMap<>();
this.columnSizes = new HashMap<>();
this.corruptedStats = new HashSet<>();
this.hasValidColumnMetrics = false;
Copy link
Member

Choose a reason for hiding this comment

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

do those need to be mutable objects? Can you use emptyMap/emptySet (or ImmutableMap/Set.of) instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

see the else { branch here which creates mutable objects and then update... methods which modifies them.
IMO there is a hope we can simplify this code ... #9716

@findepi findepi force-pushed the findepi/iceberg-more-show-stats branch from b8c30ea to 1132cce Compare October 25, 2021 13:41
@findepi
Copy link
Member Author

findepi commented Oct 25, 2021

Currently based on #9757, only last commit to review.
@losipiuk ptal

@findepi findepi force-pushed the findepi/iceberg-more-show-stats branch from 1132cce to 1488b34 Compare October 25, 2021 13:45
Copy link
Member

@losipiuk losipiuk left a comment

Choose a reason for hiding this comment

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

LGTM % comment from @alexjo2144

@findepi findepi force-pushed the findepi/iceberg-more-show-stats branch from 1488b34 to 8bf1185 Compare October 25, 2021 19:56
@findepi
Copy link
Member Author

findepi commented Oct 25, 2021

(just rebased)

Fixes

```
java.lang.NullPointerException
	at io.trino.plugin.iceberg.TableStatisticsMaker.updatePartitionedStats(TableStatisticsMaker.java:316)
	at io.trino.plugin.iceberg.TableStatisticsMaker.updateSummaryMin(TableStatisticsMaker.java:298)
	at io.trino.plugin.iceberg.TableStatisticsMaker.makeTableStatistics(TableStatisticsMaker.java:155)
	at io.trino.plugin.iceberg.TableStatisticsMaker.getTableStatistics(TableStatisticsMaker.java:73)
	at io.trino.plugin.iceberg.IcebergMetadata.getTableStatistics(IcebergMetadata.java:693)
```

However, further fixes in that code area are due.
@findepi findepi force-pushed the findepi/iceberg-more-show-stats branch from 8bf1185 to 9466aa1 Compare October 25, 2021 20:14
@findepi findepi merged commit 5633e41 into trinodb:master Oct 26, 2021
@findepi findepi deleted the findepi/iceberg-more-show-stats branch October 26, 2021 06:09
@github-actions github-actions bot added this to the 364 milestone Oct 26, 2021
@findepi findepi mentioned this pull request Oct 26, 2021
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

SHOW STATS fails with NPE when Iceberg file has no columns with stats
3 participants