apache / orc

Apache ORC - the smallest, fastest columnar storage for Hadoop workloads
https://orc.apache.org/
Apache License 2.0
665 stars 477 forks source link

ORC-1683: Fix `instanceof` of BinaryStatisticsImpl merge method #1883

Open cxzl25 opened 2 months ago

cxzl25 commented 2 months ago

What changes were proposed in this pull request?

This PR aims to fix instanceof of BinaryStatisticsImpl merge method.

Why are the changes needed?

In ORC-1542, we modified part of instanceof, but BinaryStatisticsImpl was not modified because the merge method was written differently.

However, the current code is instanceof BinaryColumnStatistics and then explicitly cast BinaryStatisticsImpl, so it should be replaced by the new instanceof writing method (Pattern Matching for instanceof).

if (other instanceof BinaryColumnStatistics) {
        BinaryStatisticsImpl bin = (BinaryStatisticsImpl) other;

How was this patch tested?

GA

Was this patch authored or co-authored using generative AI tooling?

No

dongjoon-hyun commented 2 months ago

In addition, this is not Fixing anything. We use Fix for bugs.

cxzl25 commented 2 months ago

Could you find more like the previous PR? We don't want to make many PRs like this online style change.

I have checked all related instanceof and only ORC-1683 and ORC-1685 are left.

In addition, this is not Fixing anything. We use Fix for bugs.

Since there could be a potential ClassCastException here, I've split it out to raise a separate PR.

dongjoon-hyun commented 2 months ago

Oh, I got what you mean.