diff --git a/src/pg/test/expected/41_observatory_augmentation_test.out b/src/pg/test/expected/41_observatory_augmentation_test.out index 5b13d3e..1a14f88 100644 --- a/src/pg/test/expected/41_observatory_augmentation_test.out +++ b/src/pg/test/expected/41_observatory_augmentation_test.out @@ -26,19 +26,19 @@ Done. 9516.27915900609 | 6152.51885204623 | 3363.76030695986 | 28.8 | 5301.51624447348 | 149.500458087105 | 230.000704749392 | 3835.26175169611 | 0 | 0 | 0 | 5681.01740730998 | 3323.51018362871 | 7107.02177675621 | 1040.753188991 | 69.0002114248176 | 793.502431385402 | 327.751004267883 | 2742.7584041365 | 931.502854235037 | 66304 | 0.3494 | 28291 | 3662.76122313407 | 339.251039505353 | 120.750369993431 | 0 | 1764 | 35.3 | 339.251039505353 | 0 | 224.250687130657 | 6549.27006773893 | 327.751004267883 | 28.750088093674 | 201.250616655718 | 621.001902823358 | 373.751145217762 | 1851.5056732326 | 1414.50433420876 | 1115.50341803455 | 615.251885204623 | | 57.500176187348 | 0 | 212.750651893187 | 408.251250930171 | 0 | 155.25047570584 | 109.250334755961 | 92.0002818997568 | 63.2501938060828 | 184.000563799514 | 621.001902823358 | 552.001691398541 | 327.751004267883 | 333.501021886618 | 126.500387612166 | | (1 row) - dimension | dimension_value -----------------------+------------------------------------- - {total_pop,male_pop} | {9516.27915900609,6152.51885204623} +test_obsgetcensuswithtestpointand2variables +--------------------------------------------- +t (1 row) - dimension | dimension_value ------------------------+----------------- - {female_pop,male_pop} | {NULL,NULL} +test_obsgetcensuswithnullislandarea +------------------------------------- +t (1 row) - dimension | dimension_value ------------------------+----------------- - {female_pop,male_pop} | {} +test_obsgetcensuswithnullisland +--------------------------------- +t (1 row) obs_get_gini_index_at_test_point diff --git a/src/pg/test/sql/41_observatory_augmentation_test.sql b/src/pg/test/sql/41_observatory_augmentation_test.sql index 137b021..ad7cf1a 100644 --- a/src/pg/test/sql/41_observatory_augmentation_test.sql +++ b/src/pg/test/sql/41_observatory_augmentation_test.sql @@ -13,28 +13,42 @@ SELECT * FROM -- total_pop | 9516.27915900609 -- male_pop | 6152.51885204623 -SELECT * -FROM - cdb_observatory._OBS_GetCensus( - cdb_observatory._TestPoint(), - Array['total_pop','male_pop']::text[] - ); - +WITH result as ( + SELECT array_agg(_obs_getcensus->>'value') as b + FROM( select * from + cdb_observatory._OBS_GetCensus( + cdb_observatory._TestPoint(), + Array['total_pop','male_pop']::text[] + )) a +) +select b='{9516.27915900609,6152.51885204623}' + as test_obsGetCensusWithTestPointAnd2Variables + from result; -- what happens on null island? -- expect nulls back: {female_pop, male_pop} | {NULL, NULL} -SELECT * -FROM - cdb_observatory._OBS_GetCensus( - ST_Buffer(CDB_LatLng(0, 0)::geography, 5000)::geometry, - Array['female_pop','male_pop']::text[] - ); + +WITH result as ( + SELECT count(vals) non_null + FROM( select _OBS_GetCensus->>'value' vals from + cdb_observatory._OBS_GetCensus( + ST_Buffer(CDB_LatLng(0, 0)::geography, 5000)::geometry, + Array['total_pop','male_pop']::text[] + )) a +) +SELECT non_null = 0 as test_obsGetCensusWithNullIslandArea +FROM result; + -- expect nulls back {female_pop, male_pop} | {NULL, NULL} -SELECT * -FROM - cdb_observatory._OBS_GetCensus( - CDB_LatLng(0, 0), - Array['female_pop', 'male_pop']::text[] - ); +WITH result as ( + SELECT count(vals) non_null + FROM( select _OBS_GetCensus->>'value' vals from + cdb_observatory._OBS_GetCensus( + CDB_LatLng(0, 0), + Array['total_pop','male_pop']::text[] + )) a +) +SELECT non_null = 0 as test_obsGetCensusWithNullIsland +FROM result; -- -- names | vals