From c0dfaa8341e3c35b97e393eac804a8c702872afa Mon Sep 17 00:00:00 2001 From: Andy Eschbacher Date: Thu, 2 Jun 2016 16:19:15 -0400 Subject: [PATCH] adds test for spatial markov sql function --- src/pg/test/sql/05_markov_test.sql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/pg/test/sql/05_markov_test.sql diff --git a/src/pg/test/sql/05_markov_test.sql b/src/pg/test/sql/05_markov_test.sql new file mode 100644 index 0000000..d91fc0a --- /dev/null +++ b/src/pg/test/sql/05_markov_test.sql @@ -0,0 +1,15 @@ +SET client_min_messages TO WARNING; +\set ECHO none +\pset format unaligned +\i test/fixtures/markov_usjoin_example.sql + +-- Areas of Interest functions perform some nondeterministic computations +-- (to estimate the significance); we will set the seeds for the RNGs +-- that affect those results to have repeatable results +SELECT cdb_crankshaft._cdb_random_seeds(1234); + +SELECT m1.cartodb_id, m2.trend, m2.trend_up, m2.trend_down, m2.volatility + FROM markov_usjoin_example As m1 + JOIN cdb_crankshaft.CDB_SpatialMarkov('SELECT * FROM markov_usjoin_example', Array['y1995', 'y1996', 'y1997', 'y1998', 'y1999', 'y2000', 'y2001', 'y2002', 'y2003', 'y2004', 'y2005', 'y2006', 'y2007', 'y2008', 'y2009']::text[], 5, 'knn', 5, 0, 'the_geom', 'cartodb_id') As m2 + ON m1.cartodb_id = m2.rowid + ORDER BY m1.cartodb_id;