-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Adding type hint to JSON column when field with incompatible data exists causes failing mutation #84803
Copy link
Copy link
Closed
Labels
jsonIssues and pull-requests related to the new JSON data typeIssues and pull-requests related to the new JSON data typequestionQuestion?Question?question-answered
Description
Company or project name
No response
Describe the unexpected behaviour
Evaluating JSON type as a replacement for #80434 https://fiddle.clickhouse.com/e750d205-76dc-4128-b05f-659f6da69a24
Which ClickHouse versions are affected?
Latest
How to reproduce
CREATE TABLE j (
a JSON(max_dynamic_paths=0)
) ENGINE=MergeTree
ORDER BY tuple();
INSERT INTO j VALUES ('{"my_id": "a"}');
ALTER TABLE j MODIFY COLUMN a JSON(max_dynamic_paths=0, my_id Int32);
SELECT a FROM j;
Received exception from server (version 25.7.1):
Code: 341. DB::Exception: Received from localhost:9000. DB::Exception: Exception happened during execution of mutation 'mutation_2.txt' with part 'all_1_1_0' reason: 'Code: 117. DB::Exception: Cannot insert data into JSON column: cannot parse Int32 value here: "a" (while reading path my_id): while executing 'FUNCTION _CAST(a :: 0, 'JSON(max_dynamic_paths=0, my_id Int32)' :: 1) -> _CAST(a, 'JSON(max_dynamic_paths=0, my_id Int32)') JSON(max_dynamic_paths=0, my_id Int32) : 2': (while reading from part /var/lib/clickhouse/store/21d/21da3cde-b71c-4453-b5a4-99f2bd5ee1b1/all_1_1_0/ located on disk default of type local): While executing MergeTreeSequentialSource. (INCORRECT_DATA) (version 25.7.1.3997 (official build))'. This error maybe retryable or not. In case of unretryable error, mutation can be killed with KILL MUTATION query
0. DB::checkMutationStatus(std::optional<DB::MergeTreeMutationStatus>&, std::set<String, std::less<String>, std::allocator<String>> const&) @ 0x0000000017f9c629
1. DB::StorageMergeTree::waitForMutation(long, String const&, bool) @ 0x0000000017d7c2a2
2. DB::StorageMergeTree::alter(DB::AlterCommands const&, std::shared_ptr<DB::Context const>, std::unique_lock<std::timed_mutex>&) @ 0x0000000017d7601e
3. DB::InterpreterAlterQuery::executeToTable(DB::ASTAlterQuery const&) @ 0x0000000016c4e9fa
4. DB::InterpreterAlterQuery::execute() @ 0x0000000016c4baad
5. DB::executeQueryImpl(char const*, char const*, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum, DB::ReadBuffer*, std::shared_ptr<DB::IAST>&, std::shared_ptr<DB::ImplicitTransactionControlExecutor>) @ 0x0000000017094b13
6. DB::executeQuery(String const&, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum) @ 0x000000001708e480
7. DB::TCPHandler::runImpl() @ 0x000000001851f0cc
8. DB::TCPHandler::run() @ 0x000000001853eab8
9. Poco::Net::TCPServerConnection::start() @ 0x000000001d89cb27
10. Poco::Net::TCPServerDispatcher::run() @ 0x000000001d89cf79
11. Poco::PooledThread::run() @ 0x000000001d868207
12. Poco::ThreadImpl::runnableEntry(void*) @ 0x000000001d8667a1
13. ? @ 0x0000000000094ac3
14. ? @ 0x0000000000125a04
. (UNFINISHED)
(query: ALTER TABLE j MODIFY COLUMN a JSON(max_dynamic_paths=0, my_id Int32);)
Expected behavior
No response
Error message and/or stacktrace
No response
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
jsonIssues and pull-requests related to the new JSON data typeIssues and pull-requests related to the new JSON data typequestionQuestion?Question?question-answered