You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "iting0321 (via GitHub)" <gi...@apache.org> on 2026/05/18 05:36:19 UTC
Re: [PR] Integrate Paimon with Polaris without delegation mode [polaris]
iting0321 commented on code in PR #3820:
URL: https://github.com/apache/polaris/pull/3820#discussion_r3256552015
##########
plugins/spark/v3.5/spark/src/main/java/org/apache/polaris/spark/SparkCatalog.java:
##########
@@ -135,16 +145,42 @@ public void initialize(String name, CaseInsensitiveStringMap options) {
initRESTCatalog(name, options);
this.deltaHelper = new DeltaHelper(options);
this.hudiHelper = new HudiHelper(options);
- this.paimonHelper = new PaimonHelper(options);
+ this.paimonHelper = new PaimonHelper(name, options);
}
@Override
public Table loadTable(Identifier ident) throws NoSuchTableException {
+ // First, try to load as an Iceberg table
try {
return this.icebergsSparkCatalog.loadTable(ident);
} catch (NoSuchTableException e) {
- return this.polarisSparkCatalog.loadTable(ident);
+ // Not an Iceberg table, fall through to handle as generic table
}
+
+ // For generic tables, check the format/provider to decide delegation
+ // Use getTableFormat to avoid triggering Spark DataSource resolution for routing decisions
+ String provider = this.polarisSparkCatalog.getTableFormat(ident);
+
+ // Delegate to the appropriate catalog based on the provider
+ if (PolarisCatalogUtils.usePaimon(provider)) {
+ try {
+ // For Paimon tables, use Paimon's SparkCatalog to load the table
+ // This ensures proper handling of Paimon's metadata and schema files
+ TableCatalog paimonCatalog = paimonHelper.loadPaimonCatalog();
+ return paimonCatalog.loadTable(ident);
Review Comment:
Hi @dimas-b, I just deleted the integration test and update the PR title and description. Looking forward to your feedback!
##########
plugins/spark/v3.5/spark/src/main/java/org/apache/polaris/spark/SparkCatalog.java:
##########
@@ -135,16 +145,42 @@ public void initialize(String name, CaseInsensitiveStringMap options) {
initRESTCatalog(name, options);
this.deltaHelper = new DeltaHelper(options);
this.hudiHelper = new HudiHelper(options);
- this.paimonHelper = new PaimonHelper(options);
+ this.paimonHelper = new PaimonHelper(name, options);
}
@Override
public Table loadTable(Identifier ident) throws NoSuchTableException {
+ // First, try to load as an Iceberg table
try {
return this.icebergsSparkCatalog.loadTable(ident);
} catch (NoSuchTableException e) {
- return this.polarisSparkCatalog.loadTable(ident);
+ // Not an Iceberg table, fall through to handle as generic table
}
+
+ // For generic tables, check the format/provider to decide delegation
+ // Use getTableFormat to avoid triggering Spark DataSource resolution for routing decisions
+ String provider = this.polarisSparkCatalog.getTableFormat(ident);
+
+ // Delegate to the appropriate catalog based on the provider
+ if (PolarisCatalogUtils.usePaimon(provider)) {
+ try {
+ // For Paimon tables, use Paimon's SparkCatalog to load the table
+ // This ensures proper handling of Paimon's metadata and schema files
+ TableCatalog paimonCatalog = paimonHelper.loadPaimonCatalog();
+ return paimonCatalog.loadTable(ident);
Review Comment:
Hi @dimas-b, I just deleted the integration test and updated the PR title and description. Looking forward to your feedback!
--
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.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org