-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e0381a
commit 6c6e175
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
\set ECHO none | ||
repair_key | ||
------------ | ||
|
||
(1 row) | ||
|
||
remove_provenance | ||
------------------- | ||
|
||
(1 row) | ||
|
||
ground | round | ||
--------+------- | ||
dry | 0.550 | ||
wet | 0.450 | ||
(2 rows) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
\set ECHO none | ||
SET search_path TO provsql_test,provsql; | ||
|
||
CREATE TABLE weather_conditions (dummy VARCHAR, weather VARCHAR, | ||
ground VARCHAR, p FLOAT); | ||
INSERT INTO weather_conditions VALUES ('dummy', 'rain', 'wet', 0.35); | ||
INSERT INTO weather_conditions VALUES ('dummy', 'rain', 'dry', 0.05); | ||
INSERT INTO weather_conditions VALUES ('dummy', 'no rain', 'wet', 0.1); | ||
INSERT INTO weather_conditions VALUES ('dummy', 'no rain', 'dry', 0.5); | ||
|
||
SELECT repair_key('weather_conditions','dummy'); | ||
DO $$ BEGIN | ||
PERFORM set_prob(provenance(), p) FROM weather_conditions; | ||
END $$; | ||
|
||
CREATE TABLE result_repair_key AS | ||
SELECT *, probability_evaluate(provenance()) prob FROM ( | ||
SELECT ground FROM weather_conditions GROUP BY ground) t; | ||
|
||
SELECT remove_provenance('result_repair_key'); | ||
SELECT ground, ROUND(prob::numeric, 3) FROM result_repair_key; | ||
|
||
DROP TABLE result_repair_key; | ||
DROP TABLE weather_conditions; |