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

Incorrect results returned from UNION #3669

Closed
YuanchengJiang opened this issue Aug 19, 2023 · 0 comments · Fixed by #3768
Closed

Incorrect results returned from UNION #3669

YuanchengJiang opened this issue Aug 19, 2023 · 0 comments · Fixed by #3768
Assignees
Labels
Bug Incorrect or unexpected behavior SQL Issues or changes relating to SQL execution

Comments

@YuanchengJiang
Copy link

Describe the bug

In some cases with table joins, the UNION operator does not return the expected result.

To reproduce

Query 1: result = [(0,)]

(SELECT count(1) FROM telemetry as T1 JOIN telemetry as T2 ON T1.created=T2.created WHERE T1.event=0.0)

Query 2: result = [(4361,)] (could differ but not zero)

(SELECT count(1) FROM telemetry as T1 JOIN telemetry as T2 ON T1.event=T2.event)

Query 3 (i.e., Query 1 UNION Query 2): result = [(0,)] (buggy)

(SELECT count(1) FROM telemetry as T1 JOIN telemetry as T2 ON T1.created=T2.created WHERE T1.event=0.0) UNION (SELECT count(1) FROM telemetry as T1 JOIN telemetry as T2 ON T1.event=T2.event)

Expected Behavior

The expected result of Query 3 is [(0,4361)]

Environment

- **QuestDB version**: v7.3.1

Additional context

No response

@puzpuzpuz puzpuzpuz added Bug Incorrect or unexpected behavior SQL Issues or changes relating to SQL execution labels Aug 19, 2023
@puzpuzpuz puzpuzpuz self-assigned this Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Incorrect or unexpected behavior SQL Issues or changes relating to SQL execution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants