× Heads up!

Aqua Data Studio / nhilam

Follow
IDE for Relational Databases
×
slavakiev reported 2013-07-29T11:08:40Z  · last modified 2013-09-09T14:49:16Z

Issues with using alsiases and GROUP BY in FLATTEN_ARRAY


Priority Low
Complexity Moderate
Component MongoSQL
Version 14.0

Tested Aqua Data Studio Aqua Data Studio 14.0.0-beta-74 Build #: 33340 on Ubuntu 12.04( Mongo DB 2.4.3)  and Windows XP ( Mongo DB 2.0.9).

1. Alias in GROUP BY or  MIN(), MAX() double result set and  change output format:

Normaly:
select flatten_array stats from baseball group by stats
go
-- returns 2 rows with many columns 
--stats.year stats.wins stats.mostRbis stats.grade stats.battingAvg
--1904        100                      1000                A                   0.3
--1987          80                         200                A                   0.267
 
But with alias:
 
select flatten_array stats as sts from baseball group by stats
go
--returns 4 rows instead 2 and only 1 column instead many
--sts
--{ "year" : 1904 , "wins" : 100 , "mostRbis" : 1000 , "grade" : "A" , "battingAvg" : 0.3}
--{ "year" : 1904 , "wins" : 100 , "mostRbis" : 1000 , "grade" : "A" , "battingAvg" : 0.3}
--{ "year" : 1987 , "wins" : 80 , "mostRbis" : 200 , "grade" : "A" , "battingAvg" : 0.267}
--{ "year" : 1987 , "wins" : 80 , "mostRbis" : 200 , "grade" : "A" , "battingAvg" : 0.267}
 
Same problem with MIN( ) and MAX( ) functions:  
Without GROUP BY 2 rows returns with 1 column( should be many columns)  
select flatten_array min(stats) from baseball 
go
--min(stats)
--{ "year" : 1904 , "wins" : 100 , "mostRbis" : 1000 , "grade" : "A" , "battingAvg" : 0.3}
--{ "year" : 1987 , "wins" : 80 , "mostRbis" : 200 , "grade" : "A" , "battingAvg" : 0.267}
 
GROUP BY doubles result set:
select flatten_array min(stats) from baseball group by stats
go
--returns 4 rows instead 2 and only 1 column instead many
--min(stats)
--{ "year" : 1904 , "wins" : 100 , "mostRbis" : 1000 , "grade" : "A" , "battingAvg" : 0.3}
--{ "year" : 1987 , "wins" : 80 , "mostRbis" : 200 , "grade" : "A" , "battingAvg" : 0.267}
--{ "year" : 1904 , "wins" : 100 , "mostRbis" : 1000 , "grade" : "A" , "battingAvg" : 0.3}
--{ "year" : 1987 , "wins" : 80 , "mostRbis" : 200 , "grade" : "A" , "battingAvg" : 0.267}
 
2. Alias changes output format in FLATTEN_ARRAY (without GROUP BY)
select flatten_array stats from baseball 
go
-- returns 2 rows with many columns 
--stats.year stats.wins stats.mostRbis stats.grade stats.battingAvg
--1904       100                      1000                A                   0.3
--1987          80                         200                A                   0.267
 
But with  using alias only 1 column in output: 
select flatten_array stats as sts from baseball 
go
--sts
--{ "year" : 1904 , "wins" : 100 , "mostRbis" : 1000 , "grade" : "A" , "battingAvg" : 0.3}
--{ "year" : 1987 , "wins" : 80 , "mostRbis" : 200 , "grade" : "A" , "battingAvg" : 0.267}
 
 
 

Issue #9675

Closed
Fixed
Resolved 2013-09-02T16:06:00Z
 
 
Completion
No due date
Fixed Build ADS 14.0.0-rc-12 (mongo-jdbc 1.3.2)
No time estimate

About AquaClusters Privacy Policy Support Version - 19.0.2-4 AquaFold, Inc Copyright © 2007-2017