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

TYPE_MISMATCH exception for in operator with single column tuples. #49844

Merged
merged 1 commit into from May 13, 2023

Conversation

MikhailBurdukov
Copy link
Contributor

@MikhailBurdukov MikhailBurdukov commented May 12, 2023

Changelog category (leave one):

  • Improvement

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

Add support for (an unusual) case where the arguments in the IN operator are single-element tuples.

Reproduce:

CREATE TABLE test(`report_date` Date, `sspid` UInt64) ENGINE MergeTree PARTITION BY report_date ORDER BY report_date;

INSERT INTO test SELECT toDate('2023-04-20'), 0;
INSERT INTO test SELECT toDate('2023-04-19'), 0;
INSERT INTO test SELECT toDate('2023-04-17'), 1;
INSERT INTO test SELECT toDate('2023-04-17'), 1;


SELECT * FROM test  WHERE tuple(report_date) IN tuple(toDate('2023-04-17'));
DROP TABLE test;

Result:

[mburdukov] 2023.05.12 16:59:55.869876 [ 507141 ] {0bee70f1-af4d-436e-bdfb-ae9371fd98e9} <Error> executeQuery: Code: 53. DB::Exception: Types of column 1 in section IN don't match: Date on the left, Tuple(Date) on the right. (TYPE_MISMATCH) (version 23.5.1.1) (from [::1]:34788) (comment: 02731_in_operator_with_one_size_tuple.sql) (in query: SELECT * FROM test WHERE tuple(report_date) IN tuple(toDate('2023-04-17'));), Stack trace (when copying this message, always include the lines below):

0. /home/mburdukov/workspace/clickhouse_build_r/./contrib/llvm-project/libcxx/include/exception:134: Poco::Exception::Exception(String const&, int) @ 0x1a3d93d3 in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
1. /home/mburdukov/workspace/clickhouse_build_r/./src/Common/Exception.cpp:92: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x11740115 in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
2. DB::Exception::Exception<String, String, String>(int, FormatStringHelperImpl<std::type_identity<String>::type, std::type_identity<String>::type, std::type_identity<String>::type>, String&&, String&&, String&&) @ 0xca3d500 in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
3. /home/mburdukov/workspace/clickhouse_build_r/./src/Interpreters/Set.cpp:0: DB::Set::checkTypesEqual(unsigned long, std::shared_ptr<DB::IDataType const> const&) const @ 0x16ecf1f6 in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
4. /home/mburdukov/workspace/clickhouse_build_r/./src/Storages/MergeTree/KeyCondition.cpp:1216: DB::KeyCondition::tryPrepareSetIndex(DB::RPNBuilderFunctionTreeNode const&, DB::KeyCondition::RPNElement&, unsigned long&) @ 0x178c52c4 in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
5. /home/mburdukov/workspace/clickhouse_build_r/./src/Storages/MergeTree/KeyCondition.cpp:0: DB::KeyCondition::extractAtomFromTree(DB::RPNBuilderTreeNode const&, DB::KeyCondition::RPNElement&) @ 0x178c6dbc in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
6. /home/mburdukov/workspace/clickhouse_build_r/./src/Storages/MergeTree/RPNBuilder.h:250: DB::RPNBuilder<DB::KeyCondition::RPNElement>::traverseTree(DB::RPNBuilderTreeNode const&) @ 0x178d5499 in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
7. /home/mburdukov/workspace/clickhouse_build_r/./contrib/llvm-project/libcxx/include/__functional/function.h:818: DB::KeyCondition::KeyCondition(std::shared_ptr<DB::ActionsDAG>, std::shared_ptr<DB::Context const>, std::vector<String, std::allocator<String>> const&, std::shared_ptr<DB::ExpressionActions> const&, std::unordered_set<String, std::hash<String>, std::equal_to<String>, std::allocator<String>>, bool, bool) @ 0x178c2b9a in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
8. /home/mburdukov/workspace/clickhouse_build_r/./contrib/llvm-project/libcxx/include/__memory/construct_at.h:35: DB::KeyCondition* std::construct_at[abi:v15000]<DB::KeyCondition, std::shared_ptr<DB::ActionsDAG> const&, std::shared_ptr<DB::Context const>&, std::vector<String, std::allocator<String>> const&, std::shared_ptr<DB::ExpressionActions> const&, std::unordered_set<String, std::hash<String>, std::equal_to<String>, std::allocator<String>>&, DB::KeyCondition*>(DB::KeyCondition*, std::shared_ptr<DB::ActionsDAG> const&, std::shared_ptr<DB::Context const>&, std::vector<String, std::allocator<String>> const&, std::shared_ptr<DB::ExpressionActions> const&, std::unordered_set<String, std::hash<String>, std::equal_to<String>, std::allocator<String>>&) @ 0x180aa3de in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
9. /home/mburdukov/workspace/clickhouse_build_r/./contrib/llvm-project/libcxx/include/optional:378: DB::ReadFromMergeTree::selectRangesToReadImpl(std::vector<std::shared_ptr<DB::IMergeTreeDataPart const>, std::allocator<std::shared_ptr<DB::IMergeTreeDataPart const>>>, std::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::shared_ptr<DB::StorageInMemoryMetadata const> const&, DB::SelectQueryInfo const&, std::shared_ptr<DB::Context const>, unsigned long, std::shared_ptr<std::unordered_map<String, long, std::hash<String>, std::equal_to<String>, std::allocator<std::pair<String const, long>>>>, DB::MergeTreeData const&, std::vector<String, std::allocator<String>> const&, bool, Poco::Logger*) @ 0x1809b48b in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
10. /home/mburdukov/workspace/clickhouse_build_r/./src/Processors/QueryPlan/ReadFromMergeTree.cpp:0: DB::ReadFromMergeTree::selectRangesToRead(std::vector<std::shared_ptr<DB::IMergeTreeDataPart const>, std::allocator<std::shared_ptr<DB::IMergeTreeDataPart const>>>, std::shared_ptr<DB::PrewhereInfo> const&, DB::ActionDAGNodes const&, std::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::shared_ptr<DB::StorageInMemoryMetadata const> const&, DB::SelectQueryInfo const&, std::shared_ptr<DB::Context const>, unsigned long, std::shared_ptr<std::unordered_map<String, long, std::hash<String>, std::equal_to<String>, std::allocator<std::pair<String const, long>>>>, DB::MergeTreeData const&, std::vector<String, std::allocator<String>> const&, bool, Poco::Logger*) @ 0x1809ab8f in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
11. /home/mburdukov/workspace/clickhouse_build_r/./src/Processors/QueryPlan/ReadFromMergeTree.cpp:0: DB::ReadFromMergeTree::selectRangesToRead(std::vector<std::shared_ptr<DB::IMergeTreeDataPart const>, std::allocator<std::shared_ptr<DB::IMergeTreeDataPart const>>>) const @ 0x1809a1a6 in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
12. /home/mburdukov/workspace/clickhouse_build_r/./src/Processors/QueryPlan/ReadFromMergeTree.cpp:1494: DB::ReadFromMergeTree::getAnalysisResult() const @ 0x1809ec73 in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
13. /home/mburdukov/workspace/clickhouse_build_r/./contrib/llvm-project/libcxx/include/__memory/shared_ptr.h:815: DB::ReadFromMergeTree::initializePipeline(DB::QueryPipelineBuilder&, DB::BuildQueryPipelineSettings const&) @ 0x180a0507 in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
14. /home/mburdukov/workspace/clickhouse_build_r/./contrib/llvm-project/libcxx/include/vector:1420: DB::ISourceStep::updatePipeline(std::vector<std::unique_ptr<DB::QueryPipelineBuilder, std::default_delete<DB::QueryPipelineBuilder>>, std::allocator<std::unique_ptr<DB::QueryPipelineBuilder, std::default_delete<DB::QueryPipelineBuilder>>>>, DB::BuildQueryPipelineSettings const&) @ 0x1806f93f in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
15. /home/mburdukov/workspace/clickhouse_build_r/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:302: DB::QueryPlan::buildQueryPipeline(DB::QueryPlanOptimizationSettings const&, DB::BuildQueryPipelineSettings const&) @ 0x18086197 in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
16. /home/mburdukov/workspace/clickhouse_build_r/./src/Interpreters/InterpreterSelectWithUnionQuery.cpp:379: DB::InterpreterSelectWithUnionQuery::execute() @ 0x16dbfd2e in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
17. /home/mburdukov/workspace/clickhouse_build_r/./src/Interpreters/executeQuery.cpp:0: DB::executeQueryImpl(char const*, char const*, std::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) @ 0x1707202f in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
18. /home/mburdukov/workspace/clickhouse_build_r/./src/Interpreters/executeQuery.cpp:1174: DB::executeQuery(String const&, std::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum) @ 0x1706f476 in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
19. /home/mburdukov/workspace/clickhouse_build_r/./src/Server/TCPHandler.cpp:0: DB::TCPHandler::runImpl() @ 0x17cfa864 in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
20. /home/mburdukov/workspace/clickhouse_build_r/./src/Server/TCPHandler.cpp:2045: DB::TCPHandler::run() @ 0x17d0aa59 in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
21. /home/mburdukov/workspace/clickhouse_build_r/./base/poco/Net/src/TCPServerConnection.cpp:57: Poco::Net::TCPServerConnection::start() @ 0x1a2c6c47 in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
22. /home/mburdukov/workspace/clickhouse_build_r/./contrib/llvm-project/libcxx/include/__memory/unique_ptr.h:48: Poco::Net::TCPServerDispatcher::run() @ 0x1a2c712d in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
23. /home/mburdukov/workspace/clickhouse_build_r/./base/poco/Foundation/src/ThreadPool.cpp:202: Poco::PooledThread::run() @ 0x1a42d827 in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
24. /home/mburdukov/workspace/clickhouse_build_r/./base/poco/Foundation/include/Poco/SharedPtr.h:139: Poco::ThreadImpl::runnableEntry(void*) @ 0x1a42b3e3 in /home/mburdukov/workspace/clickhouse_build_r/programs/clickhouse
25. ? @ 0x7f679541e609 in ?
26. clone @ 0x7f6795343133 in ?

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

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

@robot-clickhouse robot-clickhouse added the pr-bugfix Pull request with bugfix, not backported by default label May 12, 2023
@robot-clickhouse
Copy link
Member

robot-clickhouse commented May 12, 2023

This is an automated comment for commit 8c7b63f with description of existing statuses. It's updated for the latest CI running
The full report is available here
The overall status of the commit is 🔴 failure

Check nameDescriptionStatus
AST fuzzerRuns randomly generated queries to catch program errors. The build type is optionally given in parenthesis. If it fails, ask a maintainer for help🟢 success
Bugfix validate checkChecks that either a new test (functional or integration) or there some changed tests that fail with the binary built on master branch🟢 success
CI runningA meta-check that indicates the running CI. Normally, it's in success or pending state. The failed status indicates some problems with the PR🟡 pending
ClickHouse build checkBuilds ClickHouse in various configurations for use in further steps. You have to fix the builds that fail. Build logs often has enough information to fix the error, but you might have to reproduce the failure locally. The cmake options can be found in the build log, grepping for cmake. Use these options and follow the general build process🟢 success
Compatibility checkChecks that clickhouse binary runs on distributions with old libc versions. If it fails, ask a maintainer for help🟢 success
Docker image for serversThe check to build and optionally push the mentioned image to docker hub🟢 success
Fast testNormally this is the first check that is ran for a PR. It builds ClickHouse and runs most of stateless functional tests, omitting some. If it fails, further checks are not started until it is fixed. Look at the report to see which tests fail, then reproduce the failure locally as described here🟢 success
Flaky testsChecks if new added or modified tests are flaky by running them repeatedly, in parallel, with more randomization. Functional tests are run 100 times with address sanitizer, and additional randomization of thread scheduling. Integrational tests are run up to 10 times. If at least once a new test has failed, or was too long, this check will be red. We don't allow flaky tests, read the doc🟢 success
Install packagesChecks that the built packages are installable in a clear environment🟢 success
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests🔴 failure
Mergeable CheckChecks if all other necessary checks are successful🟢 success
Performance ComparisonMeasure changes in query performance. The performance test report is described in detail here. In square brackets are the optional part/total tests🟢 success
Push to DockerhubThe check for building and pushing the CI related docker images to docker hub🟢 success
SQLancerFuzzing tests that detect logical bugs with SQLancer tool🟢 success
SqllogicRun clickhouse on the sqllogic test set against sqlite and checks that all statements are passed🟢 success
Stateful testsRuns stateful functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc🟢 success
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc🟢 success
Stress testRuns stateless functional tests concurrently from several clients to detect concurrency-related errors🟢 success
Style CheckRuns a set of checks to keep the code style clean. If some of tests failed, see the related log from the report🟢 success
Unit testsRuns the unit tests for different release types🟢 success
Upgrade checkRuns stress tests on server version from last release and then tries to upgrade it to the version from the PR. It checks if the new server can successfully startup without any errors, crashes or sanitizer asserts🔴 failure

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label May 13, 2023
@alexey-milovidov alexey-milovidov self-assigned this May 13, 2023
@alexey-milovidov alexey-milovidov merged commit a2d1cc1 into ClickHouse:master May 13, 2023
253 of 260 checks passed
@MikhailBurdukov
Copy link
Contributor Author

Also it will be great to backport this patch. Is it possible?

@alesapin alesapin added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label May 17, 2023
robot-clickhouse added a commit that referenced this pull request May 17, 2023
robot-clickhouse added a commit that referenced this pull request May 17, 2023
robot-clickhouse added a commit that referenced this pull request May 17, 2023
robot-clickhouse-ci-1 added a commit that referenced this pull request May 17, 2023
Backport #49844 to 23.3: TYPE_MISMATCH exception for in operator with  single column tuples.
@alexey-milovidov alexey-milovidov removed pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-bugfix Pull request with bugfix, not backported by default labels May 18, 2023
@alexey-milovidov
Copy link
Member

We should not backport non-essential patches because it puts LTS versions at risk.

@Alex-Burmak
Copy link
Contributor

Agree. But this one is about backward-incompatibility. We caught this after upgrading a ClickHouse cluster from 22.3 to 22.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
can be tested Allows running workflows for external contributors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants