use dialect in SqlExec::sql#353
Conversation
| } else { | ||
| let dialect = self.engine.map_or( | ||
| Arc::new(DefaultDialect {}) as Arc<dyn Dialect + Send + Sync>, | ||
| self.dialect.clone().unwrap_or(Arc::new(DefaultDialect {})), |
There was a problem hiding this comment.
for learning purpose: when would the .sql() method be used when it uses the dialect that's other than the engine.dialect()
| filters, | ||
| limit, | ||
| Some(Engine::DuckDB), | ||
| None, |
There was a problem hiding this comment.
the DuckDB base table could have a dialect that should be passed down: https://github.com/datafusion-contrib/datafusion-table-providers/pull/353/files#diff-6e8213f7056d1bef7f632b7c1e289735154b95765ac43689561b64ae41d1bb29L57
| filters, | ||
| limit, | ||
| Some(Engine::MySQL), | ||
| None, |
There was a problem hiding this comment.
The MySQL base table could have a dialect that should be passed down: https://github.com/datafusion-contrib/datafusion-table-providers/pull/353/files#diff-e670da4ce6b50dcd434760d240a10d1d2d626220577c4846688242575123f36bL54
| let quote = |name| { | ||
| let quote = self | ||
| .dialect | ||
| .as_ref() | ||
| .and_then(|d| d.identifier_quote_style(name)) | ||
| .unwrap_or('"'); | ||
| format!("{quote}{name}{quote}") | ||
| }; |
There was a problem hiding this comment.
can this inline closure be moved to its own function?
| filters, | ||
| limit, | ||
| Some(Engine::SQLite), | ||
| None, |
There was a problem hiding this comment.
The base table on the SQLiteTable has a dialect that could be passed down.
|
Closing this in favor of a different solution |
Use the dialect given to
SqlTableinSqlExec::sql.