Java Code Examples for org.apache.flink.table.utils.TypeStringUtils#writeTypeInfo()

The following examples show how to use org.apache.flink.table.utils.TypeStringUtils#writeTypeInfo() . These examples are extracted from open source projects. 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 Project: Alink   File: FeatureBorder.java    License: Apache License 2.0 5 votes vote down vote up
public static String getTypeString(TypeInformation<?> type) {
    String typeStr = TypeStringUtils.writeTypeInfo(type);
    if ("VARCHAR".equals(typeStr)) {
        typeStr = "STRING";
    }
    return typeStr;
}
 
Example 2
Source Project: Alink   File: FlinkTypeConverter.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Convert TypeInformation array to string format array.
 *
 * @param types TypeInformation array
 * @return string representation of the types.
 */
public static String[] getTypeString(TypeInformation<?>[] types) {
    String[] sqlTypes = new String[types.length];
    for (int i = 0; i < types.length; i++) {
        sqlTypes[i] = TypeStringUtils.writeTypeInfo(types[i]);
    }
    return sqlTypes;
}
 
Example 3
Source Project: flink   File: LiteralValue.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Type information of the literal value. E.g. Types.BOOLEAN.
 *
 * @param typeInfo type information describing the value
 */
public LiteralValue of(TypeInformation<?> typeInfo) {
	Preconditions.checkNotNull(typeInfo, "Type information must not be null.");
	this.typeInfo = TypeStringUtils.writeTypeInfo(typeInfo);
	return this;
}
 
Example 4
Source Project: flink   File: LiteralValue.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Type information of the literal value. E.g. Types.BOOLEAN.
 *
 * @param typeInfo type information describing the value
 */
public LiteralValue of(TypeInformation<?> typeInfo) {
	Preconditions.checkNotNull(typeInfo, "Type information must not be null.");
	this.typeInfo = TypeStringUtils.writeTypeInfo(typeInfo);
	return this;
}
 
Example 5
Source Project: Flink-CEPplus   File: Json.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Sets the schema using type information.
 *
 * <p>JSON objects are represented as ROW types.
 *
 * <p>The schema might be nested.
 *
 * @param schemaType type information that describes the schema
 */
public Json schema(TypeInformation<Row> schemaType) {
	Preconditions.checkNotNull(schemaType);
	this.schema = TypeStringUtils.writeTypeInfo(schemaType);
	this.jsonSchema = null;
	this.deriveSchema = null;
	return this;
}
 
Example 6
Source Project: flink   File: Json.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Sets the schema using type information.
 *
 * <p>JSON objects are represented as ROW types.
 *
 * <p>The schema might be nested.
 *
 * @param schemaType type information that describes the schema
 */
public Json schema(TypeInformation<Row> schemaType) {
	Preconditions.checkNotNull(schemaType);
	this.schema = TypeStringUtils.writeTypeInfo(schemaType);
	this.jsonSchema = null;
	this.deriveSchema = null;
	return this;
}
 
Example 7
Source Project: flink   File: Json.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Sets the schema using type information.
 *
 * <p>JSON objects are represented as ROW types.
 *
 * <p>The schema might be nested.
 *
 * @param schemaType type information that describes the schema
 * @deprecated {@link Json} supports derive schema from table schema by default,
 *             it is no longer necessary to explicitly declare the format schema.
 *             This method will be removed in the future.
 */
@Deprecated
public Json schema(TypeInformation<Row> schemaType) {
	Preconditions.checkNotNull(schemaType);
	this.schema = TypeStringUtils.writeTypeInfo(schemaType);
	this.jsonSchema = null;
	this.deriveSchema = null;
	return this;
}
 
Example 8
Source Project: Alink   File: FlinkTypeConverter.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Convert TypeInformation to string representation.
 *
 * @param type TypeInformation
 * @return string representation of the type.
 */
public static String getTypeString(TypeInformation<?> type) {
    return TypeStringUtils.writeTypeInfo(type);
}