Search in sources :

Example 1 with ErrorDetail

use of com.amazonaws.services.glue.model.ErrorDetail in project presto by prestodb.

the class GlueHiveMetastore method propagatePartitionErrorToPrestoException.

private static void propagatePartitionErrorToPrestoException(String databaseName, String tableName, List<PartitionError> partitionErrors) {
    if (partitionErrors != null && !partitionErrors.isEmpty()) {
        ErrorDetail errorDetail = partitionErrors.get(0).getErrorDetail();
        String glueExceptionCode = errorDetail.getErrorCode();
        switch(glueExceptionCode) {
            case "AlreadyExistsException":
                throw new PrestoException(ALREADY_EXISTS, errorDetail.getErrorMessage());
            case "EntityNotFoundException":
                throw new TableNotFoundException(new SchemaTableName(databaseName, tableName), errorDetail.getErrorMessage());
            default:
                throw new PrestoException(HIVE_METASTORE_ERROR, errorDetail.getErrorCode() + ": " + errorDetail.getErrorMessage());
        }
    }
}
Also used : ErrorDetail(com.amazonaws.services.glue.model.ErrorDetail) TableNotFoundException(com.facebook.presto.spi.TableNotFoundException) PrestoException(com.facebook.presto.spi.PrestoException) SchemaTableName(com.facebook.presto.spi.SchemaTableName)

Aggregations

ErrorDetail (com.amazonaws.services.glue.model.ErrorDetail)1 PrestoException (com.facebook.presto.spi.PrestoException)1 SchemaTableName (com.facebook.presto.spi.SchemaTableName)1 TableNotFoundException (com.facebook.presto.spi.TableNotFoundException)1