Class IndexLookup


  • public class IndexLookup
    extends Object
    Class to assist the Trino connector, and maybe external applications, leverage the secondary * index built by the Indexer. Leverages ColumnCardinalityCache to assist in * retrieving row IDs. Currently pretty bound to the Trino connector APIs.
    • Constructor Detail

      • IndexLookup

        @Inject
        public IndexLookup​(org.apache.accumulo.core.client.Connector connector,
                           ColumnCardinalityCache cardinalityCache)
    • Method Detail

      • shutdown

        @PreDestroy
        public void shutdown()
      • applyIndex

        public boolean applyIndex​(String schema,
                                  String table,
                                  ConnectorSession session,
                                  Collection<AccumuloColumnConstraint> constraints,
                                  Collection<org.apache.accumulo.core.data.Range> rowIdRanges,
                                  List<TabletSplitMetadata> tabletSplits,
                                  AccumuloRowSerializer serializer,
                                  org.apache.accumulo.core.security.Authorizations auths)
                           throws Exception
        Scans the index table, applying the index based on the given column constraints to return a set of tablet splits.

        If this function returns true, the output parameter tabletSplits contains a list of TabletSplitMetadata objects. These in turn contain a collection of Ranges containing the exact row IDs determined using the index.

        If this function returns false, the secondary index should not be used. In this case, either the accumulo session has disabled secondary indexing, or the number of row IDs that would be used by the secondary index is greater than the configured threshold (again retrieved from the session).

        Parameters:
        schema - Schema name
        table - Table name
        session - Current client session
        constraints - All column constraints (this method will filter for if the column is indexed)
        rowIdRanges - Collection of Accumulo ranges based on any predicate against a record key
        tabletSplits - Output parameter containing the bundles of row IDs determined by the use of the index.
        serializer - Instance of a row serializer
        auths - Scan-time authorizations
        Returns:
        True if the tablet splits are valid and should be used, false otherwise
        Throws:
        Exception - If something bad happens. What are the odds?