Class Indexes

java.lang.Object
org.apache.gravitino.rel.indexes.Indexes

public class Indexes extends Object
Helper methods to create index to pass into Apache Gravitino.
  • Field Details

    • EMPTY_INDEXES

      public static final Index[] EMPTY_INDEXES
      An empty array of indexes.
    • DEFAULT_PRIMARY_KEY_NAME

      public static final String DEFAULT_PRIMARY_KEY_NAME
      Name of the default primary key. MySQL, ClickHouse, OceanBase and many other databases supports setting the name of the primary key and use it as primary key name.
      See Also:
  • Method Details

    • unique

      public static Index unique(String name, String[][] fieldNames)
      Create a unique index on columns. Like unique (a) or unique (a, b), for complex like unique
      Parameters:
      name - The name of the index
      fieldNames - The field names under the table contained in the index.
      Returns:
      The unique index
    • createMysqlPrimaryKey

      public static Index createMysqlPrimaryKey(String[][] fieldNames)
      To create a MySQL primary key, you need to use the default primary key name.
      Parameters:
      fieldNames - The field names under the table contained in the index.
      Returns:
      The primary key index
    • primary

      public static Index primary(String name, String[][] fieldNames)
      Create a primary index on columns. Like primary (a), for complex like primary
      Parameters:
      name - The name of the index
      fieldNames - The field names under the table contained in the index.
      Returns:
      The primary index
    • of

      public static Index of(Index.IndexType indexType, String name, String[][] fieldNames)
      Parameters:
      indexType - The type of the index
      name - The name of the index
      fieldNames - The field names under the table contained in the index.
      Returns:
      The index