You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/02 04:56:21 UTC

[GitHub] [arrow-datafusion] Dandandan commented on a diff in pull request #4057: Simplify InListExpr ~20-70% Faster

Dandandan commented on code in PR #4057:
URL: https://github.com/apache/arrow-datafusion/pull/4057#discussion_r1011192297


##########
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:
   We should probably rewrite inlist exprs wit few elements from `x in (0, 1)` to `x=1 or x=2`.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org