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

Aggregation on empty table yields empty table #45

Open
Aklakan opened this issue May 3, 2014 · 1 comment
Open

Aggregation on empty table yields empty table #45

Aklakan opened this issue May 3, 2014 · 1 comment

Comments

@Aklakan
Copy link
Member

Aklakan commented May 3, 2014

If we have

(Project Count(foo)
    emptySqlOp
)

Then the SqlOpStringSerializerImpl incorrectly returns null to indicate a query with no result rows.
The solution is to properly keep track of whether aggregations are being used in a query, and if so, serialize the empty table as e.g. SELECT NULL WHERE FALSE.

@Aklakan
Copy link
Member Author

Aklakan commented May 3, 2014

Added a somewhat hacky fix to SqlOpSelectBlock's isEmpty() method:

The method now checks if the projection contains a single argument that is a count function.
However, the isEmpty() method for SqlOpProjection and SqlOpExtend are currently still broken - i.e. they would incorrectly return true.

Aklakan added a commit that referenced this issue May 3, 2014
Aklakan added a commit that referenced this issue May 3, 2014
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

No branches or pull requests

1 participant