jorgecarleitao commented on a change in pull request #8090:
URL: https://github.com/apache/arrow/pull/8090#discussion_r481275359
##########
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:
Yeah, it took me some time to figure that out also; it is an artifact
from `execute`. I changed its behavior to output NULL, but I think we may need
to reformulate that code at some point, as only `utf8` show `NULL`.
----------------------------------------------------------------
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]