zhangjun0x01 opened a new pull request #2259:
URL: https://github.com/apache/iceberg/pull/2259
In some cases, I need to get the iceberg table to do some work, such as
`RewriteDataFiles`, or modify table schema. When we use the iceberg table of
`HiveCatalog`, we may need to construct the `CatalogLoader` first, then
construct the `TableLoader`, and then load the iceberg table. The code is
relatively complicated, I personally prefer to use sql as much as possible, so
I want to change the `org.apache.iceberg.flink.FlinkCatalog#loadIcebergTable`
method to public so that we can easily get the iceberg table through the
following code .
```
StreamTableEnvironment tenv = StreamTableEnvironment.create(env);
tenv.executeSql(
"CREATE CATALOG iceberg WITH (\n"
+ " 'type'='iceberg',\n"
+ " 'catalog-type'='hive',"
+ " 'warehouse'='hdfs://localhost/user/hive2/warehouse',\n"
+ " 'uri'='thrift://localhost:9083'"
+ ")");
FlinkCatalog flinkCatalog = (FlinkCatalog)
tenv.getCatalog("iceberg").get();
Table icebergTable = flinkCatalog.loadIcebergTable(new
ObjectPath("iceberg_db", "iceberg_table"));
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]