public CastParseNode cast(ParseNode expression, String dataType, Integer maxLength, Integer scale, boolean arr) { return new CastParseNode(expression, dataType, maxLength, scale, arr); }
public CastParseNode cast(ParseNode expression, String dataType, Integer maxLength, Integer scale) { return new CastParseNode(expression, dataType, maxLength, scale, false); }
public CastParseNode cast(ParseNode expression, PDataType dataType, Integer maxLength, Integer scale) { return new CastParseNode(expression, dataType, maxLength, scale, false); }
public CastParseNode cast(ParseNode expression, PDataType dataType, Integer maxLength, Integer scale, boolean arr) { return new CastParseNode(expression, dataType, maxLength, scale, arr); }
@Test public void testToSQL() { ColumnParseNode columnParseNode = new ColumnParseNode(TableName.create("SCHEMA1", "TABLE1"), "V"); CastParseNode castParseNode = new CastParseNode(columnParseNode, PLong.INSTANCE, null, null, false); StringBuilder stringBuilder = new StringBuilder(); castParseNode.toSQL(null, stringBuilder); assertEquals(" CAST(TABLE1.V AS BIGINT)", stringBuilder.toString()); }
@Test public void testToSQL_ArrayType() { ColumnParseNode columnParseNode = new ColumnParseNode(TableName.create("SCHEMA1", "TABLE1"), "V"); CastParseNode castParseNode = new CastParseNode(columnParseNode, PLong.INSTANCE, null, null, true); StringBuilder stringBuilder = new StringBuilder(); castParseNode.toSQL(null, stringBuilder); assertEquals(" CAST(TABLE1.V AS BIGINT ARRAY)", stringBuilder.toString()); } }
@Test public void testToSQL_WithLengthAndScale() { ColumnParseNode columnParseNode = new ColumnParseNode(TableName.create("SCHEMA1", "TABLE1"), "V"); CastParseNode castParseNode = new CastParseNode(columnParseNode, PDecimal.INSTANCE, 5, 3, false); StringBuilder stringBuilder = new StringBuilder(); castParseNode.toSQL(null, stringBuilder); assertEquals(" CAST(TABLE1.V AS DECIMAL(5,3))", stringBuilder.toString()); }
public CastParseNode cast(ParseNode expression, String dataType, Integer maxLength, Integer scale) { return new CastParseNode(expression, dataType, maxLength, scale, false); }
public CastParseNode cast(ParseNode expression, PDataType dataType, Integer maxLength, Integer scale) { return new CastParseNode(expression, dataType, maxLength, scale, false); }
public CastParseNode cast(ParseNode expression, String dataType, Integer maxLength, Integer scale, boolean arr) { return new CastParseNode(expression, dataType, maxLength, scale, arr); }
public CastParseNode cast(ParseNode expression, PDataType dataType, Integer maxLength, Integer scale) { return new CastParseNode(expression, dataType, maxLength, scale, false); }
public CastParseNode cast(ParseNode expression, PDataType dataType, Integer maxLength, Integer scale, boolean arr) { return new CastParseNode(expression, dataType, maxLength, scale, arr); }
public CastParseNode cast(ParseNode expression, String dataType, Integer maxLength, Integer scale, boolean arr) { return new CastParseNode(expression, dataType, maxLength, scale, arr); }
public CastParseNode cast(ParseNode expression, String dataType, Integer maxLength, Integer scale) { return new CastParseNode(expression, dataType, maxLength, scale, false); }
public CastParseNode cast(ParseNode expression, PDataType dataType, Integer maxLength, Integer scale, boolean arr) { return new CastParseNode(expression, dataType, maxLength, scale, arr); }