table impression RENAME column idfa to device;
ALTER TABLE impression
RENAME COLUMN idfa TO device
Ok.
Но стала возникать ошибка при ставке данных:
Processing: 1594305778833703849_6045_adb72cd6-2fea-4932-b055-bc304b9ad8fe.jsonl.gz
Code: 117, e.displayText() = DB::Exception: Unknown field found while parsing JSONEachRow format: device: (at row 1)
, Stack trace (when copying this message, always include the lines below):
0. Poco::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x10ed0da0 in /usr/bin/clickhouse
1. DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x95c923d in /usr/bin/clickhouse
2. ? @ 0xe7c183b in /usr/bin/clickhouse
3. DB::JSONEachRowRowInputFormat::readJSONObject(std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&) @ 0xe7bf16d in /usr/bin/clickhouse
4. DB::JSONEachRowRowInputFormat::readRow(std::__1::vector<COW<DB::IColumn>::mutable_ptr<DB::IColumn>, std::__1::allocator<COW<DB::IColumn>::mutable_ptr<DB::IColumn> > >&, DB::RowReadExtension&) @ 0xe7bf636 in /usr/bin/clickhouse
5. DB::IRowInputFormat::generate() @ 0xe760041 in /usr/bin/clickhouse
6. DB::ISource::work() @ 0xe6dd3ab in /usr/bin/clickhouse
7. DB::InputStreamFromInputFormat::readImpl() @ 0xe6a4b0d in /usr/bin/clickhouse
8. DB::IBlockInputStream::read() @ 0xd999b1d in /usr/bin/clickhouse
9. DB::ParallelParsingBlockInputStream::parserThreadFunction(unsigned long) @ 0xe6a98d8 in /usr/bin/clickhouse
10. ThreadPoolImpl<ThreadFromGlobalPool>::worker(std::__1::__list_iterator<ThreadFromGlobalPool, void*>) @ 0x95f7987 in /usr/bin/clickhouse
11. ThreadFromGlobalPool::ThreadFromGlobalPool<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda1'()>(void&&, void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda1'()&&...)::'lambda'()::operator()() const @ 0x95f80fa in /usr/bin/clickhouse
12. ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0x95f6e97 in /usr/bin/clickhouse
13. ? @ 0x95f5383 in /usr/bin/clickhouse
14. start_thread @ 0x76db in /lib/x86_64-linux-gnu/libpthread-2.27.so
15. __clone @ 0x121a3f in /lib/x86_64-linux-gnu/libc-2.27.so
(version 20.5.2.7 (official build))
Вставляю таким скриптом:
zcat "$FILENAME" \
| clickhouse-client \
--user="$CLICKHOUSE_USER" \
--password="$CLICKHOUSE_PASSWORD" \
--input_format_skip_unknown_fields=1 \
--query="INSERT INTO $CLICKHOUSE_TABLE FORMAT JSONEachRow"
Кто-нибудь сталкивался с похожей проблемой? Как это исправить? Пока на ум приходит только - использовать в JSON старое название колонки.
в какой таблице вы переименовали колонку? в kafka ? там вроде не поддерживается rename
Обсуждают сегодня