Interface SupportsOverwrite

All Superinterfaces:
SupportsOverwriteV2, SupportsTruncate, WriteBuilder

@Evolving public interface SupportsOverwrite extends SupportsOverwriteV2
Write builder trait for tables that support overwrite by filter.

Overwriting data by filter will delete any data that matches the filter and replace it with data that is committed in the write.

Since:
3.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    canOverwrite(Predicate[] predicates)
    Checks whether it is possible to overwrite data from a data source table that matches filter expressions.
    default boolean
    canOverwrite(Filter[] filters)
    Checks whether it is possible to overwrite data from a data source table that matches filter expressions.
    default WriteBuilder
    overwrite(Predicate[] predicates)
    Configures a write to replace data matching the filters with data committed in the write.
    overwrite(Filter[] filters)
    Configures a write to replace data matching the filters with data committed in the write.
    default WriteBuilder
    Configures a write to replace all existing data with data committed in the write.

    Methods inherited from interface org.apache.spark.sql.connector.write.WriteBuilder

    build, buildForBatch, buildForStreaming
  • Method Details

    • canOverwrite

      default boolean canOverwrite(Filter[] filters)
      Checks whether it is possible to overwrite data from a data source table that matches filter expressions.

      Rows should be overwritten from the data source iff all of the filter expressions match. That is, the expressions must be interpreted as a set of filters that are ANDed together.

      Parameters:
      filters - V2 filter expressions, used to match data to overwrite
      Returns:
      true if the delete operation can be performed
      Since:
      3.4.0
    • overwrite

      WriteBuilder overwrite(Filter[] filters)
      Configures a write to replace data matching the filters with data committed in the write.

      Rows must be deleted from the data source if and only if all of the filters match. That is, filters must be interpreted as ANDed together.

      Parameters:
      filters - filters used to match data to overwrite
      Returns:
      this write builder for method chaining
    • canOverwrite

      default boolean canOverwrite(Predicate[] predicates)
      Description copied from interface: SupportsOverwriteV2
      Checks whether it is possible to overwrite data from a data source table that matches filter expressions.

      Rows should be overwritten from the data source iff all of the filter expressions match. That is, the expressions must be interpreted as a set of filters that are ANDed together.

      Specified by:
      canOverwrite in interface SupportsOverwriteV2
      Parameters:
      predicates - V2 filter expressions, used to match data to overwrite
      Returns:
      true if the delete operation can be performed
    • overwrite

      default WriteBuilder overwrite(Predicate[] predicates)
      Description copied from interface: SupportsOverwriteV2
      Configures a write to replace data matching the filters with data committed in the write.

      Rows must be deleted from the data source if and only if all of the filters match. That is, filters must be interpreted as ANDed together.

      Specified by:
      overwrite in interface SupportsOverwriteV2
      Parameters:
      predicates - filters used to match data to overwrite
      Returns:
      this write builder for method chaining
    • truncate

      default WriteBuilder truncate()
      Description copied from interface: SupportsTruncate
      Configures a write to replace all existing data with data committed in the write.
      Specified by:
      truncate in interface SupportsOverwriteV2
      Specified by:
      truncate in interface SupportsTruncate
      Returns:
      this write builder for method chaining