Java Code Examples for org.apache.flink.table.types.logical.VarBinaryType#getLength()

The following examples show how to use org.apache.flink.table.types.logical.VarBinaryType#getLength() . 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: HiveTypeUtil.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TypeInfo visit(VarBinaryType varBinaryType) {
	// Flink's BytesType is defined as VARBINARY(Integer.MAX_VALUE)
	// We don't have more information in LogicalTypeRoot to distinguish BytesType and a VARBINARY(Integer.MAX_VALUE) instance
	// Thus always treat VARBINARY(Integer.MAX_VALUE) as BytesType
	if (varBinaryType.getLength() == VarBinaryType.MAX_LENGTH) {
		return TypeInfoFactory.binaryTypeInfo;
	}
	return defaultMethod(varBinaryType);
}
 
Example 2
Source File: HiveTypeUtil.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TypeInfo visit(VarBinaryType varBinaryType) {
	// Flink's BytesType is defined as VARBINARY(Integer.MAX_VALUE)
	// We don't have more information in LogicalTypeRoot to distinguish BytesType and a VARBINARY(Integer.MAX_VALUE) instance
	// Thus always treat VARBINARY(Integer.MAX_VALUE) as BytesType
	if (varBinaryType.getLength() == VarBinaryType.MAX_LENGTH) {
		return TypeInfoFactory.binaryTypeInfo;
	}
	return defaultMethod(varBinaryType);
}
 
Example 3
Source File: LogicalTypeCasts.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Boolean visit(VarBinaryType targetType) {
	if (sourceType.isNullable() && !targetType.isNullable()) {
		return false;
	}
	// BINARY and VARBINARY are very compatible within bounds
	if ((hasRoot(sourceType, LogicalTypeRoot.BINARY) || hasRoot(sourceType, LogicalTypeRoot.VARBINARY)) &&
			getLength(sourceType) <= targetType.getLength()) {
		return true;
	}
	return defaultMethod(targetType);
}
 
Example 4
Source File: LogicalTypeChecks.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Integer visit(VarBinaryType varBinaryType) {
	return varBinaryType.getLength();
}
 
Example 5
Source File: LogicalTypeChecks.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Integer visit(VarBinaryType varBinaryType) {
	return varBinaryType.getLength();
}