You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/10/03 21:01:34 UTC

[GitHub] [arrow-datafusion] houqp commented on a change in pull request #1068: Add support for UNION sql

houqp commented on a change in pull request #1068:
URL: https://github.com/apache/arrow-datafusion/pull/1068#discussion_r720900472



##########
File path: datafusion/src/execution/dataframe_impl.rs
##########
@@ -214,6 +215,20 @@ impl DataFrame for DataFrameImpl {
             .build()?;
         Ok(Arc::new(DataFrameImpl::new(self.ctx_state.clone(), &plan)))
     }
+
+    fn distinct(&self) -> Result<Arc<dyn DataFrame>> {

Review comment:
       perhaps it would be better to move this logic into the logical plan builder module, then we can reuse the same code in dataframe_impl and sql planner.

##########
File path: datafusion/tests/user_defined_plan.rs
##########
@@ -188,6 +190,44 @@ async fn run_and_compare_query_with_auto_schemas(
     Ok(())
 }
 
+// Run the query using the specified execution context and compare it
+// to the known result
+async fn run_and_compare_union_query(
+    mut ctx: ExecutionContext,
+    description: &str,
+) -> Result<()> {
+    let expected = vec![
+        "+-------------+---------+",
+        "| customer_id | revenue |",
+        "+-------------+---------+",
+        "| paul        | 300     |",
+        "| jorge       | 200     |",
+        "| andy        | 150     |",
+        "+-------------+---------+",
+    ];
+
+    let s = exec_sql(&mut ctx, QUERY2).await?;
+    let actual = s.lines().collect::<Vec<_>>();
+
+    assert_eq!(
+        expected,
+        actual,
+        "output mismatch for {}. Expectedn\n{}Actual:\n{}",
+        description,
+        expected.join("\n"),
+        s
+    );
+    Ok(())
+}
+
+#[tokio::test]
+

Review comment:
       nitpick, to keep the style consistent, we typically don't leave a newline between `#[tokio::test]` and the test implementation.




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org