You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "dqkqd (via GitHub)" <gi...@apache.org> on 2025/11/11 16:42:26 UTC
Re: [PR] bugfix: select_columns should validate column names [datafusion]
dqkqd commented on code in PR #18623:
URL: https://github.com/apache/datafusion/pull/18623#discussion_r2514921530
##########
datafusion/core/tests/dataframe/mod.rs:
##########
@@ -305,6 +305,17 @@ async fn select_columns() -> Result<()> {
Ok(())
}
+#[tokio::test]
+async fn select_columns_with_nonexistent_columns() -> Result<()> {
+ let t = test_table().await?;
+ let t2 = t.select_columns(&["canada", "c2", "rocks"]);
+ let Err(DataFusionError::SchemaError(_, _)) = t2 else {
+ return internal_err!("select_columns with nonexistent columns should error");
+ };
Review Comment:
We could verify the actual error message here (or using `assert_snapshot!`):
```suggestion
assert_contains!(
t2.unwrap_err().strip_backtrace(),
"Schema error: No field named canada"
);
```
--
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@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org