0

I'm writing a CLI utility in Rust that allows users to do data-wrangling from the command-line. I managed to leverage Polar's join commands and parse the columns to join on using:

        let selcols1: Vec<_> = self.sel1.split(',').map(polars::lazy::dsl::col).collect();
        let selcols2: Vec<_> = self.sel2.split(',').map(polars::lazy::dsl::col).collect();

...

        let mut join_results = self
            .lf1
            .with_optimizations(optimize_all)
            .join_builder()
            .with(self.lf2.with_optimizations(optimize_all))
            .left_on(selcols1)
            .right_on(selcols2)
            .how(jointype)
            .force_parallel(true)
            .finish()
            .collect()?;

However, I haven't been able to figure out how to dynamically compose Polar Expressions from the command line, specifically, the ability to create a Filter expression using user-provided input.

Is there a way to do so?

I was looking at the Polars' python bindings to see how Python sends dynamically-composed expressions over to Rust-Polars to execute but haven't been able to decipher how to do so.

jnatividad
  • 151
  • 5

0 Answers0