alamb commented on a change in pull request #1371:
URL: https://github.com/apache/arrow-datafusion/pull/1371#discussion_r759581401
##########
File path: datafusion/tests/dataframe.rs
##########
@@ -77,3 +77,37 @@ async fn join() -> Result<()> {
Ok(())
}
+
+
+#[tokio::test]
+async fn test_starts_with() -> Result<()> {
+ let schema = Arc::new(Schema::new(vec![
+ Field::new("a", DataType::Utf8, false),
+ Field::new("b", DataType::Int32, false),
+ ]));
+
+ // define data.
+ let batch = RecordBatch::try_new(
+ schema.clone(),
+ vec![
+ Arc::new(StringArray::from(vec!["abcdef", "abc123", "ab_def",
"a_bcdef"])),
+ Arc::new(Int32Array::from(vec![1, 10, 10, 100])),
+ ],
+ )?;
+
+ let mut ctx = ExecutionContext::new();
+
+ let table = MemTable::try_new(schema, vec![vec![batch]])?;
+
+ ctx.register_table("aa", Arc::new(table))?;
+
+ let df = ctx.table("aa")?;
+
+ let df = df.filter( starts_with(col("a"), lit("abc")))?;
+
+ let batches = df.collect().await?;
Review comment:
A common way to compare the output of running a query with expected
answers is using `assert_batches_eq`, for example
https://github.com/apache/arrow-datafusion/blob/15db29153aefc9b759ec03e6eeab8cb9ebf87781/datafusion/tests/sql.rs#L272-L286
--
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]