Skip to content

Commit

Permalink
use datafusion for understanding
Browse files Browse the repository at this point in the history
  • Loading branch information
GStechschulte committed Jul 14, 2024
1 parent 2cb114c commit 5cb8239
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@ use std::fs::File;
use std::path::Path;
use std::sync::Arc;

use arrow::array::{ArrayRef, BooleanArray, Int16Array, Int32Array, Int64Array, StringArray};
use arrow::array::RecordBatch;
use arrow::array::{ArrayRef, BooleanArray, Int16Array, Int64Array, StringArray};
use arrow::compute::filter;
use arrow_csv::ReaderBuilder;
// use arrow::csv::ReaderBuilder;
// use arrow::datatypes::{DataType, Field, Schema};
use arrow::error::Result;
// use arrow::record_batch::RecordBatch;
use arrow::array::RecordBatch;
use arrow_csv::ReaderBuilder;
use arrow_schema::*;
use rust_query::arrow_types;

fn filter_by_group(col_idx: usize, group: i64, batch: &RecordBatch) -> Result<RecordBatch> {
let filter_array = batch
Expand Down Expand Up @@ -39,12 +35,6 @@ fn filter_by_group(col_idx: usize, group: i64, batch: &RecordBatch) -> Result<Re

// Use our rust-query library
fn main() {
let a = Int32Array::from(vec![10]);
let b = arrow_types::Int8Type::from(vec![10]);

println!("{:?}", a);
println!("{:?}", b);

// Code for the query `SELECT * FROM employee WHERE state = 'CO'`
// against a CSV file containing the columns `id`, `first_name`,
// `last_name`, `state`, `job_title`, and `salary`
Expand Down Expand Up @@ -111,6 +101,9 @@ fn main() {
let c = filter(&my_col, &filter_array).unwrap();
println!("{:?}", c);

let projection: Vec<&str> = vec!["Testing"];
println!("{:?}", projection);

// let filter_array = batch
// .column(col_idx)
// .as_any()
Expand Down

0 comments on commit 5cb8239

Please sign in to comment.