Interface SchemaFeature

  • All Known Implementing Classes:
    SchemaFeatureSet

    public interface SchemaFeature
    Defines 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 feature
      default org.apache.spark.sql.types.StructField field()
      The Spark StructField according to the feature
      org.apache.spark.sql.types.DataType fieldDataType()
      The DataType of the field
      default org.apache.spark.sql.types.Metadata fieldMetadata()
      The metadata used for the field
      default java.lang.String fieldName()
      The name of the field
      default boolean fieldNullable()
      Define if the field is nullable
      default void generateDataType​(org.apache.cassandra.spark.data.CqlTable table, org.apache.spark.sql.types.StructType sparkSchema)
      Generate a dynamic DataType based on CqlTable and the StructType Spark schema.
      default java.lang.String optionName()
      The option name used in the Spark options
    • Method Detail

      • fieldDataType

        org.apache.spark.sql.types.DataType fieldDataType()
        The DataType of the field
        Returns:
        DataType
      • generateDataType

        default void generateDataType​(org.apache.cassandra.spark.data.CqlTable table,
                                      org.apache.spark.sql.types.StructType sparkSchema)
        Generate a dynamic DataType based on CqlTable and the StructType Spark schema. If a feature has a fixed DataType, the method does not need to be overridden.
        Parameters:
        table - the CQL table schema
        sparkSchema - 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 Spark StructField according 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