You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Stamatis Zampetakis (JIRA)" <ji...@apache.org> on 2019/06/29 22:50:00 UTC

[jira] [Comment Edited] (CALCITE-3120) MongoAdapterTest.testGroupByAvgSumCount fails due the order of sort query

    [ https://issues.apache.org/jira/browse/CALCITE-3120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16875585#comment-16875585 ] 

Stamatis Zampetakis edited comment on CALCITE-3120 at 6/29/19 10:49 PM:
------------------------------------------------------------------------

Fixed in CALCITE-3156


was (Author: asereda):
Fixed in CALCITE-3120

> MongoAdapterTest.testGroupByAvgSumCount fails due the order of sort query
> -------------------------------------------------------------------------
>
>                 Key: CALCITE-3120
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3120
>             Project: Calcite
>          Issue Type: Bug
>          Components: mongodb-adapter
>    Affects Versions: 1.19.0
>            Reporter: Stamatis Zampetakis
>            Assignee: Stamatis Zampetakis
>            Priority: Major
>
> The MongoAdapterTest.testGroupByAvgSumCount fails because $sort operator does not appear at the middle of the query but in the end.
> {noformat}
> org.junit.ComparisonFailure:
> expected and actual Mongo queries (pipelines) do not match expected:<...$project" : {
>     "[POP" : "$pop",
>     "STATE" : "$state"
>   }
> }
> {
>   "$group" : {
>     "_id" : "$STATE",
>     "_1" : {
>       "$sum" : "$POP"
>     },
>     "_2" : {
>       "$sum" : {
>         "$cond" : [{
>             "$eq" : ["POP", null]
>           }, 0, 1]
>       }
>     }
>   }
> }
> {
>   "$project" : {
>     "STATE" : "$_id",
>     "_1" : "$_1",
>     "_2" : "$_2"
>   }
> }
> {
>   "$sort" : {
>     "STATE" : 1
>   }
> }
> {
>   "$project" : {
>     "STATE" : 1,
>     "A" : {
>       "$divide" : [{
>           "$cond" : [{
>               "$eq" : ["$_2", {
>                   "$literal" : 0
>                 }]
>             }, null, "$_1"]
>         }, "$_2"]
>     },
>     "S" : {
>       "$cond" : [{
>           "$eq" : ["$_2", {
>               "$literal" : 0
>             }]
>         }, null, "$_1"]
>     },
>     "C" : "$_2"]
>   }
> }> but was:<...$project" : {
>     "[STATE" : "$state",
>     "POP" : "$pop"
>   }
> }
> {
>   "$group" : {
>     "_id" : "$STATE",
>     "_1" : {
>       "$sum" : "$POP"
>     },
>     "_2" : {
>       "$sum" : {
>         "$cond" : [{
>             "$eq" : ["POP", null]
>           }, 0, 1]
>       }
>     }
>   }
> }
> {
>   "$project" : {
>     "STATE" : "$_id",
>     "_1" : "$_1",
>     "_2" : "$_2"
>   }
> }
> {
>   "$project" : {
>     "STATE" : 1,
>     "A" : {
>       "$divide" : [{
>           "$cond" : [{
>               "$eq" : ["$_2", {
>                   "$literal" : 0
>                 }]
>             }, null, "$_1"]
>         }, "$_2"]
>     },
>     "S" : {
>       "$cond" : [{
>           "$eq" : ["$_2", {
>               "$literal" : 0
>             }]
>         }, null, "$_1"]
>     },
>     "C" : "$_2"
>   }
> }
> {
>   "$sort" : {
>     "STATE" : 1]
>   }
> }>
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)