Skip to content

[#10174] Improvement(POConverters): possible NPE for null lastVersion in fileset version update#10389

Closed
pandeysambhi wants to merge 1 commit intoapache:mainfrom
pandeysambhi:issue/10174
Closed

[#10174] Improvement(POConverters): possible NPE for null lastVersion in fileset version update#10389
pandeysambhi wants to merge 1 commit intoapache:mainfrom
pandeysambhi:issue/10174

Conversation

@pandeysambhi
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

In updateFilesetPOWithVersion, validate oldFilesetPO.getLastVersion() and normalize null to a safe baseline version ( INIT_VERSION) before incrementing to avoid NPE.

Why are the changes needed?

POConverters.updateFilesetPOWithVersion reads Long lastVersion = oldFilesetPO.getLastVersion(); and then executes lastVersion++ when needUpdateVersion is true. If lastVersion is null, Java auto-unboxing triggers a NullPointerException.

Fix: (#10174 )

Does this PR introduce any user-facing change?

no

How was this patch tested?

unit test

@github-actions
Copy link
Copy Markdown

Code Coverage Report

Overall Project 64.88% +0.31% 🟢
Files changed 87.91% 🟢

Module Coverage
aliyun 1.73% 🔴
api 47.14% 🟢
authorization-common 85.96% 🟢
aws 1.1% 🔴
azure 2.6% 🔴
catalog-common 10.0% 🔴
catalog-fileset 80.02% 🟢
catalog-hive 80.98% 🟢
catalog-jdbc-clickhouse 78.25% 🟢
catalog-jdbc-common 42.98% 🟢
catalog-jdbc-doris 80.28% 🟢
catalog-jdbc-hologres 51.09% 🟢
catalog-jdbc-mysql 79.23% 🟢
catalog-jdbc-oceanbase 78.38% 🟢
catalog-jdbc-postgresql 82.05% 🟢
catalog-jdbc-starrocks 78.27% 🟢
catalog-kafka 77.01% 🟢
catalog-lakehouse-generic 45.07% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 87.15% 🟢
catalog-lakehouse-paimon 77.71% 🟢
catalog-model 77.72% 🟢
cli 44.51% 🟢
client-java 77.83% 🟢
common 49.32% 🟢
core 81.24% +0.31% 🟢
filesystem-hadoop3 76.97% 🟢
flink 38.86% 🔴
flink-runtime 0.0% 🔴
gcp 14.2% 🔴
hadoop-common 10.39% 🔴
hive-metastore-common 45.82% 🟢
iceberg-common 50.21% 🟢
iceberg-rest-server 66.35% 🟢
integration-test-common 0.0% 🔴
jobs 66.17% 🟢
lance-common 23.78% 🔴
lance-rest-server 57.84% 🟢
lineage 53.02% 🟢
optimizer 82.95% 🟢
optimizer-api 21.95% 🔴
server 85.68% 🟢
server-common 69.72% 🟢
spark 32.79% 🔴
spark-common 39.6% 🔴
trino-connector 31.62% 🔴
Files
Module File Coverage
core POConverters.java 88.07% 🟢
SessionUtils.java 83.33% 🟢

@@ -702,6 +702,9 @@ public static FilesetPO updateFilesetPOWithVersion(
FilesetPO oldFilesetPO, FilesetEntity newFileset, boolean needUpdateVersion) {
try {
Long lastVersion = oldFilesetPO.getLastVersion();
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.

In which scenario will the return value here be null?

@jerryshao
Copy link
Copy Markdown
Contributor

I don't think this is a valid case mentioned in the issue. I'm going to close this PR and issue. You can always reopen this PR and issue if you find this problem in the real scenario. Thanks @pandeysambhi for your contribution.

@jerryshao jerryshao closed this Mar 20, 2026
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.

2 participants