kosiew commented on code in PR #22417:
URL: https://github.com/apache/datafusion/pull/22417#discussion_r3287690167
##########
datafusion-examples/examples/custom_data_source/custom_datasource.rs:
##########
@@ -53,6 +53,20 @@ pub async fn custom_datasource() -> Result<()> {
search_accounts(db.clone(), Some(col("bank_account").gt(lit(8000u64))),
1).await?;
search_accounts(db.clone(), Some(col("bank_account").gt(lit(200u64))),
2).await?;
+ // exercise SQL paths that push down non-trivial projections:
+ // - `SELECT 1 ...` requests no source columns (projection: Some([]))
+ // - `SELECT COUNT(id) ...` requests a single column (projection:
Some([0]))
+ let ctx = SessionContext::new();
+ ctx.register_table("accounts", Arc::new(db))?;
+ ctx.sql("SELECT 1 AS a FROM accounts")
Review Comment:
Nice addition to the regression coverage 👍
Right now the test only checks that the queries execute successfully. Since
this example already runs in CI, it could be helpful to also assert the
returned shape or values.
For example, `SELECT 1 AS a FROM accounts` could assert that it returns 3
rows and 1 column, and `SELECT COUNT(id)` could assert that the result is `3`.
That would make the test a bit stronger against future changes that
accidentally preserve the schema contract while changing the query semantics.
--
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]