You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by pr...@apache.org on 2014/04/02 06:11:58 UTC
[18/50] [abbrv] git commit: Added new join queries and updated
queries to used xs:dateTime.
Added new join queries and updated queries to used xs:dateTime.
Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/74a22a31
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/74a22a31
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/74a22a31
Branch: refs/heads/prestonc/hash_join
Commit: 74a22a318286d801e63d247f63062a148e4b2a5a
Parents: 94aa026
Author: Preston Carman <pr...@apache.org>
Authored: Fri Mar 14 22:05:39 2014 -0700
Committer: Preston Carman <pr...@apache.org>
Committed: Tue Apr 1 20:56:24 2014 -0700
----------------------------------------------------------------------
.../resources/noaa-ghcn-daily/queries/q00.xq | 8 +++----
.../resources/noaa-ghcn-daily/queries/q02.xq | 3 +--
.../resources/noaa-ghcn-daily/queries/q04.xq | 3 +--
.../resources/noaa-ghcn-daily/queries/q05.xq | 3 +--
.../resources/noaa-ghcn-daily/queries/q06.xq | 24 ++++++++++----------
.../noaa-ghcn-daily/queries/q06_sensor.xq | 9 --------
.../noaa-ghcn-daily/queries/q06_tmax.xq | 9 ++++++++
.../noaa-ghcn-daily/queries/q06_tmin.xq | 9 ++++++++
.../resources/noaa-ghcn-daily/queries/q07.xq | 8 +++----
.../noaa-ghcn-daily/queries/q07_sensor.xq | 10 ++++++++
.../noaa-ghcn-daily/queries/q07_station.xq | 7 ++++++
11 files changed, 58 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/74a22a31/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q00.xq
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q00.xq b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q00.xq
index 8a639dd..527fa00 100644
--- a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q00.xq
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q00.xq
@@ -3,9 +3,9 @@
(: the weather readings for December 25 over the last 10 years. :)
let $collection := "/tmp/1.0_partition_ghcnd_all_xml/sensors"
for $r in collection($collection)/dataCollection/data
-let $date := xs:date(fn:substring(xs:string(fn:data($r/date)), 0, 11))
+let $datetime := xs:dateTime(fn:data($r/date))
where $r/station eq "GHCND:ASN00008113"
- and fn:year-from-date($date) ge 2003
- and fn:month-from-date($date) eq 12
- and fn:day-from-date($date) eq 25
+ and fn:year-from-dateTime($datetime) ge 2003
+ and fn:month-from-dateTime($datetime) eq 12
+ and fn:day-from-dateTime($datetime) eq 25
return $r
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/74a22a31/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q02.xq
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q02.xq b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q02.xq
index 534dabf..88d25f3 100644
--- a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q02.xq
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q02.xq
@@ -4,9 +4,8 @@
fn:sum(
let $collection := "/tmp/1.0_partition_ghcnd_all_xml/sensors"
for $r in collection($collection)/dataCollection/data
- let $date := xs:date(fn:substring(xs:string(fn:data($r/date)), 0, 11))
where $r/station eq "GHCND:USW00024233"
and $r/dataType eq "PRCP"
- and fn:year-from-date($date) eq 1999
+ and fn:year-from-dateTime(xs:dateTime(fn:data($r/date))) eq 1999
return $r/value
) div 10
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/74a22a31/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q04.xq
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q04.xq b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q04.xq
index 174a9f7..f0ff178 100644
--- a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q04.xq
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q04.xq
@@ -7,8 +7,7 @@ for $s in collection($station_collection)/stationCollection/station
let $sensor_collection := "/tmp/1.0_partition_ghcnd_all_xml/sensors"
for $r in collection($sensor_collection)/dataCollection/data
-let $date := xs:date(fn:substring(xs:string(fn:data($r/date)), 0, 11))
where $s/id eq $r/station
and (some $x in $s/locationLabels satisfies ($x/type eq "CNTY" and fn:contains(fn:upper-case(fn:data($x/displayName)), "KING")))
- and $date eq xs:date("1976-07-04")
+ and xs:dateTime(fn:data($r/date)) eq xs:dateTime("1976-07-04T00:00:00.000")
return $r
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/74a22a31/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q05.xq
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q05.xq b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q05.xq
index 23bbaf4..366eaff 100644
--- a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q05.xq
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q05.xq
@@ -8,10 +8,9 @@ fn:min(
let $sensor_collection := "/tmp/1.0_partition_ghcnd_all_xml/sensors"
for $r in collection($sensor_collection)/dataCollection/data
- let $date := xs:date(fn:substring(xs:string(fn:data($r/date)), 0, 11))
where $s/id eq $r/station
and (some $x in $s/locationLabels satisfies ($x/type eq "ST" and fn:upper-case(fn:data($x/displayName)) eq "OREGON"))
and $r/dataType eq "TMIN"
- and fn:year-from-date($date) eq 2001
+ and fn:year-from-dateTime(xs:dateTime(fn:data($r/date))) eq 2001
return $r/value
) div 10
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/74a22a31/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q06.xq
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q06.xq b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q06.xq
index 02dc9ab..0d0a4ba 100644
--- a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q06.xq
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q06.xq
@@ -1,14 +1,14 @@
-(: XQuery Join Aggregate Query :)
-(: Self join with all stations. :)
-let $sensor_collection1 := "/tmp/1.0_partition_ghcnd_all_xml/sensors"
-for $r1 in collection($sensor_collection1)/dataCollection/data
+(: XQuery Self Join Query :)
+(: Self join with all stations finding the difference in min and max :)
+(: temperature. :)
+let $sensor_collection_min := "/tmp/1.0_partition_ghcnd_all_xml/sensors"
+for $r_min in collection($sensor_collection_min)/dataCollection/data
-let $sensor_collection2 := "/tmp/1.0_partition_ghcnd_all_xml/sensors"
-for $r2 in collection($sensor_collection2)/dataCollection/data
+let $sensor_collection_max := "/tmp/1.0_partition_ghcnd_all_xml/sensors"
+for $r_max in collection($sensor_collection_max)/dataCollection/data
-let $date1 := xs:date(fn:substring(xs:string(fn:data($r1/date)), 0, 11))
-let $date2 := xs:date(fn:substring(xs:string(fn:data($r2/date)), 0, 11))
-where $r1/station eq $r2/station
- and fn:year-from-date($date1) gt 2000
- and fn:year-from-date($date2) gt 2000
-return ($r1/value, $r2/value)
\ No newline at end of file
+where $r_min/station eq $r_max/station
+ and $r_min/date eq $r_max/date
+ and $r_min/dataType eq "TMIN"
+ and $r_max/dataType eq "TMAX"
+return ($r_max/value, $r_min/value, $r_max/value - $r_min/value)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/74a22a31/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q06_sensor.xq
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q06_sensor.xq b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q06_sensor.xq
deleted file mode 100644
index 7767b7c..0000000
--- a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q06_sensor.xq
+++ /dev/null
@@ -1,9 +0,0 @@
-(: XQuery Join Aggregate Query :)
-(: Count all sensor readings after 2000. :)
-count(
- let $sensor_collection := "/tmp/1.0_partition_ghcnd_all_xml/sensors"
- for $r in collection($sensor_collection)/dataCollection/data
- let $date := xs:date(fn:substring(xs:string(fn:data($r/date)), 0, 11))
- where fn:year-from-date($date) gt 2000
- return $r
-)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/74a22a31/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q06_tmax.xq
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q06_tmax.xq b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q06_tmax.xq
new file mode 100644
index 0000000..43694ea
--- /dev/null
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q06_tmax.xq
@@ -0,0 +1,9 @@
+(: XQuery Join Query :)
+(: Find the all the records for TMAX. :)
+count(
+ let $sensor_collection_max := "/tmp/1.0_partition_ghcnd_all_xml/sensors"
+ for $r_max in collection($sensor_collection_max)/dataCollection/data
+
+ where $r_max/dataType eq "TMAX"
+ return $r_max
+)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/74a22a31/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q06_tmin.xq
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q06_tmin.xq b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q06_tmin.xq
new file mode 100644
index 0000000..51db7c3
--- /dev/null
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q06_tmin.xq
@@ -0,0 +1,9 @@
+(: XQuery Join Query :)
+(: Find the all the records for TMIN. :)
+count(
+ let $sensor_collection_min := "/tmp/1.0_partition_ghcnd_all_xml/sensors"
+ for $r_min in collection($sensor_collection_min)/dataCollection/data
+
+ where $r_min/dataType eq "TMIN"
+ return $r_min
+)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/74a22a31/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q07.xq
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q07.xq b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q07.xq
index c4e186d..6ed194d 100644
--- a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q07.xq
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q07.xq
@@ -1,13 +1,13 @@
-(: XQuery Join Aggregate Query :)
-(: Find the lowest recorded temperature (TMIN) for each station on 2000-01-01.:)
+(: XQuery Join Query :)
+(: Find the highest recorded temperature (TMAX) for each station on :)
+(: 2000-01-01. :)
let $station_collection := "/tmp/1.0_partition_ghcnd_all_xml/stations"
for $s in collection($station_collection)/stationCollection/station
let $sensor_collection := "/tmp/1.0_partition_ghcnd_all_xml/sensors"
for $r in collection($sensor_collection)/dataCollection/data
-let $date := xs:date(fn:substring(xs:string(fn:data($r/date)), 0, 11))
where $s/id eq $r/station
and $r/dataType eq "TMAX"
- and $date eq xs:date("2000-01-01")
+ and xs:dateTime(fn:data($r/date)) eq xs:dateTime("2000-01-01T00:00:00.000")
return ($s/displayName, $r/value)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/74a22a31/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q07_sensor.xq
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q07_sensor.xq b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q07_sensor.xq
new file mode 100644
index 0000000..254c879
--- /dev/null
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q07_sensor.xq
@@ -0,0 +1,10 @@
+(: XQuery Join Query :)
+(: Count max temperature (TMAX) readings for 2000-01-01. :)
+count(
+ let $sensor_collection := "/tmp/1.0_partition_ghcnd_all_xml/sensors"
+ for $r in collection($sensor_collection)/dataCollection/data
+
+ where $r/dataType eq "TMAX"
+ and xs:dateTime(fn:data($r/date)) eq xs:dateTime("2000-01-01T00:00:00.000")
+ return $r
+)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/74a22a31/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q07_station.xq
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q07_station.xq b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q07_station.xq
new file mode 100644
index 0000000..6212016
--- /dev/null
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q07_station.xq
@@ -0,0 +1,7 @@
+(: XQuery Join Query :)
+(: Count all the stations. :)
+count(
+ let $station_collection := "/tmp/1.0_partition_ghcnd_all_xml/stations"
+ for $s in collection($station_collection)/stationCollection/station
+ return $s
+)
\ No newline at end of file