Skip to content

SQL compatibility: add IS DISTINCT FROM and <=> operators #86763

@alexey-milovidov

Description

@alexey-milovidov

Company or project name

ClickHouse

Use case

milovidov@Alekseis-MacBook-Pro ~ % ch "SELECT json.message.content FROM file('.claude/projects/*/*.jsonl', JSONAsObject) WHERE json.type = 'user' AND json.message.content.type != 'tool_result' LIMIT 5 FORMAT PrettyJSONEachRow"
milovidov@Alekseis-MacBook-Pro ~ % ch "SELECT json.message.content FROM file('.claude/projects/*/*.jsonl', JSONAsObject) WHERE json.type = 'user' AND json.message.content.type IS DISTINCT FROM 'tool_result' LIMIT 5 FORMAT PrettyJSONEachRow"
Code: 62. DB::Exception: Syntax error: failed at position 141 (DISTINCT): DISTINCT FROM 'tool_result' LIMIT 5 FORMAT PrettyJSONEachRow. Expected one of: NOT DISTINCT FROM, NULL, NOT NULL, end of query. (SYNTAX_ERROR)
milovidov@Alekseis-MacBook-Pro ~ % ch "SELECT json.message.content FROM file('.claude/projects/*/*.jsonl', JSONAsObject) WHERE json.type = 'user' AND json.message.content.type <=> 'tool_result' LIMIT 5 FORMAT PrettyJSONEachRow"
Code: 48. DB::Exception: Function isNotDistinctFrom can be used only in the JOIN ON section: while executing function isNotDistinctFrom on arguments __table1.json.message.content.type Dynamic Dynamic(size = 0, Variant(size = 0, UInt8(size = 0), UInt64(size = 0), String(size = 0))), 'tool_result'_String String Const(size = 0, String(size = 1)). (NOT_IMPLEMENTED)

Describe the solution you'd like

Implement these operators; the generic version could use IColumn::compareAt

Describe alternatives you've considered

No alternative, we have to implement that.

Additional context

Duplicate of #58145

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions