@Override public void readFields(DataInput input) throws IOException { this.numOfRanges = input.readInt(); int colSchemaSize = input.readInt(); this.listOfColumns = new ArrayList<>(colSchemaSize); for (int i = 0; i < colSchemaSize; i++) { ColumnSchema aSchema = new ColumnSchema(); aSchema.readFields(input); this.listOfColumns.add(aSchema); } } }
/** * Read column schema from binary * * @param schemaArray * @throws IOException */ public static List<ColumnSchema> readColumnSchema(byte[] schemaArray) throws IOException { // uncompress it. schemaArray = CompressorFactory.NativeSupportedCompressor.SNAPPY.getCompressor().unCompressByte( schemaArray); ByteArrayInputStream schemaStream = new ByteArrayInputStream(schemaArray); DataInput schemaInput = new DataInputStream(schemaStream); List<ColumnSchema> columnSchemas = new ArrayList<>(); int size = schemaInput.readShort(); for (int i = 0; i < size; i++) { ColumnSchema columnSchema = new ColumnSchema(); columnSchema.readFields(schemaInput); columnSchemas.add(columnSchema); } return columnSchemas; }
@Override public void readFields(DataInput in) throws IOException { this.tableId = in.readUTF(); this.tableName = in.readUTF(); int listSize = in.readInt(); this.listOfColumns = new ArrayList<>(listSize); for (int i = 0; i < listSize; i++) { ColumnSchema schema = new ColumnSchema(); schema.readFields(in); this.listOfColumns.add(schema); } int propertySize = in.readInt(); this.tableProperties = new HashMap<String, String>(propertySize); for (int i = 0; i < propertySize; i++) { String key = in.readUTF(); String value = in.readUTF(); this.tableProperties.put(key, value); } boolean partitionExists = in.readBoolean(); if (partitionExists) { this.partitionInfo = new PartitionInfo(); this.partitionInfo.readFields(in); } boolean bucketingExists = in.readBoolean(); if (bucketingExists) { this.bucketingInfo = new BucketingInfo(); this.bucketingInfo.readFields(in); } }
this.columnSchemaList = new ArrayList<>(colSchemaSize); for (int i = 0;i < colSchemaSize; i++) { ColumnSchema colSchema = new ColumnSchema(); colSchema.readFields(input); this.columnSchemaList.add(colSchema);
ColumnSchema id = new ColumnSchema(); id.setColumnName("id"); id.setDataType(DataTypes.INT); ColumnSchema date = new ColumnSchema(); date.setColumnName("date"); date.setDataType(DataTypes.STRING); ColumnSchema country = new ColumnSchema(); country.setColumnName("country"); country.setDataType(DataTypes.STRING); ColumnSchema name = new ColumnSchema(); name.setColumnName("name"); name.setDataType(DataTypes.STRING); ColumnSchema phonetype = new ColumnSchema(); phonetype.setColumnName("phonetype"); phonetype.setDataType(DataTypes.STRING); ColumnSchema serialname = new ColumnSchema(); serialname.setColumnName("serialname"); serialname.setDataType(DataTypes.STRING); ColumnSchema salary = new ColumnSchema(); salary.setColumnName("salary"); salary.setDataType(DataTypes.INT);
protected ColumnSchema thriftColumnSchemaToWrapperColumnSchema( org.apache.carbondata.format.ColumnSchema externalColumnSchema) { ColumnSchema wrapperColumnSchema = new ColumnSchema(); wrapperColumnSchema.setColumnUniqueId(externalColumnSchema.getColumn_id()); wrapperColumnSchema.setColumnName(externalColumnSchema.getColumn_name());
@Override public ColumnSchema fromExternalToWrapperColumnSchema( org.apache.carbondata.format.ColumnSchema externalColumnSchema) { ColumnSchema wrapperColumnSchema = new ColumnSchema(); wrapperColumnSchema.setColumnUniqueId(externalColumnSchema.getColumn_id()); wrapperColumnSchema.setColumnName(externalColumnSchema.getColumn_name());
public static ColumnSchema thriftColumnSchemaToWrapperColumnSchema( org.apache.carbondata.format.ColumnSchema externalColumnSchema) { ColumnSchema wrapperColumnSchema = new ColumnSchema(); wrapperColumnSchema.setColumnUniqueId(externalColumnSchema.getColumn_id()); wrapperColumnSchema.setColumnReferenceId(externalColumnSchema.getColumnReferenceId());
checkRepeatColumnName(field); ColumnSchema newColumn = new ColumnSchema(); if (parentName != null) { newColumn.setColumnName(parentName + "." + field.getFieldName());