Dandandan commented on a change in pull request #9015:
URL: https://github.com/apache/arrow/pull/9015#discussion_r549035257
##########
File path: rust/benchmarks/src/bin/tpch.rs
##########
@@ -1205,3 +1206,406 @@ fn get_schema(table: &str) -> Schema {
_ => unimplemented!(),
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use std::env;
+ use std::sync::Arc;
+
+ use arrow::array::*;
+ use arrow::record_batch::RecordBatch;
+ use arrow::util::display::array_value_to_string;
+
+ use datafusion::logical_plan::Expr;
+ use datafusion::logical_plan::Expr::Cast;
+
+ #[tokio::test]
+ async fn q1() -> Result<()> {
+ verify_query(1).await
+ }
+
+ #[tokio::test]
+ async fn q2() -> Result<()> {
+ verify_query(2).await
+ }
+
+ #[tokio::test]
+ async fn q3() -> Result<()> {
+ verify_query(3).await
+ }
+
+ #[tokio::test]
+ async fn q4() -> Result<()> {
+ verify_query(4).await
+ }
+
+ #[tokio::test]
+ async fn q5() -> Result<()> {
+ verify_query(5).await
+ }
+
+ #[tokio::test]
+ async fn q6() -> Result<()> {
+ verify_query(6).await
+ }
+
+ #[tokio::test]
+ async fn q7() -> Result<()> {
+ verify_query(7).await
+ }
+
+ #[tokio::test]
+ async fn q8() -> Result<()> {
+ verify_query(8).await
+ }
+
+ #[tokio::test]
+ async fn q9() -> Result<()> {
+ verify_query(9).await
+ }
+
+ #[tokio::test]
+ async fn q10() -> Result<()> {
+ verify_query(10).await
+ }
+
+ #[tokio::test]
+ async fn q11() -> Result<()> {
+ verify_query(11).await
+ }
+
+ #[tokio::test]
+ async fn q12() -> Result<()> {
+ verify_query(12).await
+ }
+
+ #[tokio::test]
+ async fn q13() -> Result<()> {
+ verify_query(13).await
+ }
+
+ #[tokio::test]
+ async fn q14() -> Result<()> {
+ verify_query(14).await
+ }
+
+ #[tokio::test]
+ async fn q15() -> Result<()> {
+ verify_query(15).await
+ }
+
+ #[tokio::test]
+ async fn q16() -> Result<()> {
+ verify_query(16).await
+ }
+
+ #[tokio::test]
+ async fn q17() -> Result<()> {
+ verify_query(17).await
+ }
+
+ #[tokio::test]
+ async fn q18() -> Result<()> {
+ verify_query(18).await
+ }
+
+ #[tokio::test]
+ async fn q19() -> Result<()> {
+ verify_query(19).await
+ }
+
+ #[tokio::test]
+ async fn q20() -> Result<()> {
+ verify_query(20).await
+ }
+
+ #[tokio::test]
+ async fn q21() -> Result<()> {
+ verify_query(21).await
+ }
+
+ #[tokio::test]
+ async fn q22() -> Result<()> {
+ verify_query(22).await
+ }
+
+ /// Specialised String representation
+ fn col_str(column: &ArrayRef, row_index: usize) -> String {
+ if column.is_null(row_index) {
+ return "NULL".to_string();
+ }
+
+ // Special case ListArray as there is no pretty print support for it
yet
+ if let DataType::FixedSizeList(_, n) = column.data_type() {
+ let array = column
+ .as_any()
+ .downcast_ref::<FixedSizeListArray>()
+ .unwrap()
+ .value(row_index);
+
+ let mut r = Vec::with_capacity(*n as usize);
+ for i in 0..*n {
+ r.push(col_str(&array, i as usize));
+ }
+ return format!("[{}]", r.join(","));
+ }
+
+ array_value_to_string(column, row_index)
+ .ok()
+ .unwrap_or_else(|| "???".to_string())
Review comment:
Better to have either a good error message or do normal unwrap if it
doesn't occur in test code.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]