Search before asking
What happened
I found that in JdbcSource, the CatalogTable obtained from JDBC metadata has empty partitionKeys.
The scenario where I noticed this problem was metadata retrieval, but the issue itself is more general: JdbcSource does not preserve partition key metadata in the generated CatalogTable.
For a partitioned table, the resulting metadata is still similar to:
CatalogTable{..., partitionKeys=[], ...}
I checked the JDBC catalog-building code and found that partitionKeys are explicitly initialized as empty in the current implementation.
In AbstractJdbcCatalog#getTable, CatalogTable is created with empty partition keys:
return CatalogTable.of(
tableIdentifier,
tableSchemaBuilder.build(),
buildConnectorOptions(tablePath),
Collections.emptyList(),
"",
catalogName);
In CatalogUtils, CatalogTable built from query metadata also uses empty partition keys:
return CatalogTable.of(
tableIdentifier,
tableSchema,
new HashMap<>(),
new ArrayList<>(),
"",
catalogName);
Because of this, JdbcSource loses partition metadata in the resulting CatalogTable.
The scenario where I found this issue was metadata retrieval, but the problem itself is in JdbcSource metadata generation:
- JdbcSource gets a CatalogTable
- the partitionKeys in that CatalogTable are empty
- partition metadata is lost on the JDBC source side
Expected behavior:
- for partitioned source tables, CatalogTable.partitionKeys should contain the actual partition key columns
Actual behavior:
- CatalogTable.partitionKeys is empty in JdbcSource
SeaTunnel Version
2.3.9
SeaTunnel Config
env {
parallelism = 1
job.mode = "BATCH"
}
source {
Jdbc {
url = "jdbc:hive2://localhost:10000/default"
driver = "org.apache.hive.jdbc.HiveDriver"
user = "test"
password = "test"
table_path = "default.partitioned_table"
}
}
sink {
Console {}
}
Running Command
./bin/seatunnel.sh --config config/jdbc_hive_test.conf
Error Exception
No explicit exception is thrown.
But the CatalogTable used by JdbcSource contains:
CatalogTable{..., partitionKeys=[], ...}
Zeta or Flink or Spark Version
Flink 1.18
Java or Scala Version
java 8
Screenshots
No response
Are you willing to submit PR?
Code of Conduct
Search before asking
What happened
I found that in
JdbcSource, theCatalogTableobtained from JDBC metadata has emptypartitionKeys.The scenario where I noticed this problem was metadata retrieval, but the issue itself is more general:
JdbcSourcedoes not preserve partition key metadata in the generatedCatalogTable.For a partitioned table, the resulting metadata is still similar to:
I checked the JDBC catalog-building code and found that partitionKeys are explicitly initialized as empty in the current implementation.
In AbstractJdbcCatalog#getTable, CatalogTable is created with empty partition keys:
In CatalogUtils, CatalogTable built from query metadata also uses empty partition keys:
Because of this, JdbcSource loses partition metadata in the resulting CatalogTable.
The scenario where I found this issue was metadata retrieval, but the problem itself is in JdbcSource metadata generation:
Expected behavior:
Actual behavior:
SeaTunnel Version
2.3.9
SeaTunnel Config
Running Command
Error Exception
Zeta or Flink or Spark Version
Flink 1.18
Java or Scala Version
java 8
Screenshots
No response
Are you willing to submit PR?
Code of Conduct