Kamesh Sampath
01/29/2025, 4:01 PM21:31:41,939 ERROR dev.kameshs.demos.flink.iceberg [] - Error running job
java.lang.IllegalArgumentException: table should be resolved
at [org.apache.iceberg.relocated.com](http://org.apache.iceberg.relocated.com).google.common.base.Preconditions.checkArgument(Preconditions.java:143) ~[iceberg-flink-runtime-1.20-1.7.1.jar:?]
at org.apache.iceberg.flink.FlinkCatalog.createTable(FlinkCatalog.java:394) ~[iceberg-flink-runtime-1.20-1.7.1.jar:?]
at dev.kameshs.demos.flink.iceberg.VehicleTelemetryProcessor.lambda$main$0(VehicleTelemetryProcessor.java:167) ~[main/:?]
at java.util.Optional.ifPresent(Optional.java:178) ~[?:?]
at dev.kameshs.demos.flink.iceberg.VehicleTelemetryProcessor.main(VehicleTelemetryProcessor.java:106) [main/:?]Kamesh Sampath
01/29/2025, 4:16 PMPedro Mázala
01/30/2025, 9:13 AMFlinkCatalog.createTable() means that the table identifier you are passing is either invalid, incomplete, or the catalog can’t figure out where the table is supposed to live. Most commonly, it’s because:
1. The database (namespace) is empty or invalid, e.g., an empty catalogNamespace.
2. The table name is empty or null, e.g., a missing catalogTable.
3. A required configuration (e.g., warehouse) or property is not present, causing Iceberg to fail resolving the path.
I'd add a log every time you do dotenv.get (for both catalog namespace and catalog table) and make sure those configs are coming properly and not null/empty.Kamesh Sampath
01/30/2025, 9:17 AMPedro Mázala
01/30/2025, 9:23 AMKamesh Sampath
01/30/2025, 9:24 AMminio s3 bucket I am using Nessie locallyKamesh Sampath
01/30/2025, 9:27 AMpublic void createTable(ObjectPath tablePath, CatalogBaseTable table, boolean ignoreIfExists) throws CatalogException, TableAlreadyExistException {
if (Objects.equals(table.getOptions().get("connector"), "iceberg")) {
throw new IllegalArgumentException("Cannot create the table with 'connector'='iceberg' table property in an iceberg catalog, Please create table with 'connector'='iceberg' property in a non-iceberg catalog or create table without 'connector'='iceberg' related properties in an iceberg table.");
} else {
Preconditions.checkArgument(table instanceof ResolvedCatalogTable, "table should be resolved");
this.createIcebergTable(tablePath, (ResolvedCatalogTable)table, ignoreIfExists);
}
}Kamesh Sampath
01/30/2025, 9:28 AMResolvedTable does that mean its expected a ResolvedCatalog table to be passed to createTable?Kamesh Sampath
01/30/2025, 9:28 AMResolvedCatalogTable resolvedCatalogTable = new ResolvedCatalogTable(leaderboardTable,ResolvedSchema.of(columns));Pedro Mázala
01/30/2025, 9:43 AMFlinkCatalog requires the incoming CatalogBaseTable to be an instance of ResolvedCatalogTable before it will create an Iceberg table. In your code, you’re currently constructing and passing a plain CatalogTable
You could either change it to a DDL or wrap your catalog into a ResolvedCatalogTable
import org.apache.flink.table.catalog.ResolvedCatalogTable;
import org.apache.flink.table.catalog.ResolvedSchema;
CatalogTable sinkTable = CatalogTable.newBuilder()
.schema(sinkSchema) // (an org.apache.flink.table.api.Schema)
.options(properties)
.build();
ResolvedSchema resolvedSchema = ResolvedSchema.physical(
sinkSchema.getColumns(),
sinkSchema.getWatermarkSpecs(),
sinkSchema.getPrimaryKey().orElse(null)
);
ResolvedCatalogTable resolvedTable = new ResolvedCatalogTable(sinkTable, resolvedSchema);
catalog.createTable(sinkPath, resolvedTable, false);
I did not test the code. I think this may be the issue thoKamesh Sampath
01/30/2025, 10:03 AMKamesh Sampath
01/30/2025, 10:03 AMKamesh Sampath
01/30/2025, 10:04 AMKamesh Sampath
01/30/2025, 10:11 AMsinkSchema.getColumns() gets me the list of UnresolvedColumn but physical expects Column, is it safe to cast ?Kamesh Sampath
01/30/2025, 10:24 AMfinal Schema sinkSchema =
Schema.newBuilder()
.column("player", DataTypes.STRING())
.column("balloon_color", DataTypes.STRING())
.column("score", DataTypes.BIGINT())
.column("favorite_color_bonus", DataTypes.BOOLEAN())
.column("timestamp", DataTypes.TIMESTAMP_LTZ(3))
.build();Kamesh Sampath
01/30/2025, 10:31 AMfinal ResolvedSchema leaderboardSchema =
ResolvedSchema.of(
Column.physical("player", DataTypes.STRING()),
Column.physical("balloon_color", DataTypes.STRING()),
Column.physical("score", DataTypes.STRING()),
Column.physical("favorite_color_bonus", DataTypes.STRING()),
Column.physical("timestamp", DataTypes.STRING()));
and where I was in need of Schema I did
Schema.newBuilder().fromResolvedSchema(leaderboardSchema).build()Kamesh Sampath
01/30/2025, 10:31 AMKamesh Sampath
01/30/2025, 11:37 AMPedro Mázala
01/30/2025, 1:04 PMKamesh Sampath
01/30/2025, 1:36 PMKamesh Sampath
01/30/2025, 1:36 PMKamesh Sampath
01/30/2025, 1:36 PMPedro Mázala
01/30/2025, 2:37 PMKamesh Sampath
01/30/2025, 2:45 PM