Skip to content

[CH-45]support count(*/count(1)#175

Merged
liuneng1994 merged 3 commits intoKyligence:clickhouse_backendfrom
bigo-sg:empty_read_columns
Oct 31, 2022
Merged

[CH-45]support count(*/count(1)#175
liuneng1994 merged 3 commits intoKyligence:clickhouse_backendfrom
bigo-sg:empty_read_columns

Conversation

@lgbo-ustc
Copy link
Copy Markdown

@lgbo-ustc lgbo-ustc commented Oct 26, 2022

support count(*)/count(1)

Changelog category (leave one):

  • New Feature

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
relate to issue #45

Read from file sources or java batch iterator will fail with empty columns to read. This happends when running the following queries.

select count(1) from t;
select sum(1) from t;
select 1 from t;

In this case, the rows number is the only information to need. To solve this, we try to build a block with an virtual column which indicates the rows number, and this virtual column will not be really used.

In SubstraitFileSource, if the file implement getTotalRows, we build blocks with a constant column whose total size is equal to getTotalRows's result.

In SourceFromJavaIter, we also return blocks with a constant column whose size is equal to input block's rows.

For merge tree, we try to read a least one column instead of the original empty header.

Information about CI checks: https://clickhouse.tech/docs/en/development/continuous-integration/

@kyligence-git
Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@lgbo-ustc lgbo-ustc force-pushed the empty_read_columns branch 2 times, most recently from da975ce to d2d27ef Compare October 26, 2022 04:06
@lgbo-ustc lgbo-ustc marked this pull request as ready for review October 26, 2022 04:28
@lgbo-ustc
Copy link
Copy Markdown
Author

test this please with 398

@lgbo-ustc
Copy link
Copy Markdown
Author

test this please with 398

@lgbo-ustc
Copy link
Copy Markdown
Author

test this please with 398

1 similar comment
@lgbo-ustc
Copy link
Copy Markdown
Author

test this please with 398

@lgbo-ustc
Copy link
Copy Markdown
Author

test this please with 398

1 similar comment
@lgbo-ustc
Copy link
Copy Markdown
Author

test this please with 398

@lgbo-ustc
Copy link
Copy Markdown
Author

test this please with 398

@liuneng1994
Copy link
Copy Markdown

test this please

Copy link
Copy Markdown

@liuneng1994 liuneng1994 left a comment

Choose a reason for hiding this comment

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

LGTM

@liuneng1994 liuneng1994 merged commit 844e7f5 into Kyligence:clickhouse_backend Oct 31, 2022
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