Search in sources :

Example 6 with IcebergMetastoreException

use of org.apache.drill.metastore.iceberg.exceptions.IcebergMetastoreException in project drill by apache.

the class TablesOutputDataTransformer method execute.

@Override
public List<TableMetadataUnit> execute() {
    List<TableMetadataUnit> results = new ArrayList<>();
    for (Map<MethodHandle, Object> valueToSet : valuesToSet()) {
        TableMetadataUnit.Builder builder = TableMetadataUnit.builder();
        for (Map.Entry<MethodHandle, Object> entry : valueToSet.entrySet()) {
            try {
                entry.getKey().invokeWithArguments(builder, entry.getValue());
            } catch (Throwable e) {
                throw new IcebergMetastoreException(String.format("Unable to invoke setter for [%s] using [%s]", TableMetadataUnit.Builder.class.getSimpleName(), entry.getKey()), e);
            }
        }
        results.add(builder.build());
    }
    return results;
}
Also used : IcebergMetastoreException(org.apache.drill.metastore.iceberg.exceptions.IcebergMetastoreException) TableMetadataUnit(org.apache.drill.metastore.components.tables.TableMetadataUnit) ArrayList(java.util.ArrayList) Map(java.util.Map) MethodHandle(java.lang.invoke.MethodHandle)

Aggregations

IcebergMetastoreException (org.apache.drill.metastore.iceberg.exceptions.IcebergMetastoreException)6 MethodHandle (java.lang.invoke.MethodHandle)3 ArrayList (java.util.ArrayList)3 Record (org.apache.iceberg.data.Record)3 Types (org.apache.iceberg.types.Types)3 IOException (java.io.IOException)2 Path (org.apache.hadoop.fs.Path)2 GenericRecord (org.apache.iceberg.data.GenericRecord)2 Field (java.lang.reflect.Field)1 ParameterizedType (java.lang.reflect.ParameterizedType)1 Type (java.lang.reflect.Type)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Objects (java.util.Objects)1 MetastoreColumn (org.apache.drill.metastore.MetastoreColumn)1 MetastoreFieldDefinition (org.apache.drill.metastore.MetastoreFieldDefinition)1 TableMetadataUnit (org.apache.drill.metastore.components.tables.TableMetadataUnit)1 FileSystem (org.apache.hadoop.fs.FileSystem)1 PartitionSpec (org.apache.iceberg.PartitionSpec)1 Schema (org.apache.iceberg.Schema)1