[ https://issues.apache.org/jira/browse/HIVE-24475?focusedWorklogId=521294&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-521294 ]
ASF GitHub Bot logged work on HIVE-24475: ----------------------------------------- Author: ASF GitHub Bot Created on: 07/Dec/20 17:03 Start Date: 07/Dec/20 17:03 Worklog Time Spent: 10m Work Description: asinkovits commented on a change in pull request #1730: URL: https://github.com/apache/hive/pull/1730#discussion_r537671312 ########## File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/FixAcidKeyIndex.java ########## @@ -163,11 +144,52 @@ static void checkFile(Configuration conf, Path inputPath) throws IOException { return; } - boolean validIndex = isAcidKeyIndexValid(reader); + AcidKeyIndexValidationResult validationResult = validate(conf, inputPath); + boolean validIndex = validationResult.isValid; System.out.println("Checking " + inputPath + " - acid key index is " + (validIndex ? "valid" : "invalid")); } + public static AcidKeyIndexValidationResult validate(Configuration conf, Path inputPath) throws IOException { + AcidKeyIndexValidationResult result = new AcidKeyIndexValidationResult(); + FileSystem fs = inputPath.getFileSystem(conf); + Reader reader = OrcFile.createReader(fs, inputPath); + List<StripeInformation> stripes = reader.getStripes(); + RecordIdentifier[] keyIndex = OrcRecordUpdater.parseKeyIndex(reader); + StructObjectInspector soi = (StructObjectInspector) reader.getObjectInspector(); + // struct<operation:int,originalTransaction:bigint,bucket:int,rowId:bigint,currentTransaction:bigint + + long rowsProcessed = 0; + try (RecordReader rr = reader.rows()) { + for(int i=0; i<stripes.size(); i++) { + rowsProcessed += stripes.get(i).getNumberOfRows(); + rr.seekToRow(rowsProcessed-1); + OrcStruct row = (OrcStruct) rr.next(null); + + List<? extends StructField> structFields = soi.getAllStructFieldRefs(); + + StructField transactionField = structFields.get(1); + StructField bucketField = structFields.get(2); Review comment: Fixed. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 521294) Time Spent: 1h 20m (was: 1h 10m) > Generalize fixacidkeyindex utility > ---------------------------------- > > Key: HIVE-24475 > URL: https://issues.apache.org/jira/browse/HIVE-24475 > Project: Hive > Issue Type: Improvement > Components: ORC, Transactions > Affects Versions: 3.0.0 > Reporter: Antal Sinkovits > Assignee: Antal Sinkovits > Priority: Major > Labels: pull-request-available > Time Spent: 1h 20m > Remaining Estimate: 0h > > There is a utility in hive which can validate/fix corrupted > hive.acid.key.index. > hive --service fixacidkeyindex > Unfortunately it is only tailored for a specific problem > (https://issues.apache.org/jira/browse/HIVE-18907), instead of generally > validating and recovering the hive.acid.key.index from the stripe data itself. -- This message was sent by Atlassian Jira (v8.3.4#803005)