Repository: carbondata Updated Branches: refs/heads/master b48a8c21f -> 88757754e
[CARBONDATA-2115] Docummentation - Scenarios in which aggregate query is not fetching Added the FAQ on Scenarios in which aggregate query is not fetching This closes #1905 Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/88757754 Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/88757754 Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/88757754 Branch: refs/heads/master Commit: 88757754e26423d741bb51f3f5c0222fea8de9f5 Parents: b48a8c2 Author: sgururajshetty <sgururajshe...@gmail.com> Authored: Thu Feb 1 17:59:17 2018 +0530 Committer: chenliang613 <chenliang...@huawei.com> Committed: Sat Feb 3 16:10:17 2018 +0800 ---------------------------------------------------------------------- docs/faq.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/carbondata/blob/88757754/docs/faq.md ---------------------------------------------------------------------- diff --git a/docs/faq.md b/docs/faq.md index 6bbd4f7..baa46cc 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -25,6 +25,7 @@ * [What is Carbon Lock Type?](#what-is-carbon-lock-type) * [How to resolve Abstract Method Error?](#how-to-resolve-abstract-method-error) * [How Carbon will behave when execute insert operation in abnormal scenarios?](#how-carbon-will-behave-when-execute-insert-operation-in-abnormal-scenarios) +* [Why aggregate query is not fetching data from aggregate table?] (#why-aggregate-query-is-not-fetching-data-from-aggregate-table) ## What are Bad Records? Records that fail to get loaded into the CarbonData due to data type incompatibility or are empty or have incompatible format are classified as Bad Records. @@ -141,4 +142,40 @@ INSERT INTO TABLE carbon_table SELECT id, city FROM source_table; When the column type in carbon table is different from the column specified in select statement. The insert operation will still success, but you may get NULL in result, because NULL will be substitute value when conversion type failed. +## Why aggregate query is not fetching data from aggregate table? +Following are the aggregate queries that wonât fetch data from aggregate table: + +- **Scenario 1** : +When SubQuery predicate is present in the query. + +Example + +``` +create table gdp21(cntry smallint, gdp double, y_year date) stored by 'carbondata' +create datamap ag1 on table gdp21 using 'preaggregate' as select cntry, sum(gdp) from gdp group by ctry; +select ctry from pop1 where ctry in (select cntry from gdp21 group by cntry) +``` + +- **Scenario 2** : +When aggregate function along with âinâ filter. + +Example. + +``` +create table gdp21(cntry smallint, gdp double, y_year date) stored by 'carbondata' +create datamap ag1 on table gdp21 using 'preaggregate' as select cntry, sum(gdp) from gdp group by ctry; +select cntry, sum(gdp) from gdp21 where cntry in (select ctry from pop1) group by cntry; +``` + +- **Scenario 3** : +When aggregate function having âjoinâ with Equal filter. + +Example. + +``` +create table gdp21(cntry smallint, gdp double, y_year date) stored by 'carbondata' +create datamap ag1 on table gdp21 using 'preaggregate' as select cntry, sum(gdp) from gdp group by ctry; +select cntry,sum(gdp) from gdp21,pop1 where cntry=ctry group by cntry; +``` +