//All the below results are after code change. Build: ADS17-alpha-19 1. SQL Query without /1000 select FLATTEN_ARRAY asset, epochTimeInMillis as epochTimeInSeconds, anomalyResult.modelResults.modelName as model, anomalyResult.modelResults.anomalyScore as score from test Result: asset epochTimeInSeconds model score -------- --------------------- -------- ----------------- dsafjkkk 35647 abc 12.49153623540901 dsafjkkk 35647 pqr 12.38601205387994 Point: A1 =========================================================================================================== 2. SQL Query with /1000 select FLATTEN_ARRAY asset, epochTimeInMillis/1000 as epochTimeInSeconds, anomalyResult.modelResults.modelName as model, anomalyResult.modelResults.anomalyScore as score from test Result: asset epochTimeInSeconds model score -------- --------------------- -------- ----------------- dsafjkkk 35.647 abc 12.49153623540901 dsafjkkk 35.647 pqr 12.49153623540901 //Not expecting this line in result dsafjkkk 35.647 abc 12.38601205387994 //Not expecting this line in result dsafjkkk 35.647 pqr 12.38601205387994 // The result is not displayed properly in ADS // Please refer 3rd point- Equivalent query run in Java code Point: A2 3. In Java code- SQL Query with /1000 select FLATTEN_ARRAY asset, epochTimeInMillis/1000 as epochTimeInSeconds, anomalyResult.modelResults.modelName as model, anomalyResult.modelResults.anomalyScore as score from test Result: obj{ "asset" : 'dsafjkkk', "epochTimeInSeconds" : 35.647, "model" : [ 'abc', 'pqr' ], "score" : [ 12.49153623540901, 12.38601205387994 ] } // I was expecting the result in below format: -----obj{ "asset" : 'dsafjkkk', "epochTimeInMillis" : 35647.0, "anomalyResult" : { "modelResults" : [ { "modelName" : 'abc', "anomalyScore" : 12.49153623540901 }, { "modelName" : 'pqr', "anomalyScore" : 12.38601205387994 } ] } } ------ Point: A3 // When we execute the SQL query without / 1000 , we get above result [surrounded in ----]. // But when the [ query/1000 ] is executed, we are getting right result, but it is not in expected format. 4. Why this is happening. a] Refer : [ File : "MongoUtils.java" Method: private static void expandArrays(DBObject object, String[] columnNames, int currentPos, List result) throws SQLException ] The result display logic in above method is working properly for [SQL without /1000 ] query. --But it doesn't work for [SQL with /1000] query. Need to make some changes in Display Logic, to make it Generic.