Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,17 @@ public class SchemaAlreadyExistsException

public SchemaAlreadyExistsException(String schemaName)
{
this(schemaName, format("Schema already exists: '%s'", schemaName));
this(schemaName, null);
}

public SchemaAlreadyExistsException(String schemaName, String message)
public SchemaAlreadyExistsException(String schemaName, Throwable cause)
{
super(ALREADY_EXISTS, message);
this(schemaName, format("Schema already exists: '%s'", schemaName), cause);
}

public SchemaAlreadyExistsException(String schemaName, String message, Throwable cause)
{
super(ALREADY_EXISTS, message, cause);
this.schemaName = schemaName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ public class TableAlreadyExistsException

public TableAlreadyExistsException(SchemaTableName tableName)
{
this(tableName, format("Table already exists: '%s'", tableName));
this(tableName, null);
}

public TableAlreadyExistsException(SchemaTableName tableName, String message)
public TableAlreadyExistsException(SchemaTableName tableName, Throwable cause)
Comment thread
pajaks marked this conversation as resolved.
Outdated
Comment thread
pajaks marked this conversation as resolved.
Outdated
{
this(tableName, message, null);
this(tableName, format("Table already exists: '%s'", tableName), cause);
}

public TableAlreadyExistsException(SchemaTableName tableName, String message, Throwable cause)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ private void updateTableStatisticsInternal(String databaseName, String tableName
columnStatisticsProvider.updateTableColumnStatistics(table, updatedStatistics.getColumnStatistics());
}
catch (EntityNotFoundException e) {
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName));
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName), e);
}
catch (AmazonServiceException e) {
throw new TrinoException(HIVE_METASTORE_ERROR, e);
Expand Down Expand Up @@ -486,7 +486,7 @@ public void createDatabase(Database database)
glueClient.createDatabase(new CreateDatabaseRequest().withDatabaseInput(databaseInput)));
}
catch (AlreadyExistsException e) {
throw new SchemaAlreadyExistsException(database.getDatabaseName());
throw new SchemaAlreadyExistsException(database.getDatabaseName(), e);
}
catch (AmazonServiceException e) {
throw new TrinoException(HIVE_METASTORE_ERROR, e);
Expand Down Expand Up @@ -518,7 +518,7 @@ public void dropDatabase(String databaseName, boolean deleteData)
glueClient.deleteDatabase(new DeleteDatabaseRequest().withName(databaseName)));
}
catch (EntityNotFoundException e) {
throw new SchemaNotFoundException(databaseName);
throw new SchemaNotFoundException(databaseName, e);
}
catch (AmazonServiceException e) {
throw new TrinoException(HIVE_METASTORE_ERROR, e);
Expand Down Expand Up @@ -562,10 +562,10 @@ public void createTable(Table table, PrincipalPrivileges principalPrivileges)
.withTableInput(input)));
}
catch (AlreadyExistsException e) {
throw new TableAlreadyExistsException(new SchemaTableName(table.getDatabaseName(), table.getTableName()));
throw new TableAlreadyExistsException(new SchemaTableName(table.getDatabaseName(), table.getTableName()), e);
}
catch (EntityNotFoundException e) {
throw new SchemaNotFoundException(table.getDatabaseName());
throw new SchemaNotFoundException(table.getDatabaseName(), e);
}
catch (AmazonServiceException e) {
throw new TrinoException(HIVE_METASTORE_ERROR, e);
Expand Down Expand Up @@ -625,7 +625,7 @@ public void replaceTable(String databaseName, String tableName, Table newTable,
.withTableInput(newTableInput)));
}
catch (EntityNotFoundException e) {
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName));
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName), e);
}
catch (AmazonServiceException e) {
throw new TrinoException(HIVE_METASTORE_ERROR, e);
Expand Down Expand Up @@ -706,7 +706,7 @@ public void setTableOwner(String databaseName, String tableName, HivePrincipal p
.withTableInput(newTableInput)));
}
catch (EntityNotFoundException e) {
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName));
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName), e);
}
catch (AmazonServiceException e) {
throw new TrinoException(HIVE_METASTORE_ERROR, e);
Expand Down Expand Up @@ -1121,7 +1121,7 @@ public void alterPartition(String databaseName, String tableName, PartitionWithS
partition.getStatistics().getColumnStatistics());
}
catch (EntityNotFoundException e) {
throw new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), partition.getPartition().getValues());
throw new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), partition.getPartition().getValues(), e);
}
catch (AmazonServiceException e) {
throw new TrinoException(HIVE_METASTORE_ERROR, e);
Expand Down Expand Up @@ -1265,10 +1265,10 @@ public void createFunction(String databaseName, String functionName, LanguageFun
.withFunctionInput(functionInput)));
}
catch (AlreadyExistsException e) {
throw new TrinoException(ALREADY_EXISTS, "Function already exists");
throw new TrinoException(ALREADY_EXISTS, "Function already exists", e);
}
catch (EntityNotFoundException e) {
throw new SchemaNotFoundException(databaseName);
throw new SchemaNotFoundException(databaseName, e);
}
catch (AmazonServiceException e) {
throw new TrinoException(HIVE_METASTORE_ERROR, e);
Expand Down Expand Up @@ -1301,7 +1301,7 @@ public void dropFunction(String databaseName, String functionName, String signat
.withFunctionName(metastoreFunctionName(functionName, signatureToken))));
}
catch (EntityNotFoundException e) {
throw new TrinoException(FUNCTION_NOT_FOUND, "Function not found");
throw new TrinoException(FUNCTION_NOT_FOUND, "Function not found", e);
}
catch (AmazonServiceException e) {
throw new TrinoException(HIVE_METASTORE_ERROR, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ private Map<String, HiveColumnStatistics> getTableColumnStatistics(String databa
}));
}
catch (NoSuchObjectException e) {
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName));
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName), e);
}
catch (TException e) {
throw new TrinoException(HIVE_METASTORE_ERROR, e);
Expand Down Expand Up @@ -480,7 +480,7 @@ private Map<String, List<ColumnStatisticsObj>> getMetastorePartitionColumnStatis
}));
}
catch (NoSuchObjectException e) {
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName));
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName), e);
}
catch (TException e) {
throw new TrinoException(HIVE_METASTORE_ERROR, e);
Expand Down Expand Up @@ -561,7 +561,7 @@ private void setTableColumnStatistics(String databaseName, String tableName, Lis
}));
}
catch (NoSuchObjectException e) {
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName));
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName), e);
}
catch (TException e) {
throw new TrinoException(HIVE_METASTORE_ERROR, e);
Expand All @@ -585,7 +585,7 @@ private void deleteTableColumnStatistics(String databaseName, String tableName,
}));
}
catch (NoSuchObjectException e) {
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName));
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName), e);
}
catch (TException e) {
throw new TrinoException(HIVE_METASTORE_ERROR, e);
Expand Down Expand Up @@ -655,7 +655,7 @@ private void setPartitionColumnStatistics(String databaseName, String tableName,
}));
}
catch (NoSuchObjectException e) {
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName));
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName), e);
}
catch (TException e) {
throw new TrinoException(HIVE_METASTORE_ERROR, e);
Expand All @@ -679,7 +679,7 @@ private void deletePartitionColumnStatistics(String databaseName, String tableNa
}));
}
catch (NoSuchObjectException e) {
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName));
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName), e);
}
catch (TException e) {
throw new TrinoException(HIVE_METASTORE_ERROR, e);
Expand Down Expand Up @@ -974,7 +974,7 @@ public void createDatabase(Database database)
}));
}
catch (AlreadyExistsException e) {
throw new SchemaAlreadyExistsException(database.getName());
throw new SchemaAlreadyExistsException(database.getName(), e);
}
catch (TException e) {
throw new TrinoException(HIVE_METASTORE_ERROR, e);
Expand All @@ -999,7 +999,7 @@ public void dropDatabase(String databaseName, boolean deleteData)
}));
}
catch (NoSuchObjectException e) {
throw new SchemaNotFoundException(databaseName);
throw new SchemaNotFoundException(databaseName, e);
}
catch (TException e) {
throw new TrinoException(HIVE_METASTORE_ERROR, e);
Expand Down Expand Up @@ -1027,7 +1027,7 @@ public void alterDatabase(String databaseName, Database database)
}));
}
catch (NoSuchObjectException e) {
throw new SchemaNotFoundException(databaseName);
throw new SchemaNotFoundException(databaseName, e);
}
catch (TException e) {
throw new TrinoException(HIVE_METASTORE_ERROR, e);
Expand All @@ -1053,10 +1053,10 @@ public void createTable(Table table)
}));
}
catch (AlreadyExistsException e) {
throw new TableAlreadyExistsException(new SchemaTableName(table.getDbName(), table.getTableName()));
throw new TableAlreadyExistsException(new SchemaTableName(table.getDbName(), table.getTableName()), e);
}
catch (NoSuchObjectException e) {
throw new SchemaNotFoundException(table.getDbName());
throw new SchemaNotFoundException(table.getDbName(), e);
}
catch (InvalidObjectException e) {
boolean databaseMissing;
Expand All @@ -1068,7 +1068,7 @@ public void createTable(Table table)
databaseMissing = false; // we don't know, assume it exists for the purpose of error reporting
}
if (databaseMissing) {
throw new SchemaNotFoundException(table.getDbName());
throw new SchemaNotFoundException(table.getDbName(), e);
}
throw new TrinoException(HIVE_METASTORE_ERROR, e);
}
Expand Down Expand Up @@ -1100,7 +1100,7 @@ public void dropTable(String databaseName, String tableName, boolean deleteData)
}));
}
catch (NoSuchObjectException e) {
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName));
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName), e);
}
catch (TException e) {
throw new TrinoException(HIVE_METASTORE_ERROR, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public void dropNamespace(ConnectorSession session, String namespace)
glueClient.deleteDatabase(new DeleteDatabaseRequest().withName(namespace)));
}
catch (EntityNotFoundException e) {
throw new SchemaNotFoundException(namespace);
throw new SchemaNotFoundException(namespace, e);
}
catch (AmazonServiceException e) {
throw new TrinoException(ICEBERG_CATALOG_ERROR, e);
Expand All @@ -280,7 +280,7 @@ public Map<String, Object> loadNamespaceMetadata(ConnectorSession session, Strin
return metadata.buildOrThrow();
}
catch (EntityNotFoundException e) {
throw new SchemaNotFoundException(namespace);
throw new SchemaNotFoundException(namespace, e);
}
catch (AmazonServiceException e) {
throw new TrinoException(ICEBERG_CATALOG_ERROR, e);
Expand All @@ -305,7 +305,7 @@ public void createNamespace(ConnectorSession session, String namespace, Map<Stri
.withDatabaseInput(createDatabaseInput(namespace, properties))));
}
catch (AlreadyExistsException e) {
throw new SchemaAlreadyExistsException(namespace);
throw new SchemaAlreadyExistsException(namespace, e);
}
catch (AmazonServiceException e) {
throw new TrinoException(ICEBERG_CATALOG_ERROR, e);
Expand Down