[teiid-issues] [JBoss JIRA] (TEIID-2983) MongoDB: Function "count()" returns sum instead of number of rows

Steven Hawkins (JIRA) issues at jboss.org
Thu Jun 5 10:10:16 EDT 2014


    [ https://issues.jboss.org/browse/TEIID-2983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12973779#comment-12973779 ] 

Steven Hawkins commented on TEIID-2983:
---------------------------------------

> Is there a way re-write multiple aggregate statement above? right now I can only think that that needs to split into two statements.

Yes, unless you can use subqueries the only other alternative would be a more complicated sum expression:

sum(case when col is not null then 1 else 0 end)

> MongoDB can group by multiple elements in a group, then we can do a sum like

The grouping should come from the group by correct?

> 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)


More information about the teiid-issues mailing list