kosiew commented on code in PR #24738:
URL: https://github.com/apache/datafusion/pull/24738#discussion_r4053216913
##########
benchmarks/src/statistics.rs:
##########
@@ -772,6 +786,80 @@ mod tests {
assert!(!reports.is_empty());
}
+ async fn report_query_files(
+ options: &RunOpt,
+ ctx: &SessionContext,
+ ) -> Vec<QueryReport> {
+ let mut reports = vec![];
+ for path in query_files(&options.query_path,
options.query.as_deref()).unwrap() {
+ options
+ .report_query_file(ctx, &path, None, &mut reports)
+ .await
+ .unwrap();
+ }
+ reports
+ }
+
+ #[tokio::test]
+ async fn refreshes_sql_dialect_between_query_files() {
+ let directory = tempdir().unwrap();
+ fs::write(
+ directory.path().join("01.sql"),
+ "SET datafusion.sql_parser.dialect = 'MySQL'",
+ )
+ .unwrap();
+ fs::write(directory.path().join("02.sql"), "# MySQL comment\nSELECT
1").unwrap();
+ let options = RunOpt {
+ query: None,
+ compare: None,
+ path: directory.path().to_path_buf(),
+ query_path: directory.path().to_path_buf(),
+ };
+
+ let reports = report_query_files(&options,
&SessionContext::new()).await;
Review Comment:
Could we extend this test with a third file after `RESET
datafusion.sql_parser.dialect` that uses syntax supported by the default
dialect? That would verify that the parser options are refreshed repeatedly,
including after a reset, rather than only testing the initial transition to
MySQL.
--
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]