From acde384157bf0ffe516c6ab3c5504e61fd28dce9 Mon Sep 17 00:00:00 2001 From: Andy Eschbacher Date: Wed, 28 Sep 2016 16:27:41 -0400 Subject: [PATCH] update tests --- src/pg/sql/18_outliers.sql | 2 +- .../{18_outliers.out => 18_outliers_test.out} | 8 +++++++- .../sql/{18_outliers.sql => 18_outliers_test.sql} | 11 ++++++----- 3 files changed, 14 insertions(+), 7 deletions(-) rename src/pg/test/expected/{18_outliers.out => 18_outliers_test.out} (54%) rename src/pg/test/sql/{18_outliers.sql => 18_outliers_test.sql} (86%) diff --git a/src/pg/sql/18_outliers.sql b/src/pg/sql/18_outliers.sql index 3ae7a5e..6b6d943 100644 --- a/src/pg/sql/18_outliers.sql +++ b/src/pg/sql/18_outliers.sql @@ -27,7 +27,7 @@ BEGIN SELECT array_agg( CASE WHEN avg_val = 0 THEN null - ELSE outlier_fraction > i / avg_val + ELSE outlier_fraction < i::numeric / avg_val::numeric END ) INTO out_vals FROM unnest(attr) As x(i); diff --git a/src/pg/test/expected/18_outliers.out b/src/pg/test/expected/18_outliers_test.out similarity index 54% rename from src/pg/test/expected/18_outliers.out rename to src/pg/test/expected/18_outliers_test.out index 1c0f186..a329e07 100644 --- a/src/pg/test/expected/18_outliers.out +++ b/src/pg/test/expected/18_outliers_test.out @@ -1,16 +1,22 @@ +SET client_min_messages TO WARNING; +\set ECHO none outlier|rowid t|11 t|16 t|17 +(3 rows) outlier|rowid t|16 t|17 +(2 rows) outlier|rowid t|8 t|11 t|16 +(3 rows) outlier|rowid t|8 t|9 t|11 -t|15 +t|16 +(4 rows) diff --git a/src/pg/test/sql/18_outliers.sql b/src/pg/test/sql/18_outliers_test.sql similarity index 86% rename from src/pg/test/sql/18_outliers.sql rename to src/pg/test/sql/18_outliers_test.sql index 432d4c1..c12c889 100644 --- a/src/pg/test/sql/18_outliers.sql +++ b/src/pg/test/sql/18_outliers_test.sql @@ -19,7 +19,7 @@ WITH a AS ( ARRAY[1,3,2,3,5,1,2,32,12, 3,57, 2, 1, 4, 2,100,-100]::numeric[] As vals, ARRAY[1,2,3,4,5,6,7, 8, 9,10,11,12,13,14,15, 16, 17]::int[] As ids ), b As ( SELECT - (cdb_StdDevOutlier(vals, 1.0, ids)).* + (cdb_crankshaft.cdb_StdDevOutlier(vals, 1.0, ids)).* FROM a ORDER BY ids) SELECT * @@ -33,7 +33,7 @@ WITH a AS ( ARRAY[1,2,3,4,5,6,7, 8, 9,10,11,12,13,14,15, 16, 17]::int[] As ids ), b As ( SELECT - (CDB_StdDevOutlier(vals, 2.0, ids)).* + (cdb_crankshaft.CDB_StdDevOutlier(vals, 2.0, ids)).* FROM a ORDER BY ids) SELECT * @@ -48,7 +48,7 @@ WITH a AS ( ARRAY[1,2,3,4,5,6,7, 8, 9,10,11,12,13,14,15, 16, 17]::int[] As ids ), b As ( SELECT - (CDB_PercentOutlier(vals, 2.0, ids)).* + (cdb_crankshaft.CDB_PercentOutlier(vals, 2.0, ids)).* FROM a ORDER BY ids) SELECT * @@ -64,7 +64,8 @@ WITH a AS ( SELECT unnest(vals) As v, unnest(ids) as i FROM a ) -SELECT CDB_StaticOutlier(v, 11.0), i +SELECT cdb_crankshaft.CDB_StaticOutlier(v, 11.0) As outlier, i As rowid FROM b -WHERE CDB_StaticOutlier(v, 11.0) is True +WHERE cdb_crankshaft.CDB_StaticOutlier(v, 11.0) is True ORDER BY i; +