[ 
https://issues.apache.org/jira/browse/HIVE-30023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18138815#comment-18138815
 ] 

yongzhi.shao edited comment on HIVE-30023 at 11/5/26, 2:25 PM:
---------------------------------------------------------------

[~dkuzmenko] hello sir.If an Iceberg table has null partition values, how 
should we handle this scenario now?

Shouldn't we stay consistent with the behavior of non-Iceberg tables and write 
the value "__HIVE_DEFAULT_PARTITION__"? But I can't shake the feeling that this 
could be problematic.


was (Author: lisoda):
[~dkuzmenko] hello sir.If an Iceberg table has null partition values, how 
should we handle this scenario now?

> NPE Cannot invoke "String.trim()" because "identifier" is null in 
> ObjectStore.getMTable when running ANALYZE TABLE ... COMPUTE STATISTICS FOR 
> COLUMNS on an Iceberg table with a NULL partition value
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-30023
>                 URL: https://issues.apache.org/jira/browse/HIVE-30023
>             Project: Hive
>          Issue Type: Bug
>    Affects Versions: 4.2.0
>         Environment: * Apache Hive *4.2.0* ({{{}rel/release-4.2.0{}}}); also 
> expected on master
>  * Bundled Iceberg *1.9.1* ({{{}iceberg/pom.xml{}}})
>  * Table: *Iceberg* table, partitioned by a *bigint* partition column
>  * The partition column contains a *NULL* value (Iceberg treats NULL as a 
> first-class partition value)
>            Reporter: hidataplus
>            Priority: Major
>
> Running {{ANALYZE TABLE <iceberg_table> COMPUTE STATISTICS FOR COLUMNS}} on 
> an Iceberg table whose *partition column contains a NULL value* fails with:
> java.lang.NullPointerException: Cannot invoke "String.trim()" because 
> "identifier" is null
> The NPE is thrown *server-side* in the metastore 
> ({{{}ObjectStore.getMTable{}}}) while processing the {{alter_partitions}} RPC 
> that the column-stats path issues to write back partition parameters. It is 
> caused by {{ObjectStore.alterPartitionNoTxn}} trusting the incoming Thrift 
> {{Partition}} object's own {{dbName}} (which is null for the Iceberg 
> null-value partition) instead of the request-level database name.
>  
> h2. Reproduction steps
>  # Create an Iceberg table partitioned by a bigint column:
> CREATE TABLE db.t (id INT) PARTITIONED BY (pt BIGINT) STORED BY ICEBERG;
>  
>  # Insert a row with a NULL partition value:
> INSERT INTO db.t VALUES (1, NULL);
>  
>  # Run column-statistics analysis:
> ANALYZE TABLE db.t COMPUTE STATISTICS FOR COLUMNS;
>  
> *Expected:* the statement succeeds (or the null partition is handled 
> gracefully).
> *Actual:* {{{}NullPointerException: Cannot invoke "String.trim()" because 
> "identifier" is null{}}}.
> Notes:
>  * Inserting the NULL value itself succeeds; only {{ANALYZE ... FOR COLUMNS}} 
> fails.
>  * {{ANALYZE TABLE ... COMPUTE STATISTICS}} (basic stats, no {{{}FOR 
> COLUMNS{}}}) does not hit this path.
>  * Tables without a NULL partition value are unaffected.
> h2. Stack traces(not  al)
> org.apache.hadoop.hive.ql.metadata.HiveException: Unable to alter partition. 
> java.lang.NullPointerException: Cannot invoke "String.trim()" because 
> "identifier" is null
>         at 
> org.apache.hadoop.hive.ql.metadata.Hive.alterPartitions(Hive.java:1217)
>         at 
> org.apache.hadoop.hive.ql.stats.BasicStatsTask.aggregateStats(BasicStatsTask.java:406)
>         at 
> org.apache.hadoop.hive.ql.stats.BasicStatsTask.process(BasicStatsTask.java:108)
>         at 
> org.apache.hadoop.hive.ql.exec.StatsTask.execute(StatsTask.java:111)
>         at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:214)
>         at 
> org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:105)
>         at org.apache.hadoop.hive.ql.Executor.launchTask(Executor.java:354)
>         at org.apache.hadoop.hive.ql.Executor.launchTasks(Executor.java:327)
>         at org.apache.hadoop.hive.ql.Executor.runTasks(Executor.java:244)
>         at org.apache.hadoop.hive.ql.Executor.execute(Executor.java:105)
>         at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:345)
>         at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:189)
>         at org.apache.hadoop.hive.ql.Driver.run(Driver.java:142)
>         at org.apache.hadoop.hive.ql.Driver.run(Driver.java:137)
>         at 
> org.apache.hadoop.hive.ql.reexec.ReExecDriver.run(ReExecDriver.java:190)
>         at 
> org.apache.hive.service.cli.operation.SQLOperation.runQuery(SQLOperation.java:234)
>         at 
> org.apache.hive.service.cli.operation.SQLOperation$BackgroundWork$1.run(SQLOperation.java:334)
>         at 
> java.base/javax.security.auth.Subject.lambda$callAs$0(Subject.java:379)
>         at 
> java.base/java.security.AccessController.doPrivileged(AccessController.java:714)
>         at java.base/javax.security.auth.Subject.doAs(Subject.java:525)
>         at java.base/javax.security.auth.Subject.callAs(Subject.java:381)
>         at 
> org.apache.hadoop.security.authentication.util.SubjectUtil.callAs(SubjectUtil.java:161)
>         at 
> org.apache.hadoop.security.authentication.util.SubjectUtil.doAs(SubjectUtil.java:233)
>         at 
> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1951)
>         at 
> org.apache.hive.service.cli.operation.SQLOperation$BackgroundWork.run(SQLOperation.java:354)
>         at 
> java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
>         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
>         at 
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
>         at 
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
>         at java.base/java.lang.Thread.run(Thread.java:1583)
> Caused by: MetaException(message:java.lang.NullPointerException: Cannot 
> invoke "String.trim()" because "identifier" is null)
>         at 
> org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$alter_partitions_req_result$alter_partitions_req_resultStandardScheme.read(ThriftHiveMetastore.java)
>         at 
> org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$alter_partitions_req_result$alter_partitions_req_resultStandardScheme.read(ThriftHiveMetastore.java)
>         at 
> org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$alter_partitions_req_result.read(ThriftHiveMetastore.java)
>         at 
> org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:88)
>         at 
> org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.recv_alter_partitions_req(ThriftHiveMetastore.java:4625)
>         at 
> org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.alter_partitions_req(ThriftHiveMetastore.java:4612)
>         at 
> org.apache.hadoop.hive.metastore.client.ThriftHiveMetaStoreClient.alter_partitions(ThriftHiveMetaStoreClient.java:2382)
>         at 
> org.apache.hadoop.hive.metastore.client.MetaStoreClientWrapper.alter_partitions(MetaStoreClientWrapper.java:530)
>         at 
> org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.alter_partitions(SessionHiveMetaStoreClient.java:1689)
>         at 
> org.apache.hadoop.hive.metastore.client.MetaStoreClientWrapper.alter_partitions(MetaStoreClientWrapper.java:530)
>         at 
> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
>         at java.base/java.lang.reflect.Method.invoke(Method.java:580)
>         at 
> org.apache.hadoop.hive.metastore.client.SynchronizedMetaStoreClient$SynchronizedHandler.invoke(SynchronizedMetaStoreClient.java:69)
>         at jdk.proxy2/jdk.proxy2.$Proxy33.alter_partitions(Unknown Source)
>         at 
> org.apache.hadoop.hive.metastore.client.MetaStoreClientWrapper.alter_partitions(MetaStoreClientWrapper.java:530)
>  
>  



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to