Java Code Examples for org.apache.calcite.sql.type.SqlTypeUtil#addCharsetAndCollation()

The following examples show how to use org.apache.calcite.sql.type.SqlTypeUtil#addCharsetAndCollation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OLAPTable.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
private RelDataType deriveRowType(RelDataTypeFactory typeFactory) {
    RelDataTypeFactory.FieldInfoBuilder fieldInfo = typeFactory.builder();
    for (ColumnDesc column : sourceColumns) {
        RelDataType sqlType = createSqlType(typeFactory, column.getUpgradedType(), column.isNullable());
        sqlType = SqlTypeUtil.addCharsetAndCollation(sqlType, typeFactory);
        fieldInfo.add(column.getName(), sqlType);
    }
    return typeFactory.createStructType(fieldInfo);
}
 
Example 2
Source File: JSqlTable.java    From kafka-eagle with Apache License 2.0 5 votes vote down vote up
public RelDataType getRowType(RelDataTypeFactory typeFactory) {
	if (dataType == null) {
		RelDataTypeFactory.FieldInfoBuilder fieldInfo = typeFactory.builder();
		for (JSqlMapData.Column column : this.sourceTable.columns) {
			RelDataType sqlType = typeFactory.createJavaType(JSqlMapData.JAVATYPE_MAPPING.get(column.type));
			sqlType = SqlTypeUtil.addCharsetAndCollation(sqlType, typeFactory);
			fieldInfo.add(column.name, sqlType);
		}
		this.dataType = typeFactory.createStructType(fieldInfo);
	}
	return this.dataType;
}
 
Example 3
Source File: OLAPTable.java    From kylin with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
private RelDataType deriveRowType(RelDataTypeFactory typeFactory) {
    RelDataTypeFactory.FieldInfoBuilder fieldInfo = typeFactory.builder();
    for (ColumnDesc column : sourceColumns) {
        RelDataType sqlType = createSqlType(typeFactory, column.getUpgradedType(), column.isNullable());
        sqlType = SqlTypeUtil.addCharsetAndCollation(sqlType, typeFactory);
        fieldInfo.add(column.getName(), sqlType);
    }
    return typeFactory.createStructType(fieldInfo);
}
 
Example 4
Source File: RexBuilder.java    From Bats with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a reference to a given field of the input record.
 *
 * @param type Type of field
 * @param i    Ordinal of field
 * @return Reference to field
 */
public RexInputRef makeInputRef(
    RelDataType type,
    int i) {
  type = SqlTypeUtil.addCharsetAndCollation(type, typeFactory);
  return rexFactory.makeInputRef(i, type);
}
 
Example 5
Source File: RexBuilder.java    From calcite with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a reference to a given field of the input record.
 *
 * @param type Type of field
 * @param i    Ordinal of field
 * @return Reference to field
 */
public RexInputRef makeInputRef(
    RelDataType type,
    int i) {
  type = SqlTypeUtil.addCharsetAndCollation(type, typeFactory);
  return new RexInputRef(i, type);
}
 
Example 6
Source File: RexBuilder.java    From Bats with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a reference to a given field of the pattern.
 *
 * @param alpha the pattern name
 * @param type Type of field
 * @param i    Ordinal of field
 * @return Reference to field of pattern
 */
public RexPatternFieldRef makePatternFieldRef(String alpha, RelDataType type, int i) {
  type = SqlTypeUtil.addCharsetAndCollation(type, typeFactory);
  return new RexPatternFieldRef(alpha, i, type);
}
 
Example 7
Source File: RexBuilder.java    From calcite with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a reference to a given field of the pattern.
 *
 * @param alpha the pattern name
 * @param type Type of field
 * @param i    Ordinal of field
 * @return Reference to field of pattern
 */
public RexPatternFieldRef makePatternFieldRef(String alpha, RelDataType type, int i) {
  type = SqlTypeUtil.addCharsetAndCollation(type, typeFactory);
  return new RexPatternFieldRef(alpha, i, type);
}
 
Example 8
Source File: RexBuilder.java    From calcite with Apache License 2.0 2 votes vote down vote up
/**
 * Create a reference to local variable.
 *
 * @param type Type of variable
 * @param i    Ordinal of variable
 * @return  Reference to local variable
 */
public RexLocalRef makeLocalRef(RelDataType type, int i) {
  type = SqlTypeUtil.addCharsetAndCollation(type, typeFactory);
  return new RexLocalRef(i, type);
}