Skip to content

Apache DataFusion SQL Query Engine

Add test for querying predicate on dictionary (#3937)

Andrew Lambae13455cf0ee
diff --git a/datafusion/core/tests/sql/predicates.rs b/datafusion/core/tests/sql/predicates.rs
index 07e016a27d..b233ff5167 100644
--- a/datafusion/core/tests/sql/predicates.rs
+++ b/datafusion/core/tests/sql/predicates.rs
@@ -427,6 +427,34 @@ async fn csv_in_set_test() -> Result<()> {
Ok(())
}
+#[tokio::test]
+#[ignore]
+// https://github.com/apache/arrow-datafusion/issues/3936
+async fn in_set_string_dictionaries() -> Result<()> {
+ let input = vec![Some("foo"), Some("bar"), None, Some("fazzz")]
+ .into_iter()
+ .collect::<DictionaryArray<Int32Type>>();
+
+ let batch = RecordBatch::try_from_iter(vec![("c1", Arc::new(input) as _)]).unwrap();
+
+ let ctx = SessionContext::new();
+ ctx.register_batch("test", batch)?;
+
+ let sql = "SELECT * FROM test WHERE c1 IN ('foo', 'Bar', 'fazz')";
+ let actual = execute_to_batches(&ctx, sql).await;
+ let expected = vec![
+ "+-------+",
+ "| c1 |",
+ "+-------+",
+ "| foo |",
+ "| fazzz |",
+ "+-------+",
+ ];
+
+ assert_batches_eq!(expected, &actual);
+ Ok(())
+}
+
#[tokio::test]
#[ignore]
// https://github.com/apache/arrow-datafusion/issues/3635