Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flink] Fix Table Doesn't Exist Exception when Reading System Tables with Flink Generic Catalog #2428

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix Table Doesn't Exist Exception when Reading System Tables with Fli…
…nk Generic Catalog.
  • Loading branch information
zhuangchong committed Nov 30, 2023
commit 744f8fe3078201fed27059d04ca82b5ba221e6fb
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,18 @@ public void dropFunction(ObjectPath functionPath, boolean ignoreIfNotExists)
@Override
public CatalogTableStatistics getTableStatistics(ObjectPath tablePath)
throws TableNotExistException, CatalogException {
if (isPaimonTable(tablePath)) {
return paimon.getTableStatistics(tablePath);
}
return flink.getTableStatistics(tablePath);
}

@Override
public CatalogColumnStatistics getTableColumnStatistics(ObjectPath tablePath)
throws TableNotExistException, CatalogException {
if (isPaimonTable(tablePath)) {
return paimon.getTableColumnStatistics(tablePath);
}
return flink.getTableColumnStatistics(tablePath);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,24 @@ public void testPaimonTableToBlackHole() {
sql("CREATE TABLE bh (f0 INT, f1 INT) WITH ('connector'='blackhole')");
sql("INSERT INTO bh SELECT * FROM paimon_t");
}

@Test
public void testReadPaimonSystemTable() {
sql(
"CREATE TABLE paimon_t (\n"
+ " user_id BIGINT,\n"
+ " item_id BIGINT,\n"
+ " behavior STRING,\n"
+ " dt STRING,\n"
+ " PRIMARY KEY (dt, user_id) NOT ENFORCED\n"
+ ") PARTITIONED BY (dt) "
+ " WITH ('connector'='paimon', 'file.format' = 'avro' )");
sql("INSERT INTO paimon_t VALUES (1, 2, 'click', '2023-11-01')");
sql("INSERT INTO paimon_t VALUES (2, 3, 'click', '2023-11-02')");

List<Row> result =
sql("SELECT snapshot_id, schema_id, commit_kind FROM paimon_t$snapshots");

assertThat(result).containsExactly(Row.of(1L, 0L, "APPEND"), Row.of(2L, 0L, "APPEND"));
}
}
Loading