JoeryH commented on code in PR #26317:
URL: https://github.com/apache/datafusion/pull/26317#discussion_r4495525613
##########
datafusion/sql/src/select.rs:
##########
@@ -1003,9 +1003,16 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
) -> Result<Vec<SelectExpr>> {
let mut prepared_select_exprs = Vec::with_capacity(projection.len());
let mut error_builder = DataFusionErrorBuilder::new();
+ let using_columns = plan.using_columns()?;
Review Comment:
good find, this caused about a 2% performance regression. making it lazy
removed this regression
##########
datafusion/sql/src/select.rs:
##########
@@ -1130,13 +1138,15 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
rename: options.opt_rename,
};
if let Some(replace) = options.opt_replace {
+ let using_columns = plan.using_columns()?;
Review Comment:
added this to
[wildcard.slt](https://github.com/apache/datafusion/pull/26317/changes#diff-865fa640b89d8db42fa46b8ba62dce797b7826bb4477785c2c3751e0e0fea474)
##########
datafusion/core/benches/sql_planner.rs:
##########
@@ -850,6 +850,26 @@ fn criterion_benchmark(c: &mut Criterion) {
});
}
+ // Nested SELECTs that each name every column of the one below
+ {
+ let columns = |qualifier: &str| {
+ (0..700)
+ .map(|i| format!("{qualifier}.c{i} AS c{i}"))
+ .collect::<Vec<_>>()
+ .join(", ")
+ };
+ let mut query = format!("SELECT {} FROM t700", columns("t700"));
+ for level in 0..8 {
+ query = format!(
+ "SELECT {} FROM ({query}) l{level}",
+ columns(&format!("l{level}"))
+ );
+ }
Review Comment:
Thanks for the suggestion, I added small width/depth case and
qualified-wildcard-only. Here are some of the results
| case | parent | before | now |
|-------------|--------|--------|-------|
| named 700×8 | 168.6 | 52.3 | 51.0 |
| named 100×8 | 8.70 | 5.88 | 5.90 |
| q.* 700×1 | 3.96 | 4.04 | 3.97 |
| q.* 700×8 | 18.31 | 18.63 | 18.38 |
--
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]