static RecordIdentifier[] parseKeyIndex(Reader reader) { String[] stripes; try { ByteBuffer val = reader.getMetadataValue(OrcRecordUpdater.ACID_KEY_INDEX_NAME) .duplicate(); stripes = utf8Decoder.decode(val).toString().split(";"); } catch (CharacterCodingException e) { throw new IllegalArgumentException("Bad string encoding for " + OrcRecordUpdater.ACID_KEY_INDEX_NAME, e); } RecordIdentifier[] result = new RecordIdentifier[stripes.length]; for(int i=0; i < stripes.length; ++i) { if (stripes[i].length() != 0) { String[] parts = stripes[i].split(","); result[i] = new RecordIdentifier(); result[i].setValues(Long.parseLong(parts[0]), Integer.parseInt(parts[1]), Long.parseLong(parts[2])); } } return result; }
static RecordIdentifier[] parseKeyIndex(Reader reader) { String[] stripes; try { if (!reader.hasMetadataValue(OrcRecordUpdater.ACID_KEY_INDEX_NAME)) { return null; } ByteBuffer val = reader.getMetadataValue(OrcRecordUpdater.ACID_KEY_INDEX_NAME) .duplicate(); stripes = utf8Decoder.decode(val).toString().split(";"); } catch (CharacterCodingException e) { throw new IllegalArgumentException("Bad string encoding for " + OrcRecordUpdater.ACID_KEY_INDEX_NAME, e); } RecordIdentifier[] result = new RecordIdentifier[stripes.length]; for(int i=0; i < stripes.length; ++i) { if (stripes[i].length() != 0) { String[] parts = stripes[i].split(","); result[i] = new RecordIdentifier(); result[i].setValues(Long.parseLong(parts[0]), Integer.parseInt(parts[1]), Long.parseLong(parts[2])); } } return result; }
@Override protected void populateRecordIdentifier(OrcStruct rowId) { if (rowId == null) { this.isNull = true; return; } recordIdentifier.setValues(((LongWritable) rowId.getFieldValue(Field.writeId.ordinal())).get(), ((IntWritable) rowId.getFieldValue(Field.bucketId.ordinal())).get(), ((LongWritable) rowId.getFieldValue(Field.rowId.ordinal())).get()); this.isNull = false; }
RecordIdentifier currRecordIdInBatch = new RecordIdentifier(); while (isDeleteRecordAvailable && currIndex != -1 && currIndex <= lastValidIndex) { currRecordIdInBatch.setValues( (originalWriteId != null) ? originalWriteId[currIndex] : repeatedOriginalWriteId, (bucket != null) ? (int) bucket[currIndex] : (int) repeatedBucket,
RecordIdentifier currRecordIdInBatch = new RecordIdentifier(); while (isDeleteRecordAvailable && currIndex != -1 && currIndex <= lastValidIndex) { currRecordIdInBatch.setValues( (originalTransaction != null) ? originalTransaction[currIndex] : repeatedOriginalTransaction, (bucket != null) ? (int) bucket[currIndex] : (int) repeatedBucket,
@Test public void TestOrdering() throws Exception { RecordIdentifier left = new RecordIdentifier(100, 200, 1200); RecordIdentifier right = new RecordIdentifier(); right.setValues(100L, 200, 1000L); assertTrue(right.compareTo(left) < 0); assertTrue(left.compareTo(right) > 0); left.set(right); assertTrue(right.compareTo(left) == 0); right.setRowId(2000); assertTrue(right.compareTo(left) > 0); left.setValues(1, 2, 3); right.setValues(100, 2, 3); assertTrue(left.compareTo(right) < 0); assertTrue(right.compareTo(left) > 0); left.setValues(1, 2, 3); right.setValues(1, 100, 3); assertTrue(left.compareTo(right) < 0); assertTrue(right.compareTo(left) > 0); }
static RecordIdentifier[] parseKeyIndex(Reader reader) { String[] stripes; try { ByteBuffer val = reader.getMetadataValue(OrcRecordUpdater.ACID_KEY_INDEX_NAME) .duplicate(); stripes = utf8Decoder.decode(val).toString().split(";"); } catch (CharacterCodingException e) { throw new IllegalArgumentException("Bad string encoding for " + OrcRecordUpdater.ACID_KEY_INDEX_NAME, e); } RecordIdentifier[] result = new RecordIdentifier[stripes.length]; for(int i=0; i < stripes.length; ++i) { if (stripes[i].length() != 0) { String[] parts = stripes[i].split(","); result[i] = new RecordIdentifier(); result[i].setValues(Long.parseLong(parts[0]), Integer.parseInt(parts[1]), Long.parseLong(parts[2])); } } return result; }