java.lang.Object
org.apache.cassandra.cql3.functions.masking.ColumnMask

public class ColumnMask extends Object
Dynamic data mask that can be applied to a schema column.

It consists on a partial application of a certain MaskingFunction to the values of a column, with the precondition that the type of any masked column is compatible with the type of the first argument of the function.

This partial application is meant to be associated to specific columns in the schema, acting as a mask for the values of those columns. It's associated to queries such as:

    CREATE TABLE t (k int PRIMARY KEY, v int MASKED WITH mask_inner(1, 1));
    ALTER TABLE t ALTER v MASKED WITH mask_inner(2, 1);
    ALTER TABLE t ALTER v DROP MASKED;
 
Note that in the example above we are referencing the mask_inner function with two arguments. However, that CQL function actually has three arguments. The first argument is always ommitted when attaching the function to a schema column. The value of that first argument is always the value of the masked column, in this case an int.
  • Field Details

    • DISABLED_ERROR_MESSAGE

      public static final String DISABLED_ERROR_MESSAGE
      See Also:
    • function

      public final ScalarFunction function
      The CQL function used for masking.
    • partialArgumentValues

      protected final ByteBuffer[] partialArgumentValues
      The values of the arguments of the partially applied masking function.
  • Constructor Details

  • Method Details

    • partialArgumentTypes

      public List<AbstractType<?>> partialArgumentTypes()
      Returns:
      The types of the arguments of the partially applied masking function, as an unmodifiable list.
    • partialArgumentValues

      public List<ByteBuffer> partialArgumentValues()
      Returns:
      The values of the arguments of the partially applied masking function, as an unmodifiable list that can contain nulls.
    • withReversedType

      public ColumnMask withReversedType()
      Returns:
      A copy of this mask for a version of its masked column that has its type reversed.
    • masker

      public ColumnMask.Masker masker(ProtocolVersion version)
      Parameters:
      version - the used version of the transport protocol
      Returns:
      a masker instance that caches the terminal masking function arguments
    • ensureEnabled

      public static void ensureEnabled()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • appendCqlTo

      public void appendCqlTo(CqlBuilder builder)