incubator-gluten icon indicating copy to clipboard operation
incubator-gluten copied to clipboard

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

Open lgbo-ustc opened this issue 2 years ago • 2 comments

Relate to the issue https://github.com/Kyligence/ClickHouse/issues/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)

lgbo-ustc avatar Sep 22 '22 08:09 lgbo-ustc

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:

github-actions[bot] avatar Sep 22 '22 08:09 github-actions[bot]

Please rebase to main and add some UTs

zzcclp avatar Oct 17 '22 09:10 zzcclp

Please rebase to main

zzcclp avatar Oct 20 '22 12:10 zzcclp

wait for https://github.com/Kyligence/ClickHouse/pull/175 be merged

lgbo-ustc avatar Oct 26 '22 04:10 lgbo-ustc