NGA-TRAN commented on code in PR #16742:
URL: https://github.com/apache/datafusion/pull/16742#discussion_r2200734851
##########
datafusion/proto/tests/cases/roundtrip_physical_plan.rs:
##########
@@ -1780,3 +1780,111 @@ async fn
test_tpch_part_in_list_query_with_real_parquet_data() -> Result<()> {
Ok(())
}
+
+/// Helper function to create a SessionContext with all TPC-H tables
registered as external tables
+async fn tpch_context() -> Result<SessionContext> {
+ use datafusion_common::test_util::datafusion_test_data;
+
+ let ctx = SessionContext::new();
+ let test_data = datafusion_test_data();
+
+ // TPC-H table names
+ let tables = [
+ "part", "supplier", "partsupp", "customer", "orders", "lineitem",
"nation",
+ "region",
+ ];
+
+ // Create external tables for all TPC-H tables
+ for table in &tables {
+ let table_sql = format!(
+ "CREATE EXTERNAL TABLE {table} STORED AS PARQUET LOCATION
'{test_data}/tpch_{table}_small.parquet'"
+ );
+ ctx.sql(&table_sql).await.map_err(|e| {
+ DataFusionError::External(
+ format!("Failed to create {table} table: {e}").into(),
+ )
+ })?;
+ }
+
+ Ok(ctx)
+}
+
+/// Helper function to get TPC-H query SQL
+fn get_tpch_query_sql(query: usize) -> Result<Vec<String>> {
+ use std::fs;
+
+ if !(1..=22).contains(&query) {
+ return Err(DataFusionError::External(
+ format!("Invalid TPC-H query number: {query}").into(),
+ ));
+ }
+
+ let filename = format!("../../benchmarks/queries/q{query}.sql");
+ let contents = fs::read_to_string(&filename).map_err(|e| {
+ DataFusionError::External(
+ format!("Failed to read query file {filename}: {e}").into(),
+ )
+ })?;
+
+ Ok(contents
+ .split(';')
+ .map(|s| s.trim())
+ .filter(|s| !s.is_empty())
+ .map(|s| s.to_string())
+ .collect())
+}
+
+// Skip q16 until https://github.com/apache/datafusion/issues/16665 is fixed
+#[tokio::test]
+async fn test_serialize_deserialize_tpch_queries() -> Result<()> {
Review Comment:
I am thinking to merge the [failed q16 test
](https://github.com/apache/datafusion/pull/16662/files) into this test to make
it one test
--
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]