Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi match with non const patterns #38485

Merged
merged 14 commits into from
Jul 8, 2022

Conversation

rschu1ze
Copy link
Member

@rschu1ze rschu1ze commented Jun 27, 2022

Resolves #38046

Functions multiMatchAny(), multiMatchAnyIndex(), multiMatchAllIndices() and their fuzzy variants now accept non-const pattern array argument

While working on this PR, I noticed that functions

  • multiSearchAny(), multiSearchAnyCaseInsensitive(), multiSearchAnyUTF8, multiSearchAnyCaseInsensitiveUTF8()
  • multiSearchFirstPosition(), multiSearchFirstPositionCaseInsensitive(), multiSearchFirstPositionUTF8(), multiSearchFirstPositionCaseInsensitiveUTF8()
  • multiSearchFirstIndex(), multiSearchFirstIndexCaseInsensitive(), multiSearchFirstIndexUTF8(), multiSearchFirstIndexCaseInsensitiveUTF8()

broke and needed the same treatment (non-const needles). So I fixed that too which eventually blew this PR a bit up.

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Functions multiMatchAny(), multiMatchAnyIndex(), multiMatchAllIndices() and their fuzzy variants now accept non-const pattern array argument

Information about CI checks: https://clickhouse.com/docs/en/development/continuous-integration/

@robot-ch-test-poll1 robot-ch-test-poll1 added the pr-improvement Pull request with some product improvements label Jun 27, 2022
@rschu1ze rschu1ze force-pushed the multi-match-with-non_const-patterns branch from 2e6c2fe to 82442b4 Compare June 28, 2022 07:52
@rschu1ze
Copy link
Member Author

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Jun 29, 2022

update

✅ Branch has been successfully updated

@rschu1ze rschu1ze force-pushed the multi-match-with-non_const-patterns branch 2 times, most recently from 17fc728 to c40a9fb Compare June 30, 2022 19:33
#38434 (comment)
#38434 (comment)
#38434 (comment)

(the latter is no longer relevant as the affected places were removed in
the meantime)
After making function multi[Fuzzy]Match(Any|AnyIndex|AllIndices)() work
with non-const needles, 12 more functions started to fail in test
"00233_position_function_family":

multiSearchAny()
multiSearchAnyCaseInsensitive()
multiSearchAnyUTF8
multiSearchAnyCaseInsensitiveUTF8()

multiSearchFirstPosition()
multiSearchFirstPositionCaseInsensitive()
multiSearchFirstPositionUTF8()
multiSearchFirstPositionCaseInsensitiveUTF8()

multiSearchFirstIndex()
multiSearchFirstIndexCaseInsensitive()
multiSearchFirstIndexUTF8()
multiSearchFirstIndexCaseInsensitiveUTF8()

Failing queries take the form
  select 0 = multiSearchAny('\0', CAST([], 'Array(String)'));
@rschu1ze rschu1ze force-pushed the multi-match-with-non_const-patterns branch from c40a9fb to 1eed72b Compare July 4, 2022 14:00
@rschu1ze rschu1ze marked this pull request as ready for review July 4, 2022 14:10
@Avogar Avogar self-assigned this Jul 4, 2022
Difficult to test because x86 and ARM behave differently due to
vectorscan not available everyehwere ... The same stuff
(multiFuzzyMatch) is tested elsewhere.
@rschu1ze
Copy link
Member Author

rschu1ze commented Jul 5, 2022

Dockerhub died before integration/stateless tests ran.

Will need to fix some tests anyways, hopefully Dockerhub is up the next time.

@rschu1ze
Copy link
Member Author

rschu1ze commented Jul 5, 2022

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Jul 5, 2022

update

✅ Branch has been successfully updated

@rschu1ze
Copy link
Member Author

rschu1ze commented Jul 6, 2022

The stress test errors are related to keeper and unrelated.

@Avogar
Copy link
Member

Avogar commented Jul 6, 2022

I decided to experiment a bit and found logical error. It wasn't introduced in this PR, the same error occurs in master.

:) select multiMatchAllIndices('123456', []::Array(String)) from numbers(10)

[avogar-dev] 2022.07.06 13:49:08.900328 [ 1520406 ] {97b1e70b-06bc-459e-8057-6e1cc40fc9cc} <Fatal> : Logical error: 'Invalid parameter: expressions is NULL'.
[avogar-dev] 2022.07.06 13:49:08.901685 [ 1520536 ] <Fatal> BaseDaemon: ########################################
[avogar-dev] 2022.07.06 13:49:08.902254 [ 1520536 ] <Fatal> BaseDaemon: (version 22.7.1.1, build id: 0D2C3A5A13DD649B) (from thread 1520406) (query_id: 97b1e70b-06bc-459e-8057-6e1cc40fc9cc) (query: select multiMatchAllIndices(materialize('123456'), arrayMap(x -> toString(x), range(number % 3))) from numbers(10)) Received signal Aborted (6)
[avogar-dev] 2022.07.06 13:49:08.902545 [ 1520536 ] <Fatal> BaseDaemon:
[avogar-dev] 2022.07.06 13:49:08.902831 [ 1520536 ] <Fatal> BaseDaemon: Stack trace: 0x7f660904c03b 0x7f660902b859 0x1705a326 0x1705a3b5 0x1705a465 0x2118898f 0x21188604 0x21188595 0x2118855d 0x21188515 0x211884dd 0x21184666 0x21184555 0x2117ebe1 0x21188298 0x2118b15d 0x2118a61f 0x21189fec 0x1a519d4d 0x253b2ac8 0x253b3b39 0x253b4a43 0x262a511b 0x262a45bc 0x2838ce24 0x21721d22 0x27f8a9c1 0x27fc75c3 0x27fc7204 0x27faa7a1 0x27faaad7 0x27fa9c52 0x27fa91f8 0x27fce708 0x27fce5e0 0x27fce575 0x27fce521 0x27fce432 0x27fce31b 0x27fce1f5 0x27fce1bd
[avogar-dev] 2022.07.06 13:49:08.903185 [ 1520536 ] <Fatal> BaseDaemon: 4. raise @ 0x7f660904c03b in ?
[avogar-dev] 2022.07.06 13:49:08.903356 [ 1520536 ] <Fatal> BaseDaemon: 5. abort @ 0x7f660902b859 in ?
[avogar-dev] 2022.07.06 13:49:09.032217 [ 1520536 ] <Fatal> BaseDaemon: 6. /build/build_docker/../src/Common/Exception.cpp:40: DB::abortOnFailedAssertion(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x1705a326 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:09.161325 [ 1520536 ] <Fatal> BaseDaemon: 7. /build/build_docker/../src/Common/Exception.cpp:63: DB::handle_error_code(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, bool, std::__1::vector<void*, std::__1::allocator<void*> > const&) @ 0x1705a3b5 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:09.269574 [ 1520536 ] <Fatal> BaseDaemon: 8. /build/build_docker/../src/Common/Exception.cpp:70: DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, bool) @ 0x1705a465 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:09.538216 [ 1520536 ] <Fatal> BaseDaemon: 9. /build/build_docker/../src/Functions/Regexps.h:254: DB::MultiRegexps::Regexps DB::MultiRegexps::constructRegexps<true, false>(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::optional<unsigned int>) @ 0x2118898f in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:09.791783 [ 1520536 ] <Fatal> BaseDaemon: 10. /build/build_docker/../src/Functions/Regexps.h:302: DB::MultiRegexps::Regexps* DB::MultiRegexps::get<true, false>(std::__1::vector<std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::allocator<std::__1::basic_string_view<char, std::__1::char_traits<char> > > > const&, std::__1::optional<unsigned int>)::'lambda'()::operator()() const @ 0x21188604 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:10.055640 [ 1520536 ] <Fatal> BaseDaemon: 11. /build/build_docker/../contrib/libcxx/include/type_traits:3640: decltype(static_cast<DB::MultiRegexps::Regexps* DB::MultiRegexps::get<true, false>(std::__1::vector<std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::allocator<std::__1::basic_string_view<char, std::__1::char_traits<char> > > > const&, std::__1::optional<unsigned int>)::'lambda'()&>(fp)()) std::__1::__invoke<DB::MultiRegexps::Regexps* DB::MultiRegexps::get<true, false>(std::__1::vector<std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::allocator<std::__1::basic_string_view<char, std::__1::char_traits<char> > > > const&, std::__1::optional<unsigned int>)::'lambda'()&>(DB::MultiRegexps::Regexps* DB::MultiRegexps::get<true, false>(std::__1::vector<std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::allocator<std::__1::basic_string_view<char, std::__1::char_traits<char> > > > const&, std::__1::optional<unsigned int>)::'lambda'()&) @ 0x21188595 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:10.306756 [ 1520536 ] <Fatal> BaseDaemon: 12. /build/build_docker/../contrib/libcxx/include/__functional/invoke.h:30: DB::MultiRegexps::Regexps std::__1::__invoke_void_return_wrapper<DB::MultiRegexps::Regexps, false>::__call<DB::MultiRegexps::Regexps* DB::MultiRegexps::get<true, false>(std::__1::vector<std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::allocator<std::__1::basic_string_view<char, std::__1::char_traits<char> > > > const&, std::__1::optional<unsigned int>)::'lambda'()&>(DB::MultiRegexps::Regexps* DB::MultiRegexps::get<true, false>(std::__1::vector<std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::allocator<std::__1::basic_string_view<char, std::__1::char_traits<char> > > > const&, std::__1::optional<unsigned int>)::'lambda'()&) @ 0x2118855d in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:10.559764 [ 1520536 ] <Fatal> BaseDaemon: 13. /build/build_docker/../contrib/libcxx/include/__functional/function.h:230: std::__1::__function::__default_alloc_func<DB::MultiRegexps::Regexps* DB::MultiRegexps::get<true, false>(std::__1::vector<std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::allocator<std::__1::basic_string_view<char, std::__1::char_traits<char> > > > const&, std::__1::optional<unsigned int>)::'lambda'(), DB::MultiRegexps::Regexps ()>::operator()() @ 0x21188515 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:10.815291 [ 1520536 ] <Fatal> BaseDaemon: 14. /build/build_docker/../contrib/libcxx/include/__functional/function.h:711: DB::MultiRegexps::Regexps std::__1::__function::__policy_invoker<DB::MultiRegexps::Regexps ()>::__call_impl<std::__1::__function::__default_alloc_func<DB::MultiRegexps::Regexps* DB::MultiRegexps::get<true, false>(std::__1::vector<std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::allocator<std::__1::basic_string_view<char, std::__1::char_traits<char> > > > const&, std::__1::optional<unsigned int>)::'lambda'(), DB::MultiRegexps::Regexps ()> >(std::__1::__function::__policy_storage const*) @ 0x211884dd in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:11.086117 [ 1520536 ] <Fatal> BaseDaemon: 15. /build/build_docker/../contrib/libcxx/include/__functional/function.h:843: std::__1::__function::__policy_func<DB::MultiRegexps::Regexps ()>::operator()() const @ 0x21184666 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:11.354628 [ 1520536 ] <Fatal> BaseDaemon: 16. /build/build_docker/../contrib/libcxx/include/__functional/function.h:1184: std::__1::function<DB::MultiRegexps::Regexps ()>::operator()() const @ 0x21184555 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:11.611161 [ 1520536 ] <Fatal> BaseDaemon: 17. /build/build_docker/../src/Functions/Regexps.h:151: DB::MultiRegexps::RegexpsConstructor::operator()() @ 0x2117ebe1 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:11.876995 [ 1520536 ] <Fatal> BaseDaemon: 18. /build/build_docker/../src/Functions/Regexps.h:308: DB::MultiRegexps::Regexps* DB::MultiRegexps::get<true, false>(std::__1::vector<std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::allocator<std::__1::basic_string_view<char, std::__1::char_traits<char> > > > const&, std::__1::optional<unsigned int>) @ 0x21188298 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:12.138434 [ 1520536 ] <Fatal> BaseDaemon: 19. /build/build_docker/../src/Functions/MultiMatchAllIndicesImpl.h:180: DB::MultiMatchAllIndicesImpl<DB::(anonymous namespace)::NameMultiMatchAllIndices, unsigned long, false>::vectorVector(DB::PODArray<char8_t, 4096ul, Allocator<false, false>, 15ul, 16ul> const&, DB::PODArray<unsigned long, 4096ul, Allocator<false, false>, 15ul, 16ul> const&, DB::ColumnArray const&, DB::PODArray<unsigned long, 4096ul, Allocator<false, false>, 15ul, 16ul>&, DB::PODArray<unsigned long, 4096ul, Allocator<false, false>, 15ul, 16ul>&, std::__1::optional<unsigned int>, bool, unsigned long, unsigned long) @ 0x2118b15d in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:12.370406 [ 1520536 ] <Fatal> BaseDaemon: 20. /build/build_docker/../src/Functions/MultiMatchAllIndicesImpl.h:149: DB::MultiMatchAllIndicesImpl<DB::(anonymous namespace)::NameMultiMatchAllIndices, unsigned long, false>::vectorVector(DB::PODArray<char8_t, 4096ul, Allocator<false, false>, 15ul, 16ul> const&, DB::PODArray<unsigned long, 4096ul, Allocator<false, false>, 15ul, 16ul> const&, DB::ColumnArray const&, DB::PODArray<unsigned long, 4096ul, Allocator<false, false>, 15ul, 16ul>&, DB::PODArray<unsigned long, 4096ul, Allocator<false, false>, 15ul, 16ul>&, bool, unsigned long, unsigned long) @ 0x2118a61f in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:12.603654 [ 1520536 ] <Fatal> BaseDaemon: 21. /build/build_docker/../src/Functions/FunctionsMultiStringSearch.h:111: DB::FunctionsMultiStringSearch<DB::MultiMatchAllIndicesImpl<DB::(anonymous namespace)::NameMultiMatchAllIndices, unsigned long, false> >::executeImpl(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long) const @ 0x21189fec in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:12.747973 [ 1520536 ] <Fatal> BaseDaemon: 22. /build/build_docker/../src/Functions/IFunctionAdaptors.h:21: DB::FunctionToExecutableFunctionAdaptor::executeImpl(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long) const @ 0x1a519d4d in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:12.910922 [ 1520536 ] <Fatal> BaseDaemon: 23. /build/build_docker/../src/Functions/IFunction.cpp:249: DB::IExecutableFunction::executeWithoutLowCardinalityColumns(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const @ 0x253b2ac8 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:13.074310 [ 1520536 ] <Fatal> BaseDaemon: 24. /build/build_docker/../src/Functions/IFunction.cpp:303: DB::IExecutableFunction::executeWithoutSparseColumns(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const @ 0x253b3b39 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:13.238252 [ 1520536 ] <Fatal> BaseDaemon: 25. /build/build_docker/../src/Functions/IFunction.cpp:373: DB::IExecutableFunction::execute(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const @ 0x253b4a43 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:13.750515 [ 1520536 ] <Fatal> BaseDaemon: 26. /build/build_docker/../src/Interpreters/ExpressionActions.cpp:609: DB::executeAction(DB::ExpressionActions::Action const&, DB::(anonymous namespace)::ExecutionContext&, bool) @ 0x262a511b in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:14.163268 [ 1520536 ] <Fatal> BaseDaemon: 27. /build/build_docker/../src/Interpreters/ExpressionActions.cpp:726: DB::ExpressionActions::execute(DB::Block&, unsigned long&, bool) const @ 0x262a45bc in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:14.289038 [ 1520536 ] <Fatal> BaseDaemon: 28. /build/build_docker/../src/Processors/Transforms/ExpressionTransform.cpp:23: DB::ExpressionTransform::transform(DB::Chunk&) @ 0x2838ce24 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:14.462491 [ 1520536 ] <Fatal> BaseDaemon: 29. /build/build_docker/../src/Processors/ISimpleTransform.h:33: DB::ISimpleTransform::transform(DB::Chunk&, DB::Chunk&) @ 0x21721d22 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:14.605740 [ 1520536 ] <Fatal> BaseDaemon: 30. /build/build_docker/../src/Processors/ISimpleTransform.cpp:89: DB::ISimpleTransform::work() @ 0x27f8a9c1 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:14.708242 [ 1520536 ] <Fatal> BaseDaemon: 31. /build/build_docker/../src/Processors/Executors/ExecutionThreadContext.cpp:47: DB::executeJob(DB::ExecutingGraph::Node*, DB::ReadProgressCallback*) @ 0x27fc75c3 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:14.805053 [ 1520536 ] <Fatal> BaseDaemon: 32. /build/build_docker/../src/Processors/Executors/ExecutionThreadContext.cpp:86: DB::ExecutionThreadContext::executeTask() @ 0x27fc7204 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:14.984762 [ 1520536 ] <Fatal> BaseDaemon: 33. /build/build_docker/../src/Processors/Executors/PipelineExecutor.cpp:222: DB::PipelineExecutor::executeStepImpl(unsigned long, std::__1::atomic<bool>*) @ 0x27faa7a1 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:15.164826 [ 1520536 ] <Fatal> BaseDaemon: 34. /build/build_docker/../src/Processors/Executors/PipelineExecutor.cpp:187: DB::PipelineExecutor::executeSingleThread(unsigned long) @ 0x27faaad7 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:15.316278 [ 1520536 ] <Fatal> BaseDaemon: 35. /build/build_docker/../src/Processors/Executors/PipelineExecutor.cpp:331: DB::PipelineExecutor::executeImpl(unsigned long) @ 0x27fa9c52 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:15.494834 [ 1520536 ] <Fatal> BaseDaemon: 36. /build/build_docker/../src/Processors/Executors/PipelineExecutor.cpp:88: DB::PipelineExecutor::execute(unsigned long) @ 0x27fa91f8 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:15.671523 [ 1520536 ] <Fatal> BaseDaemon: 37. /build/build_docker/../src/Processors/Executors/PullingAsyncPipelineExecutor.cpp:79: DB::threadFunction(DB::PullingAsyncPipelineExecutor::Data&, std::__1::shared_ptr<DB::ThreadGroupStatus>, unsigned long) @ 0x27fce708 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:15.845642 [ 1520536 ] <Fatal> BaseDaemon: 38. /build/build_docker/../src/Processors/Executors/PullingAsyncPipelineExecutor.cpp:108: DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0::operator()() const @ 0x27fce5e0 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:16.022428 [ 1520536 ] <Fatal> BaseDaemon: 39. /build/build_docker/../contrib/libcxx/include/type_traits:3648: decltype(static_cast<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&>(fp)()) std::__1::__invoke_constexpr<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&) @ 0x27fce575 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:16.198687 [ 1520536 ] <Fatal> BaseDaemon: 40. /build/build_docker/../contrib/libcxx/include/tuple:1595: decltype(auto) std::__1::__apply_tuple_impl<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&, std::__1::tuple<>&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&, std::__1::tuple<>&, std::__1::__tuple_indices<>) @ 0x27fce521 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:16.374821 [ 1520536 ] <Fatal> BaseDaemon: 41. /build/build_docker/../contrib/libcxx/include/tuple:1604: decltype(auto) std::__1::apply<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&, std::__1::tuple<>&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&, std::__1::tuple<>&) @ 0x27fce432 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:16.525584 [ 1520536 ] <Fatal> BaseDaemon: 42. /build/build_docker/../src/Common/ThreadPool.h:188: ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'()::operator()() @ 0x27fce31b in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:16.701029 [ 1520536 ] <Fatal> BaseDaemon: 43. /build/build_docker/../contrib/libcxx/include/type_traits:3640: decltype(static_cast<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(fp)()) std::__1::__invoke<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'()&>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&) @ 0x27fce1f5 in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:16.874933 [ 1520536 ] <Fatal> BaseDaemon: 44. /build/build_docker/../contrib/libcxx/include/__functional/invoke.h:62: void std::__1::__invoke_void_return_wrapper<void, true>::__call<ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'()&>(ThreadFromGlobalPool::ThreadFromGlobalPool<DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0>(DB::PullingAsyncPipelineExecutor::pull(DB::Chunk&, unsigned long)::$_0&&)::'lambda'()&) @ 0x27fce1bd in /home/avogar/tmp/clickhouse
[avogar-dev] 2022.07.06 13:49:18.239210 [ 1520536 ] <Fatal> BaseDaemon: Integrity check of the executable skipped because the reference checksum could not be read. (calculated checksum: 5F7266ED2572702F8AFBF9F2D790A93F)
→ Progress: 10.00 rows, 80.00 B (0.50 rows/s., 4.00 B/s.)  99%Exception on client:
Code: 32. DB::Exception: Attempt to read after eof: while receiving packet from localhost:9000. (ATTEMPT_TO_READ_AFTER_EOF)

@rschu1ze As you are already familiar with this code, maybe it will be easy to fix it for you. But let's do it in a separate PR with bugfix changelog category

@Avogar
Copy link
Member

Avogar commented Jul 6, 2022

What about functions multiSearchAllPositions*? Why don't update them too?

@rschu1ze
Copy link
Member Author

rschu1ze commented Jul 6, 2022

What about functions multiSearchAllPositions*? Why don't update them too?

Generally speaking, searching with non-const needles is more expensive than with const needles as the searcher needs to be re-initialized once per row (which is slow for fast Volnitsky search and fast for slow std lib search). So, non-const needles are nice-to-have from a functional POV but not recommended.

This PR is about three functions for which a user wanted non-const needles. While doing so, I had to add support for non-const needles to more functions. multiSearchAllPositions() wasn't one of these. Looking at it's implementation, it should not be too difficult to also allow non-const needles but that would go into a separate PR then.

}
#else
/// fallback if vectorscan is not compiled
/// -- the code is copypasted from vectorVector() in MatchImpl.h and quite complex code ... all of it can be removed once vectorscan is
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This branch is called in a quite obscure edge case ... for functions mutliMatchAny() / multiMatchAnyIndex() with non-const needles on platforms where vectorscan is disabled (all non-x86 at the moment). It is a bit fragile and I had to write it from scratch using some copypasta from elsewhere because the technique used in the fallback for const needles didn't work conceptually.

I did some local testing to make sure it's okay. However, if problems in CI tests pop up, I would likely remove it altogether and throw a "not implemented" exception instead. The same is done for function multiMatchAllIndices() which is sort of related. There is a good chance that vectorscan can be enabled on non-x86 so we could throw the fallback away anyways.

@rschu1ze
Copy link
Member Author

rschu1ze commented Jul 7, 2022

I decided to experiment a bit and found logical error. It wasn't introduced in this PR, the same error occurs in master.
[...]
@rschu1ze As you are already familiar with this code, maybe it will be easy to fix it for you. But let's do it in a separate PR with bugfix changelog category

Interesting, thanks for finding this. Will take a look.

@rschu1ze rschu1ze force-pushed the multi-match-with-non_const-patterns branch from 192debd to 1de5e9a Compare July 7, 2022 12:35
@rschu1ze
Copy link
Member Author

rschu1ze commented Jul 7, 2022

All tests are green except the ubsan stress test ("Backward compatibility check: Server failed to start"). But the failure is is caused by network issues and keeper. Other stress tests ran fine. Guess we are good to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-improvement Pull request with some product improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

multiFuzzyMatchAny function requirement
3 participants