Skip to content

Conversation

@volokluev
Copy link
Member

@volokluev volokluev commented Jan 13, 2026

For cross item queries to work, we need to be able to put a subquery into an AST node. Rather than modifying the whole query pipeline to be able to do this, take a shortcut and add an ArbitrarySQL node that is not transformed in any way by the query pipeline but can be inserted into a manually constructed EAP query (as we do in EAP)

The query I want to be able to build is :

SELECT * FROM eap_items_1_dist WHERE trace_id IN (SELECT trace_id FROM eap_items_1_dist WHERE...)

@volokluev volokluev requested a review from a team as a code owner January 13, 2026 19:13
volokluev and others added 2 commits January 13, 2026 11:45
Remove truncation logic from visit_arbitrary_sql to always display
the full SQL query, and remove the corresponding test case that
expected truncation behavior.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@dataclass(frozen=True, repr=_AUTO_REPR)
class ArbitrarySQL(Expression):
"""
Represents raw SQL that should be passed through directly to ClickHouse
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RawSQL / DangerousSQL / UnescapedSQL might be better to make usage of this stick out in bad situations

Renamed the ArbitrarySQL class to DangerousRawSQL to better reflect
the dangerous nature of this expression type that bypasses safety checks.

Changes:
- Renamed class from ArbitrarySQL to DangerousRawSQL
- Renamed visitor method from visit_arbitrary_sql to visit_dangerous_raw_sql
- Updated all implementations across 8 source files and 4 test files
- All 102 tests passing

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@volokluev volokluev merged commit 54b0de1 into master Jan 14, 2026
34 checks passed
@volokluev volokluev deleted the arbitrary_ast_node branch January 14, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants