alamb commented on a change in pull request #8090:
URL: https://github.com/apache/arrow/pull/8090#discussion_r481070644



##########
File path: rust/datafusion/tests/sql.rs
##########
@@ -682,6 +682,32 @@ fn query_length() -> Result<()> {
     Ok(())
 }
 
+#[test]
+fn query_concat() -> Result<()> {
+    let schema = Arc::new(Schema::new(vec![
+        Field::new("c1", DataType::Utf8, false),
+        Field::new("c2", DataType::Int32, true),
+    ]));
+
+    let data = RecordBatch::try_new(
+        schema.clone(),
+        vec![
+            Arc::new(StringArray::from(vec!["", "a", "aa", "aaa"])),
+            Arc::new(Int32Array::from(vec![Some(0), Some(1), None, Some(3)])),
+        ],
+    )?;
+
+    let table = MemTable::new(schema, vec![vec![data]])?;
+
+    let mut ctx = ExecutionContext::new();
+    ctx.register_table("test", Box::new(table));
+    let sql = "SELECT concat(c1, '-hi-', cast(c2 as varchar)) FROM test";
+    let actual = execute(&mut ctx, sql);
+    let expected = vec!["\"-hi-0\"", "\"a-hi-1\"", "\"\"", "\"aaa-hi-3\""];

Review comment:
       I am surprised that the third result is `""` and not `NULL` (as the 
third i32 input is NULL). Is that some artifact of using `execute`?




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


Reply via email to