tustvold commented on code in PR #4057:
URL: https://github.com/apache/arrow-datafusion/pull/4057#discussion_r1010953480
##########
datafusion/physical-expr/src/expressions/in_list.rs:
##########
@@ -17,50 +17,31 @@
//! InList expression
+use ahash::RandomState;
use std::any::Any;
-use std::collections::HashSet;
use std::fmt::Debug;
use std::sync::Arc;
-use arrow::array::GenericStringArray;
-use arrow::array::{
- ArrayRef, BooleanArray, Float32Array, Float64Array, Int16Array, Int32Array,
- Int64Array, Int8Array, OffsetSizeTrait, TimestampMicrosecondArray,
- TimestampMillisecondArray, TimestampNanosecondArray, TimestampSecondArray,
- UInt16Array, UInt32Array, UInt64Array, UInt8Array,
-};
-use arrow::{
- datatypes::{DataType, Schema},
- record_batch::RecordBatch,
-};
-
+use crate::hash_utils::HashValue;
use crate::physical_expr::down_cast_any_ref;
use crate::utils::expr_list_eq_any_order;
use crate::PhysicalExpr;
use arrow::array::*;
-use arrow::datatypes::TimeUnit;
-use datafusion_common::cast::as_date32_array;
-use datafusion_common::ScalarValue;
-use datafusion_common::ScalarValue::{
- Binary, Boolean, Date32, Date64, Decimal128, Int16, Int32, Int64, Int8,
LargeBinary,
- LargeUtf8, TimestampMicrosecond, TimestampMillisecond, TimestampNanosecond,
- TimestampSecond, UInt16, UInt32, UInt64, UInt8, Utf8,
-};
-use datafusion_common::{DataFusionError, Result};
+use arrow::datatypes::*;
+use arrow::downcast_primitive_array;
+use arrow::record_batch::RecordBatch;
+use arrow::util::bit_iterator::BitIndexIterator;
+use datafusion_common::{DataFusionError, Result, ScalarValue};
use datafusion_expr::ColumnarValue;
-
-/// Size at which to use a Set rather than Vec for `IN` / `NOT IN`
-/// Value chosen by the benchmark at
-/// https://github.com/apache/arrow-datafusion/pull/2156#discussion_r845198369
-/// TODO: add switch codeGen in In_List
-static OPTIMIZER_INSET_THRESHOLD: usize = 30;
Review Comment:
With the changes in this PR the hashset is only slower when list contains 1
or 2 non-null primitive values. I did not feel this warranted the additional
complexity, especially as the optimizer should really rewrite an InList of two
elements to a disjunctive boolean expression.
--
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]