You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/02/11 13:49:00 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #5253: [sqllogictest] Define output types and check them in tests

alamb commented on code in PR #5253:
URL: https://github.com/apache/arrow-datafusion/pull/5253#discussion_r1103630180


##########
datafusion/core/tests/sqllogictests/src/engines/postgres/mod.rs:
##########
@@ -290,27 +249,20 @@ impl sqllogictest::AsyncDB for Postgres {
             return Ok(DBOutput::StatementComplete(0));
         }
         let rows = self.client.query(sql, &[]).await?;
-        let output = rows
-            .iter()
-            .map(|row| {
-                row.columns()
-                    .iter()
-                    .enumerate()
-                    .map(|(idx, column)| cell_to_string(row, column, idx))
-                    .collect::<Vec<String>>()
-            })
-            .collect::<Vec<_>>();
 
-        if output.is_empty() {
-            let stmt = self.client.prepare(sql).await?;
-            Ok(DBOutput::Rows {
-                types: vec![DFColumnType::Any; stmt.columns().len()],
-                rows: vec![],
-            })
+        if rows.is_empty() {
+            return Ok(DBOutput::StatementComplete(0));

Review Comment:
   The opposite (empty result as a query result with schema) is probably a better behavior as it would allow checking types for statements like `COUNT(*) FROM foo WHERE false`



-- 
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