cj-zhukov commented on code in PR #18946:
URL: https://github.com/apache/datafusion/pull/18946#discussion_r2591406127


##########
datafusion-examples/examples/builtin_functions/regexp.rs:
##########
@@ -32,12 +35,30 @@ use datafusion::prelude::*;
 /// https://docs.rs/regex/latest/regex/#grouping-and-flags
 pub async fn regexp() -> Result<()> {
     let ctx = SessionContext::new();
-    ctx.register_csv(
-        "examples",
-        "datafusion/physical-expr/tests/data/regex.csv",
-        CsvReadOptions::new(),
-    )
-    .await?;
+    // content from file 'datafusion/physical-expr/tests/data/regex.csv'
+    let csv_data = r#"values,patterns,replacement,flags
+abc,^(a),bb\1bb,i

Review Comment:
   I inlined the CSV because I ran into issues reading files that live outside 
the `datafusion-examples`crate 
(https://github.com/apache/datafusion/pull/18946#issuecomment-3588064235) The 
relative path works locally but not in CI, so the example couldn’t reliably 
find `datafusion/physical-expr/tests/data/regex.csv`
   
   To keep the example self-contained and stable in CI, I embedded the data and 
wrote it to a temp file before registering it.
   
   Longer term, a cleaner solution might be to store example data directly 
inside the `datafusion-examples` crate (e.g. an `examples/data/folder`). I’d be 
happy to work with that in a follow-up.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to