Class TableSchema.ColumnType
java.lang.Object
org.apache.beam.sdk.io.clickhouse.TableSchema.ColumnType
- All Implemented Interfaces:
Serializable
- Enclosing class:
TableSchema
A descriptor for a column type.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TableSchema.ColumnTypestatic final TableSchema.ColumnTypestatic final TableSchema.ColumnTypestatic final intDefaultDateTime64precision in ClickHouse.static final intDefaultDecimalprecision in ClickHouse when none is specified.static final intDefaultDecimalscale in ClickHouse when none is specified.static final TableSchema.ColumnTypestatic final TableSchema.ColumnTypestatic final TableSchema.ColumnTypestatic final TableSchema.ColumnTypestatic final TableSchema.ColumnTypestatic final TableSchema.ColumnTypestatic final TableSchema.ColumnTypestatic final TableSchema.ColumnTypestatic final TableSchema.ColumnTypestatic final TableSchema.ColumnTypestatic final TableSchema.ColumnTypestatic final TableSchema.ColumnType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TableSchema.ColumnTypearray(TableSchema.ColumnType arrayElementType) abstract @Nullable TableSchema.ColumnTypestatic org.apache.beam.sdk.io.clickhouse.TableSchema.ColumnType.Builderbuilder()static TableSchema.ColumnTypeReturns aDateTime64type with ClickHouse's default precision of 3.static TableSchema.ColumnTypedateTime64(int precision) static TableSchema.ColumnTypedecimal(int precision, int scale) Returns aDecimal(precision, scale)type.static TableSchema.ColumnTypestatic TableSchema.ColumnTypestatic TableSchema.ColumnTypefixedString(int size) abstract booleannullable()static TableSchema.ColumnTypenullable(TableSchema.TypeName typeName) static TableSchema.ColumnTypeof(TableSchema.TypeName typeName) static TableSchema.ColumnTypeParse string with ClickHouse type toTableSchema.ColumnType.static ObjectparseDefaultExpression(TableSchema.ColumnType columnType, String value) Get default value of a column based on expression.Sub-second precision (0–9) ofDateTime64, or total number of decimal digits (1–76) ofDecimal.scale()Number of fractional decimal digits (0–precision) ofDecimal.static TableSchema.ColumnTypetuple(Map<String, TableSchema.ColumnType> elements) abstract @Nullable Map<String, TableSchema.ColumnType> abstract TableSchema.TypeNametypeName()withNullable(boolean nullable)
-
Field Details
-
DATE
-
DATETIME
-
FLOAT32
-
FLOAT64
-
INT8
-
INT16
-
INT32
-
INT64
-
STRING
-
UINT8
-
UINT16
-
UINT32
-
UINT64
-
BOOL
-
TUPLE
-
DEFAULT_DATETIME64_PRECISION
public static final int DEFAULT_DATETIME64_PRECISIONDefaultDateTime64precision in ClickHouse.- See Also:
-
DEFAULT_DECIMAL_PRECISION
public static final int DEFAULT_DECIMAL_PRECISIONDefaultDecimalprecision in ClickHouse when none is specified.- See Also:
-
DEFAULT_DECIMAL_SCALE
public static final int DEFAULT_DECIMAL_SCALEDefaultDecimalscale in ClickHouse when none is specified.- See Also:
-
-
Constructor Details
-
ColumnType
public ColumnType()
-
-
Method Details
-
nullable
public abstract boolean nullable() -
typeName
-
enumValues
-
fixedStringSize
-
arrayElementType
-
tupleTypes
-
precision
Sub-second precision (0–9) ofDateTime64, or total number of decimal digits (1–76) ofDecimal.nullfor other types. -
scale
Number of fractional decimal digits (0–precision) ofDecimal.nullfor other types. -
withNullable
-
of
-
nullable
-
fixedString
-
dateTime64
Returns aDateTime64type with ClickHouse's default precision of 3. -
dateTime64
-
decimal
Returns aDecimal(precision, scale)type.ClickHouse stores
Decimalvalues as integers of a width chosen from the declared precision: 32 bits for precision 1–9, 64 for 10–18, 128 for 19–38 and 256 for 39–76. The width aliasesDecimal32(S),Decimal64(S),Decimal128(S)andDecimal256(S)correspond to precisions 9, 18, 38 and 76.- Parameters:
precision- total number of decimal digits, in[1, 76]scale- number of fractional decimal digits, in[0, precision]
-
enum8
-
enum16
-
array
-
tuple
-
parse
Parse string with ClickHouse type toTableSchema.ColumnType.- Parameters:
str- string representation of ClickHouse type- Returns:
- type of ClickHouse column
- Throws:
IllegalArgumentException- ifstris not a valid ClickHouse column type
-
parseDefaultExpression
Get default value of a column based on expression.E.g., "CREATE TABLE hits(id Int32, count Int32 DEFAULT <str>)"
- Parameters:
columnType- type of ClickHouse expressionvalue- ClickHouse expression- Returns:
- value of ClickHouse expression
-
builder
public static org.apache.beam.sdk.io.clickhouse.TableSchema.ColumnType.Builder builder()
-