public Object getFieldValue(_Fields field) { switch (field) { case FACT_TABLE: return getFact_table(); case AGGREGATE_TABLE_LIST: return getAggregate_table_list(); case DATA_MAP_SCHEMAS: return getDataMapSchemas(); } throw new IllegalStateException(); }
public org.apache.thrift.TBase<org.apache.carbondata.format.TableInfo, org.apache.carbondata.format.TableInfo._Fields> create() { return new org.apache.carbondata.format.TableInfo(); } };
public void setFieldValue(_Fields field, Object value) { switch (field) { case FACT_TABLE: if (value == null) { unsetFact_table(); } else { setFact_table((TableSchema)value); } break; case AGGREGATE_TABLE_LIST: if (value == null) { unsetAggregate_table_list(); } else { setAggregate_table_list((List<TableSchema>)value); } break; case DATA_MAP_SCHEMAS: if (value == null) { unsetDataMapSchemas(); } else { setDataMapSchemas((List<DataMapSchema>)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 FACT_TABLE: return isSetFact_table(); case AGGREGATE_TABLE_LIST: return isSetAggregate_table_list(); case DATA_MAP_SCHEMAS: return isSetDataMapSchemas(); } throw new IllegalStateException(); }
@Override public org.apache.carbondata.format.TableInfo fromWrapperToExternalTableInfo( TableInfo wrapperTableInfo, String dbName, String tableName) { org.apache.carbondata.format.TableSchema thriftFactTable = fromWrapperToExternalTableSchema(wrapperTableInfo.getFactTable()); org.apache.carbondata.format.TableInfo tableInfo = new org.apache.carbondata.format.TableInfo(thriftFactTable, new ArrayList<org.apache.carbondata.format.TableSchema>()); List<DataMapSchema> wrapperChildSchemaList = wrapperTableInfo.getDataMapSchemaList(); if (null != wrapperChildSchemaList) { List<org.apache.carbondata.format.DataMapSchema> thriftChildSchemas = fromWrapperToExternalChildSchemaList(wrapperChildSchemaList); tableInfo.setDataMapSchemas(thriftChildSchemas); } return tableInfo; }
@Override public TableInfo fromExternalToWrapperTableInfo( org.apache.carbondata.format.TableInfo externalTableInfo, String dbName, String tableName, String tablePath) { TableInfo wrapperTableInfo = new TableInfo(); List<org.apache.carbondata.format.SchemaEvolutionEntry> schemaEvolutionList = externalTableInfo.getFact_table().getSchema_evolution().getSchema_evolution_history(); wrapperTableInfo.setLastUpdatedTime( schemaEvolutionList.get(schemaEvolutionList.size() - 1).getTime_stamp()); wrapperTableInfo.setDatabaseName(dbName); wrapperTableInfo.setTableUniqueName(CarbonTable.buildUniqueName(dbName, tableName)); wrapperTableInfo.setFactTable( fromExternalToWrapperTableSchema(externalTableInfo.getFact_table(), tableName)); if (null != externalTableInfo.getDataMapSchemas()) { wrapperTableInfo.setDataMapSchemaList( fromExternalToWrapperChildSchemaList(externalTableInfo.getDataMapSchemas())); } wrapperTableInfo.setTablePath(tablePath); return wrapperTableInfo; }
public static CarbonTable buildTable( String tablePath, String tableName, Configuration configuration) throws IOException { TableInfo tableInfoInfer = CarbonUtil.buildDummyTableInfo(tablePath, "null", "null"); CarbonFile carbonFile = getFirstIndexFile(FileFactory.getCarbonFile(tablePath, configuration)); if (carbonFile == null) { throw new RuntimeException("Carbon index file not exists."); } org.apache.carbondata.format.TableInfo tableInfo = CarbonUtil .inferSchemaFromIndexFile(carbonFile.getPath(), tableName); List<ColumnSchema> columnSchemaList = new ArrayList<ColumnSchema>(); for (org.apache.carbondata.format.ColumnSchema thriftColumnSchema : tableInfo .getFact_table().getTable_columns()) { ColumnSchema columnSchema = thriftColumnSchemaToWrapperColumnSchema(thriftColumnSchema); if (columnSchema.getColumnReferenceId() == null) { columnSchema.setColumnReferenceId(columnSchema.getColumnUniqueId()); } columnSchemaList.add(columnSchema); } tableInfoInfer.getFactTable().setListOfColumns(columnSchemaList); return CarbonTable.buildFromTableInfo(tableInfoInfer); }
public void write(org.apache.thrift.protocol.TProtocol oprot, TableInfo struct) throws org.apache.thrift.TException { struct.validate(); if (struct.isSetDataMapSchemas()) { oprot.writeFieldBegin(DATA_MAP_SCHEMAS_FIELD_DESC);
if (isSetDataMapSchemas()) { if (!first) sb.append(", "); sb.append("dataMapSchemas:");
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof TableInfo) return this.equals((TableInfo)that); return false; }
/** * This method will prepare dummy tableInfo * * @param carbonDataFilePath * @param tableName * @return */ public static TableInfo buildDummyTableInfo(String carbonDataFilePath, String tableName, String dbName) { // During SDK carbon Reader, This method will be called. // This API will avoid IO operation to get the columnSchema list. // ColumnSchema list will be filled during blocklet loading (where actual IO happens) List<ColumnSchema> columnSchemaList = new ArrayList<>(); TableSchema tableSchema = getDummyTableSchema(tableName,columnSchemaList); ThriftWrapperSchemaConverterImpl thriftWrapperSchemaConverter = new ThriftWrapperSchemaConverterImpl(); org.apache.carbondata.format.TableSchema thriftFactTable = thriftWrapperSchemaConverter.fromWrapperToExternalTableSchema(tableSchema); org.apache.carbondata.format.TableInfo tableInfo = new org.apache.carbondata.format.TableInfo(thriftFactTable, new ArrayList<org.apache.carbondata.format.TableSchema>()); tableInfo.setDataMapSchemas(null); SchemaConverter schemaConverter = new ThriftWrapperSchemaConverterImpl(); TableInfo wrapperTableInfo = schemaConverter.fromExternalToWrapperTableInfo( tableInfo, dbName, tableName, carbonDataFilePath); wrapperTableInfo.setTransactionalTable(false); return wrapperTableInfo; }
public boolean equals(TableInfo that) { if (that == null) return false; boolean this_present_fact_table = true && this.isSetFact_table(); boolean that_present_fact_table = true && that.isSetFact_table(); if (this_present_fact_table || that_present_fact_table) { if (!(this_present_fact_table && that_present_fact_table)) return false; if (!this.fact_table.equals(that.fact_table)) return false; } boolean this_present_aggregate_table_list = true && this.isSetAggregate_table_list(); boolean that_present_aggregate_table_list = true && that.isSetAggregate_table_list(); if (this_present_aggregate_table_list || that_present_aggregate_table_list) { if (!(this_present_aggregate_table_list && that_present_aggregate_table_list)) return false; if (!this.aggregate_table_list.equals(that.aggregate_table_list)) return false; } boolean this_present_dataMapSchemas = true && this.isSetDataMapSchemas(); boolean that_present_dataMapSchemas = true && that.isSetDataMapSchemas(); if (this_present_dataMapSchemas || that_present_dataMapSchemas) { if (!(this_present_dataMapSchemas && that_present_dataMapSchemas)) return false; if (!this.dataMapSchemas.equals(that.dataMapSchemas)) return false; } return true; }
org.apache.carbondata.format.SchemaEvolutionEntry schemaEvolutionEntry = new org.apache.carbondata.format.SchemaEvolutionEntry(tableInfo.getLastUpdatedTime()); thriftTableInfo.getFact_table().getSchema_evolution().getSchema_evolution_history() .add(schemaEvolutionEntry);
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TableInfo struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; struct.fact_table.write(oprot); { oprot.writeI32(struct.aggregate_table_list.size()); for (TableSchema _iter142 : struct.aggregate_table_list) { _iter142.write(oprot); } } BitSet optionals = new BitSet(); if (struct.isSetDataMapSchemas()) { optionals.set(0); } oprot.writeBitSet(optionals, 1); if (struct.isSetDataMapSchemas()) { { oprot.writeI32(struct.dataMapSchemas.size()); for (DataMapSchema _iter143 : struct.dataMapSchemas) { _iter143.write(oprot); } } } }
thriftWrapperSchemaConverter.fromWrapperToExternalTableSchema(tableSchema); org.apache.carbondata.format.TableInfo tableInfo = new org.apache.carbondata.format.TableInfo(thriftFactTable, new ArrayList<org.apache.carbondata.format.TableSchema>()); tableInfo.setDataMapSchemas(null); return tableInfo; } finally {
@Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_fact_table = true && (isSetFact_table()); list.add(present_fact_table); if (present_fact_table) list.add(fact_table); boolean present_aggregate_table_list = true && (isSetAggregate_table_list()); list.add(present_aggregate_table_list); if (present_aggregate_table_list) list.add(aggregate_table_list); boolean present_dataMapSchemas = true && (isSetDataMapSchemas()); list.add(present_dataMapSchemas); if (present_dataMapSchemas) list.add(dataMapSchemas); return list.hashCode(); }
public TableInfo deepCopy() { return new TableInfo(this); }
thriftWrapperSchemaConverter.fromWrapperToExternalTableSchema(tableSchema); org.apache.carbondata.format.TableInfo tableInfo = new org.apache.carbondata.format.TableInfo(thriftFactTable, new ArrayList<org.apache.carbondata.format.TableSchema>()); tableInfo.setDataMapSchemas(null); return tableInfo;
lastComparison = Boolean.valueOf(isSetFact_table()).compareTo(other.isSetFact_table()); if (lastComparison != 0) { return lastComparison; if (isSetFact_table()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fact_table, other.fact_table); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetAggregate_table_list()).compareTo(other.isSetAggregate_table_list()); if (lastComparison != 0) { return lastComparison; if (isSetAggregate_table_list()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.aggregate_table_list, other.aggregate_table_list); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetDataMapSchemas()).compareTo(other.isSetDataMapSchemas()); if (lastComparison != 0) { return lastComparison; if (isSetDataMapSchemas()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dataMapSchemas, other.dataMapSchemas); if (lastComparison != 0) {
/** * Performs a deep copy on <i>other</i>. */ public TableInfo(TableInfo other) { if (other.isSetFact_table()) { this.fact_table = new TableSchema(other.fact_table); } if (other.isSetAggregate_table_list()) { List<TableSchema> __this__aggregate_table_list = new ArrayList<TableSchema>(other.aggregate_table_list.size()); for (TableSchema other_element : other.aggregate_table_list) { __this__aggregate_table_list.add(new TableSchema(other_element)); } this.aggregate_table_list = __this__aggregate_table_list; } if (other.isSetDataMapSchemas()) { List<DataMapSchema> __this__dataMapSchemas = new ArrayList<DataMapSchema>(other.dataMapSchemas.size()); for (DataMapSchema other_element : other.dataMapSchemas) { __this__dataMapSchemas.add(new DataMapSchema(other_element)); } this.dataMapSchemas = __this__dataMapSchemas; } }