@Override public Object clone() throws CloneNotSupportedException { ColumnDefinition column = (ColumnDefinition) super.clone(); column.columnName = columnName; return column; } }
@Override boolean equalsTo(Expr expr) { CastExpr another = (CastExpr) expr; return target.equals(another.target); } }
@Override public boolean equalsTo(Expr expr) { if (expr instanceof ColumnDefinition) { ColumnDefinition another = (ColumnDefinition) expr; return columnName.equals(another.columnName) && super.equalsTo(another); } return false; }
public static Type convertDataType(DataTypeExpr dataType) { TajoDataTypes.Type type = TajoDataTypes.Type.valueOf(dataType.getTypeName()); if (dataType.hasLengthOrPrecision()) { return Char(dataType.getLengthOrPrecision()); } else { if (dataType.hasLengthOrPrecision()) { return Char(dataType.getLengthOrPrecision()); } else { return Array(convertDataType(dataType.getElementType())); } else if (type == TajoDataTypes.Type.RECORD) { return Record(convertTableElementsSchema(dataType.getNestedRecordTypes())); } else if (type == TajoDataTypes.Type.MAP) { return Map(convertDataType(dataType.getKeyType()), convertDataType(dataType.getValueType())); } else if (type == TajoDataTypes.Type.NUMERIC) { if (dataType.hasLengthOrPrecision() && dataType.hasScale()) { return Numeric(dataType.getLengthOrPrecision(), dataType.getScale()); } else if (dataType.hasLengthOrPrecision()) { return Numeric(dataType.getLengthOrPrecision()); } else { return Numeric;
public ColumnDefinition(String columnName, DataTypeExpr dataType) { super(dataType.getTypeName()); this.columnName = columnName; // precision and scale if (dataType.hasLengthOrPrecision()) { setLengthOrPrecision(dataType.lengthOrPrecision); if (dataType.hasScale()) { setScale(dataType.scale); } } // nested records if (dataType.isRecordType()) { this.recordType = dataType.recordType; } // map type if (dataType.isMapType()) { this.mapType = dataType.mapType; } }
public static TypeDesc convertDataType(DataTypeExpr dataType) { TajoDataTypes.Type type = TajoDataTypes.Type.valueOf(dataType.getTypeName()); TajoDataTypes.DataType.Builder builder = TajoDataTypes.DataType.newBuilder(); builder.setType(type); if (dataType.hasLengthOrPrecision()) { builder.setLength(dataType.getLengthOrPrecision()); } else { if (type == TajoDataTypes.Type.CHAR) { builder.setLength(1); } } TypeDesc typeDesc; if (type == TajoDataTypes.Type.RECORD) { Schema nestedRecordSchema = convertTableElementsSchema(dataType.getNestedRecordTypes()); typeDesc = new TypeDesc(nestedRecordSchema); } else { typeDesc = new TypeDesc(builder.build()); } return typeDesc; }
typeDefinition = new DataTypeExpr(Type.CHAR.name()); typeDefinition.setLengthOrPrecision( Integer.parseInt(character_string_type.type_length().NUMBER().getText())); typeDefinition = new DataTypeExpr(Type.VARCHAR.name()); typeDefinition.setLengthOrPrecision( Integer.parseInt(character_string_type.type_length().NUMBER().getText())); typeDefinition = new DataTypeExpr(Type.TEXT.name()); typeDefinition = new DataTypeExpr(Type.NCHAR.name()); typeDefinition = new DataTypeExpr(Type.NVARCHAR.name()); typeDefinition.setLengthOrPrecision(Integer.parseInt(nchar_type.type_length().NUMBER().getText())); typeDefinition = new DataTypeExpr(Type.BLOB.name()); typeDefinition.setLengthOrPrecision(Integer.parseInt(blob_type.type_length().NUMBER().getText())); typeDefinition = new DataTypeExpr(Type.INT1.name()); typeDefinition = new DataTypeExpr(Type.INT2.name()); typeDefinition = new DataTypeExpr(Type.INT4.name()); typeDefinition = new DataTypeExpr(Type.INT8.name());
public ColumnDefinition(String columnName, DataTypeExpr dataType) { super(dataType.getTypeName()); this.columnName = columnName; // precision and scale if (dataType.hasLengthOrPrecision()) { setLengthOrPrecision(dataType.lengthOrPrecision); if (dataType.hasScale()) { setScale(dataType.scale); } } if (dataType.isRecordType()) { this.recordType = dataType.recordType; } if (dataType.isMapType()) { this.mapType = dataType.mapType; } if (dataType.isArrayType()) { this.arrayType = dataType.arrayType; } }
typeDefinition = new DataTypeExpr(Type.CHAR.name()); typeDefinition.setLengthOrPrecision( Integer.parseInt(character_string_type.type_length().NUMBER().getText())); typeDefinition = new DataTypeExpr(Type.VARCHAR.name()); typeDefinition.setLengthOrPrecision( Integer.parseInt(character_string_type.type_length().NUMBER().getText())); typeDefinition = new DataTypeExpr(Type.TEXT.name()); typeDefinition = new DataTypeExpr(Type.NCHAR.name()); typeDefinition = new DataTypeExpr(Type.NVARCHAR.name()); typeDefinition.setLengthOrPrecision(Integer.parseInt(nchar_type.type_length().NUMBER().getText())); typeDefinition = new DataTypeExpr(Type.BLOB.name()); typeDefinition.setLengthOrPrecision(Integer.parseInt(blob_type.type_length().NUMBER().getText())); typeDefinition = new DataTypeExpr(Type.INT1.name()); typeDefinition = new DataTypeExpr(Type.INT2.name()); typeDefinition = new DataTypeExpr(Type.INT4.name()); typeDefinition = new DataTypeExpr(Type.INT8.name());
@Override public Object clone() throws CloneNotSupportedException { ColumnDefinition column = (ColumnDefinition) super.clone(); column.columnName = columnName; return column; } }
@Override public boolean equalsTo(Expr expr) { if (expr instanceof ColumnDefinition) { ColumnDefinition another = (ColumnDefinition) expr; return columnName.equals(another.columnName) && super.equalsTo(another); } return false; }
@Override boolean equalsTo(Expr expr) { CastExpr another = (CastExpr) expr; return target.equals(another.target); } }