Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryExecutionError: DB::Exception: Types of column 1 in section IN don't match: UInt64 on the left, Tuple(UInt64) on the right #4213

Closed
klboke opened this issue May 22, 2023 · 3 comments
Labels

Comments

@klboke
Copy link
Contributor

klboke commented May 22, 2023

Environment

Sentry version : 23.1.1
ClickHouse version: 22.8.17

Steps to Reproduce

To deploy Sentry, visit http://127.0.0.1:3000/organizations/sentry/releases/

Expected Result

No exceptions

Actual Result

QueryExecutionError: DB::Exception: Types of column 1 in section IN don't match: UInt64 on the left, Tuple(UInt64) on the right. Stack trace:

0. DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, bool) @ 0xa4029da in /opt/bitnami/clickhouse/bin/clickhouse
1. DB::Set::checkTypesEqual(unsigned long, std::__1::shared_ptr<DB::IDataType const> const&) const @ 0x14fd8600 in /opt/bitnami/clickhouse/bin/clickhouse
2. DB::KeyCondition::tryPrepareSetIndex(DB::KeyCondition::FunctionTree const&, std::__1::shared_ptr<DB::Context const>, DB::KeyCondition::RPNElement&, unsigned long&) @ 0x15841324 in /opt/bitnami/clickhouse/bin/clickhouse
3. DB::KeyCondition::tryParseAtomFromAST(DB::KeyCondition::Tree const&, std::__1::shared_ptr<DB::Context const>, DB::Block&, DB::KeyCondition::RPNElement&) @ 0x1583d867 in /opt/bitnami/clickhouse/bin/clickhouse
4. DB::KeyCondition::traverseAST(DB::KeyCondition::Tree const&, std::__1::shared_ptr<DB::Context const>, DB::Block&) @ 0x1583...
  File "sentry/api/bases/organization_events.py", line 186, in handle_query_errors
    yield
  File "sentry/api/endpoints/organization_sessions.py", line 84, in handle_query_errors
    yield
  File "sentry/api/endpoints/organization_sessions.py", line 40, in data_fn
    return release_health.run_sessions_query(
  File "sentry/utils/services.py", line 127, in <lambda>
    context[key] = (lambda f: lambda *a, **k: getattr(self, f)(*a, **k))(key)
  File "sentry/release_health/sessions.py", line 115, in run_sessions_query
    totals, series = _run_sessions_query(query_clone)
  File "sentry/snuba/sessions_v2.py", line 536, in _run_sessions_query
    result_timeseries = timeseries_query_builder.run_query("sessions.timeseries")["data"]
  File "sentry/search/events/builder/discover.py", line 1438, in run_query
    return raw_snql_query(self.get_snql_query(), referrer, use_cache)
  File "sentry/utils/snuba.py", line 744, in raw_snql_query
    return _apply_cache_and_build_results([params], referrer=referrer, use_cache=use_cache)[0]
  File "sentry/utils/snuba.py", line 811, in _apply_cache_and_build_results
    query_results = _bulk_snuba_query([item[1] for item in to_query], headers)
  File "sentry/utils/snuba.py", line 894, in _bulk_snuba_query
    raise clickhouse_error_codes_map.get(error["code"], QueryExecutionError)(

error sql

SELECT (toStartOfHour(started, 'Universal') AS _snuba_bucketed_started), (project_id AS _snuba_project_id), _snuba_bucketed_started, (plus(countIfMerge(sessions), sumIfMerge(sessions_preaggr)) AS _snuba_sessions), _snuba_project_id FROM sessions_hourly_local PREWHERE in(_snuba_project_id, [1, 2]) WHERE greaterOrEquals((started AS _snuba_started), toDateTime('2023-05-21T03:00:00', 'Universal')) AND less(_snuba_started, toDateTime('2023-05-22T02:24:00', 'Universal')) AND equals((org_id AS _snuba_org_id), 1) AND in(tuple(_snuba_project_id), tuple(tuple(1))) AND in(_snuba_project_id, tuple(1)) GROUP BY _snuba_bucketed_started, _snuba_project_id ORDER BY _snuba_sessions DESC LIMIT 5000 OFFSET 0
@chadwhitacre
Copy link
Member

Word from inside:

As for the first one, i have no idea. Except we have to kill sessions ASAP. This is totally legacy code that we haven't run in prod for quite a while.

@mcannizz
Copy link
Member

@klboke, this error indicates that the Sentry UI is sending a malformed query to Snuba and ClickHouse. Are you observing any problems in Sentry's UI when this happens? If so, please describe them further.

@getsantry
Copy link
Contributor

getsantry bot commented Oct 5, 2024

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added the Stale label Oct 5, 2024
@getsantry getsantry bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

3 participants