pitrou commented on code in PR #46859: URL: https://github.com/apache/arrow/pull/46859#discussion_r2182886977
########## cpp/src/arrow/compute/expression.cc: ########## @@ -1267,6 +1267,15 @@ struct Inequality { auto options = checked_pointer_cast<SetLookupOptions>(is_in_call->options); + // The maximum number of values in the is_in expression set of values + // in order to use the simplification. + // If the set is large there are performance implications, see: + // https://github.com/apache/arrow/issues/46777 + static constexpr int16_t kIsInSimplificationMaxValueSet = 50; Review Comment: Nit, but `static` is unnecessary here. ########## cpp/src/arrow/compute/expression_test.cc: ########## @@ -1679,6 +1689,15 @@ TEST(Expression, SimplifyIsIn) { Simplify{is_in(field_ref("u32"), int64(), "[1,3,5,7,9]", null_matching)} .WithGuarantee(greater(field_ref("u32"), literal(3))) .Expect(is_in(field_ref("u32"), int64(), "[5,7,9]", null_matching)); + + Simplify{is_in(field_ref("u32"), int64(), make_range_json(1, 40), null_matching)} + .WithGuarantee(greater(field_ref("u32"), literal(10))) + .Expect(is_in(field_ref("u32"), int64(), make_range_json(11, 40), null_matching)); + + // For large ranges we don't do any simplification Review Comment: ```suggestion // For large ranges we don't do any simplification, see // `kIsInSimplificationMaxValueSet` in expression.cc. ``` -- 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-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org