Skip to content

Commit 9caae4f

Browse files
authored
Adds a cache for ParquetMetaData. (#16)
1 parent 0229e93 commit 9caae4f

File tree

3 files changed

+271
-19
lines changed

3 files changed

+271
-19
lines changed

datafusion/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ smallvec = { version = "1.6", features = ["union"] }
6969
rand = "0.8"
7070
# dependencies added in the cubestore fork start here.
7171
itertools = "0.9.0"
72+
lru = "0.6.5"
7273
serde = { version = "1.0", features = ["rc"] }
7374
serde_derive = "1.0"
7475
tracing = "0.1.25"

datafusion/src/physical_plan/expressions/in_list.rs

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ use std::sync::Arc;
2323
use arrow::array::GenericStringArray;
2424
use arrow::array::{
2525
ArrayRef, BooleanArray, Float32Array, Float64Array, Int16Array, Int32Array,
26-
Int64Array, Int8Array, StringOffsetSizeTrait, UInt16Array, UInt32Array, UInt64Array,
27-
UInt8Array, Int64Decimal0Array, Int64Decimal1Array, Int64Decimal2Array, Int64Decimal3Array, Int64Decimal4Array,
28-
Int64Decimal5Array, Int64Decimal10Array
26+
Int64Array, Int64Decimal0Array, Int64Decimal10Array, Int64Decimal1Array,
27+
Int64Decimal2Array, Int64Decimal3Array, Int64Decimal4Array, Int64Decimal5Array,
28+
Int8Array, StringOffsetSizeTrait, UInt16Array, UInt32Array, UInt64Array, UInt8Array,
2929
};
3030
use arrow::{datatypes::DataType, record_batch::RecordBatch};
3131

@@ -44,7 +44,7 @@ pub struct InListExpr {
4444
}
4545

4646
macro_rules! make_contains {
47-
($ARRAY:expr, $LIST_VALUES:expr, $NEGATED:expr, Int64Decimal, $ARRAY_TYPE:ident, $SCALE:expr) => {{
47+
($ARRAY:expr, $LIST_VALUES:expr, $NEGATED:expr, Int64Decimal, $ARRAY_TYPE:ident, $SCALE:expr) => {{
4848
let array = $ARRAY.as_any().downcast_ref::<$ARRAY_TYPE>().unwrap();
4949

5050
let mut contains_null = false;
@@ -317,25 +317,74 @@ impl PhysicalExpr for InListExpr {
317317
make_contains!(array, list_values, self.negated, UInt8, UInt8Array)
318318
}
319319
DataType::Int64Decimal(0) => {
320-
make_contains!(array, list_values, self.negated, Int64Decimal, Int64Decimal0Array, 0)
320+
make_contains!(
321+
array,
322+
list_values,
323+
self.negated,
324+
Int64Decimal,
325+
Int64Decimal0Array,
326+
0
327+
)
321328
}
322329
DataType::Int64Decimal(1) => {
323-
make_contains!(array, list_values, self.negated, Int64Decimal, Int64Decimal1Array, 1)
330+
make_contains!(
331+
array,
332+
list_values,
333+
self.negated,
334+
Int64Decimal,
335+
Int64Decimal1Array,
336+
1
337+
)
324338
}
325339
DataType::Int64Decimal(2) => {
326-
make_contains!(array, list_values, self.negated, Int64Decimal, Int64Decimal2Array, 2)
340+
make_contains!(
341+
array,
342+
list_values,
343+
self.negated,
344+
Int64Decimal,
345+
Int64Decimal2Array,
346+
2
347+
)
327348
}
328349
DataType::Int64Decimal(3) => {
329-
make_contains!(array, list_values, self.negated, Int64Decimal, Int64Decimal3Array, 3)
350+
make_contains!(
351+
array,
352+
list_values,
353+
self.negated,
354+
Int64Decimal,
355+
Int64Decimal3Array,
356+
3
357+
)
330358
}
331359
DataType::Int64Decimal(4) => {
332-
make_contains!(array, list_values, self.negated, Int64Decimal, Int64Decimal4Array, 4)
360+
make_contains!(
361+
array,
362+
list_values,
363+
self.negated,
364+
Int64Decimal,
365+
Int64Decimal4Array,
366+
4
367+
)
333368
}
334369
DataType::Int64Decimal(5) => {
335-
make_contains!(array, list_values, self.negated, Int64Decimal, Int64Decimal5Array, 5)
370+
make_contains!(
371+
array,
372+
list_values,
373+
self.negated,
374+
Int64Decimal,
375+
Int64Decimal5Array,
376+
5
377+
)
336378
}
337379
DataType::Int64Decimal(10) => {
338-
make_contains!(array, list_values, self.negated, Int64Decimal, Int64Decimal10Array, 10)
380+
make_contains!(
381+
array,
382+
list_values,
383+
self.negated,
384+
Int64Decimal,
385+
Int64Decimal10Array,
386+
10
387+
)
339388
}
340389
DataType::Boolean => {
341390
make_contains!(array, list_values, self.negated, Boolean, BooleanArray)

0 commit comments

Comments
 (0)