plusplusjiajia commented on code in PR #733:
URL: https://github.com/apache/paimon-rust/pull/733#discussion_r3830328219


##########
crates/integrations/datafusion/src/catalog.rs:
##########
@@ -465,9 +603,39 @@ impl SchemaProvider for PaimonSchemaProvider {
         let schema_force_view_types = self.schema_force_view_types;
         let identifier = Identifier::new(self.database.clone(), 
object.table().to_string());
         let branch = object.branch().map(str::to_string);
+        let table_engines: HashMap<PaimonTableType, Arc<dyn 
TableEngineResolver>> = self
+            .table_engines
+            .read()
+            .unwrap_or_else(|e| e.into_inner())
+            .clone();
         await_with_runtime(async move {
-            match catalog.get_table(&identifier).await {
-                Ok(mut table) => {
+            let engine_types: HashSet<PaimonTableType> = 
table_engines.keys().copied().collect();
+            match catalog.load_table_routing(&identifier, &engine_types).await 
{
+                Ok(paimon::catalog::RoutedTableLoad::Engine(declared)) => {
+                    if branch.is_some() {
+                        return Err(plan_datafusion_err!(
+                            "branches are not supported for '{}' tables 
('{}')",
+                            declared,
+                            identifier.full_name()
+                        ));
+                    }
+                    let resolver = table_engines
+                        .get(&declared)
+                        .expect("declared type came from this engine map");
+                    let resolved = resolver
+                        .resolve_table(identifier.database(), 
identifier.object())
+                        .await?;
+                    // Read-only wrap: DML must not reach the engine provider.
+                    Ok(resolved.map(|inner| {

Review Comment:
   @JingsongLi The reproduction steps helped. Sweeping that surface turned up 
three more ways in: session selectors, selectors stored in the table's own 
options, and unsupported scan options. All rejected now, and registration 
installs the relation planner so the rejection holds without SQLContext.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to