Interface SchemaFeature
-
- All Known Implementing Classes:
SchemaFeatureSet
public interface SchemaFeatureDefines the properties of schema features. It requires to be implemented as enum
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <T extends org.apache.spark.sql.catalyst.InternalRow>
org.apache.cassandra.spark.sparksql.RowBuilder<T>decorate(org.apache.cassandra.spark.sparksql.RowBuilder<T> builder)Decorate the Spark row builder according to the featuredefault org.apache.spark.sql.types.StructFieldfield()The SparkStructFieldaccording to the featureorg.apache.spark.sql.types.DataTypefieldDataType()TheDataTypeof the fielddefault org.apache.spark.sql.types.MetadatafieldMetadata()The metadata used for the fielddefault java.lang.StringfieldName()The name of the fielddefault booleanfieldNullable()Define if the field is nullabledefault voidgenerateDataType(org.apache.cassandra.spark.data.CqlTable table, org.apache.spark.sql.types.StructType sparkSchema)Generate a dynamicDataTypebased onCqlTableand theStructTypeSpark schema.default java.lang.StringoptionName()The option name used in the Spark options
-
-
-
Method Detail
-
fieldDataType
org.apache.spark.sql.types.DataType fieldDataType()
TheDataTypeof the field- Returns:
- DataType
-
generateDataType
default void generateDataType(org.apache.cassandra.spark.data.CqlTable table, org.apache.spark.sql.types.StructType sparkSchema)Generate a dynamicDataTypebased onCqlTableand theStructTypeSpark schema. If a feature has a fixedDataType, the method does not need to be overridden.- Parameters:
table- the CQL table schemasparkSchema- the Spark schema
-
decorate
<T extends org.apache.spark.sql.catalyst.InternalRow> org.apache.cassandra.spark.sparksql.RowBuilder<T> decorate(org.apache.cassandra.spark.sparksql.RowBuilder<T> builder)
Decorate the Spark row builder according to the feature- Parameters:
builder- the row builder- Returns:
- a new decorated builder
-
optionName
default java.lang.String optionName()
The option name used in the Spark options- Returns:
- option name
-
field
default org.apache.spark.sql.types.StructField field()
The SparkStructFieldaccording to the feature- Returns:
- struct field
-
fieldName
default java.lang.String fieldName()
The name of the field- Returns:
- field name
-
fieldNullable
default boolean fieldNullable()
Define if the field is nullable- Returns:
- true, if the field is nullable
-
fieldMetadata
default org.apache.spark.sql.types.Metadata fieldMetadata()
The metadata used for the field- Returns:
- metadata
-
-