Skip to content

Instantly share code, notes, and snippets.

View alamb's full-sized avatar

Andrew Lamb alamb

View GitHub Profile
@alamb
alamb / gist:acd653c49e318ff70672b61325ba3443
Created October 16, 2022 10:08
Nested structure parquet encoding example
#[test]
fn test_foo() {
let mut a = ListBuilder::new(Int32Builder::new());
a.values().append_value(1);
a.append(true);
a.append(false);
a.values().append_null();
a.values().append_null();
a.append(true);
let values = Arc::new(a.finish()) as ArrayRef;
@alamb
alamb / test_iterator.rs
Created January 7, 2022 21:58
Test of creating arrow arrays from iterators that incorrectly report their bounds
use arrow::array::UInt64Array;
// Make an iterator that is untruthful about its actual length (say it is shorter than it really is):
struct BadIterator {
/// where the iterator currently is
cur: u64,
/// How many items will this iterator *actually* make
pub limit: u64,
// Please find the full, tested version in
// https://github.com/influxdata/influxdb_iox/blob/fe155e15fb2ad166aee66b0458e63c24a8128dd4/query/src/exec/task.rs#L101-L118
pub struct DedicatedExecutor {
state: Arc<Mutex<State>>,
}
/// Runs futures (and any `tasks` that are `tokio::task::spawned` by
/// them) on a separate Tokio Executor
struct State {