Has anyone here been able to get flink to work wit...
# troubleshooting
m
Has anyone here been able to get flink to work with the iceberg runtime? I''m trying to create a table in our iceberg data catalog, but keep getting:
Cannot initialize Catalog implementation org.apache.iceberg.aws.glue.GlueCatalog: Cannot find constructor for interface org.apache.iceberg.catalog.Catalog
I'm using the
org.apache.iceberg:iceberg-flink-runtime-1.18:1.5.0
jar.
r
yes, I wrote about it here including setup https://www.decodable.co/blog/kafka-to-iceberg-with-flink
per https://iceberg.apache.org/docs/1.5.1/aws/#flink have you included
iceberg-aws-bundle
JAR too?
m
Thank you @rmoff for getting back to me! I will read your blog, it looks great! I have gotten it to find the iceberg functionality by adding amazon.awssdkbundle2.29.8, but I still cannot create a catalog using the glue type:
Copy code
tableEnv.executeSql(
                    "CREATE CATALOG pulse WITH (" +
                                "'type'='iceberg'," +
                                "'warehouse'='s3://bucket/'," +
                                "'catalog-impl'='org.apache.iceberg.aws.glue.GlueCatalog'," +
                                "'io-impl'='org.apache.iceberg.aws.s3.S3FileIO'," +
                                "'property-version'='1'," +
                                "'catalog-id'='aws-account-id'" +
                                ")"
            );
Or this create command passes without errors, but I cannot select anything from it.
SQL validation failed. From line 1, column 15 to line 1, column 38: Object 'pulse' not found
This might be glue specific, but appreciate any ideas you might have.
r
can you share what you're running after the
CREATE CATALOG
?
m
Copy code
tEnv.sqlQuery("select * from pulse.sa.search_extended where ts = '20240101' and vertical = 'H' limit 10")
                    .execute().print();
I also tried:
Copy code
tEnv.executeSql("CREATE TABLE sa.test_flink (ts STRING) WITH (" +
                    "\t  'connector'     = 'iceberg',\n" +
                    "\t  'catalog-type'  = 'glue',\n" +
                    "\t  'catalog-name'  = 'pulse',\n" +
                    "\t  'warehouse'     = 's3://bucket/',\n" +
                    "\t  'io-impl' = 'org.apache.iceberg.aws.s3.S3FileIO',\n" +
                    "\t  'catalog-id' = 'aws-account-id')" );
but that seems to try to create a table in default_catalog, not pulse as indicated...
Copy code
Exception in thread "main" org.apache.flink.table.api.ValidationException: Could not execute CreateTable in path `default_catalog`.`sa`.`test_flink`
r
does it work if you drop the qualifiers, and just do
CREATE TABLE test_flink
?
I've not done this in pyflink, but from Flink SQL you can set the catalog and database as current, and then you don't need to use the qualifiers. It's not that they won't work, but it just removes one complexity from it to help pinpoint the problem now
so something like
Copy code
table_env.execute_sql("USE CATALOG pulse")
are you creating the
sa
database anywhere?
does that already exist in Glue?
maybe you need
Copy code
table_env.execute_sql("USE CATALOG pulse")
table_env.execute_sql("USE DATABASE sa")
and then your
CREATE TABLE
command
m
Yes that already exists in glue
I don’t think I can run USE in table env
r
it's what the docs show - try it?
m
I tried this now, still no luck:
Copy code
tableEnv.executeSql(
                    "CREATE CATALOG pulse WITH (" +
                                "'type'='iceberg'," +
                                "'warehouse'='s3://bucket/'," +
                                "'catalog-impl'='org.apache.iceberg.aws.glue.GlueCatalog'," +
                                "'io-impl'='org.apache.iceberg.aws.s3.S3FileIO'," +
                                "'property-version'='1'," +
                                "'catalog-id'='aws-account-id'" +
                                ")"
            );
            tEnv.executeSql("USE CATALOG pulse");
            tEnv.executeSql("USE DATABASE sa");
            tEnv.sqlQuery("select * from search_extended where ts = '20240101' and vertical = 'H' limit 10")
                    .execute().print();
Fails with:
A catalog with name [pulse] does not exist.
r
you've got both
tableEnv
and
tEnv
. Try
Copy code
tableEnv.executeSql(
                    "CREATE CATALOG pulse WITH (" +
                                "'type'='iceberg'," +
                                "'warehouse'='s3://bucket/'," +
                                "'catalog-impl'='org.apache.iceberg.aws.glue.GlueCatalog'," +
                                "'io-impl'='org.apache.iceberg.aws.s3.S3FileIO'," +
                                "'property-version'='1'," +
                                "'catalog-id'='aws-account-id'" +
                                ")"
            );
            tableEnv.executeSql("USE CATALOG pulse");
            tableEnv.executeSql("USE DATABASE sa");
            tableEnv.sqlQuery("select * from search_extended where ts = '20240101' and vertical = 'H' limit 10")
                    .execute().print();
m
Yeah, I just saw that now. Thanks for your help!
👍 1
It seems to be working now. Although it doesn't print anything.