tobyhede commented on a change in pull request #1371:
URL: https://github.com/apache/arrow-datafusion/pull/1371#discussion_r761607457
##########
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:
Thanks @alamb - I discovered that one in my digging, so much easier than
what I was attempting to do.
Working on some of the other functions atm.
--
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]