liurenjie1024 commented on code in PR #1600:
URL: https://github.com/apache/iceberg-rust/pull/1600#discussion_r2293293046


##########
crates/integrations/datafusion/tests/integration_datafusion_test.rs:
##########
@@ -432,3 +432,370 @@ async fn test_metadata_table() -> Result<()> {
 
     Ok(())
 }
+
+#[tokio::test]
+async fn test_insert_into() -> Result<()> {

Review Comment:
   Thanks for these tests, it would be much easier if we have sql logic tests.



##########
crates/integrations/datafusion/src/table/mod.rs:
##########
@@ -152,11 +174,52 @@ impl TableProvider for IcebergTableProvider {
     fn supports_filters_pushdown(
         &self,
         filters: &[&Expr],
-    ) -> std::result::Result<Vec<TableProviderFilterPushDown>, 
datafusion::error::DataFusionError>
-    {
+    ) -> DFResult<Vec<TableProviderFilterPushDown>> {
         // Push down all filters, as a single source of truth, the scanner 
will drop the filters which couldn't be push down
         Ok(vec![TableProviderFilterPushDown::Inexact; filters.len()])
     }
+
+    async fn insert_into(
+        &self,
+        _state: &dyn Session,
+        input: Arc<dyn ExecutionPlan>,
+        _insert_op: InsertOp,
+    ) -> DFResult<Arc<dyn ExecutionPlan>> {
+        if !self
+            .table

Review Comment:
   Sounds reasonable to me.



##########
crates/integrations/datafusion/src/table/mod.rs:
##########
@@ -140,8 +152,15 @@ impl TableProvider for IcebergTableProvider {
         filters: &[Expr],
         _limit: Option<usize>,
     ) -> DFResult<Arc<dyn ExecutionPlan>> {
+        // Refresh table if catalog is available
+        let table = if let Some(catalog) = &self.catalog {
+            
catalog.load_table(self.table.identifier()).await.map_err(to_datafusion_error)?
+        } else {
+            self.table.clone()
+        };
+

Review Comment:
   I agree that this maybe a problem, but I don't think we should do it here? 
Creating another issue to track this maybe a better approach.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to