forked from apache/datafusion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08343dd
commit 218ff7b
Showing
10 changed files
with
418 additions
and
270 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use datafusion::common::Result; | ||
use datafusion::prelude::{CsvReadOptions, SessionContext}; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<()> { | ||
let ctx = SessionContext::new(); | ||
ctx.register_csv( | ||
"examples", | ||
"../../datafusion/physical-expr/tests/data/regex.csv", | ||
CsvReadOptions::new(), | ||
) | ||
.await?; | ||
|
||
// | ||
// | ||
//regexp_count examples | ||
// | ||
// | ||
// regexp_count format is (regexp_count(text, regex[, flags]) | ||
// | ||
|
||
// use sql and regexp_count function to test col 'values', against patterns in col 'patterns' without flags | ||
let result = ctx | ||
.sql("select regexp_count(values, patterns) from examples") | ||
.await? | ||
.collect() | ||
.await?; | ||
|
||
println!("{:?}", result); | ||
assert_eq!(result.len(), 1); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.