You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/08 12:29:28 UTC

[GitHub] [arrow-datafusion] milenkovicm opened a new pull request, #4143: update table provider factory to schema parameter

milenkovicm opened a new pull request, #4143:
URL: https://github.com/apache/arrow-datafusion/pull/4143

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes #4142.
   
   # Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   # What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   # Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   # Are there any user-facing changes?
   
   `TableProviderFactory::create` is a public interface and change will be backward incompatible, but as this interface is in state of flux recently it would make sense to break it now 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #4143: add schema parameter to table provider factory create method

Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #4143:
URL: https://github.com/apache/arrow-datafusion/pull/4143#discussion_r1017144754


##########
datafusion/core/tests/sql/create_drop.rs:
##########
@@ -387,6 +387,36 @@ async fn create_custom_table() -> Result<()> {
     Ok(())
 }
 
+#[tokio::test]
+async fn create_external_table_with_ddl() -> Result<()> {
+    let mut table_factories: HashMap<String, Arc<dyn TableProviderFactory>> =
+        HashMap::new();
+    table_factories.insert("mocktable".to_string(), Arc::new(TestTableFactory {}));
+    let cfg = RuntimeConfig::new().with_table_factories(table_factories);
+    let env = RuntimeEnv::new(cfg).unwrap();
+    let ses = SessionConfig::new();
+    let ctx = SessionContext::with_config_rt(ses, Arc::new(env));
+
+    let sql = "CREATE EXTERNAL TABLE dt (a_id integer, a_str string, a_bool boolean) STORED AS MOCKTABLE LOCATION 'mockprotocol://path/to/table';";
+    ctx.sql(sql).await.unwrap();
+
+    let cat = ctx.catalog("datafusion").unwrap();
+    let schema = cat.schema("public").unwrap();
+
+    let exists = schema.table_exist("dt");
+    assert!(exists, "Table should have been created!");
+
+    let table_schema = schema.table("dt").unwrap().schema();
+
+    assert_eq!(3, table_schema.fields().len());
+
+    assert_eq!(&DataType::Int32, table_schema.field(0).data_type());

Review Comment:
   👍 



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] milenkovicm commented on pull request #4143: add schema parameter to table provider factory create method

Posted by GitBox <gi...@apache.org>.
milenkovicm commented on PR #4143:
URL: https://github.com/apache/arrow-datafusion/pull/4143#issuecomment-1308554119

   thanks @alamb, looks like #4126 did most of the job I was intending with this pr, schema can be extracted from `cmd` directly. so this pr at the end contributes test for part of #4126
   
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #4143: add schema parameter to table provider factory create method

Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #4143:
URL: https://github.com/apache/arrow-datafusion/pull/4143#discussion_r1018225257


##########
datafusion/core/tests/sql/create_drop.rs:
##########
@@ -387,6 +387,36 @@ async fn create_custom_table() -> Result<()> {
     Ok(())
 }
 
+#[tokio::test]
+async fn create_external_table_with_ddl() -> Result<()> {
+    let mut table_factories: HashMap<String, Arc<dyn TableProviderFactory>> =
+        HashMap::new();
+    table_factories.insert("mocktable".to_string(), Arc::new(TestTableFactory {}));

Review Comment:
   this is so cool



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] andygrove commented on pull request #4143: add schema parameter to table provider factory create method

Posted by GitBox <gi...@apache.org>.
andygrove commented on PR #4143:
URL: https://github.com/apache/arrow-datafusion/pull/4143#issuecomment-1307570745

   @avantgardnerio may be interested in reviewing this as well


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] ursabot commented on pull request #4143: add schema parameter to table provider factory create method

Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #4143:
URL: https://github.com/apache/arrow-datafusion/pull/4143#issuecomment-1309101381

   Benchmark runs are scheduled for baseline = 130354394ed8657a90e89a0bb65643e01715811a and contender = 9692fb01604cb2c25a05e49d6a4e6c30c1d32c75. 9692fb01604cb2c25a05e49d6a4e6c30c1d32c75 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/779fa06d42e84ca3a108e74c3fa06c96...a4b423553a314a6a872b406d191c5d25/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/5f645e789c1349118a3964848e43c0cd...afb1582a7b304a0b9c982067bffcca4c/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/3ccf4937a9134564a9b7857c28b0461f...8bdcf4cd9e934f68bb514991e01f7300/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/03f2fc6b2c344f44a8bc98909150a2ed...7b1f94fe0ca54a7894cb11fd9775ddf2/)
   Buildkite builds:
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
   test-mac-arm: Supported benchmark langs: C++, Python, R
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] andygrove commented on pull request #4143: add schema parameter to table provider factory create method

Posted by GitBox <gi...@apache.org>.
andygrove commented on PR #4143:
URL: https://github.com/apache/arrow-datafusion/pull/4143#issuecomment-1307352964

   Thanks @milenkovicm. The changes seem reasonable, but could you add some tests?


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb merged pull request #4143: add schema parameter to table provider factory create method

Posted by GitBox <gi...@apache.org>.
alamb merged PR #4143:
URL: https://github.com/apache/arrow-datafusion/pull/4143


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org