[ 
https://issues.apache.org/jira/browse/HIVE-26146?focusedWorklogId=758056&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-758056
 ]

ASF GitHub Bot logged work on HIVE-26146:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 18/Apr/22 18:31
            Start Date: 18/Apr/22 18:31
    Worklog Time Spent: 10m 
      Work Description: amansinha100 commented on code in PR #3216:
URL: https://github.com/apache/hive/pull/3216#discussion_r852312966


##########
ql/src/java/org/apache/hadoop/hive/ql/io/orc/FixAcidKeyIndex.java:
##########
@@ -180,7 +180,8 @@ public static AcidKeyIndexValidationResult 
validate(Configuration conf, Path inp
         RecordIdentifier recordIdentifier = new 
RecordIdentifier(lastTransaction, lastBucket, lastRowId);
         result.recordIdentifiers.add(recordIdentifier);
 
-        if (stripes.size() != keyIndex.length || keyIndex[i] == null || 
recordIdentifier.compareTo(keyIndex[i]) != 0) {
+        if (keyIndex == null || stripes.size() != keyIndex.length || 
keyIndex[i] == null

Review Comment:
   Since keyIndex is independent of the stripes,  the `if (keyIndex == null)` 
check can be done right after line 159  and the `result.isValid` set to false 
right then.  Otherwise, here we will be setting the flag repeatedly. The check 
here could be modified to 
   `if (result.isValid && (stipes.size() ...<original condition>))`





Issue Time Tracking
-------------------

    Worklog Id:     (was: 758056)
    Time Spent: 20m  (was: 10m)

> Handle missing hive.acid.key.index in the fixacidkeyindex utility
> -----------------------------------------------------------------
>
>                 Key: HIVE-26146
>                 URL: https://issues.apache.org/jira/browse/HIVE-26146
>             Project: Hive
>          Issue Type: Improvement
>          Components: ORC, Transactions
>    Affects Versions: 4.0.0-alpha-2
>            Reporter: Alessandro Solimando
>            Assignee: Alessandro Solimando
>            Priority: Critical
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> There is a utility in hive which can validate/fix corrupted 
> _hive.acid.key.index_: 
> {code:bash}
> hive --service fixacidkeyindex
> {code}
> At the moment the utility throws a NPE if the _hive.acid.key.index_ metadata 
> entry is missing:
> {noformat}
> ERROR checking /hive-dev-box/multistripe_ko_acid.orc
> java.lang.NullPointerException
>         at 
> org.apache.hadoop.hive.ql.io.orc.FixAcidKeyIndex.validate(FixAcidKeyIndex.java:183)
>         at 
> org.apache.hadoop.hive.ql.io.orc.FixAcidKeyIndex.checkFile(FixAcidKeyIndex.java:147)
>         at 
> org.apache.hadoop.hive.ql.io.orc.FixAcidKeyIndex.checkFiles(FixAcidKeyIndex.java:130)
>         at 
> org.apache.hadoop.hive.ql.io.orc.FixAcidKeyIndex.main(FixAcidKeyIndex.java:106)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at org.apache.hadoop.util.RunJar.run(RunJar.java:308)
>         at org.apache.hadoop.util.RunJar.main(RunJar.java:222)
> {noformat}
> The aim of this ticket is to handle such case in order to support 
> re-generating this metadata entry even when it is missing.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to