Search code examples
clickhouse

ClickHouse: NO_COMMON_TYPE exception when I use a SELECT statement


I'm trying to select all items from ClickHouse DB where the viewIds array contains 341852351. I run this query:

SELECT *
FROM 
array join viewIds
WHERE has(viewIds, '341852351')

But I get this error:

There is no supertype for types Int256, String because some of them are String/FixedString and some of them are not: While processing has(viewIds, '341852351'). (NO_COMMON_TYPE)

Please help me to fix this query.


Solution

  • Looks like the viewIds is an Int256 array. In this case, you should pass the value as Int256 rather than as a string. Try this:

    SELECT *
    FROM 
    array join viewIds
    WHERE has(viewIds, 341852351)