Skip to content

<Error> executeQuery: Code: 43, e.displayText() = DB::Exception: Illegal type Int64 of last argument for aggregate function with If suffix: #16588

@jjtjiang

Description

@jjtjiang

When i use argMaxIf function ,sometimes there will be problems.To be more precise, when I use a smaller amount of data, say 15,000,000 rows of data, I don't get this problem, but when I continue to insert 5,000,000 rows of data, the query sql reports the following error.
When divided into three sql ,three sql separate query HL_LOCK_TYPE,HL_LOCK_STATE,HL_BLOCKEDBY_INT_ID these three fields, is also no problem.
thanks

logs are below:
2020.11.01 18:29:29.947360 [ 160 ] {8c5cab1b-c410-4338-a7e0-4af011c72538} executeQuery: Code: 43, e.displayText() = DB::Exception: Illegal type Int64 of last argument for aggregate function with If suffix: While executing SourceFromNativeStream (version 20.8.4.11 (official build)) (from [::ffff:10.16.130.50]:52476) (in query: SELECT HL_LOCK_EXT_ID, HL_LOCK_INT_ID, argMaxIf(HL_LOCK_TYPE, offset, Sign > 0) AS HL_LOCK_TYPE, argMaxIf(HL_LOCK_STATE, offset, Sign > 0) AS HL_LOCK_STATE, argMaxIf(HL_BLOCKEDBY_INT_ID, offset, Sign > 0) AS HL_BLOCKEDBY_INT_ID FROM test.hive_locks2 GROUP BY HL_LOCK_EXT_ID, HL_LOCK_INT_ID HAVING sum(Sign) > 0;), Stack trace (when copying this message, always include the lines below):

  1. Poco::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, int) @ 0x18ba03d0 in /usr/bin/clickhouse
  2. DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, int) @ 0xe606dad in /usr/bin/clickhouse
  3. DB::AggregateFunctionCombinatorIf::transformArguments(std::__1::vector<std::__1::shared_ptr<DB::IDataType const>, std::__1::allocator<std::__1::shared_ptr<DB::IDataType const> > > const&) const @ 0xf8fa4ff in /usr/bin/clickhouse
  4. DB::AggregateFunctionFactory::getImpl(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::vector<std::__1::shared_ptr<DB::IDataType const>, std::__1::allocator<std::__1::shared_ptr<DB::IDataType const> > > const&, DB::Array const&, DB::AggregateFunctionProperties&, bool, int) const @ 0x1520b19a in /usr/bin/clickhouse
  5. DB::AggregateFunctionFactory::get(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::vector<std::__1::shared_ptr<DB::IDataType const>, std::__1::allocator<std::__1::shared_ptr<DB::IDataType const> > > const&, DB::Array const&, DB::AggregateFunctionProperties&, int) const @ 0x1520b848 in /usr/bin/clickhouse
  6. DB::AggregateFunctionFactory::getImpl(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::vector<std::__1::shared_ptr<DB::IDataType const>, std::__1::allocator<std::__1::shared_ptr<DB::IDataType const> > > const&, DB::Array const&, DB::AggregateFunctionProperties&, bool, int) const @ 0x1520af01 in /usr/bin/clickhouse
  7. DB::AggregateFunctionFactory::get(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::vector<std::__1::shared_ptr<DB::IDataType const>, std::__1::allocator<std::__1::shared_ptr<DB::IDataType const> > > const&, DB::Array const&, DB::AggregateFunctionProperties&, int) const @ 0x1520b5c1 in /usr/bin/clickhouse
  8. ? @ 0x15486aba in /usr/bin/clickhouse
  9. std::__1::__function::__func<std::__1::shared_ptr<DB::IDataType const> ()(std::__1::shared_ptrDB::IAST const&), std::__1::allocator<std::__1::shared_ptr<DB::IDataType const> ()(std::__1::shared_ptrDB::IAST const&)>, std::__1::shared_ptr<DB::IDataType const> (std::__1::shared_ptrDB::IAST const&)>::operator()(std::__1::shared_ptrDB::IAST const&) @ 0x154885a7 in /usr/bin/clickhouse
  10. DB::DataTypeFactory::get(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::shared_ptrDB::IAST const&) const @ 0x154b1efc in /usr/bin/clickhouse
  11. DB::DataTypeFactory::get(std::__1::shared_ptrDB::IAST const&) const @ 0x154b2525 in /usr/bin/clickhouse
  12. DB::DataTypeFactory::get(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const @ 0x154b2714 in /usr/bin/clickhouse
  13. DB::NativeBlockInputStream::readImpl() @ 0x15aba47e in /usr/bin/clickhouse
  14. DB::IBlockInputStream::read() @ 0x1545e1ad in /usr/bin/clickhouse
  15. ? @ 0x16525d5a in /usr/bin/clickhouse
  16. DB::ISource::work() @ 0x162b59bb in /usr/bin/clickhouse
  17. ? @ 0x162eb140 in /usr/bin/clickhouse
  18. ? @ 0x162ef39d in /usr/bin/clickhouse
  19. ? @ 0x162efc66 in /usr/bin/clickhouse
  20. ThreadPoolImplstd::__1::thread::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0xe6345b7 in /usr/bin/clickhouse
  21. ? @ 0xe632b03 in /usr/bin/clickhouse
  22. start_thread @ 0x9609 in /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
  23. __clone @ 0x122293 in /usr/lib/x86_64-linux-gnu/libc-2.31.so

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed user-visible misbehaviour in official release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions