Package org.apache.calcite.rel.type
Class RelDataTypeFactory.Builder
java.lang.Object
org.apache.calcite.rel.type.RelDataTypeFactory.Builder
- Direct Known Subclasses:
RelDataTypeFactory.FieldInfoBuilder
- Enclosing interface:
- RelDataTypeFactory
Fluid API to build a list of fields.
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder
(RelDataTypeFactory typeFactory) Creates a Builder with the given type factory. -
Method Summary
Modifier and TypeMethodDescriptionadd
(String name, org.apache.calcite.avatica.util.TimeUnit startUnit, int startPrecision, org.apache.calcite.avatica.util.TimeUnit endUnit, int fractionalSecondPrecision) Adds a field with an interval type.add
(String name, RelDataType type) Adds a field with given name and type.add
(String name, SqlTypeName typeName) Adds a field with a type created usingRelDataTypeFactory.createSqlType(org.apache.calcite.sql.type.SqlTypeName)
.add
(String name, SqlTypeName typeName, int precision) Adds a field with a type created usingRelDataTypeFactory.createSqlType(org.apache.calcite.sql.type.SqlTypeName, int)
.add
(String name, SqlTypeName typeName, int precision, int scale) Adds a field with a type created usingRelDataTypeFactory.createSqlType(org.apache.calcite.sql.type.SqlTypeName, int, int)
.add
(RelDataTypeField field) Adds a field.addAll
(Iterable<? extends Map.Entry<String, RelDataType>> fields) Adds all fields in a collection.build()
Creates a struct type with the current contents of this builder.Creates a dynamic struct type with the current contents of this builder.int
Returns the number of fields.getFieldName
(int index) Returns the name of a given field.getFieldType
(int index) Returns the type of a given field.kind
(StructKind kind) boolean
nameExists
(String name) Returns whether a field exists with the given name.nullable
(boolean nullable) Changes the nullability of the last field added.nullableRecord
(boolean nullableRecord) Sets whether the record type will be nullable.uniquify()
Makes sure that field names are unique.
-
Constructor Details
-
Builder
Creates a Builder with the given type factory.
-
-
Method Details
-
getFieldCount
public int getFieldCount()Returns the number of fields.- Returns:
- number of fields
-
getFieldName
Returns the name of a given field.- Parameters:
index
- Ordinal of field- Returns:
- Name of given field
-
getFieldType
Returns the type of a given field.- Parameters:
index
- Ordinal of field- Returns:
- Type of given field
-
add
Adds a field with given name and type. -
add
Adds a field with a type created usingRelDataTypeFactory.createSqlType(org.apache.calcite.sql.type.SqlTypeName)
. -
add
Adds a field with a type created usingRelDataTypeFactory.createSqlType(org.apache.calcite.sql.type.SqlTypeName, int)
. -
add
Adds a field with a type created usingRelDataTypeFactory.createSqlType(org.apache.calcite.sql.type.SqlTypeName, int, int)
. -
add
public RelDataTypeFactory.Builder add(String name, org.apache.calcite.avatica.util.TimeUnit startUnit, int startPrecision, org.apache.calcite.avatica.util.TimeUnit endUnit, int fractionalSecondPrecision) Adds a field with an interval type. -
nullable
Changes the nullability of the last field added.- Throws:
IndexOutOfBoundsException
- if no fields have been added
-
add
Adds a field. Field's ordinal is ignored. -
addAll
Adds all fields in a collection. -
kind
-
nullableRecord
Sets whether the record type will be nullable. -
uniquify
Makes sure that field names are unique. -
build
Creates a struct type with the current contents of this builder. -
buildDynamic
Creates a dynamic struct type with the current contents of this builder. -
nameExists
Returns whether a field exists with the given name.
-