sourceType, targetType)) { sourceTypeString = sourceType.getFullTypeString(); targetTypeString = targetType.getFullTypeString(); } else { sourceTypeString = sourceType.toString();
protected void generateTypeString(StringBuilder sb, boolean withDetail) { if (withDetail) { sb.append(elementType.getFullTypeString()); } else { sb.append(elementType.toString()); } sb.append(" MULTISET"); }
protected void generateTypeString(StringBuilder sb, boolean withDetail) { if (withDetail) { sb.append(elementType.getFullTypeString()); } else { sb.append(elementType.toString()); } sb.append(" MULTISET"); }
protected void generateTypeString(StringBuilder sb, boolean withDetail) { if (withDetail) { sb.append(elementType.getFullTypeString()); } else { sb.append(elementType.toString()); } sb.append(" ARRAY"); }
protected void generateTypeString(StringBuilder sb, boolean withDetail) { if (withDetail) { sb.append(elementType.getFullTypeString()); } else { sb.append(elementType.toString()); } sb.append(" ARRAY"); }
protected void generateTypeString(StringBuilder sb, boolean withDetail) { sb.append("(") .append( withDetail ? keyType.getFullTypeString() : keyType.toString()) .append(", ") .append( withDetail ? valueType.getFullTypeString() : valueType.toString()) .append(") MAP"); }
protected void generateTypeString(StringBuilder sb, boolean withDetail) { sb.append("(") .append( withDetail ? keyType.getFullTypeString() : keyType.toString()) .append(", ") .append( withDetail ? valueType.getFullTypeString() : valueType.toString()) .append(") MAP"); }
public String getFullTypeString() { return delegate.getFullTypeString(); }
public String getFullTypeString() { return delegate.getFullTypeString(); }
protected void generateTypeString(StringBuilder sb, boolean withDetail) { sb.append("CrossType("); for (Ord<RelDataType> type : Ord.zip(types)) { if (type.i > 0) { sb.append(", "); } if (withDetail) { sb.append(type.e.getFullTypeString()); } else { sb.append(type.e.toString()); } } sb.append(")"); } }
protected void generateTypeString(StringBuilder sb, boolean withDetail) { sb.append("CrossType("); for (Ord<RelDataType> type : Ord.zip(types)) { if (type.i > 0) { sb.append(", "); } if (withDetail) { sb.append(type.e.getFullTypeString()); } else { sb.append(type.e.toString()); } } sb.append(")"); } }
/** * Creates a key for {@link RexNode} which is the same as another key of * another RexNode only if the two have both the same type and textual * representation. For example, "10" integer and "10" bigint result in * different keys. */ public static Pair<RexNode, String> makeKey(RexNode expr) { return Pair.of(expr, expr.getType().getFullTypeString()); }
/** * Creates a key for {@link RexNode} which is the same as another key of * another RexNode only if the two have both the same type and textual * representation. For example, "10" integer and "10" bigint result in * different keys. */ public static Pair<String, String> makeKey(RexNode expr) { return Pair.of(expr.toString(), expr.getType().getFullTypeString()); }
private UserException getConvertFunctionInvalidTypeException(final RexCall function) { // Caused by user entering a value with a numeric type final String functionName = function.getOperator().getName(); final String typeName = function.getOperands().get(1).getType().getFullTypeString(); return UserException.parseError() .message("Invalid type %s passed as second argument to function '%s'. " + "The function expects a literal argument.", typeName, functionName) .build(logger); }
private UserException getConvertFunctionInvalidTypeException(final RexCall function) { // Caused by user entering a value with a numeric type final String functionName = function.getOperator().getName(); final String typeName = function.getOperands().get(1).getType().getFullTypeString(); return UserException.parseError() .message("Invalid type %s passed as second argument to function '%s'. " + "The function expects a literal argument.", typeName, functionName) .build(logger); }
@Test public void testValues() { // Equivalent SQL: // VALUES (true, 1), (false, -50) AS t(a, b) final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.values(new String[]{"a", "b"}, true, 1, false, -50) .build(); final String expected = "LogicalValues(tuples=[[{ true, 1 }, { false, -50 }]])\n"; assertThat(root, hasTree(expected)); final String expectedType = "RecordType(BOOLEAN NOT NULL a, INTEGER NOT NULL b) NOT NULL"; assertThat(root.getRowType().getFullTypeString(), is(expectedType)); }
@Test public void testValues() { // Equivalent SQL: // VALUES (true, 1), (false, -50) AS t(a, b) final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.values(new String[]{"a", "b"}, true, 1, false, -50) .build(); final String expected = "LogicalValues(tuples=[[{ true, 1 }, { false, -50 }]])\n"; assertThat(root, hasTree(expected)); final String expectedType = "RecordType(BOOLEAN NOT NULL a, INTEGER NOT NULL b) NOT NULL"; assertThat(root.getRowType().getFullTypeString(), is(expectedType)); }
/** Tests creating Values with some field names and some values null. */ @Test public void testValuesNullable() { // Equivalent SQL: // VALUES (null, 1, 'abc'), (false, null, 'longer string') final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.values(new String[]{"a", null, "c"}, null, 1, "abc", false, null, "longer string").build(); final String expected = "LogicalValues(tuples=[[{ null, 1, 'abc' }, { false, null, 'longer string' }]])\n"; assertThat(root, hasTree(expected)); final String expectedType = "RecordType(BOOLEAN a, INTEGER expr$1, CHAR(13) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\" NOT NULL c) NOT NULL"; assertThat(root.getRowType().getFullTypeString(), is(expectedType)); }
/** Tests creating Values with some field names and some values null. */ @Test public void testValuesNullable() { // Equivalent SQL: // VALUES (null, 1, 'abc'), (false, null, 'longer string') final RelBuilder builder = RelBuilder.create(config().build()); RelNode root = builder.values(new String[]{"a", null, "c"}, null, 1, "abc", false, null, "longer string").build(); final String expected = "LogicalValues(tuples=[[{ null, 1, 'abc' }, { false, null, 'longer string' }]])\n"; assertThat(root, hasTree(expected)); final String expectedType = "RecordType(BOOLEAN a, INTEGER expr$1, CHAR(13) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\" NOT NULL c) NOT NULL"; assertThat(root.getRowType().getFullTypeString(), is(expectedType)); }
@Test public void testValuesAllNull() { final RelBuilder builder = RelBuilder.create(config().build()); RelDataType rowType = builder.getTypeFactory().builder() .add("a", SqlTypeName.BIGINT) .add("a", SqlTypeName.VARCHAR, 10) .build(); RelNode root = builder.values(rowType, null, null, 1, null).build(); final String expected = "LogicalValues(tuples=[[{ null, null }, { 1, null }]])\n"; assertThat(root, hasTree(expected)); final String expectedType = "RecordType(BIGINT NOT NULL a, VARCHAR(10) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\" NOT NULL a) NOT NULL"; assertThat(root.getRowType().getFullTypeString(), is(expectedType)); }