[
https://issues.jboss.org/browse/TEIID-2983?page=com.atlassian.jira.plugin...
]
Ramesh Reddy commented on TEIID-2983:
-------------------------------------
I do not know if that type of sum statement can be build, mongodb processing is a
pipeline. In order for SUM function to return the number documents (instead of summation)
you would need to give it an "_id" based grouping, before the summation task and
there can be only one "_id" in the pipeline execution. So, now
{code}
select count(*), count(CustomerId) from customer
{code}
will fail saying that multiple count aggregates are not allowed
however, queries like these are allowed
{code}
select count(*), min(CustomerId) from customer
{code}
as these do not need the grouping construct.
MongoDB: Function "count()" returns sum instead of number
of rows
-----------------------------------------------------------------
Key: TEIID-2983
URL:
https://issues.jboss.org/browse/TEIID-2983
Project: Teiid
Issue Type: Bug
Components: Misc. Connectors
Affects Versions: 8.7.1
Reporter: Van Halbert
Assignee: Ramesh Reddy
Labels: Beta1
Fix For: 8.7.1, 8.8
Function "count()" returns sum of rows instead of number of rows
Query [1] returns sum of values of all rows of IntKey column.
Query [2] correctly returns number of rows
[1] SELECT COUNT(IntKey) FROM BQT1.SmallA
[2] SELECT COUNT(*) FROM BQT1.SmallA
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)