Skip to content

[CH-45]Support count(1)/count(*)#398

Merged
zzcclp merged 6 commits intoapache:mainfrom
bigo-sg:empty_read_columns
Nov 1, 2022
Merged

[CH-45]Support count(1)/count(*)#398
zzcclp merged 6 commits intoapache:mainfrom
bigo-sg:empty_read_columns

Conversation

@lgbo-ustc
Copy link
Contributor

Relate to the issue Kyligence/ClickHouse#45

What changes were proposed in this pull request?

A empty base_schema will be made in the scan node when run the following queries

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

The backend source node will return empty data or throw an exception when there is no column to read.
So we fill a attribute to read in FileSourceScanExec.

Another problem is in ProjectExecTransformer. If ProjectExecTransformer's child is an ColumnarInputAdapter and projectList is empty, it would generate a scan node with empty base_schema. So when childCtx is null, we don't return directly.

How was this patch tested?

(Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests)

(If this patch involves UI changes, please attach a screenshot; otherwise, remove this)

@github-actions
Copy link

Thanks for opening a pull request!

Could you open an issue for this pull request on Github Issues?

https://github.com/oap-project/gluten/issues

Then could you also rename commit message and pull request title in the following format?

[Gluten-${ISSUES_ID}] ${detailed message}

See also:

@zzcclp zzcclp requested review from rui-mo, zhztheplayer and zzcclp and removed request for zhztheplayer September 22, 2022 08:52
@lgbo-ustc lgbo-ustc force-pushed the empty_read_columns branch 2 times, most recently from 959e087 to 3f87780 Compare September 22, 2022 09:02
@lgbo-ustc lgbo-ustc changed the title Support count(1)/count(*) [clickhouse-45]Support count(1)/count(*) Sep 27, 2022
@lgbo-ustc lgbo-ustc changed the title [clickhouse-45]Support count(1)/count(*) [CH-45]Support count(1)/count(*) Sep 27, 2022
@zzcclp
Copy link
Contributor

zzcclp commented Oct 17, 2022

Please rebase to main and add some UTs

@lgbo-ustc lgbo-ustc force-pushed the empty_read_columns branch 3 times, most recently from 29af11c to b57d73e Compare October 18, 2022 04:02
@zzcclp
Copy link
Contributor

zzcclp commented Oct 20, 2022

Please rebase to main

@lgbo-ustc
Copy link
Contributor Author

wait for Kyligence/ClickHouse#175 be merged

Copy link
Contributor

@rui-mo rui-mo left a comment

Choose a reason for hiding this comment

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

Verified on Jenkins. LGTM.

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