alamb commented on a change in pull request #1202:
URL: https://github.com/apache/arrow-datafusion/pull/1202#discussion_r741891292
##########
File path: datafusion/tests/sql.rs
##########
@@ -5305,3 +5305,57 @@ async fn case_with_bool_type_result() -> Result<()> {
assert_eq!(expected, actual);
Ok(())
}
+
+#[tokio::test]
+async fn use_between_experssion_in_select_query() -> Result<()> {
+ let mut ctx = ExecutionContext::new();
+
+ let sql = "SELECT 1 NOT BETWEEN 3 AND 5";
+ let actual = execute_to_batches(&mut ctx, sql).await;
+ let expected = vec![
+ "+---------------+",
+ "| Boolean(true) |",
+ "+---------------+",
+ "| true |",
+ "+---------------+",
+ ];
+ assert_batches_eq!(expected, &actual);
+
+ let input = Int64Array::from(vec![1, 2, 3, 4]);
+ let batch = RecordBatch::try_from_iter(vec![("c1", Arc::new(input) as
_)]).unwrap();
+ let table = MemTable::try_new(batch.schema(), vec![vec![batch]])?;
+ ctx.register_table("test", Arc::new(table))?;
+
+ let sql = "SELECT abs(c1) BETWEEN 0 AND LoG(c1 * 100 ) FROM test";
+ let actual = execute_to_batches(&mut ctx, sql).await;
+ // Expect field name to be correctly converted for expr, low and high.
+ let expected = vec![
+
"+--------------------------------------------------------------------+",
+ "| abs(test.c1) BETWEEN Int64(0) AND log(test.c1 Multiply Int64(100))
|",
+
"+--------------------------------------------------------------------+",
+ "| true
|",
+ "| true
|",
+ "| false
|",
+ "| false
|",
+
"+--------------------------------------------------------------------+",
+ ];
+ assert_batches_eq!(expected, &actual);
+
+ let sql = "EXPLAIN SELECT c1 BETWEEN 2 AND 3 FROM test";
Review comment:
I think this one is fine -- thank you @capkurmagati
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]