public Object getFieldValue(_Fields field) { switch (field) { case NUM_ROWS: return getNum_rows(); case COLUMN_DATA_CHUNKS: return getColumn_data_chunks(); } throw new IllegalStateException(); }
public BlockletInfo deepCopy() { return new BlockletInfo(this); }
public void setFieldValue(_Fields field, Object value) { switch (field) { case NUM_ROWS: if (value == null) { unsetNum_rows(); } else { setNum_rows((Integer)value); } break; case COLUMN_DATA_CHUNKS: if (value == null) { unsetColumn_data_chunks(); } else { setColumn_data_chunks((List<DataChunk>)value); } break; } }
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case NUM_ROWS: return isSetNum_rows(); case COLUMN_DATA_CHUNKS: return isSetColumn_data_chunks(); } throw new IllegalStateException(); }
void apppendBlocklet(DataOutputStream outputStream) throws IOException { outputStream.write(CarbonStreamOutputFormat.CARBON_SYNC_MARKER); BlockletInfo blockletInfo = new BlockletInfo(); blockletInfo.setNum_rows(getRowIndex() + 1); BlockletHeader blockletHeader = new BlockletHeader(); blockletHeader.setBlocklet_length(getCount()); blockletHeader.setMutation(MutationType.INSERT); blockletHeader.setBlocklet_info(blockletInfo); // add blocklet level min/max blockletMinMaxIndex = generateBlockletMinMax(); if (blockletInfo.getNum_rows() > 1) { BlockletIndex blockletIndex = new BlockletIndex(); blockletIndex.setMin_max_index(CarbonMetadataUtil.convertMinMaxIndex(blockletMinMaxIndex)); blockletHeader.setBlocklet_index(blockletIndex); } byte[] headerBytes = CarbonUtil.getByteArray(blockletHeader); outputStream.writeInt(headerBytes.length); outputStream.write(headerBytes); byte[] compressed = compressor.compressByte(getBytes(), getCount()); outputStream.writeInt(compressed.length); outputStream.write(compressed); }
case 4: // BLOCKLET_INFO if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.blocklet_info = new BlockletInfo(); struct.blocklet_info.read(iprot); struct.setBlocklet_infoIsSet(true); } else {
public BlockletHeader readBlockletHeader() throws IOException { int len = readIntFromStream(); byte[] b = new byte[len]; if (!readBytesFromStream(b, 0, len)) { throw new EOFException("Failed to read blocklet header"); } BlockletHeader header = CarbonUtil.readBlockletHeader(b); rowNums = header.getBlocklet_info().getNum_rows(); rowIndex = 0; return header; }
List<DataChunk> measureChunk = new ArrayList<DataChunk>(); Iterator<org.apache.carbondata.format.DataChunk> column_data_chunksIterator = blockletInfoThrift.getColumn_data_chunksIterator(); if (null != column_data_chunksIterator) { while (column_data_chunksIterator.hasNext()) { blockletInfo.setNumberOfRows(blockletInfoThrift.getNum_rows()); return blockletInfo;
public void write(org.apache.thrift.protocol.TProtocol oprot, BlockletInfo struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldBegin(NUM_ROWS_FIELD_DESC); oprot.writeI32(struct.num_rows); oprot.writeFieldEnd(); if (struct.column_data_chunks != null) { if (struct.isSetColumn_data_chunks()) { oprot.writeFieldBegin(COLUMN_DATA_CHUNKS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.column_data_chunks.size())); for (DataChunk _iter99 : struct.column_data_chunks) { _iter99.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
public boolean equals(BlockletInfo that) { if (that == null) return false; boolean this_present_num_rows = true; boolean that_present_num_rows = true; if (this_present_num_rows || that_present_num_rows) { if (!(this_present_num_rows && that_present_num_rows)) return false; if (this.num_rows != that.num_rows) return false; } boolean this_present_column_data_chunks = true && this.isSetColumn_data_chunks(); boolean that_present_column_data_chunks = true && that.isSetColumn_data_chunks(); if (this_present_column_data_chunks || that_present_column_data_chunks) { if (!(this_present_column_data_chunks && that_present_column_data_chunks)) return false; if (!this.column_data_chunks.equals(that.column_data_chunks)) return false; } return true; }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof BlockletInfo) return this.equals((BlockletInfo)that); return false; }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, BlockletHeader struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.blocklet_length = iprot.readI32(); struct.setBlocklet_lengthIsSet(true); struct.mutation = org.apache.carbondata.format.MutationType.findByValue(iprot.readI32()); struct.setMutationIsSet(true); struct.blocklet_info = new BlockletInfo(); struct.blocklet_info.read(iprot); struct.setBlocklet_infoIsSet(true); BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { struct.blocklet_index = new BlockletIndex(); struct.blocklet_index.read(iprot); struct.setBlocklet_indexIsSet(true); } if (incoming.get(1)) { struct.dictionary = new org.apache.carbondata.format.ColumnDictionaryChunk(); struct.dictionary.read(iprot); struct.setDictionaryIsSet(true); } } }
private boolean scanBlockletAndFillVector(BlockletHeader header) throws IOException { int rowNums = header.getBlocklet_info().getNum_rows(); vectorProxy = new CarbonVectorProxy(MemoryMode.OFF_HEAP, outputSchema, rowNums, false); vectorProxy.setNumRows(rowNums);
@Override public int compareTo(BlockletInfo other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetNum_rows()).compareTo(other.isSetNum_rows()); if (lastComparison != 0) { return lastComparison; } if (isSetNum_rows()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num_rows, other.num_rows); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetColumn_data_chunks()).compareTo(other.isSetColumn_data_chunks()); if (lastComparison != 0) { return lastComparison; } if (isSetColumn_data_chunks()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.column_data_chunks, other.column_data_chunks); if (lastComparison != 0) { return lastComparison; } } return 0; }
@Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_num_rows = true; list.add(present_num_rows); if (present_num_rows) list.add(num_rows); boolean present_column_data_chunks = true && (isSetColumn_data_chunks()); list.add(present_column_data_chunks); if (present_column_data_chunks) list.add(column_data_chunks); return list.hashCode(); }
if (!(this_present_blocklet_info && that_present_blocklet_info)) return false; if (!this.blocklet_info.equals(that.blocklet_info)) return false;
for (int _i144 = 0; _i144 < _list142.size; ++_i144) _elem143 = new BlockletInfo(); _elem143.read(iprot); struct.blocklet_info_list.add(_elem143);
List<BlockletInfo> __this__blocklet_info_list = new ArrayList<BlockletInfo>(other.blocklet_info_list.size()); for (BlockletInfo other_element : other.blocklet_info_list) { __this__blocklet_info_list.add(new BlockletInfo(other_element));
/** * Performs a deep copy on <i>other</i>. */ public BlockletInfo(BlockletInfo other) { __isset_bitfield = other.__isset_bitfield; this.num_rows = other.num_rows; if (other.isSetColumn_data_chunks()) { List<DataChunk> __this__column_data_chunks = new ArrayList<DataChunk>(other.column_data_chunks.size()); for (DataChunk other_element : other.column_data_chunks) { __this__column_data_chunks.add(new DataChunk(other_element)); } this.column_data_chunks = __this__column_data_chunks; } }
for (int _i164 = 0; _i164 < _list162.size; ++_i164) _elem163 = new BlockletInfo(); _elem163.read(iprot); struct.blocklet_info_list.add(_elem163);