getViewNames(String schema)
- {
- requireNonNull(schema, "schema is null");
- return metaManager.getViewNames(schema);
- }
-
- public AccumuloView getView(SchemaTableName viewName)
- {
- requireNonNull(viewName, "viewName is null");
- return metaManager.getView(viewName);
- }
-
- /**
- * Fetches the TabletSplitMetadata for a query against an Accumulo table.
- *
- * Does a whole bunch of fun stuff! Splitting on row ID ranges, applying secondary indexes, column pruning,
- * all sorts of sweet optimizations. What you have here is an important method.
- *
- * @param session Current session
- * @param schema Schema name
- * @param table Table Name
- * @param rowIdDomain Domain for the row ID
- * @param constraints Column constraints for the query
- * @param serializer Instance of a row serializer
- * @return List of TabletSplitMetadata objects for Trino
- */
- public List getTabletSplits(
- ConnectorSession session,
- String schema,
- String table,
- Optional rowIdDomain,
- List constraints,
- AccumuloRowSerializer serializer)
- {
- try {
- String tableName = AccumuloTable.getFullTableName(schema, table);
- LOG.debug("Getting tablet splits for table %s", tableName);
-
- // Get the initial Range based on the row ID domain
- Collection rowIdRanges = getRangesFromDomain(rowIdDomain, serializer);
- List tabletSplits = new ArrayList<>();
-
- // Use the secondary index, if enabled
- if (AccumuloSessionProperties.isOptimizeIndexEnabled(session)) {
- // Get the scan authorizations to query the index
- Authorizations auths = getScanAuthorizations(session, schema, table);
-
- // Check the secondary index based on the column constraints
- // If this returns true, return the tablet splits to Trino
- if (indexLookup.applyIndex(schema, table, session, constraints, rowIdRanges, tabletSplits, serializer, auths)) {
- return tabletSplits;
- }
- }
-
- // If we can't (or shouldn't) use the secondary index, we will just use the Range from the row ID domain
-
- // Split the ranges on tablet boundaries, if enabled
- Collection splitRanges;
- if (AccumuloSessionProperties.isOptimizeSplitRangesEnabled(session)) {
- splitRanges = splitByTabletBoundaries(tableName, rowIdRanges);
- }
- else {
- // if not enabled, just use the same collection
- splitRanges = rowIdRanges;
- }
-
- // Create TabletSplitMetadata objects for each range
- boolean fetchTabletLocations = AccumuloSessionProperties.isOptimizeLocalityEnabled(session);
-
- LOG.debug("Fetching tablet locations: %s", fetchTabletLocations);
-
- for (Range range : splitRanges) {
- // If locality is enabled, then fetch tablet location
- if (fetchTabletLocations) {
- tabletSplits.add(new TabletSplitMetadata(getTabletLocation(tableName, range.getStartKey()), ImmutableList.of(range)));
- }
- else {
- // else, just use the default location
- tabletSplits.add(new TabletSplitMetadata(Optional.empty(), ImmutableList.of(range)));
- }
- }
-
- // Log some fun stuff and return the tablet splits
- LOG.debug("Number of splits for table %s is %d with %d ranges", tableName, tabletSplits.size(), splitRanges.size());
- return tabletSplits;
- }
- catch (Exception e) {
- throw new TrinoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to get splits from Accumulo", e);
- }
- }
-
- /**
- * Gets the scan authorizations to use for scanning tables.
- *
- * In order of priority: session username authorizations, then table property, then the default connector auths.
- *
- * @param session Current session
- * @param schema Schema name
- * @param table Table Name
- * @return Scan authorizations
- * @throws AccumuloException If a generic Accumulo error occurs
- * @throws AccumuloSecurityException If a security exception occurs
- */
- private Authorizations getScanAuthorizations(ConnectorSession session, String schema,
- String table)
- throws AccumuloException, AccumuloSecurityException
- {
- String sessionScanUser = AccumuloSessionProperties.getScanUsername(session);
- if (sessionScanUser != null) {
- Authorizations scanAuths = client.securityOperations().getUserAuthorizations(sessionScanUser);
- LOG.debug("Using session scan auths for user %s: %s", sessionScanUser, scanAuths);
- return scanAuths;
- }
-
- AccumuloTable accumuloTable = this.getTable(new SchemaTableName(schema, table));
- if (accumuloTable == null) {
- throw new TableNotFoundException(new SchemaTableName(schema, table));
- }
-
- Optional strAuths = accumuloTable.getScanAuthorizations();
- if (strAuths.isPresent()) {
- Authorizations scanAuths = new Authorizations(Iterables.toArray(COMMA_SPLITTER.split(strAuths.get()), String.class));
- LOG.debug("scan_auths table property set, using: %s", scanAuths);
- return scanAuths;
- }
-
- LOG.debug("scan_auths table property not set, using connector auths: %s", this.auths);
- return this.auths;
- }
-
- private Collection splitByTabletBoundaries(String tableName, Collection ranges)
- throws org.apache.accumulo.core.client.TableNotFoundException, AccumuloException, AccumuloSecurityException
- {
- ImmutableSet.Builder rangeBuilder = ImmutableSet.builder();
- for (Range range : ranges) {
- // if start and end key are equivalent, no need to split the range
- if (range.getStartKey() != null && range.getEndKey() != null && range.getStartKey().equals(range.getEndKey())) {
- rangeBuilder.add(range);
- }
- else {
- // Call out to Accumulo to split the range on tablets
- rangeBuilder.addAll(client.tableOperations().splitRangeByTablets(tableName, range, Integer.MAX_VALUE));
- }
- }
- return rangeBuilder.build();
- }
-
- /**
- * Gets the TabletServer hostname for where the given key is located in the given table
- *
- * @param table Fully-qualified table name
- * @param key Key to locate
- * @return The tablet location, or DUMMY_LOCATION if an error occurs
- */
- private Optional getTabletLocation(String table, Key key)
- {
- try {
- // Get the Accumulo table ID so we can scan some fun stuff
- String tableId = client.tableOperations().tableIdMap().get(table);
-
- // Create our scanner against the metadata table, fetching 'loc' family
- Scanner scanner = client.createScanner("accumulo.metadata", auths);
- scanner.fetchColumnFamily(new Text("loc"));
-
- // Set the scan range to just this table, from the table ID to the default tablet
- // row, which is the last listed tablet
- Key defaultTabletRow = new Key(tableId + '<');
- Key start = new Key(tableId);
- Key end = defaultTabletRow.followingKey(PartialKey.ROW);
- scanner.setRange(new Range(start, end));
-
- Optional location = Optional.empty();
- if (key == null) {
- // if the key is null, then it is -inf, so get first tablet location
- Iterator> iter = scanner.iterator();
- if (iter.hasNext()) {
- location = Optional.of(iter.next().getValue().toString());
- }
- }
- else {
- // Else, we will need to scan through the tablet location data and find the location
-
- // Create some text objects to do comparison for what we are looking for
- Text splitCompareKey = new Text();
- key.getRow(splitCompareKey);
- Text scannedCompareKey = new Text();
-
- // Scan the table!
- for (Entry entry : scanner) {
- // Get the bytes of the key
- byte[] keyBytes = entry.getKey().getRow().copyBytes();
-
- // If the last byte is <, then we have hit the default tablet, so use this location
- if (keyBytes[keyBytes.length - 1] == '<') {
- location = Optional.of(entry.getValue().toString());
- break;
- }
- // Chop off some magic nonsense
- scannedCompareKey.set(keyBytes, 3, keyBytes.length - 3);
-
- // Compare the keys, moving along the tablets until the location is found
- if (scannedCompareKey.getLength() > 0) {
- int compareTo = splitCompareKey.compareTo(scannedCompareKey);
- if (compareTo <= 0) {
- location = Optional.of(entry.getValue().toString());
- }
- else {
- // all future tablets will be greater than this key
- break;
- }
- }
- }
- scanner.close();
- }
-
- // If we were unable to find the location for some reason, return the default tablet
- // location
- return location.isPresent() ? location : getDefaultTabletLocation(table);
- }
- catch (Exception e) {
- // Swallow this exception so the query does not fail due to being unable
- // to locate the tablet server for the provided Key.
- // This is purely an optimization, but we will want to log the error.
- LOG.error(e, "Failed to get tablet location, returning dummy location");
- return Optional.empty();
- }
- }
-
- private Optional getDefaultTabletLocation(String fulltable)
- {
- try {
- String tableId = client.tableOperations().tableIdMap().get(fulltable);
-
- // Create a scanner over the metadata table, fetching the 'loc' column of the default tablet row
- Scanner scan = client.createScanner("accumulo.metadata", client.securityOperations().getUserAuthorizations(username));
- scan.fetchColumnFamily(new Text("loc"));
- scan.setRange(new Range(tableId + '<'));
-
- // scan the entry
- Optional location = Optional.empty();
- for (Entry entry : scan) {
- if (location.isPresent()) {
- throw new TrinoException(FUNCTION_IMPLEMENTATION_ERROR, "Scan for default tablet returned more than one entry");
- }
-
- location = Optional.of(entry.getValue().toString());
- }
-
- scan.close();
- return location;
- }
- catch (Exception e) {
- // Swallow this exception so the query does not fail due to being unable to locate the tablet server for the default tablet.
- // This is purely an optimization, but we will want to log the error.
- LOG.error(e, "Failed to get tablet location, returning dummy location");
- return Optional.empty();
- }
- }
-
- /**
- * Gets a collection of Accumulo Range objects from the given Trino domain.
- * This maps the column constraints of the given Domain to an Accumulo Range scan.
- *
- * @param domain Domain, can be null (returns (-inf, +inf) Range)
- * @param serializer Instance of an {@link AccumuloRowSerializer}
- * @return A collection of Accumulo Range objects
- * @throws TableNotFoundException If the Accumulo table is not found
- */
- public static Collection getRangesFromDomain(Optional domain, AccumuloRowSerializer serializer)
- throws TableNotFoundException
- {
- // if we have no predicate pushdown, use the full range
- if (domain.isEmpty()) {
- return ImmutableSet.of(new Range());
- }
-
- ImmutableSet.Builder rangeBuilder = ImmutableSet.builder();
- for (io.trino.spi.predicate.Range range : domain.get().getValues().getRanges().getOrderedRanges()) {
- rangeBuilder.add(getRangeFromTrinoRange(range, serializer));
- }
-
- return rangeBuilder.build();
- }
-
- private static Range getRangeFromTrinoRange(io.trino.spi.predicate.Range trinoRange, AccumuloRowSerializer serializer)
- throws TableNotFoundException
- {
- Range accumuloRange;
- if (trinoRange.isAll()) {
- accumuloRange = new Range();
- }
- else if (trinoRange.isSingleValue()) {
- Text split = new Text(serializer.encode(trinoRange.getType(), trinoRange.getSingleValue()));
- accumuloRange = new Range(split);
- }
- else {
- if (trinoRange.isLowUnbounded()) {
- // If low is unbounded, then create a range from (-inf, value), checking inclusivity
- Text split = new Text(serializer.encode(trinoRange.getType(), trinoRange.getHighBoundedValue()));
- accumuloRange = new Range(null, false, split, trinoRange.isLowInclusive());
- }
- else if (trinoRange.isHighUnbounded()) {
- // If high is unbounded, then create a range from (value, +inf), checking inclusivity
- Text split = new Text(serializer.encode(trinoRange.getType(), trinoRange.getLowBoundedValue()));
- accumuloRange = new Range(split, trinoRange.isHighInclusive(), null, false);
- }
- else {
- // If high is unbounded, then create a range from low to high, checking inclusivity
- boolean startKeyInclusive = trinoRange.isLowInclusive();
- Text startSplit = new Text(serializer.encode(trinoRange.getType(), trinoRange.getLowBoundedValue()));
-
- boolean endKeyInclusive = trinoRange.isHighInclusive();
- Text endSplit = new Text(serializer.encode(trinoRange.getType(), trinoRange.getHighBoundedValue()));
- accumuloRange = new Range(startSplit, startKeyInclusive, endSplit, endKeyInclusive);
- }
- }
-
- return accumuloRange;
- }
-}
diff --git a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloModule.java b/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloModule.java
deleted file mode 100644
index cb3e56a184de..000000000000
--- a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloModule.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.trino.plugin.accumulo;
-
-import com.google.inject.Binder;
-import com.google.inject.Inject;
-import com.google.inject.Module;
-import com.google.inject.Provider;
-import com.google.inject.Scopes;
-import io.airlift.json.JsonCodec;
-import io.airlift.log.Logger;
-import io.trino.plugin.accumulo.conf.AccumuloConfig;
-import io.trino.plugin.accumulo.conf.AccumuloSessionProperties;
-import io.trino.plugin.accumulo.conf.AccumuloTableProperties;
-import io.trino.plugin.accumulo.index.ColumnCardinalityCache;
-import io.trino.plugin.accumulo.index.IndexLookup;
-import io.trino.plugin.accumulo.io.AccumuloPageSinkProvider;
-import io.trino.plugin.accumulo.io.AccumuloRecordSetProvider;
-import io.trino.plugin.accumulo.metadata.AccumuloTable;
-import io.trino.plugin.accumulo.metadata.ZooKeeperMetadataManager;
-import org.apache.accumulo.core.client.Accumulo;
-import org.apache.accumulo.core.client.AccumuloClient;
-
-import static io.airlift.configuration.ConfigBinder.configBinder;
-import static io.airlift.json.JsonCodecBinder.jsonCodecBinder;
-import static io.trino.plugin.base.ClosingBinder.closingBinder;
-
-/**
- * Trino module to do all kinds of run Guice injection stuff!
- *
- * WARNING: Contains black magick
- */
-public class AccumuloModule
- implements Module
-{
- @Override
- public void configure(Binder binder)
- {
- binder.bind(AccumuloConnector.class).in(Scopes.SINGLETON);
- binder.bind(AccumuloMetadata.class).in(Scopes.SINGLETON);
- binder.bind(AccumuloMetadataFactory.class).in(Scopes.SINGLETON);
- binder.bind(AccumuloMetadataManager.class).in(Scopes.SINGLETON);
- binder.bind(AccumuloSplitManager.class).in(Scopes.SINGLETON);
- binder.bind(AccumuloRecordSetProvider.class).in(Scopes.SINGLETON);
- binder.bind(AccumuloPageSinkProvider.class).in(Scopes.SINGLETON);
- binder.bind(AccumuloSessionProperties.class).in(Scopes.SINGLETON);
- binder.bind(AccumuloTableProperties.class).in(Scopes.SINGLETON);
- binder.bind(ZooKeeperMetadataManager.class).in(Scopes.SINGLETON);
- binder.bind(AccumuloTableManager.class).in(Scopes.SINGLETON);
- binder.bind(IndexLookup.class).in(Scopes.SINGLETON);
- binder.bind(ColumnCardinalityCache.class).in(Scopes.SINGLETON);
- binder.bind(AccumuloClient.class).toProvider(ClientProvider.class).in(Scopes.SINGLETON);
- closingBinder(binder).registerCloseable(AccumuloClient.class);
-
- configBinder(binder).bindConfig(AccumuloConfig.class);
-
- jsonCodecBinder(binder).bindMapJsonCodec(String.class, JsonCodec.listJsonCodec(AccumuloTable.class));
- }
-
- private static class ClientProvider
- implements Provider
- {
- private static final Logger LOG = Logger.get(ClientProvider.class);
-
- private final String instance;
- private final String zooKeepers;
- private final String username;
- private final String password;
-
- @Inject
- public ClientProvider(AccumuloConfig config)
- {
- this.instance = config.getInstance();
- this.zooKeepers = config.getZooKeepers();
- this.username = config.getUsername();
- this.password = config.getPassword();
- }
-
- @Override
- public AccumuloClient get()
- {
- AccumuloClient client = Accumulo.newClient()
- .to(instance, zooKeepers)
- .as(username, password)
- .build();
- LOG.info("Connection to instance %s at %s established, user %s", instance, zooKeepers, username);
- return client;
- }
- }
-}
diff --git a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloPlugin.java b/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloPlugin.java
deleted file mode 100644
index 886aee388cdb..000000000000
--- a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloPlugin.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.trino.plugin.accumulo;
-
-import com.google.common.collect.ImmutableList;
-import io.trino.spi.Plugin;
-import io.trino.spi.connector.ConnectorFactory;
-
-public class AccumuloPlugin
- implements Plugin
-{
- @Override
- public Iterable getConnectorFactories()
- {
- return ImmutableList.of(new AccumuloConnectorFactory());
- }
-}
diff --git a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloSplitManager.java b/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloSplitManager.java
deleted file mode 100644
index be9436e402cc..000000000000
--- a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloSplitManager.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.trino.plugin.accumulo;
-
-import com.google.common.collect.ImmutableList;
-import com.google.inject.Inject;
-import io.trino.plugin.accumulo.model.AccumuloColumnConstraint;
-import io.trino.plugin.accumulo.model.AccumuloColumnHandle;
-import io.trino.plugin.accumulo.model.AccumuloSplit;
-import io.trino.plugin.accumulo.model.AccumuloTableHandle;
-import io.trino.plugin.accumulo.model.SerializedRange;
-import io.trino.plugin.accumulo.model.TabletSplitMetadata;
-import io.trino.spi.connector.ColumnHandle;
-import io.trino.spi.connector.ConnectorSession;
-import io.trino.spi.connector.ConnectorSplit;
-import io.trino.spi.connector.ConnectorSplitManager;
-import io.trino.spi.connector.ConnectorSplitSource;
-import io.trino.spi.connector.ConnectorTableHandle;
-import io.trino.spi.connector.ConnectorTransactionHandle;
-import io.trino.spi.connector.Constraint;
-import io.trino.spi.connector.DynamicFilter;
-import io.trino.spi.connector.FixedSplitSource;
-import io.trino.spi.predicate.Domain;
-import io.trino.spi.predicate.TupleDomain;
-
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-import static java.util.Objects.requireNonNull;
-
-public class AccumuloSplitManager
- implements ConnectorSplitManager
-{
- private final AccumuloMetadataManager metadataManager;
-
- @Inject
- public AccumuloSplitManager(AccumuloMetadataManager metadataManager)
- {
- this.metadataManager = requireNonNull(metadataManager, "metadataManager is null");
- }
-
- @Override
- public ConnectorSplitSource getSplits(
- ConnectorTransactionHandle transactionHandle,
- ConnectorSession session,
- ConnectorTableHandle tableHandle,
- DynamicFilter dynamicFilter,
- Constraint constraint)
- {
- AccumuloTableHandle handle = (AccumuloTableHandle) tableHandle;
-
- String schemaName = handle.getSchema();
- String tableName = handle.getTable();
- String rowIdName = handle.getRowId();
-
- // Get non-row ID column constraints
- List constraints = getColumnConstraints(rowIdName, handle.getConstraint());
-
- // Get the row domain column range
- Optional rDom = getRangeDomain(rowIdName, handle.getConstraint());
-
- // Call out to our client to retrieve all tablet split metadata using the row ID domain and the secondary index
- List tabletSplits = metadataManager.getTabletSplits(session, schemaName, tableName, rDom, constraints, handle.getSerializerInstance());
-
- // Pack the tablet split metadata into a connector split
- ImmutableList.Builder cSplits = ImmutableList.builder();
- for (TabletSplitMetadata splitMetadata : tabletSplits) {
- AccumuloSplit split = new AccumuloSplit(
- splitMetadata.ranges().stream().map(SerializedRange::serialize).collect(Collectors.toList()),
- splitMetadata.hostPort());
- cSplits.add(split);
- }
-
- return new FixedSplitSource(cSplits.build());
- }
-
- private static Optional getRangeDomain(String rowIdName, TupleDomain constraint)
- {
- if (constraint.getDomains().isPresent()) {
- for (Entry columnDomain : constraint.getDomains().get().entrySet()) {
- AccumuloColumnHandle col = (AccumuloColumnHandle) columnDomain.getKey();
- if (col.name().equals(rowIdName)) {
- return Optional.of(columnDomain.getValue());
- }
- }
- }
-
- return Optional.empty();
- }
-
- /**
- * Gets a list of {@link AccumuloColumnConstraint} based on the given constraint ID, excluding the row ID column
- *
- * @param rowIdName Trino column name mapping to the Accumulo row ID
- * @param constraint Set of query constraints
- * @return List of all column constraints
- */
- private static List getColumnConstraints(String rowIdName, TupleDomain constraint)
- {
- ImmutableList.Builder constraintBuilder = ImmutableList.builder();
- constraint.getDomains().orElseThrow().forEach((handle, domain) -> {
- AccumuloColumnHandle columnHandle = (AccumuloColumnHandle) handle;
-
- if (!columnHandle.name().equals(rowIdName)) {
- // Family and qualifier will exist for non-row ID columns
- constraintBuilder.add(new AccumuloColumnConstraint(
- columnHandle.name(),
- columnHandle.family().get(),
- columnHandle.qualifier().get(),
- Optional.of(domain),
- columnHandle.indexed()));
- }
- });
-
- return constraintBuilder.build();
- }
-}
diff --git a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloTableManager.java b/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloTableManager.java
deleted file mode 100644
index a0ecfd709bc8..000000000000
--- a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloTableManager.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.trino.plugin.accumulo;
-
-import com.google.inject.Inject;
-import io.airlift.log.Logger;
-import io.trino.spi.TrinoException;
-import org.apache.accumulo.core.client.AccumuloClient;
-import org.apache.accumulo.core.client.AccumuloException;
-import org.apache.accumulo.core.client.AccumuloSecurityException;
-import org.apache.accumulo.core.client.IteratorSetting;
-import org.apache.accumulo.core.client.NamespaceExistsException;
-import org.apache.accumulo.core.client.NamespaceNotEmptyException;
-import org.apache.accumulo.core.client.NamespaceNotFoundException;
-import org.apache.accumulo.core.client.TableExistsException;
-import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
-import org.apache.hadoop.io.Text;
-
-import java.util.EnumSet;
-import java.util.Map;
-import java.util.Set;
-
-import static io.trino.plugin.accumulo.AccumuloErrorCode.ACCUMULO_TABLE_DNE;
-import static io.trino.plugin.accumulo.AccumuloErrorCode.ACCUMULO_TABLE_EXISTS;
-import static io.trino.plugin.accumulo.AccumuloErrorCode.UNEXPECTED_ACCUMULO_ERROR;
-import static io.trino.spi.StandardErrorCode.ALREADY_EXISTS;
-import static java.util.Objects.requireNonNull;
-
-/**
- * This class is a light wrapper for Accumulo's Connector object.
- * It will perform the given operation, or throw an exception if an Accumulo- or ZooKeeper-based error occurs.
- */
-public class AccumuloTableManager
-{
- private static final Logger LOG = Logger.get(AccumuloTableManager.class);
- private final AccumuloClient client;
-
- @Inject
- public AccumuloTableManager(AccumuloClient client)
- {
- this.client = requireNonNull(client, "client is null");
- }
-
- public void createNamespace(String schema)
- {
- try {
- client.namespaceOperations().create(schema);
- }
- catch (NamespaceExistsException e) {
- throw new TrinoException(ALREADY_EXISTS, "Namespace already exists: " + schema, e);
- }
- catch (AccumuloException | AccumuloSecurityException e) {
- throw new TrinoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to create Accumulo namespace: " + schema, e);
- }
- }
-
- public void dropNamespace(String schema)
- {
- try {
- client.namespaceOperations().delete(schema);
- }
- catch (AccumuloException | AccumuloSecurityException | NamespaceNotFoundException | NamespaceNotEmptyException e) {
- throw new TrinoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to delete Accumulo namespace: " + schema, e);
- }
- }
-
- public boolean namespaceExists(String schema)
- {
- try {
- return client.namespaceOperations().exists(schema);
- }
- catch (AccumuloException | AccumuloSecurityException e) {
- throw new TrinoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to check for existence Accumulo namespace: " + schema, e);
- }
- }
-
- public boolean exists(String table)
- {
- return client.tableOperations().exists(table);
- }
-
- public void createAccumuloTable(String table)
- {
- try {
- client.tableOperations().create(table);
- }
- catch (AccumuloException | AccumuloSecurityException e) {
- throw new TrinoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to create Accumulo table", e);
- }
- catch (TableExistsException e) {
- throw new TrinoException(ACCUMULO_TABLE_EXISTS, "Accumulo table already exists", e);
- }
- }
-
- public void setLocalityGroups(String tableName, Map> groups)
- {
- if (groups.isEmpty()) {
- return;
- }
-
- try {
- client.tableOperations().setLocalityGroups(tableName, groups);
- LOG.debug("Set locality groups for %s to %s", tableName, groups);
- }
- catch (AccumuloException | AccumuloSecurityException e) {
- throw new TrinoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to set locality groups", e);
- }
- catch (TableNotFoundException e) {
- throw new TrinoException(ACCUMULO_TABLE_DNE, "Failed to set locality groups, table does not exist", e);
- }
- }
-
- public void setIterator(String table, IteratorSetting setting)
- {
- try {
- // Remove any existing iterator settings of the same name, if applicable
- Map> iterators = client.tableOperations().listIterators(table);
- if (iterators.containsKey(setting.getName())) {
- client.tableOperations().removeIterator(table, setting.getName(), iterators.get(setting.getName()));
- }
-
- client.tableOperations().attachIterator(table, setting);
- }
- catch (AccumuloSecurityException | AccumuloException e) {
- throw new TrinoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to set iterator on table " + table, e);
- }
- catch (TableNotFoundException e) {
- throw new TrinoException(ACCUMULO_TABLE_DNE, "Failed to set iterator, table does not exist", e);
- }
- }
-
- public void deleteAccumuloTable(String tableName)
- {
- try {
- client.tableOperations().delete(tableName);
- }
- catch (AccumuloException | AccumuloSecurityException e) {
- throw new TrinoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to delete Accumulo table", e);
- }
- catch (TableNotFoundException e) {
- throw new TrinoException(ACCUMULO_TABLE_DNE, "Failed to delete Accumulo table, does not exist", e);
- }
- }
-
- public void renameAccumuloTable(String oldName, String newName)
- {
- try {
- client.tableOperations().rename(oldName, newName);
- }
- catch (AccumuloSecurityException | AccumuloException e) {
- throw new TrinoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to rename table", e);
- }
- catch (TableNotFoundException e) {
- throw new TrinoException(ACCUMULO_TABLE_DNE, "Failed to rename table, old table does not exist", e);
- }
- catch (TableExistsException e) {
- throw new TrinoException(ACCUMULO_TABLE_EXISTS, "Failed to rename table, new table already exists", e);
- }
- }
-}
diff --git a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloTransactionHandle.java b/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloTransactionHandle.java
deleted file mode 100644
index 5eda4d453e92..000000000000
--- a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloTransactionHandle.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.trino.plugin.accumulo;
-
-import io.trino.spi.connector.ConnectorTransactionHandle;
-
-import java.util.UUID;
-
-import static java.util.Objects.requireNonNull;
-
-public record AccumuloTransactionHandle(UUID uuid)
- implements ConnectorTransactionHandle
-{
- public AccumuloTransactionHandle()
- {
- this(UUID.randomUUID());
- }
-
- public AccumuloTransactionHandle
- {
- requireNonNull(uuid, "uuid is null");
- }
-}
diff --git a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/Types.java b/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/Types.java
deleted file mode 100644
index cac7973e7ac0..000000000000
--- a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/Types.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.trino.plugin.accumulo;
-
-import io.trino.spi.type.ArrayType;
-import io.trino.spi.type.MapType;
-import io.trino.spi.type.Type;
-
-/**
- * Utility class for Trino Type-related functionality.
- */
-public final class Types
-{
- private Types() {}
-
- public static boolean isArrayType(Type type)
- {
- return type instanceof ArrayType;
- }
-
- public static boolean isMapType(Type type)
- {
- return type instanceof MapType;
- }
-
- /**
- * Gets the element type of the given array type. Does not validate that the given type is an array.
- *
- * @param type An array type
- * @return Element type of the array
- * @throws IndexOutOfBoundsException If type is not an array
- * @see Types#isArrayType
- */
- public static Type getElementType(Type type)
- {
- return type.getTypeParameters().get(0);
- }
-
- /**
- * Gets the key type of the given map type. Does not validate that the given type is a map.
- *
- * @param type A map type
- * @return Key type of the map
- * @throws IndexOutOfBoundsException If type is not a map
- * @see Types#isMapType
- */
- public static Type getKeyType(Type type)
- {
- return type.getTypeParameters().get(0);
- }
-
- /**
- * Gets the value type of the given map type. Does not validate that the given type is a map.
- *
- * @param type A map type
- * @return Value type of the map
- * @throws IndexOutOfBoundsException If type is not a map
- * @see Types#isMapType
- */
- public static Type getValueType(Type type)
- {
- return type.getTypeParameters().get(1);
- }
-}
diff --git a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/conf/AccumuloConfig.java b/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/conf/AccumuloConfig.java
deleted file mode 100644
index 0535c8792b01..000000000000
--- a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/conf/AccumuloConfig.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.trino.plugin.accumulo.conf;
-
-import io.airlift.configuration.Config;
-import io.airlift.configuration.ConfigDescription;
-import io.airlift.configuration.ConfigSecuritySensitive;
-import io.airlift.units.Duration;
-import jakarta.validation.constraints.Min;
-import jakarta.validation.constraints.NotNull;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * File-based configuration properties for the Accumulo connector
- */
-public class AccumuloConfig
-{
- public static final String INSTANCE = "accumulo.instance";
- public static final String ZOOKEEPERS = "accumulo.zookeepers";
- public static final String USERNAME = "accumulo.username";
- public static final String PASSWORD = "accumulo.password";
- public static final String ZOOKEEPER_METADATA_ROOT = "accumulo.zookeeper.metadata.root";
- public static final String CARDINALITY_CACHE_SIZE = "accumulo.cardinality.cache.size";
- public static final String CARDINALITY_CACHE_EXPIRE_DURATION = "accumulo.cardinality.cache.expire.duration";
-
- private String instance;
- private String zooKeepers;
- private String username;
- private String password;
- private String zkMetadataRoot = "/trino-accumulo";
- private int cardinalityCacheSize = 100_000;
- private Duration cardinalityCacheExpiration = new Duration(5, TimeUnit.MINUTES);
-
- @NotNull
- public String getInstance()
- {
- return this.instance;
- }
-
- @Config(INSTANCE)
- @ConfigDescription("Accumulo instance name")
- public AccumuloConfig setInstance(String instance)
- {
- this.instance = instance;
- return this;
- }
-
- @NotNull
- public String getZooKeepers()
- {
- return this.zooKeepers;
- }
-
- @Config(ZOOKEEPERS)
- @ConfigDescription("ZooKeeper quorum connect string for Accumulo")
- public AccumuloConfig setZooKeepers(String zooKeepers)
- {
- this.zooKeepers = zooKeepers;
- return this;
- }
-
- @NotNull
- public String getUsername()
- {
- return this.username;
- }
-
- @Config(USERNAME)
- @ConfigDescription("Sets the user to use when interacting with Accumulo. This user will require administrative permissions")
- public AccumuloConfig setUsername(String username)
- {
- this.username = username;
- return this;
- }
-
- @NotNull
- public String getPassword()
- {
- return this.password;
- }
-
- @Config(PASSWORD)
- @ConfigSecuritySensitive
- @ConfigDescription("Sets the password for the configured user")
- public AccumuloConfig setPassword(String password)
- {
- this.password = password;
- return this;
- }
-
- @NotNull
- public String getZkMetadataRoot()
- {
- return zkMetadataRoot;
- }
-
- @Config(ZOOKEEPER_METADATA_ROOT)
- @ConfigDescription("Sets the root znode for metadata storage")
- public AccumuloConfig setZkMetadataRoot(String zkMetadataRoot)
- {
- this.zkMetadataRoot = zkMetadataRoot;
- return this;
- }
-
- @Min(1)
- public int getCardinalityCacheSize()
- {
- return cardinalityCacheSize;
- }
-
- @Config(CARDINALITY_CACHE_SIZE)
- @ConfigDescription("Sets the cardinality cache size")
- public AccumuloConfig setCardinalityCacheSize(int cardinalityCacheSize)
- {
- this.cardinalityCacheSize = cardinalityCacheSize;
- return this;
- }
-
- @NotNull
- public Duration getCardinalityCacheExpiration()
- {
- return cardinalityCacheExpiration;
- }
-
- @Config(CARDINALITY_CACHE_EXPIRE_DURATION)
- @ConfigDescription("Sets the cardinality cache expiration")
- public AccumuloConfig setCardinalityCacheExpiration(Duration cardinalityCacheExpiration)
- {
- this.cardinalityCacheExpiration = cardinalityCacheExpiration;
- return this;
- }
-}
diff --git a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/conf/AccumuloSessionProperties.java b/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/conf/AccumuloSessionProperties.java
deleted file mode 100644
index b3be64afe77e..000000000000
--- a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/conf/AccumuloSessionProperties.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.trino.plugin.accumulo.conf;
-
-import com.google.common.collect.ImmutableList;
-import com.google.inject.Inject;
-import io.airlift.units.Duration;
-import io.trino.spi.connector.ConnectorSession;
-import io.trino.spi.session.PropertyMetadata;
-
-import java.util.List;
-
-import static io.trino.plugin.base.session.PropertyMetadataUtil.durationProperty;
-import static io.trino.spi.session.PropertyMetadata.booleanProperty;
-import static io.trino.spi.session.PropertyMetadata.doubleProperty;
-import static io.trino.spi.session.PropertyMetadata.integerProperty;
-import static io.trino.spi.session.PropertyMetadata.stringProperty;
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
-
-/**
- * Class contains all session-based properties for the Accumulo connector.
- * Use SHOW SESSION to view all available properties.
- *
- * Can set the property using:
- *
- * SET SESSION <property> = <value>;
- */
-public final class AccumuloSessionProperties
-{
- private static final String OPTIMIZE_LOCALITY_ENABLED = "optimize_locality_enabled";
- private static final String OPTIMIZE_SPLIT_RANGES_ENABLED = "optimize_split_ranges_enabled";
- private static final String OPTIMIZE_INDEX_ENABLED = "optimize_index_enabled";
- private static final String INDEX_ROWS_PER_SPLIT = "index_rows_per_split";
- private static final String INDEX_THRESHOLD = "index_threshold";
- private static final String INDEX_LOWEST_CARDINALITY_THRESHOLD = "index_lowest_cardinality_threshold";
- private static final String INDEX_METRICS_ENABLED = "index_metrics_enabled";
- private static final String SCAN_USERNAME = "scan_username";
- private static final String INDEX_SHORT_CIRCUIT_CARDINALITY_FETCH = "index_short_circuit_cardinality_fetch";
- private static final String INDEX_CARDINALITY_CACHE_POLLING_DURATION = "index_cardinality_cache_polling_duration";
-
- private final List> sessionProperties;
-
- @Inject
- public AccumuloSessionProperties()
- {
- sessionProperties = ImmutableList.of(
- booleanProperty(
- OPTIMIZE_LOCALITY_ENABLED,
- "Set to true to enable data locality for non-indexed scans. Default true.", true,
- false),
- booleanProperty(
- OPTIMIZE_SPLIT_RANGES_ENABLED,
- "Set to true to split non-indexed queries by tablet splits. Should generally be true.",
- true, false),
- stringProperty(
- SCAN_USERNAME,
- "User to impersonate when scanning the tables. This property trumps the scan_auths table property. Default is the user in the configuration file.", null, false),
- booleanProperty(
- OPTIMIZE_INDEX_ENABLED,
- "Set to true to enable usage of the secondary index on query. Default true.",
- true,
- false),
- integerProperty(
- INDEX_ROWS_PER_SPLIT,
- "The number of Accumulo row IDs that are packed into a single Trino split. Default 10000",
- 10000,
- false),
- doubleProperty(
- INDEX_THRESHOLD,
- "The ratio between number of rows to be scanned based on the index over the total number of rows. If the ratio is below this threshold, the index will be used. Default .2",
- 0.2,
- false),
- doubleProperty(
- INDEX_LOWEST_CARDINALITY_THRESHOLD,
- "The threshold where the column with the lowest cardinality will be used instead of computing an intersection of ranges in the secondary index. Secondary index must be enabled. Default .01",
- 0.01,
- false),
- booleanProperty(
- INDEX_METRICS_ENABLED,
- "Set to true to enable usage of the metrics table to optimize usage of the index. Default true",
- true,
- false),
- booleanProperty(
- INDEX_SHORT_CIRCUIT_CARDINALITY_FETCH,
- "Short circuit the retrieval of index metrics once any column is less than the lowest cardinality threshold. Default true",
- true,
- false),
- durationProperty(
- INDEX_CARDINALITY_CACHE_POLLING_DURATION,
- "Sets the cardinality cache polling duration for short circuit retrieval of index metrics. Default 10ms",
- new Duration(10, MILLISECONDS),
- false));
- }
-
- public List> getSessionProperties()
- {
- return sessionProperties;
- }
-
- public static boolean isOptimizeLocalityEnabled(ConnectorSession session)
- {
- return session.getProperty(OPTIMIZE_LOCALITY_ENABLED, Boolean.class);
- }
-
- public static boolean isOptimizeSplitRangesEnabled(ConnectorSession session)
- {
- return session.getProperty(OPTIMIZE_SPLIT_RANGES_ENABLED, Boolean.class);
- }
-
- public static boolean isOptimizeIndexEnabled(ConnectorSession session)
- {
- return session.getProperty(OPTIMIZE_INDEX_ENABLED, Boolean.class);
- }
-
- public static double getIndexThreshold(ConnectorSession session)
- {
- return session.getProperty(INDEX_THRESHOLD, Double.class);
- }
-
- public static int getNumIndexRowsPerSplit(ConnectorSession session)
- {
- return session.getProperty(INDEX_ROWS_PER_SPLIT, Integer.class);
- }
-
- public static double getIndexSmallCardThreshold(ConnectorSession session)
- {
- return session.getProperty(INDEX_LOWEST_CARDINALITY_THRESHOLD, Double.class);
- }
-
- public static Duration getIndexCardinalityCachePollingDuration(ConnectorSession session)
- {
- return session.getProperty(INDEX_CARDINALITY_CACHE_POLLING_DURATION, Duration.class);
- }
-
- public static boolean isIndexMetricsEnabled(ConnectorSession session)
- {
- return session.getProperty(INDEX_METRICS_ENABLED, Boolean.class);
- }
-
- public static String getScanUsername(ConnectorSession session)
- {
- return session.getProperty(SCAN_USERNAME, String.class);
- }
-
- public static boolean isIndexShortCircuitEnabled(ConnectorSession session)
- {
- return session.getProperty(INDEX_SHORT_CIRCUIT_CARDINALITY_FETCH, Boolean.class);
- }
-}
diff --git a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/conf/AccumuloTableProperties.java b/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/conf/AccumuloTableProperties.java
deleted file mode 100644
index 8ec8b25c528f..000000000000
--- a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/conf/AccumuloTableProperties.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.trino.plugin.accumulo.conf;
-
-import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import io.trino.plugin.accumulo.serializers.AccumuloRowSerializer;
-import io.trino.plugin.accumulo.serializers.LexicoderRowSerializer;
-import io.trino.plugin.accumulo.serializers.StringRowSerializer;
-import io.trino.spi.TrinoException;
-import io.trino.spi.session.PropertyMetadata;
-import io.trino.spi.type.VarcharType;
-
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Optional;
-import java.util.Set;
-
-import static com.google.common.base.Preconditions.checkState;
-import static io.trino.spi.StandardErrorCode.INVALID_TABLE_PROPERTY;
-import static io.trino.spi.session.PropertyMetadata.booleanProperty;
-import static io.trino.spi.session.PropertyMetadata.stringProperty;
-import static java.util.Objects.requireNonNull;
-
-/**
- * Class contains all table properties for the Accumulo connector. Used when creating a table:
- *
- * CREATE TABLE foo (a VARCHAR, b INT)
- * WITH (column_mapping = 'b:md:b', external = true);
- */
-public final class AccumuloTableProperties
-{
- public static final String COLUMN_MAPPING = "column_mapping";
- public static final String INDEX_COLUMNS = "index_columns";
- public static final String EXTERNAL = "external";
- public static final String LOCALITY_GROUPS = "locality_groups";
- public static final String ROW_ID = "row_id";
- public static final String SERIALIZER = "serializer";
- public static final String SCAN_AUTHS = "scan_auths";
- private static final Splitter COLON_SPLITTER = Splitter.on(':').trimResults();
- private static final Splitter COMMA_SPLITTER = Splitter.on(',').omitEmptyStrings().trimResults();
- private static final Splitter PIPE_SPLITTER = Splitter.on('|').omitEmptyStrings().trimResults();
-
- private final List> tableProperties;
-
- public AccumuloTableProperties()
- {
- PropertyMetadata s1 = stringProperty(
- COLUMN_MAPPING,
- "Comma-delimited list of column metadata: col_name:col_family:col_qualifier,[...]. Required for external tables. Not setting this property results in auto-generated column names.",
- null,
- false);
-
- PropertyMetadata s2 = stringProperty(
- INDEX_COLUMNS,
- "A comma-delimited list of Trino columns that are indexed in this table's corresponding index table. Default is no indexed columns.",
- "",
- false);
-
- PropertyMetadata s3 = booleanProperty(
- EXTERNAL,
- "If true, Trino will only do metadata operations for the table. Else, Trino will create and drop Accumulo tables where appropriate. Default false.",
- false,
- false);
-
- PropertyMetadata s4 = stringProperty(
- LOCALITY_GROUPS,
- "List of locality groups to set on the Accumulo table. Only valid on internal tables. String format is locality group name, colon, comma delimited list of Trino column names in the group. Groups are delimited by pipes. Example: group1:colA,colB,colC|group2:colD,colE,colF|etc.... Default is no locality groups.",
- null,
- false);
-
- PropertyMetadata s5 = stringProperty(
- ROW_ID,
- "Trino column name that maps to the Accumulo row ID. Default is the first column.",
- null,
- false);
-
- PropertyMetadata s6 = new PropertyMetadata<>(
- SERIALIZER,
- "Serializer for Accumulo data encodings. Can either be 'default', 'string', 'lexicoder', or a Java class name. Default is 'default', i.e. the value from AccumuloRowSerializer.getDefault(), i.e. 'lexicoder'.",
- VarcharType.VARCHAR, String.class,
- AccumuloRowSerializer.getDefault().getClass().getName(),
- false,
- x -> x.equals("default")
- ? AccumuloRowSerializer.getDefault().getClass().getName()
- : (x.equals("string") ? StringRowSerializer.class.getName()
- : (x.equals("lexicoder")
- ? LexicoderRowSerializer.class.getName()
- : (String) x)),
- object -> object);
-
- PropertyMetadata s7 = stringProperty(
- SCAN_AUTHS,
- "Scan-time authorizations set on the batch scanner. Default is all scan authorizations for the user",
- null,
- false);
-
- tableProperties = ImmutableList.of(s1, s2, s3, s4, s5, s6, s7);
- }
-
- public List> getTableProperties()
- {
- return tableProperties;
- }
-
- /**
- * Gets the value of the column_mapping property, or Optional.empty() if not set.
- *
- * Parses the value into a map of Trino column name to a pair of strings, the Accumulo column family and qualifier.
- *
- * @param tableProperties The map of table properties
- * @return The column mapping, Trino name to (accumulo column family, qualifier)
- */
- public static Optional