diff --git a/.github/workflows/github_actions.yml b/.github/workflows/github_actions.yml
index fbbcff0574..8c815e4274 100644
--- a/.github/workflows/github_actions.yml
+++ b/.github/workflows/github_actions.yml
@@ -17,42 +17,30 @@ jobs:
os: [ ubuntu-latest, macos-11 ]
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
+
+ - name: Set up Java
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'adopt'
+ java-version: '17'
+ check-latest: true
- run: |
- export JAVA_HOME=$JAVA_HOME_11_X64
mvn checkstyle:checkstyle
shell: bash
name: checkStyle
- run: |
- export JAVA_HOME=$JAVA_HOME_11_X64
- mvn clean package -DskipTests
+ mvn clean package -e -DskipTests
shell: bash
name: checkFormat
- run: |
- export JAVA_HOME=$JAVA_HOME_11_X64
mvn test
shell: bash
name: test
- - run: |
- set -e pipefail
- # Display log files if the build failed
- echo "Dumping log files for failed build"
- echo "----------------------------------"
- for f in $(find $BUILD_REPOSITORY_LOCALPATH -name *.dumpstream);
- do echo "------"
- echo $f
- echo "======"
- cat $f
- done;
- shell: bash
- name: error_print
- if: ${{ failure() }}
-
-
Release:
if: startsWith(github.ref, 'refs/tags/')
needs: [Test]
diff --git a/pom.xml b/pom.xml
index d770aa22d5..43932eaf13 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
trino-root
io.trino
- 357
+ 405
trino-tiledb
@@ -54,7 +54,13 @@
com.github.oshi
oshi-core
- 3.10.0
+ 6.4.0
+
+
+ org.slf4j
+ slf4j-api
+
+
@@ -145,7 +151,7 @@
io.trino
trino-testing
- 357
+ 405
test
@@ -191,6 +197,7 @@
org.testng
testng
+ 7.3.0
test
diff --git a/src/main/java/io/trino/plugin/tiledb/TileDBClient.java b/src/main/java/io/trino/plugin/tiledb/TileDBClient.java
index 3a35fa0c1a..c64415e815 100644
--- a/src/main/java/io/trino/plugin/tiledb/TileDBClient.java
+++ b/src/main/java/io/trino/plugin/tiledb/TileDBClient.java
@@ -62,7 +62,6 @@ public class TileDBClient
protected Context ctx;
protected TileDBConfig config;
-
protected oshi.SystemInfo systemInfo;
protected HardwareAbstractionLayer hardwareAbstractionLayer;
@@ -101,6 +100,11 @@ public TileDBClient(TileDBConnectorId connectorId, TileDBConfig config)
hardwareAbstractionLayer = systemInfo.getHardware();
}
+ public HardwareAbstractionLayer getHardwareAbstractionLayer()
+ {
+ return hardwareAbstractionLayer;
+ }
+
/**
* Get plugin configuration
* @return TileDB plugin configuration
@@ -229,11 +233,6 @@ public Context getCtx()
return ctx;
}
- public HardwareAbstractionLayer getHardwareAbstractionLayer()
- {
- return hardwareAbstractionLayer;
- }
-
/**
* Rollback a create table statement, this just drops the array
* @param handle tiledb table handler
diff --git a/src/main/java/io/trino/plugin/tiledb/TileDBConfig.java b/src/main/java/io/trino/plugin/tiledb/TileDBConfig.java
index 340cd0a390..9b50032d6e 100644
--- a/src/main/java/io/trino/plugin/tiledb/TileDBConfig.java
+++ b/src/main/java/io/trino/plugin/tiledb/TileDBConfig.java
@@ -35,7 +35,7 @@ public class TileDBConfig
private int readBufferSize = 1024 * 1024 * 10;
- private int writeBufferSize = 1024 * 1024 * 10;
+ private int writeBufferSize = 1024 * 1024 * 1;
private String awsAccessKeyId;
diff --git a/src/main/java/io/trino/plugin/tiledb/TileDBConnector.java b/src/main/java/io/trino/plugin/tiledb/TileDBConnector.java
index 9ed3176f20..e4c36d2478 100644
--- a/src/main/java/io/trino/plugin/tiledb/TileDBConnector.java
+++ b/src/main/java/io/trino/plugin/tiledb/TileDBConnector.java
@@ -21,6 +21,7 @@
import io.trino.spi.connector.ConnectorMetadata;
import io.trino.spi.connector.ConnectorPageSinkProvider;
import io.trino.spi.connector.ConnectorRecordSetProvider;
+import io.trino.spi.connector.ConnectorSession;
import io.trino.spi.connector.ConnectorSplitManager;
import io.trino.spi.connector.ConnectorTransactionHandle;
import io.trino.spi.session.PropertyMetadata;
@@ -78,7 +79,7 @@ public TileDBConnector(
}
@Override
- public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly)
+ public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit)
{
TileDBTransactionHandle transaction = new TileDBTransactionHandle();
transactions.put(transaction, metadata);
@@ -100,7 +101,7 @@ public void rollback(ConnectorTransactionHandle transactionHandle)
}
@Override
- public ConnectorMetadata getMetadata(ConnectorTransactionHandle transactionHandle)
+ public ConnectorMetadata getMetadata(ConnectorSession session, ConnectorTransactionHandle transactionHandle)
{
return metadata;
}
diff --git a/src/main/java/io/trino/plugin/tiledb/TileDBConnectorFactory.java b/src/main/java/io/trino/plugin/tiledb/TileDBConnectorFactory.java
index f08f5fbcd7..58cb13faec 100644
--- a/src/main/java/io/trino/plugin/tiledb/TileDBConnectorFactory.java
+++ b/src/main/java/io/trino/plugin/tiledb/TileDBConnectorFactory.java
@@ -22,7 +22,6 @@
import io.trino.spi.connector.Connector;
import io.trino.spi.connector.ConnectorContext;
import io.trino.spi.connector.ConnectorFactory;
-import io.trino.spi.connector.ConnectorHandleResolver;
import java.util.Map;
@@ -42,12 +41,6 @@ public String getName()
return "tiledb";
}
- @Override
- public ConnectorHandleResolver getHandleResolver()
- {
- return new TileDBHandleResolver();
- }
-
@Override
public Connector create(String catalogName, Map requiredConfig, ConnectorContext context)
{
@@ -62,7 +55,6 @@ public Connector create(String catalogName, Map requiredConfig,
});
Injector injector = app
- .strictConfig()
.doNotInitializeLogging()
.setRequiredConfigurationProperties(requiredConfig)
.initialize();
diff --git a/src/main/java/io/trino/plugin/tiledb/TileDBHandleResolver.java b/src/main/java/io/trino/plugin/tiledb/TileDBHandleResolver.java
deleted file mode 100644
index 5f13b89d57..0000000000
--- a/src/main/java/io/trino/plugin/tiledb/TileDBHandleResolver.java
+++ /dev/null
@@ -1,73 +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.tiledb;
-
-import io.trino.spi.connector.ColumnHandle;
-import io.trino.spi.connector.ConnectorHandleResolver;
-import io.trino.spi.connector.ConnectorInsertTableHandle;
-import io.trino.spi.connector.ConnectorOutputTableHandle;
-import io.trino.spi.connector.ConnectorSplit;
-import io.trino.spi.connector.ConnectorTableHandle;
-import io.trino.spi.connector.ConnectorTableLayoutHandle;
-import io.trino.spi.connector.ConnectorTransactionHandle;
-
-/**
- * TileDBHandleResolver returns the class types for each handler component so prestodb can load the correct
- * classes
- */
-public class TileDBHandleResolver
- implements ConnectorHandleResolver
-{
- @Override
- public Class extends ConnectorTableLayoutHandle> getTableLayoutHandleClass()
- {
- return TileDBTableLayoutHandle.class;
- }
-
- @Override
- public Class extends ConnectorTableHandle> getTableHandleClass()
- {
- return TileDBTableHandle.class;
- }
-
- @Override
- public Class extends ColumnHandle> getColumnHandleClass()
- {
- return TileDBColumnHandle.class;
- }
-
- @Override
- public Class extends ConnectorSplit> getSplitClass()
- {
- return TileDBSplit.class;
- }
-
- @Override
- public Class extends ConnectorTransactionHandle> getTransactionHandleClass()
- {
- return TileDBTransactionHandle.class;
- }
-
- @Override
- public Class extends ConnectorOutputTableHandle> getOutputTableHandleClass()
- {
- return TileDBOutputTableHandle.class;
- }
-
- @Override
- public Class extends ConnectorInsertTableHandle> getInsertTableHandleClass()
- {
- return TileDBOutputTableHandle.class;
- }
-}
diff --git a/src/main/java/io/trino/plugin/tiledb/TileDBMetadata.java b/src/main/java/io/trino/plugin/tiledb/TileDBMetadata.java
index 973ee49a46..532c5d44dd 100644
--- a/src/main/java/io/trino/plugin/tiledb/TileDBMetadata.java
+++ b/src/main/java/io/trino/plugin/tiledb/TileDBMetadata.java
@@ -13,11 +13,9 @@
*/
package io.trino.plugin.tiledb;
-import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Maps;
import io.airlift.log.Logger;
import io.airlift.slice.Slice;
import io.tiledb.java.api.Array;
@@ -35,28 +33,19 @@
import io.trino.spi.connector.ColumnMetadata;
import io.trino.spi.connector.ConnectorInsertTableHandle;
import io.trino.spi.connector.ConnectorMetadata;
-import io.trino.spi.connector.ConnectorNewTableLayout;
import io.trino.spi.connector.ConnectorOutputMetadata;
import io.trino.spi.connector.ConnectorOutputTableHandle;
import io.trino.spi.connector.ConnectorSession;
import io.trino.spi.connector.ConnectorTableHandle;
import io.trino.spi.connector.ConnectorTableLayout;
-import io.trino.spi.connector.ConnectorTableLayoutHandle;
-import io.trino.spi.connector.ConnectorTableLayoutResult;
import io.trino.spi.connector.ConnectorTableMetadata;
-import io.trino.spi.connector.Constraint;
-import io.trino.spi.connector.LocalProperty;
+import io.trino.spi.connector.RetryMode;
import io.trino.spi.connector.SchemaTableName;
import io.trino.spi.connector.SchemaTablePrefix;
import io.trino.spi.connector.TableNotFoundException;
-import io.trino.spi.predicate.Domain;
-import io.trino.spi.predicate.Range;
-import io.trino.spi.predicate.TupleDomain;
-import io.trino.spi.predicate.ValueSet;
import io.trino.spi.statistics.ComputedStatistics;
import io.trino.spi.type.Type;
import io.trino.spi.type.VarcharType;
-import org.apache.commons.beanutils.ConvertUtils;
import javax.inject.Inject;
@@ -65,36 +54,26 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
-import java.util.stream.Collectors;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
-import static io.airlift.slice.Slices.utf8Slice;
import static io.tiledb.java.api.ArrayType.TILEDB_SPARSE;
import static io.tiledb.java.api.Constants.TILEDB_VAR_NUM;
-import static io.tiledb.java.api.QueryType.TILEDB_READ;
import static io.trino.plugin.tiledb.TileDBColumnProperties.getDimension;
import static io.trino.plugin.tiledb.TileDBColumnProperties.getExtent;
import static io.trino.plugin.tiledb.TileDBColumnProperties.getFilterList;
import static io.trino.plugin.tiledb.TileDBColumnProperties.getLowerBound;
-import static io.trino.plugin.tiledb.TileDBColumnProperties.getNullable;
import static io.trino.plugin.tiledb.TileDBColumnProperties.getUpperBound;
import static io.trino.plugin.tiledb.TileDBErrorCode.TILEDB_CREATE_TABLE_ERROR;
-import static io.trino.plugin.tiledb.TileDBErrorCode.TILEDB_RECORD_SET_ERROR;
import static io.trino.plugin.tiledb.TileDBModule.tileDBTypeFromTrinoType;
import static io.trino.plugin.tiledb.TileDBSessionProperties.getEncryptionKey;
-import static io.trino.plugin.tiledb.TileDBSessionProperties.getSplitOnlyPredicates;
import static io.trino.plugin.tiledb.TileDBTableProperties.getEncryptionKey;
-import static io.trino.spi.type.RealType.REAL;
-import static java.lang.Float.floatToRawIntBits;
import static java.util.Objects.requireNonNull;
/**
@@ -153,140 +132,6 @@ public TileDBTableHandle getTableHandle(ConnectorSession session, SchemaTableNam
return new TileDBTableHandle(connectorId, tableName.getSchemaName(), tableName.getTableName(), table.getURI().toString());
}
- @Override
- public List getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint constraint, Optional> desiredColumns)
- {
- TileDBTableHandle tableHandle = (TileDBTableHandle) table;
-
- // Set the dimensions as the partition columns
- Optional> partitioningColumns = Optional.empty();
- ImmutableList.Builder> localProperties = ImmutableList.builder();
-
- Map columns = getColumnHandles(session, tableHandle);
- boolean hasPredicate = constraint.predicate().isPresent();
-
- // Predicates are fetched as summary of constraints
- TupleDomain effectivePredicate = constraint.getSummary();
-// Set columnHandles = new HashSet<>(); //TODO check if possible in the future
-// for (ColumnHandle e : columns.values()) {
-// if (hasPredicate) {
-// columnsWithPredicates.add(e);
-// }
-// //columns that are not included in the columnHandles are filtered by presto, not tileDB. Strings and queries with 'OR' are not pushed down for now.
-// if ((((effectivePredicate.getDomains().get().get(e) != null) &&
-// (effectivePredicate.getDomains().get().get(e).getValues().getRanges().getOrderedRanges().size() > 1)))) { //having more than one range effectively means it is an OR condition, which is not yet supported by the core library.
-// LOG.info("Column %s has an OR condition which is not yet supported by TileDB's native QueryCondition. The filtering will happen by Trino.", ((TileDBColumnHandle) e).getColumnName());
-// }
-// else if (columnsWithPredicates.contains(e)) { //Predicates are not supported by the QueryCondition, thus we need to leave this to Presto.
-// LOG.info("Column %s uses a Predicate which is not yet supported by TileDB's native QueryCondition. The filtering will happen by Trino.", ((TileDBColumnHandle) e).getColumnName());
-// }
-// else {
-// columnHandles.add(e);
-// }
-// }
-
- Set dimensionHandles = columns.values().stream()
- .filter(e -> ((TileDBColumnHandle) e).getIsDimension())
- .collect(Collectors.toSet());
-
- List columnsInLayout;
- if (desiredColumns.isPresent()) {
- // Add all dimensions since dimensions will always be returned by tiledb
- Set desiredColumnsWithDimension = new HashSet<>(desiredColumns.get());
- desiredColumnsWithDimension.addAll(dimensionHandles);
-// desiredColumnsWithDimension.addAll(columnHandles);
- columnsInLayout = new ArrayList<>(desiredColumnsWithDimension);
- }
- else {
- columnsInLayout = new ArrayList<>(columns.values());
- }
-
- // The only enforceable constraints are ones for dimension columns
- Map enforceableDimensionDomains = new HashMap<>(Maps.filterKeys(effectivePredicate.getDomains().get(), Predicates.in(dimensionHandles)));
-
- if (!getSplitOnlyPredicates(session)) {
- try {
- Array array;
- String key = getEncryptionKey(session);
- if (key == null) {
- array = new Array(tileDBClient.buildContext(session), tableHandle.getURI(), TILEDB_READ);
- }
- else {
- array = new Array(tileDBClient.buildContext(session), tableHandle.getURI(), TILEDB_READ, EncryptionType.TILEDB_AES_256_GCM, key.getBytes());
- }
-
- HashMap nonEmptyDomain = array.nonEmptyDomain();
- // Find any dimension which do not have predicates and add one for the entire domain.
- // This is required so we can later split on the predicates
- for (ColumnHandle dimensionHandle : dimensionHandles) {
- if (!enforceableDimensionDomains.containsKey(dimensionHandle)) {
- TileDBColumnHandle columnHandle = ((TileDBColumnHandle) dimensionHandle);
- if (nonEmptyDomain.containsKey(columnHandle.getColumnName())) {
- Pair