public Object getFieldValue(_Fields field) { switch (field) { case TABLE_ID: return getTable_id(); case TABLE_COLUMNS: return getTable_columns(); case SCHEMA_EVOLUTION: return getSchema_evolution(); case TABLE_PROPERTIES: return getTableProperties(); case BUCKETING_INFO: return getBucketingInfo(); case PARTITION_INFO: return getPartitionInfo(); case LONG_STRING_COLUMNS: return getLong_string_columns(); } throw new IllegalStateException(); }
public TableSchema deepCopy() { return new TableSchema(this); }
/** 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 TABLE_ID: return isSetTable_id(); case TABLE_COLUMNS: return isSetTable_columns(); case SCHEMA_EVOLUTION: return isSetSchema_evolution(); case TABLE_PROPERTIES: return isSetTableProperties(); case BUCKETING_INFO: return isSetBucketingInfo(); case PARTITION_INFO: return isSetPartitionInfo(); case LONG_STRING_COLUMNS: return isSetLong_string_columns(); } throw new IllegalStateException(); }
case TABLE_ID: if (value == null) { unsetTable_id(); } else { setTable_id((String)value); unsetTable_columns(); } else { setTable_columns((List<ColumnSchema>)value); unsetSchema_evolution(); } else { setSchema_evolution((SchemaEvolution)value); unsetTableProperties(); } else { setTableProperties((Map<String,String>)value); unsetBucketingInfo(); } else { setBucketingInfo((BucketingInfo)value); unsetPartitionInfo(); } else { setPartitionInfo((PartitionInfo)value); unsetLong_string_columns(); } else { setLong_string_columns((List<String>)value);
@Override public TableSchema fromExternalToWrapperTableSchema( org.apache.carbondata.format.TableSchema externalTableSchema, String tableName) { TableSchema wrapperTableSchema = new TableSchema(); wrapperTableSchema.setTableId(externalTableSchema.getTable_id()); wrapperTableSchema.setTableName(tableName); wrapperTableSchema.setTableProperties(externalTableSchema.getTableProperties()); List<ColumnSchema> listOfColumns = new ArrayList<ColumnSchema>(); for (org.apache.carbondata.format.ColumnSchema externalColumnSchema : externalTableSchema .getTable_columns()) { listOfColumns.add(fromExternalToWrapperColumnSchema(externalColumnSchema)); } if (null != externalTableSchema.tableProperties) { CarbonUtil .setLocalDictColumnsToWrapperSchema(listOfColumns, externalTableSchema.tableProperties, externalTableSchema.tableProperties .get(CarbonCommonConstants.LOCAL_DICTIONARY_ENABLE)); } wrapperTableSchema.setListOfColumns(listOfColumns); wrapperTableSchema.setSchemaEvolution( fromExternalToWrapperSchemaEvolution(externalTableSchema.getSchema_evolution())); if (externalTableSchema.isSetBucketingInfo()) { wrapperTableSchema.setBucketingInfo( fromExternalToWrapperBucketingInfo(externalTableSchema.bucketingInfo)); } if (externalTableSchema.getPartitionInfo() != null) { wrapperTableSchema.setPartitionInfo( fromExternalToWrapperPartitionInfo(externalTableSchema.getPartitionInfo())); } return wrapperTableSchema; }
if (isSetTableProperties()) { if (!first) sb.append(", "); sb.append("tableProperties:"); if (isSetBucketingInfo()) { if (!first) sb.append(", "); sb.append("bucketingInfo:"); if (isSetPartitionInfo()) { if (!first) sb.append(", "); sb.append("partitionInfo:"); if (isSetLong_string_columns()) { if (!first) sb.append(", "); sb.append("long_string_columns:");
@Override public org.apache.carbondata.format.TableSchema fromWrapperToExternalTableSchema( TableSchema wrapperTableSchema) { List<org.apache.carbondata.format.ColumnSchema> thriftColumnSchema = new ArrayList<org.apache.carbondata.format.ColumnSchema>(); for (ColumnSchema wrapperColumnSchema : wrapperTableSchema.getListOfColumns()) { thriftColumnSchema.add(fromWrapperToExternalColumnSchema(wrapperColumnSchema)); } org.apache.carbondata.format.SchemaEvolution schemaEvolution = fromWrapperToExternalSchemaEvolution(wrapperTableSchema.getSchemaEvolution()); org.apache.carbondata.format.TableSchema externalTableSchema = new org.apache.carbondata.format.TableSchema( wrapperTableSchema.getTableId(), thriftColumnSchema, schemaEvolution); externalTableSchema.setTableProperties(wrapperTableSchema.getTableProperties()); if (wrapperTableSchema.getBucketingInfo() != null) { externalTableSchema.setBucketingInfo( fromWrapperToExternalBucketingInfo(wrapperTableSchema.getBucketingInfo())); } if (wrapperTableSchema.getPartitionInfo() != null) { externalTableSchema.setPartitionInfo( fromWrapperToExternalPartitionInfo(wrapperTableSchema.getPartitionInfo())); } return externalTableSchema; }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, TableInfo struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.fact_table = new TableSchema(); struct.fact_table.read(iprot); struct.setFact_tableIsSet(true); for (int _i146 = 0; _i146 < _list144.size; ++_i146) _elem145 = new TableSchema(); _elem145.read(iprot); struct.aggregate_table_list.add(_elem145);
@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); }
if (struct.isSetTableProperties()) { optionals.set(0); if (struct.isSetBucketingInfo()) { optionals.set(1); if (struct.isSetPartitionInfo()) { optionals.set(2); if (struct.isSetLong_string_columns()) { optionals.set(3); if (struct.isSetTableProperties()) { if (struct.isSetBucketingInfo()) { struct.bucketingInfo.write(oprot); if (struct.isSetPartitionInfo()) { struct.partitionInfo.write(oprot); if (struct.isSetLong_string_columns()) {
case 1: // FACT_TABLE if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.fact_table = new TableSchema(); struct.fact_table.read(iprot); struct.setFact_tableIsSet(true); } else { for (int _i136 = 0; _i136 < _list134.size; ++_i136) _elem135 = new TableSchema(); _elem135.read(iprot); struct.aggregate_table_list.add(_elem135);
org.apache.carbondata.format.SchemaEvolutionEntry schemaEvolutionEntry = new org.apache.carbondata.format.SchemaEvolutionEntry(tableInfo.getLastUpdatedTime()); thriftTableInfo.getFact_table().getSchema_evolution().getSchema_evolution_history() .add(schemaEvolutionEntry);
boolean present_table_id = true && (isSetTable_id()); list.add(present_table_id); if (present_table_id) list.add(table_id); boolean present_table_columns = true && (isSetTable_columns()); list.add(present_table_columns); if (present_table_columns) list.add(table_columns); boolean present_schema_evolution = true && (isSetSchema_evolution()); list.add(present_schema_evolution); if (present_schema_evolution) list.add(schema_evolution); boolean present_tableProperties = true && (isSetTableProperties()); list.add(present_tableProperties); if (present_tableProperties) list.add(tableProperties); boolean present_bucketingInfo = true && (isSetBucketingInfo()); list.add(present_bucketingInfo); if (present_bucketingInfo) list.add(bucketingInfo); boolean present_partitionInfo = true && (isSetPartitionInfo()); list.add(present_partitionInfo); if (present_partitionInfo) list.add(partitionInfo);
public void write(org.apache.thrift.protocol.TProtocol oprot, TableSchema struct) throws org.apache.thrift.TException { struct.validate(); if (struct.isSetTableProperties()) { oprot.writeFieldBegin(TABLE_PROPERTIES_FIELD_DESC); if (struct.isSetBucketingInfo()) { oprot.writeFieldBegin(BUCKETING_INFO_FIELD_DESC); struct.bucketingInfo.write(oprot); if (struct.isSetPartitionInfo()) { oprot.writeFieldBegin(PARTITION_INFO_FIELD_DESC); struct.partitionInfo.write(oprot); if (struct.isSetLong_string_columns()) { oprot.writeFieldBegin(LONG_STRING_COLUMNS_FIELD_DESC);
case 5: // CHILD_TABLE_SCHEMA if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.childTableSchema = new TableSchema(); struct.childTableSchema.read(iprot); struct.setChildTableSchemaIsSet(true); } else {
/** * 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; } }
boolean this_present_table_id = true && this.isSetTable_id(); boolean that_present_table_id = true && that.isSetTable_id(); if (this_present_table_id || that_present_table_id) { if (!(this_present_table_id && that_present_table_id)) boolean this_present_table_columns = true && this.isSetTable_columns(); boolean that_present_table_columns = true && that.isSetTable_columns(); if (this_present_table_columns || that_present_table_columns) { if (!(this_present_table_columns && that_present_table_columns)) boolean this_present_schema_evolution = true && this.isSetSchema_evolution(); boolean that_present_schema_evolution = true && that.isSetSchema_evolution(); if (this_present_schema_evolution || that_present_schema_evolution) { if (!(this_present_schema_evolution && that_present_schema_evolution)) boolean this_present_tableProperties = true && this.isSetTableProperties(); boolean that_present_tableProperties = true && that.isSetTableProperties(); if (this_present_tableProperties || that_present_tableProperties) { if (!(this_present_tableProperties && that_present_tableProperties)) boolean this_present_bucketingInfo = true && this.isSetBucketingInfo(); boolean that_present_bucketingInfo = true && that.isSetBucketingInfo(); if (this_present_bucketingInfo || that_present_bucketingInfo) { if (!(this_present_bucketingInfo && that_present_bucketingInfo)) boolean this_present_partitionInfo = true && this.isSetPartitionInfo(); boolean that_present_partitionInfo = true && that.isSetPartitionInfo(); if (this_present_partitionInfo || that_present_partitionInfo) { if (!(this_present_partitionInfo && that_present_partitionInfo))
struct.childTableSchema = new TableSchema(); struct.childTableSchema.read(iprot); struct.setChildTableSchemaIsSet(true);
/** * Performs a deep copy on <i>other</i>. */ public DataMapSchema(DataMapSchema other) { if (other.isSetDataMapName()) { this.dataMapName = other.dataMapName; } if (other.isSetClassName()) { this.className = other.className; } if (other.isSetProperties()) { Map<String,String> __this__properties = new HashMap<String,String>(other.properties); this.properties = __this__properties; } if (other.isSetChildTableIdentifier()) { this.childTableIdentifier = new RelationIdentifier(other.childTableIdentifier); } if (other.isSetChildTableSchema()) { this.childTableSchema = new TableSchema(other.childTableSchema); } }