× Heads up!

Aqua Data Studio / nhilam

Follow
IDE for Relational Databases
×
slavakiev reported 2013-07-21T19:05:29Z  · last modified 2013-09-23T21:11:20Z

Wrong program beheviour when complex WHAT and WHERE clauses in the statement


Priority Low
Complexity Unknown
Component MongoSQL
Version 14.0

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

When statement has complex WHAT and WHERE cluses program takes full WHERE statement in one name and puts it into the $match clause.Thus such statements always works in wrong way by returning empty result set. At list program should return error message, e.g. "Complex expressions  not supported" instead showing wrong result in silance.For example,

SELECT (valuation+3) * (valuation-10) , (valuation +21), city FROM baseball 
WHERE
(valuation+2) - (valuation+1) + (valuation+21)=32
go
--empty result set instead rows

--Because program builds absolutely wrong statement by naming full WHERE clause as one name "valuation + 2 - (valuation + 1) + (valuation + 21)"

 --[ { "$project" : { "_id" : 0, "(valuation + 3) * (valuation - 10)" : { "$multiply" : [ { "$add" : [ "$valuation", 3 ] }, { "$subtract" : [ "$valuation", 10 ] } ] }, "valuation + 21" : { "$add" : [ "$valuation", 21 ] }, "city" : "$city" } }, { "$match" : { "valuation + 2 - (valuation + 1) + (valuation + 21)" : 32 } } ]   

In current version I propose to show error message instead such wrong beheviour. In next version such statement can be realised with help of using 2 or more $project statements when all binary memebers from WHAT and WHERE clauses automaticaly calculated in the first $project with giving them names( it is nt a problem if same memebers will be in the WHERE and WHAT because in $project duplication of same names is possible). In next $project in pipeline with these names possible to make new operations with new naming and finaly all comparisons can be done in the $match.

For example, currently wrong working statement:

select valuation+2 from baseball
where valuation+1=11 
and city='Chicago'
go
--empty result set instead rows
This can be realised with help of 2 $projects:
db.baseball.aggregate({$project:{city:"$city",val1:{$add:["$valuation",1]},val2:{$add:["$valuation",2]}}},{$match:{ "$and" : [ { "city" : "Chicago" }, { val1 : 11 } ] }},{$project:{_id:0,"valuation+2":"$val2"}})  
 

      

Issue #9629

Closed
Fixed
Resolved 2013-09-20T12:29:31Z
 
 
Completion
No due date
Fixed Build ADS 14.0.0-rc-25 (mongo-jdbc 1.3.5)
No time estimate

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