Skip to content

I'm trying to insert a map<int32, int32>, and getting this error - #423

@akr-25

Description

@akr-25

Error: DB::Exception: Empty query
Code: 62
name: DB::Exception
StackTrace:

0. DB::Exception::Exception(DB::Exception::MessageMasked const&, int, bool) @ 0xe74c47a in /usr/bin/clickhouse
1. ? @ 0x7eb1f2d in /usr/bin/clickhouse
2. DB::parseQueryAndMovePosition(DB::IParser&, char const*&, char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, bool, unsigned long, unsigned long) @ 0x15a5a03f in /usr/bin/clickhouse
3. DB::DataTypeFactory::get(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) const @ 0x135f850b in /usr/bin/clickhouse
4. DB::NativeReader::read() @ 0x153b43aa in /usr/bin/clickhouse
5. DB::TCPHandler::receiveData(bool) @ 0x15393850 in /usr/bin/clickhouse
6. DB::TCPHandler::receivePacket() @ 0x153891ae in /usr/bin/clickhouse
7. DB::TCPHandler::readDataNext() @ 0x1538c4b6 in /usr/bin/clickhouse
8. DB::TCPHandler::processInsertQuery() @ 0x15389ede in /usr/bin/clickhouse
9. DB::TCPHandler::runImpl() @ 0x153820d1 in /usr/bin/clickhouse
10. DB::TCPHandler::run() @ 0x153956d9 in /usr/bin/clickhouse
11. Poco::Net::TCPServerConnection::start() @ 0x1820feb4 in /usr/bin/clickhouse
12. Poco::Net::TCPServerDispatcher::run() @ 0x1821185b in /usr/bin/clickhouse
13. Poco::PooledThread::run() @ 0x183a0947 in /usr/bin/clickhouse
14. Poco::ThreadImpl::runnableEntry(void*) @ 0x1839e37d in /usr/bin/clickhouse
15. start_thread @ 0x7e25 in /usr/lib64/libpthread-2.17.so
16. __clone @ 0xfebad in /usr/lib64/libc-2.17.so

one question first, Code 62 is for SYNTAX_ERROR in the error_codes.h file, but the exception display name is Empty query, something's wrong?

I wrote a simple c++ application which dumps some data in the clickhouse database. There are like 40-50 columns there, if I insert all the data except keep tags (map field) an empty map, then it inserts well, but if I try to populate the map it crashes with the above exception

Here's the code snippet for inserting maps -

        auto& map = std::get<std::unordered_map<int32_t, int32_t>>(value);
        auto tupls = std::make_shared<clickhouse::ColumnTuple>(
            std::vector<clickhouse::ColumnRef>{
                std::make_shared<clickhouse::ColumnInt32>(),
                std::make_shared<clickhouse::ColumnInt32>()});

        auto data = std::make_shared<clickhouse::ColumnArray>(tupls);
        auto val = tupls->CloneEmpty()->As<clickhouse::ColumnTuple>();

        for (auto& entry : map) {
          (*val)[0]->AsStrict<clickhouse::ColumnInt32>()->Append(entry.first);
          (*val)[1]->AsStrict<clickhouse::ColumnInt32>()->Append(entry.second);
        }

        data->AppendAsColumn(val);
        auto data_map = std::make_shared<clickhouse::ColumnMap>(data);
        col->As<clickhouse::ColumnMap>()->Append(data_map);

tags is defined as Map(Int32, Int32) in clickhouse table

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions