samredai opened a new issue #4410:
URL: https://github.com/apache/iceberg/issues/4410


   When using the `HadoopFileIO` with a `JdbcCatalog`, creating a table runs 
into a NPE:
   ```java
   import org.apache.iceberg.catalog.Catalog;
   import org.apache.iceberg.CatalogProperties;
   import org.apache.iceberg.jdbc.JdbcCatalog;
   import org.apache.iceberg.hadoop.HadoopFileIO;
   import org.apache.iceberg.catalog.TableIdentifier;
   import org.apache.iceberg.Schema;
   import org.apache.iceberg.types.Types;
   
   Map<String, String> properties = new HashMap<>();
   
   properties.put(CatalogProperties.CATALOG_IMPL, JdbcCatalog.class.getName());
   properties.put(CatalogProperties.URI, 
"jdbc:postgresql://postgres:5432/demo_catalog");
   properties.put(JdbcCatalog.PROPERTY_PREFIX + "user", "admin");
   properties.put(JdbcCatalog.PROPERTY_PREFIX + "password", "password");
   properties.put(CatalogProperties.WAREHOUSE_LOCATION, 
"/home/iceberg/warehouse");
   properties.put(CatalogProperties.FILE_IO_IMPL, HadoopFileIO.class.getName());
   
   Catalog catalog = new JdbcCatalog();
   catalog.initialize("demo", properties);
   
   TableIdentifier name = TableIdentifier.of("somedb", "sometable");
   Schema schema = new Schema(
     Types.NestedField.required(1, "level", Types.StringType.get()),
     Types.NestedField.required(2, "event_time", 
Types.TimestampType.withZone()),
     Types.NestedField.required(3, "message", Types.StringType.get()),
     Types.NestedField.optional(4, "call_stack", Types.ListType.ofRequired(5, 
Types.StringType.get()))
   );
   
   catalog.createTable(name, schema)
   ```
   output:
   ```java
   java.lang.NullPointerException: null
        at 
org.apache.iceberg.hadoop.HadoopFileIO.newOutputFile(HadoopFileIO.java:64)
        at 
org.apache.iceberg.BaseMetastoreTableOperations.writeNewMetadata(BaseMetastoreTableOperations.java:150)
        at 
org.apache.iceberg.jdbc.JdbcTableOperations.doCommit(JdbcTableOperations.java:93)
        at 
org.apache.iceberg.BaseMetastoreTableOperations.commit(BaseMetastoreTableOperations.java:127)
        at 
org.apache.iceberg.BaseMetastoreCatalog$BaseMetastoreCatalogTableBuilder.create(BaseMetastoreCatalog.java:165)
        at org.apache.iceberg.catalog.Catalog.createTable(Catalog.java:78)
        at org.apache.iceberg.catalog.Catalog.createTable(Catalog.java:112)
        at .(#96:1)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to