You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by ti...@apache.org on 2014/03/14 23:09:22 UTC

[01/25] git commit: Change queries to use a value comparison.

Repository: incubator-vxquery
Updated Branches:
  refs/heads/westmann/prettyprint 64f6eb91e -> 04ac20d12


Change queries to use a value comparison.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/1ea5f1a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/1ea5f1a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/1ea5f1a6

Branch: refs/heads/westmann/prettyprint
Commit: 1ea5f1a6badef5daed45fc6ac9d087ee08517f0e
Parents: 64f6eb9
Author: Preston Carman <pr...@apache.org>
Authored: Thu Feb 13 09:27:56 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Feb 13 09:27:56 2014 -0800

----------------------------------------------------------------------
 .../src/main/resources/noaa-ghcn-daily/queries/q00.xq              | 2 +-
 .../src/main/resources/noaa-ghcn-daily/queries/q01.xq              | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1ea5f1a6/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 119b957..8a639dd 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
@@ -5,7 +5,7 @@ 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:ASN00008113" 
-    and fn:year-from-date($date) >= (2003) 
+    and fn:year-from-date($date) ge 2003
     and fn:month-from-date($date) eq 12 
     and fn:day-from-date($date) eq 25
 return $r
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/1ea5f1a6/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q01.xq
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q01.xq b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q01.xq
index ab0b2ab..93bfbbb 100644
--- a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q01.xq
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/queries/q01.xq
@@ -4,5 +4,5 @@
 (: meters per second). (Wind value is in tenth of a meter per second)         :)
 let $collection := "/tmp/1.0_partition_ghcnd_all_xml/sensors"
 for $r in collection($collection)/dataCollection/data
-where $r/dataType eq "AWND" and $r/value > 491.744
+where $r/dataType eq "AWND" and xs:decimal(fn:data($r/value)) gt 491.744
 return $r
\ No newline at end of file


[22/25] git commit: Adding the xqts test results to the vxquery-xtest project. The goal is to now have a test result version we can compare against with each release.

Posted by ti...@apache.org.
Adding the xqts test results to the vxquery-xtest project. The goal is to now have a test result version we can compare against with each release.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/ef04365e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/ef04365e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/ef04365e

Branch: refs/heads/westmann/prettyprint
Commit: ef04365e03af17e9c38b65cf0136b440ae7bffd7
Parents: 5673d9e
Author: Preston Carman <pr...@apache.org>
Authored: Wed Feb 19 11:18:10 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Wed Feb 19 11:18:10 2014 -0800

----------------------------------------------------------------------
 vxquery-xtest/results/README.md |     4 +
 vxquery-xtest/results/xqts.txt  | 19221 +++++++++++++++++++++++++++++++++
 2 files changed, 19225 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/ef04365e/vxquery-xtest/results/README.md
----------------------------------------------------------------------
diff --git a/vxquery-xtest/results/README.md b/vxquery-xtest/results/README.md
new file mode 100644
index 0000000..c620dc1
--- /dev/null
+++ b/vxquery-xtest/results/README.md
@@ -0,0 +1,4 @@
+= XQTS Text Results =
+
+The xqts.txt file holds the results from running the XQTS tests. The results
+have been sorted through the linux sort command.
\ No newline at end of file


[02/25] git commit: All the changes to make managing and running the benchmark easier. A xml configuration file holds all the data so partitions can be created with one argument to the cli. Also its easy to rebuild the data since the configuration is sav

Posted by ti...@apache.org.
All the changes to make managing and running the benchmark easier. A xml configuration file holds all the data so partitions can be created with one argument to the cli. Also its easy to rebuild the data since the configuration is saved.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/a253e2f0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/a253e2f0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/a253e2f0

Branch: refs/heads/westmann/prettyprint
Commit: a253e2f0805ad7781720d9542ef3f4c295570f6c
Parents: 1ea5f1a
Author: Preston Carman <pr...@apache.org>
Authored: Thu Feb 13 09:38:04 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Feb 13 09:38:04 2014 -0800

----------------------------------------------------------------------
 .../resources/noaa-ghcn-daily/scripts/README.md |  15 ++-
 .../noaa-ghcn-daily/scripts/run_benchmark.sh    |  20 +++
 .../noaa-ghcn-daily/scripts/weather_cli.py      | 121 ++++++++-----------
 .../noaa-ghcn-daily/scripts/weather_config.py   | 115 ++++++++++++++++++
 .../scripts/weather_convert_to_xml.py           |   2 +-
 .../scripts/weather_data_files.py               | 109 +++++++++++------
 .../noaa-ghcn-daily/scripts/weather_example.xml |  39 ++++++
 7 files changed, 308 insertions(+), 113 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/a253e2f0/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/README.md
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/README.md b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/README.md
index 2d9c2eb..585f54f 100644
--- a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/README.md
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/README.md
@@ -18,6 +18,17 @@ Detailed GHDN-DAILY information:
 The process takes a save folder for the data. The folder contains a several 
 folders:
 
+ - all_xml_files (The generated xml files for a given package)
  - downloads (All files taken from the NOAA HTTP site)
- - 1\_node\_{package}\_xml{\_compression} (The generated xml files for a given 
-     package)
\ No newline at end of file
+ - dataset-[name] (all files related to a single dataset)
+     
+     
+# Examples commands
+
+Building
+
+
+Partitioning
+python weather_cli.py -x weather_example.xml
+
+Linking
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/a253e2f0/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/run_benchmark.sh
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/run_benchmark.sh b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/run_benchmark.sh
new file mode 100644
index 0000000..ff34a88
--- /dev/null
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/run_benchmark.sh
@@ -0,0 +1,20 @@
+# Run all the queries and save a log. 
+# First argument: Supply the folder which houses all the queries (recursive).
+# Second argument: adds options to the VXQuery CLI.
+#
+# run_benchmark.sh ./noaa-ghcn-daily/benchmarks/local_speed_up/queries/
+# run_benchmark.sh ./noaa-ghcn-daily/benchmarks/local_speed_up/queries/ "-client-net-ip-address 169.235.27.138"
+#
+
+if [ -z "${1}" ]
+then
+    echo "Please supply a directory for query files to be found."
+    exit
+fi
+
+for j in $(find ${1} -name '*.xq')
+do
+	echo "Running query: ${j}"
+	time sh ./vxquery-cli/target/appassembler/bin/vxq ${j} ${2} -timing -showquery -frame-size 1000000 -repeatexec 10 > ${j}.log 2>&1
+done
+

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/a253e2f0/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_cli.py
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_cli.py b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_cli.py
index d9f83eb..c69133e 100644
--- a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_cli.py
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_cli.py
@@ -20,6 +20,7 @@ import sys, getopt
 from weather_data_files import *
 from weather_download_files import *
 from weather_convert_to_xml import *
+from weather_config import *
 
 DEBUG_OUTPUT = False
 COMPRESSED = False
@@ -31,21 +32,17 @@ COMPRESSED = False
 #
 def main(argv):
     append = False
-    download_path = ""
     max_records = 0
     package = "ghcnd_gsn"
-    partitions = 0
-    nodes = -1
     process_file_name = ""
     reset = False
-    save_path = ""
     section = "all"
-    test = ""
     token = ""
     update = False
+    xml_config_path = ""
     
     try:
-        opts, args = getopt.getopt(argv, "acd:f:hl:m:n:p:rs:t:uvw:", ["download_directory=", "file=", "locality=", "max_station_files=", "nodes=", "save_directory=", "package=", "partitions=", "web_service="])
+        opts, args = getopt.getopt(argv, "acf:hl:m:ruvw:x:", ["file=", "locality=", "max_station_files=", "web_service=", "xml_config="])
     except getopt.GetoptError:
         print 'The file options for weather_cli.py were not correctly specified.'
         print 'To see a full list of options try:'
@@ -56,42 +53,23 @@ def main(argv):
             print 'Converting weather daily files to xml options:'
             print '    -a        Append the results to the progress file.'
             print '    -c        Compress the produced XML file with .gz.'
-            print '    --download_directory (str)  The directory for saving the downloaded files. (default: downloads)'
-            print '    -d (str)  The directory for saving the downloaded files and generated XML files.'
             print '    -f (str)  The file name of a specific station to process.'
             print '              * Helpful when testing a single stations XML file output.'
             print '    -l (str)  Select the locality of the scripts execution (download, progress_file, sensor_build, station_build, partition, statistics).'
             print '    -m (int)  Limits the number of files created for each station.'
             print '              * Helpful when testing to make sure all elements are supported for each station.'
             print '              Alternate form: --max_station_files=(int)'
-            print '    -n (int)  The numeric node id starting at 0.'
-            print '    --partitions (int)  The number of partitions (sections) for creating split up generated data.'
-            print '    -p (str)  The package used to generate files. (all, gsn, hcn)'
-            print '    -t (str)  The benchmark test used to partition files. (speed_up, batch_scale_up)'
             print '    -r        Reset the build process. (For one section or all sections depending on other parameters.)'
             print '    -u        Recalculate the file count and data size for each data source file.'
             print '    -v        Extra debug information.'
             print '    -w (str)  Downloads the station XML file form the web service.'
+            print '    -x (str)  XML config file for weather data.'
             sys.exit()
         elif opt in ('-a', "--append"):
             append = True
         elif opt == '-c':
             global COMPRESSED
             COMPRESSED = True
-        elif opt == '--download_directory':
-            # check if file exists.
-            if os.path.exists(arg):
-                download_path = arg
-            else:
-                print 'Error: Argument must be a directory for --download_directory.'
-                sys.exit()
-        elif opt in ('-d', "--save_directory"):
-            # check if file exists.
-            if os.path.exists(arg):
-                save_path = arg
-            else:
-                print 'Error: Argument must be a directory for --save_directory (-s).'
-                sys.exit()
         elif opt in ('-f', "--file"):
             # check if file exists.
             if os.path.exists(arg):
@@ -111,30 +89,12 @@ def main(argv):
             else:
                 print 'Error: Argument must be an integer for --max_station_files (-m).'
                 sys.exit()
-        elif opt in ('-n'):
-            if arg.isdigit():
-                nodes = int(arg)
-            else:
-                print 'Error: Argument must be an integer for -n.'
-                sys.exit()
-        elif opt == "--partitions":
-            if arg.isdigit():
-                partitions = int(arg)
-            else:
-                print 'Error: Argument must be an integer for --partitions.'
-                sys.exit()
         elif opt in ('-p', "--package"):
             if arg in ("all", "gsn", "hcn"):
                 package = "ghcnd_" + arg
             else:
                 print 'Error: Argument must be an string for one of the known weather packages: "all", "gsn", "hcn"'
                 sys.exit()
-        elif opt in ('-t'):
-            if arg in ("speed_up", "batch_scale_up"):
-                test = arg
-            else:
-                print 'Error: Argument must be an string for one of the known benchmark tests: "speed_up", "batch_scale_up"'
-                sys.exit()
         elif opt == '-r':
             reset = True
         elif opt == '-u':
@@ -149,15 +109,27 @@ def main(argv):
             else:
                 print 'Error: Argument must be a string --web_service (-w).'
                 sys.exit()
+        elif opt in ('-x', "--xml_config"):
+            # check if file exists.
+            if os.path.exists(arg):
+                xml_config_path = arg
+            else:
+                print 'Error: Argument must be a xml file for --xml_config (-x).'
+                sys.exit()
 
     # Required fields to run the script.
-    if save_path == "" or not os.path.exists(save_path):
+    if xml_config_path == "" or not os.path.exists(xml_config_path):
+        print 'Error: The xml config option must be supplied: --xml_config (-x).'
+        sys.exit()
+    config = WeatherConfig(xml_config_path)
+    
+    # Required fields to run the script.
+    if config.get_save_path() == "" or not os.path.exists(config.get_save_path()):
         print 'Error: The save directory option must be supplied: --save_directory (-d).'
         sys.exit()
 
     # Set up downloads folder.
-    if download_path == "":
-        download_path = save_path + "/downloads"
+    download_path = config.get_save_path() + "/downloads"
     if section in ("all", "download"):
         print 'Processing the download section.'
         download = WeatherDownloadFiles(download_path)
@@ -168,19 +140,13 @@ def main(argv):
 
 
     # Create some basic paths for save files and references.
-    ghcnd_data_dly_path = download_path + '/' + package + '/' + package
-    ghcnd_xml_path = save_path + "/1.0_partition_" + package + '_xml/'
-    ghcnd_xml_gz_path = save_path + "/1.0_partition_" + package + '_xml_gz/'
-    if COMPRESSED:
-        xml_data_save_path = ghcnd_xml_gz_path
-    else:
-        xml_data_save_path = ghcnd_xml_path
+    ghcnd_data_dly_path = download_path + '/' + config.get_package() + '/' + config.get_package()
+    xml_data_save_path = config.get_save_path() + '/all_xml_files/'
 
     # Make sure the xml folder is available.
     if not os.path.isdir(xml_data_save_path):
         os.makedirs(xml_data_save_path)
 
-
     # Set up the XML build objects.
     convert = WeatherWebServiceMonthlyXMLFile(download_path, xml_data_save_path, COMPRESSED, DEBUG_OUTPUT)
     progress_file = xml_data_save_path + "_data_progress.csv"
@@ -233,24 +199,35 @@ def main(argv):
                 data.update_file_station_status(file_name, status)
             else:
                 data.update_file_station_status(file_name, WeatherDataFiles.DATA_FILE_MISSING)
-                
-    if section in ("all", "partition") and partitions > 1:
-        print 'Processing the partition section.'
-        data.reset()
-        data.copy_to_n_partitions(xml_data_save_path, partitions)
+                    
+    for dataset in config.get_dataset_list():
+        # Set up the setting for each dataset.
+        dataset_folder = "/dataset-" + dataset.get_name()
+        progress_file = config.get_save_path() + dataset_folder + "/_data_progress.csv"
+        data = WeatherDataFiles(ghcnd_data_dly_path, progress_file)
+        base_paths = []
+        for paths in dataset.get_save_paths():
+            base_paths.append(paths + dataset_folder + "/")
 
-    if section in ("test_links"):
-        if test and partitions > 0 and nodes > -1:
-            print 'Processing the test links section.'
-            data.reset()
-            data.create_test_links(save_path, test, nodes, partitions)
-        else:
-            print 'Error: Not enough information for this section.'
-            sys.exit()
+        if section in ("all", "partition"):
+            for partition in dataset.get_partitions():
+                print 'Processing the partition section (' + dataset.get_name() + ':d' + str(len(base_paths)) + ':p' + str(partition) + ').'
+                data.reset()
+                data.copy_to_n_partitions(xml_data_save_path, partition, base_paths)
+    
+        if section in ("all", "test_links"):
+            # TODO determine current node 
+            if test and partitions > 0 and virtual_partitions > 0 and nodes > -1:
+                print 'Processing the test links section.'
+                data.reset()
+                data.create_test_links(config.get_save_path(), xml_data_save_path, test, nodes, partitions, virtual_partitions, base_paths)
+            else:
+                print 'Error: Not enough information for this section.'
+                sys.exit()
 
-    if section in ("all", "statistics"):
-        print 'Processing the statistics section.'
-        data.print_progress_file_stats(convert)
-                
+#     if section in ("statistics"):
+#         print 'Processing the statistics section.'
+#         data.print_progress_file_stats(convert)
+                  
 if __name__ == "__main__":
     main(sys.argv[1:])

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/a253e2f0/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_config.py
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_config.py b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_config.py
new file mode 100644
index 0000000..fa12342
--- /dev/null
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_config.py
@@ -0,0 +1,115 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+from xml.dom.minidom import parse
+
+class WeatherConfig:
+    def __init__(self, config_xml_file):
+        self.config_xml_file = config_xml_file
+        
+        self.config = parse(self.config_xml_file)
+
+    def get_save_path(self):
+        return self.get_text(self.config.getElementsByTagName("save_path")[0])
+
+    def get_package(self):
+        return self.get_text(self.config.getElementsByTagName("package")[0])
+
+    def get_node_machine_list(self):
+        nodes = []
+        for node in self.config.getElementsByTagName("node"):
+            id = self.get_node_name(node)
+            ip = self.get_node_ip(node)
+            nodes.append(Machine(id, ip))
+        return nodes
+
+    def get_dataset_list(self):
+        nodes = []
+        for node in self.config.getElementsByTagName("dataset"):
+            name = self.get_dataset_name(node)
+            save_paths = self.get_dataset_save_paths(node)
+            partitions = self.get_dataset_partitions(node)
+            nodes.append(Dataset(name, save_paths, partitions))
+        return nodes
+
+
+    # --------------------------------------------------------------------------
+    # Node Specific Functions
+    # --------------------------------------------------------------------------
+    def get_node_ip(self, node):
+        return self.get_text(node.getElementsByTagName("ip_address")[0])
+
+    def get_node_name(self, node):
+        return self.get_text(node.getElementsByTagName("name")[0])
+
+    
+    # --------------------------------------------------------------------------
+    # Dataset Specific Functions
+    # --------------------------------------------------------------------------
+    def get_dataset_name(self, node):
+        return self.get_text(node.getElementsByTagName("name")[0])
+
+    def get_dataset_save_paths(self, node):
+        paths = []
+        for node in node.getElementsByTagName("save_path"):
+            paths.append(self.get_text(node))
+        return paths
+
+    def get_dataset_partitions(self, node):
+        paths = []
+        for node in node.getElementsByTagName("partitions_per_path"):
+            paths.append(int(self.get_text(node)))
+        return paths
+
+    def get_text(self, xml_node):
+        rc = []
+        for node in xml_node.childNodes:
+            if node.nodeType == node.TEXT_NODE:
+                rc.append(node.data)
+        return ''.join(rc)
+
+class Machine:
+    def __init__(self, id, ip):
+        self.id = id
+        self.ip = ip
+    
+    def get_node_name(self):
+        return self.id
+    
+    def get_node_ip(self):
+        return self.ip
+    
+    def __repr__(self):
+        return self.id + "(" + self.ip + ")"
+    
+class Dataset:
+    def __init__(self, name, save_paths, partitions):
+        self.name = name
+        self.save_paths = save_paths
+        self.partitions = partitions
+    
+    def get_name(self):
+        return self.name
+    
+    def get_save_paths(self):
+        return self.save_paths
+    
+    def get_partitions(self):
+        return self.partitions
+    
+    def __repr__(self):
+        return self.name + ":" + str(self.save_paths) + ":" + str(self.partitions)
+    

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/a253e2f0/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_convert_to_xml.py
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_convert_to_xml.py b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_convert_to_xml.py
index 0f62195..514f5f9 100644
--- a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_convert_to_xml.py
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_convert_to_xml.py
@@ -128,7 +128,7 @@ class WeatherConvertToXML:
                 # process set
                 file_count += self.process_one_month_sensor_set(records, page)
                 records = []
-                if sensor_count >= sensor_max:
+                if sensor_count >= sensor_max and month == month_last and year == year_last:
                     # start a new page.
                     page += 1
                 else:

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/a253e2f0/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_data_files.py
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_data_files.py b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_data_files.py
index c85fe86..be85c69 100644
--- a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_data_files.py
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_data_files.py
@@ -20,6 +20,7 @@ import linecache
 import distutils.core
 
 from weather_convert_to_xml import *
+from collections import OrderedDict
 
 # Weather data files created to manage the conversion process.
 # Allows partition and picking up where you left off.
@@ -91,57 +92,79 @@ class WeatherDataFiles:
             self.close_progress_data(True)
         self.reset()
         
-    def create_test_links(self, save_path, test, node, partitions):
+    def create_test_links(self, save_path, xml_save_path, test, node, partitions, virtual_partitions, base_paths=[]):
+        if (len(base_paths) == 0):
+            base_paths.append(os.path.dirname(save_path))
+        partition_list = sorted(get_partition_paths(partitions, base_paths))
+        
         test_path = save_path + "/" + test
         if not os.path.isdir(test_path):
             os.makedirs(test_path)
-        for i in range(partitions):
-            test_partition_path = test_path + "/partition" + str(i+1)
-            if (node <= i):
-                # link
-                if test == "speed_up":
-                    os.symlink(save_path + "/" + str(i+1) + "." + str(node) + "_partition_ghcnd_all_xml_gz", test_partition_path)
-                if test == "batch_scale_up":
-                    os.symlink(save_path + "/" + str(partitions) + "." + str(node) + "_partition_ghcnd_all_xml_gz", test_partition_path)
-            else:
-                # fake directories
-                os.makedirs(test_partition_path + "/sensors")
-                os.makedirs(test_partition_path + "/stations")
+        for i in range(virtual_partitions):
+            # one virtual partition per disk
+            for j in range(len(base_paths)):
+                for index, path in enumerate(partition_list):
+                    offset = partitions * j
+                    test_partition_path = test_path + "/partition" + str(i + 1) + "_disk" + str(j + 1)
+                    if not os.path.isdir(test_partition_path):
+                        os.makedirs(test_partition_path)
+                    if (node <= i):
+                        if test == "speed_up":
+                            group = partitions / (i + 1)
+                        elif test == "batch_scale_up":
+                            group = partitions / virtual_partitions
+                        else:
+                            group = -1
+                        # link
+                        if (group) * node + offset <= index and index < (group) * (node + 1) + offset:
+                            os.symlink(path, test_partition_path + "/index" + str(index))
+                    else:
+                        # fake directories
+                        os.makedirs(test_partition_path + "/sensors")
+                        os.makedirs(test_partition_path + "/stations")
             
         
     # Once the initial data has been generated, the data can be copied into a set number of partitions. 
-    def copy_to_n_partitions(self, save_path, partitions):
+    def copy_to_n_partitions(self, save_path, partitions, base_paths=[]):
+        if (len(base_paths) == 0):
+            return
         
         # Initialize the partition paths.
-        partition_paths = []
-        for i in range(0, partitions):
-            new_partition_path = save_path.replace("1.0_partition", str(partitions) + "." + str(i) + "_partition")
-            partition_paths.append(new_partition_path)
-            
+        partition_sizes = []
+        partition_paths = get_partition_paths(partitions, base_paths)
+        for path in partition_paths:
+            partition_sizes.append(0)
             # Make sure the xml folder is available.
-            if not os.path.isdir(new_partition_path):
-                os.makedirs(new_partition_path)
+            if not os.path.isdir(path):
+                os.makedirs(path)
 
-        # copy stations and sensors into each partition round robin
+        # copy stations and sensors into each partition
         current_partition = 0
         csv_sorted = self.get_csv_in_partition_order()
-        for item in csv_sorted:
-            row_contents = item.rsplit(self.SEPERATOR)
-            file_name = row_contents[self.INDEX_DATA_FILE_NAME]
-            station_id = os.path.basename(file_name).split('.')[0]
-
-            # Copy station files
-            for type in ("sensors", "stations"):
-                file_path = build_base_save_folder(save_path, station_id, type)
-                new_file_path = build_base_save_folder(partition_paths[current_partition], station_id, type)
-                if os.path.isdir(file_path):
-                    distutils.dir_util.copy_tree(file_path, new_file_path)
+        for item, size in csv_sorted.iteritems():
+            station_id = item.split('.')[0]
+            # Update partition bases on smallest current size.
+            current_partition = partition_sizes.index(min(partition_sizes))
             
-            # Update partition
-            current_partition += 1
-            if current_partition >= partitions:
-                current_partition = 0
+            # Copy sensor files
+            type = "sensors"
+            file_path = build_base_save_folder(save_path, station_id, type) + station_id
+            new_file_path = build_base_save_folder(partition_paths[current_partition], station_id, type) + station_id
+            if os.path.isdir(file_path):
+                distutils.dir_util.copy_tree(file_path, new_file_path)
+            partition_sizes[current_partition] += size
 
+        
+            # Copy station files
+            type = "stations"
+            file_path = build_base_save_folder(save_path, station_id, type) + station_id + ".xml"
+            new_file_base = build_base_save_folder(partition_paths[current_partition], station_id, type)
+            new_file_path = new_file_base + station_id + ".xml"
+            if os.path.isfile(file_path):
+                if not os.path.isdir(new_file_base):
+                    os.makedirs(new_file_base)
+                shutil.copyfile(file_path, new_file_path)
+    
     def get_csv_in_partition_order(self):
         self.open_progress_data()
         row_count = len(self.progress_data)
@@ -156,7 +179,7 @@ class WeatherDataFiles:
             csv_dict[file_name] = folder_data
         
         # New sorted list.
-        return sorted(csv_dict, key=csv_dict.get, reverse=True)
+        return OrderedDict(sorted(csv_dict.items(), key=lambda x: x[1], reverse=True))
         
     def get_file_row(self, file_name):
         for i in range(0, len(self.progress_data)):
@@ -323,3 +346,13 @@ class WeatherDataFiles:
             elif self.type == "station" and (columns[self.INDEX_DATA_STATION_STATUS].strip() != self.DATA_FILE_DOWNLOADED or self.data_reset):
                 break
         return columns[self.INDEX_DATA_FILE_NAME]
+    
+def get_partition_paths(partitions, base_paths):        
+    partition_paths = []
+    for i in range(0, partitions):
+        for j in range(0, len(base_paths)):
+            new_partition_path = base_paths[j] + "partitions/" + str(len(base_paths)) + "disk/d" + str(j) +"_p" + str(partitions) + "_i" + str(i) + "/"
+            partition_paths.append(new_partition_path)
+    return partition_paths
+
+

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/a253e2f0/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_example.xml
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_example.xml b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_example.xml
new file mode 100644
index 0000000..b8e60fd
--- /dev/null
+++ b/vxquery-benchmark/src/main/resources/noaa-ghcn-daily/scripts/weather_example.xml
@@ -0,0 +1,39 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<data xmlns="data">
+    <name>Local Example</name>
+    <save_path>/data</save_path>
+    <package>all</package>
+    <node>
+        <name>localhost</name>
+        <ip_address>127.0.0.1</ip_address>
+    </node>
+    <dataset>
+        <name>tiny</name>
+        <save_path>/data</save_path>
+        <partitions_per_path>1</partitions_per_path>
+        <partitions_per_path>2</partitions_per_path>
+        <partitions_per_path>4</partitions_per_path>
+        <partitions_per_path>8</partitions_per_path>
+    </dataset>
+    <dataset>
+        <name>small</name>
+        <save_path>/data</save_path>
+        <partitions_per_path>4</partitions_per_path>
+        <partitions_per_path>8</partitions_per_path>
+    </dataset>
+</data>


[18/25] git commit: Addressing all the code review changes.

Posted by ti...@apache.org.
Addressing all the code review changes.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/d88a64e1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/d88a64e1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/d88a64e1

Branch: refs/heads/westmann/prettyprint
Commit: d88a64e17ff6aff2e5ee11597d5c5de8f30145ca
Parents: 8a00d1b
Author: Preston Carman <pr...@apache.org>
Authored: Mon Feb 17 13:34:53 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Mon Feb 17 13:34:53 2014 -0800

----------------------------------------------------------------------
 .../java/org/apache/vxquery/cli/VXQuery.java    |  6 +++---
 ...tractRemoveRedundantTypeExpressionsRule.java |  8 ++++----
 .../RemoveRedundantCastExpressionsRule.java     |  2 +-
 .../RemoveRedundantDataExpressionsRule.java     |  2 +-
 .../RemoveRedundantPromoteExpressionsRule.java  |  2 +-
 .../RemoveRedundantTreatExpressionsRule.java    |  3 +--
 .../rewriter/rules/util/ExpressionToolbox.java  |  5 +++--
 ...GeneralComparisonScalarEvaluatorFactory.java | 18 ++++++++----------
 .../misc/FnDataScalarEvaluatorFactory.java      |  3 +--
 .../org/apache/vxquery/xmlparser/XMLParser.java | 20 --------------------
 10 files changed, 23 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/d88a64e1/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
----------------------------------------------------------------------
diff --git a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
index 06deac5..da6f40b 100644
--- a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
+++ b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
@@ -117,9 +117,9 @@ public class VXQuery {
         }
         VXQuery vxq = new VXQuery(opts);
         vxq.execute();
-        Date end = new Date();
         // if -timing argument passed, show the starting and ending times
         if (opts.timing) {
+            Date end = new Date();
             message = "Execution time: " + (end.getTime() - start.getTime()) + "ms";
             System.out.println(message);
             timing.add(message);
@@ -254,9 +254,9 @@ public class VXQuery {
             CompilerControlBlock ccb = new CompilerControlBlock(new StaticContextImpl(RootStaticContextImpl.INSTANCE),
                     resultSetId);
             compiler.compile(query, new StringReader(qStr), ccb, opts.optimizationLevel);
-            end = new Date();
             // if -timing argument passed, show the starting and ending times
             if (opts.timing) {
+                end = new Date();
                 message = "Compile time: " + (end.getTime() - start.getTime()) + "ms";
                 System.out.println(message);
                 timing.add(message);
@@ -276,9 +276,9 @@ public class VXQuery {
             for (int i = 0; i < opts.repeatExec; ++i) {
                 start = new Date();
                 runJob(js, writer);
-                end = new Date();
                 // if -timing argument passed, show the starting and ending times
                 if (opts.timing) {
+                    end = new Date();
                     if ((i + 1) > 3) {
                         totalTiming += end.getTime() - start.getTime();
                     }

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/d88a64e1/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractRemoveRedundantTypeExpressionsRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractRemoveRedundantTypeExpressionsRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractRemoveRedundantTypeExpressionsRule.java
index 752e107..5298f2a 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractRemoveRedundantTypeExpressionsRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractRemoveRedundantTypeExpressionsRule.java
@@ -73,14 +73,14 @@ public abstract class AbstractRemoveRedundantTypeExpressionsRule implements IAlg
             // Find the input return type.
             inputSequenceType = ExpressionToolbox.getOutputSequenceType(opRef, argFirstM, dCtx);
 
-            // Find the treat type.
+            // Find the argument type.
             SequenceType sTypeArg = null;
             if (hasTypeArgument()) {
-                sTypeArg = ExpressionToolbox.getTypeExpressionTypeArguement(searchM, dCtx);
+                sTypeArg = ExpressionToolbox.getTypeExpressionTypeArgument(searchM, dCtx);
             }
 
             // remove
-            if (safeToReplace(sTypeArg, inputSequenceType)) {
+            if (matchesAllInstancesOf(sTypeArg, inputSequenceType)) {
                 searchM.setValue(argFirstM.getValue());
                 modified = true;
             }
@@ -88,7 +88,7 @@ public abstract class AbstractRemoveRedundantTypeExpressionsRule implements IAlg
         return modified;
     }
 
-    public abstract boolean safeToReplace(SequenceType sTypeArg, SequenceType sTypeOutput);
+    public abstract boolean matchesAllInstancesOf(SequenceType sTypeArg, SequenceType sTypeOutput);
 
     public boolean hasTypeArgument() {
         return true;

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/d88a64e1/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantCastExpressionsRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantCastExpressionsRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantCastExpressionsRule.java
index bf06b00..339feea 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantCastExpressionsRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantCastExpressionsRule.java
@@ -51,7 +51,7 @@ public class RemoveRedundantCastExpressionsRule extends AbstractRemoveRedundantT
     }
 
     @Override
-    public boolean safeToReplace(SequenceType sTypeArg, SequenceType sTypeOutput) {
+    public boolean matchesAllInstancesOf(SequenceType sTypeArg, SequenceType sTypeOutput) {
         if (sTypeArg != null && sTypeOutput != null && sTypeOutput.equals(sTypeArg)) {
             // Same type.
             return true;

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/d88a64e1/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantDataExpressionsRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantDataExpressionsRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantDataExpressionsRule.java
index fb05e4d..97f98f5 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantDataExpressionsRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantDataExpressionsRule.java
@@ -53,7 +53,7 @@ public class RemoveRedundantDataExpressionsRule extends AbstractRemoveRedundantT
         return false;
     }
 
-    public boolean safeToReplace(SequenceType sTypeArg, SequenceType sTypeOutput) {
+    public boolean matchesAllInstancesOf(SequenceType sTypeArg, SequenceType sTypeOutput) {
         if (sTypeOutput != null && sTypeOutput.getItemType().isAtomicType()) {
             return true;
         }

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/d88a64e1/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantPromoteExpressionsRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantPromoteExpressionsRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantPromoteExpressionsRule.java
index 589618d..12865e0 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantPromoteExpressionsRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantPromoteExpressionsRule.java
@@ -56,7 +56,7 @@ public class RemoveRedundantPromoteExpressionsRule extends AbstractRemoveRedunda
     }
 
     @Override
-    public boolean safeToReplace(SequenceType sTypeArg, SequenceType sTypeOutput) {
+    public boolean matchesAllInstancesOf(SequenceType sTypeArg, SequenceType sTypeOutput) {
         if (sTypeArg != null) {
             if (sTypeArg.getItemType() != BuiltinTypeRegistry.XS_DOUBLE
                     && sTypeArg.getItemType() != BuiltinTypeRegistry.XS_FLOAT

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/d88a64e1/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantTreatExpressionsRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantTreatExpressionsRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantTreatExpressionsRule.java
index 63ad06f..ef23f30 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantTreatExpressionsRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantTreatExpressionsRule.java
@@ -54,11 +54,10 @@ public class RemoveRedundantTreatExpressionsRule extends AbstractRemoveRedundant
     }
 
     @Override
-    public boolean safeToReplace(SequenceType sTypeArg, SequenceType sTypeOutput) {
+    public boolean matchesAllInstancesOf(SequenceType sTypeArg, SequenceType sTypeOutput) {
         if (sTypeArg != null) {
             stm.setSequenceType(sTypeArg);
             if (sTypeOutput != null && stm.isSubType(sTypeOutput)) {
-                // Same type.
                 return true;
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/d88a64e1/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java
index 7d54068..7794ed0 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java
@@ -171,7 +171,7 @@ public class ExpressionToolbox {
         return pTypeCode.getInteger();
     }
 
-    public static SequenceType getTypeExpressionTypeArguement(Mutable<ILogicalExpression> searchM,
+    public static SequenceType getTypeExpressionTypeArgument(Mutable<ILogicalExpression> searchM,
             StaticContextImpl dCtx) {
         int typeId = getTypeExpressionTypeArgument(searchM);
         if (typeId > 0) {
@@ -192,7 +192,7 @@ public class ExpressionToolbox {
                     return null;
                 } else if (function.getFunctionIdentifier().equals(BuiltinOperators.CAST.getFunctionIdentifier())) {
                     // Special case since case has multiple type outputs.
-                    return ExpressionToolbox.getTypeExpressionTypeArguement(argFirstM, dCtx);
+                    return ExpressionToolbox.getTypeExpressionTypeArgument(argFirstM, dCtx);
                 } else {
                     return function.getSignature().getReturnType();
                 }
@@ -212,6 +212,7 @@ public class ExpressionToolbox {
                 if (variableOp.getOperatorTag() == LogicalOperatorTag.DATASOURCESCAN) {
                     return SequenceType.create(AnyNodeType.INSTANCE, Quantifier.QUANT_ONE);
                 }
+                // TODO Consider support for other operators. i.e. Assign.
         }
         return null;
     }

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/d88a64e1/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java
index 1bcd1ce..a7b79e8 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java
@@ -101,6 +101,12 @@ public abstract class AbstractGeneralComparisonScalarEvaluatorFactory extends
         final VoidPointable p2 = (VoidPointable) VoidPointable.FACTORY.createPointable();
         final TaggedValuePointable tvpSeq1 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
         final TaggedValuePointable tvpSeq2 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+        final TaggedValuePointable tvpTransform1 = (TaggedValuePointable) TaggedValuePointable.FACTORY
+                .createPointable();
+        final TaggedValuePointable tvpTransform2 = (TaggedValuePointable) TaggedValuePointable.FACTORY
+                .createPointable();
+        final TaggedValuePointable tvpCompare1 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+        final TaggedValuePointable tvpCompare2 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
 
         return new AbstractTaggedValueArgumentScalarEvaluator(args) {
             AbstractCastToOperation aCastToOp = new CastToStringOperation();
@@ -188,20 +194,12 @@ public abstract class AbstractGeneralComparisonScalarEvaluatorFactory extends
                 boolean tagTransformed1 = false, tagTransformed2 = false;
                 abvsInner1.reset();
                 abvsInner2.reset();
-                TaggedValuePointable tvpTransform1 = (TaggedValuePointable) TaggedValuePointable.FACTORY
-                        .createPointable();
-                TaggedValuePointable tvpTransform2 = (TaggedValuePointable) TaggedValuePointable.FACTORY
-                        .createPointable();
                 tvpTransform1.set(tvpArg1);
                 tvpTransform2.set(tvpArg2);
                 int tid1 = FunctionHelper.getBaseTypeForGeneralComparisons(tvpTransform1.getTag());
                 int tid2 = FunctionHelper.getBaseTypeForGeneralComparisons(tvpTransform2.getTag());
 
                 // Converted tags
-                TaggedValuePointable tvpCompare1 = (TaggedValuePointable) TaggedValuePointable.FACTORY
-                        .createPointable();
-                TaggedValuePointable tvpCompare2 = (TaggedValuePointable) TaggedValuePointable.FACTORY
-                        .createPointable();
                 try {
                     // Converts node tree's into untyped atomic values that can then be compared as atomic items.
                     if (tid1 == ValueTag.NODE_TREE_TAG && tid2 == ValueTag.NODE_TREE_TAG) {
@@ -239,7 +237,7 @@ public abstract class AbstractGeneralComparisonScalarEvaluatorFactory extends
                     }
                     // Copy over the values not changed and upgrade numeric values to double.
                     if (!tagTransformed1) {
-                        tvpCompare1 = tvpTransform1;
+                        tvpCompare1.set(tvpTransform1);
                         if (FunctionHelper.isDerivedFromDouble(tvpCompare1.getTag())) {
                             FunctionHelper.getDoublePointable(tvpTransform1, dOutInner1);
                             tvpCompare1.set(abvsInner1.getByteArray(), abvsInner1.getStartOffset(),
@@ -248,7 +246,7 @@ public abstract class AbstractGeneralComparisonScalarEvaluatorFactory extends
                         }
                     }
                     if (!tagTransformed2) {
-                        tvpCompare2 = tvpTransform2;
+                        tvpCompare2.set(tvpTransform2);
                         if (FunctionHelper.isDerivedFromDouble(tvpCompare2.getTag())) {
                             FunctionHelper.getDoublePointable(tvpTransform2, dOutInner2);
                             tvpCompare2.set(abvsInner2.getByteArray(), abvsInner2.getStartOffset(),

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/d88a64e1/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/misc/FnDataScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/misc/FnDataScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/misc/FnDataScalarEvaluatorFactory.java
index cd4dbb3..7aed0b4 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/misc/FnDataScalarEvaluatorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/misc/FnDataScalarEvaluatorFactory.java
@@ -27,7 +27,6 @@ import org.apache.vxquery.exceptions.SystemException;
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator;
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
 import org.apache.vxquery.runtime.functions.util.AtomizeHelper;
-import org.apache.vxquery.runtime.functions.util.FunctionHelper;
 
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluator;
@@ -49,7 +48,7 @@ public class FnDataScalarEvaluatorFactory extends AbstractTaggedValueArgumentSca
         return new FnDataScalarEvaluator(args);
     }
 
-    private class FnDataScalarEvaluator extends AbstractTaggedValueArgumentScalarEvaluator {
+    private static class FnDataScalarEvaluator extends AbstractTaggedValueArgumentScalarEvaluator {
         final AtomizeHelper ah = new AtomizeHelper();
         final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
         final SequenceBuilder sb = new SequenceBuilder();

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/d88a64e1/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java b/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java
index c2ada24..d73dd12 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java
@@ -14,8 +14,6 @@
  */
 package org.apache.vxquery.xmlparser;
 
-import org.apache.vxquery.exceptions.ErrorCode;
-import org.apache.vxquery.exceptions.SystemException;
 import org.xml.sax.InputSource;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLReaderFactory;
@@ -46,22 +44,4 @@ public class XMLParser {
             throw new HyracksDataException(e.toString());
         }
     }
-
-    public void reset() throws SystemException {
-    }
-
-    public static void parseInputSource(InputSource in, ArrayBackedValueStorage abvs, boolean attachTypes,
-            ITreeNodeIdProvider idProvider) throws SystemException {
-        XMLReader parser;
-        try {
-            parser = XMLReaderFactory.createXMLReader();
-            SAXContentHandler handler = new SAXContentHandler(attachTypes, idProvider);
-            parser.setContentHandler(handler);
-            parser.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
-            parser.parse(in);
-            handler.write(abvs);
-        } catch (Exception e) {
-            throw new SystemException(ErrorCode.FODC0002, e, in.getSystemId());
-        }
-    }
 }
\ No newline at end of file


[14/25] git commit: Found a reference to old version of the function helper util.

Posted by ti...@apache.org.
Found a reference to old version of the function helper util.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/80ffdd84
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/80ffdd84
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/80ffdd84

Branch: refs/heads/westmann/prettyprint
Commit: 80ffdd84e7a37e0a2aff1603ff511d10d3567040
Parents: e88b8e1
Author: Preston Carman <pr...@apache.org>
Authored: Thu Feb 13 16:19:25 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Feb 13 16:19:25 2014 -0800

----------------------------------------------------------------------
 .../unary/AbstractNumericUnaryScalarEvaluatorFactory.java          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/80ffdd84/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/unary/AbstractNumericUnaryScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/unary/AbstractNumericUnaryScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/unary/AbstractNumericUnaryScalarEvaluatorFactory.java
index 9919f34..8456dec 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/unary/AbstractNumericUnaryScalarEvaluatorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/unary/AbstractNumericUnaryScalarEvaluatorFactory.java
@@ -85,7 +85,7 @@ public abstract class AbstractNumericUnaryScalarEvaluatorFactory extends
                                 case ValueTag.XS_BYTE_TAG:
                                 case ValueTag.XS_UNSIGNED_BYTE_TAG:
                                     abvsInteger.reset();
-                                    FunctionHelper.getIntegerPointable(tvp, ppool, dOutInteger);
+                                    FunctionHelper.getIntegerPointable(tvp, dOutInteger);
                                     longp.set(abvsInteger.getByteArray(), abvsInteger.getStartOffset() + 1,
                                             LongPointable.TYPE_TRAITS.getFixedLength());
                             }


[09/25] git commit: Update the atomize function to use a new utility class that reuses variables.

Posted by ti...@apache.org.
Update the atomize function to use a new utility class that reuses variables.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/f9ec13bf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/f9ec13bf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/f9ec13bf

Branch: refs/heads/westmann/prettyprint
Commit: f9ec13bf682455d1faeeadeaf46909281b1a77b6
Parents: c74c986
Author: Preston Carman <pr...@apache.org>
Authored: Thu Feb 13 15:26:18 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Feb 13 15:26:18 2014 -0800

----------------------------------------------------------------------
 ...ctTaggedValueArgumentAggregateEvaluator.java |   6 +-
 ...tractTaggedValueArgumentScalarEvaluator.java |   4 +
 ...ctTaggedValueArgumentUnnestingEvaluator.java |   6 +-
 ...GeneralComparisonScalarEvaluatorFactory.java |  22 ++-
 .../misc/FnDataScalarEvaluatorFactory.java      |  53 +++---
 .../runtime/functions/util/AtomizeHelper.java   | 167 +++++++++++++++++++
 6 files changed, 226 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f9ec13bf/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentAggregateEvaluator.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentAggregateEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentAggregateEvaluator.java
index e39d493..78faf89 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentAggregateEvaluator.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentAggregateEvaluator.java
@@ -16,6 +16,8 @@
  */
 package org.apache.vxquery.runtime.functions.base;
 
+import org.apache.vxquery.datamodel.accessors.PointablePool;
+import org.apache.vxquery.datamodel.accessors.PointablePoolFactory;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.exceptions.SystemException;
 
@@ -29,11 +31,13 @@ public abstract class AbstractTaggedValueArgumentAggregateEvaluator implements I
 
     private final TaggedValuePointable[] tvps;
 
+    protected final PointablePool ppool = PointablePoolFactory.INSTANCE.createPointablePool();
+
     public AbstractTaggedValueArgumentAggregateEvaluator(IScalarEvaluator[] args) {
         this.args = args;
         tvps = new TaggedValuePointable[args.length];
         for (int i = 0; i < tvps.length; ++i) {
-            tvps[i] = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+            tvps[i] = new TaggedValuePointable();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f9ec13bf/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentScalarEvaluator.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentScalarEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentScalarEvaluator.java
index 4371db8..e3ea702 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentScalarEvaluator.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentScalarEvaluator.java
@@ -16,6 +16,8 @@
  */
 package org.apache.vxquery.runtime.functions.base;
 
+import org.apache.vxquery.datamodel.accessors.PointablePool;
+import org.apache.vxquery.datamodel.accessors.PointablePoolFactory;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.exceptions.SystemException;
 
@@ -28,6 +30,8 @@ public abstract class AbstractTaggedValueArgumentScalarEvaluator implements ISca
     private final IScalarEvaluator[] args;
 
     private final TaggedValuePointable[] tvps;
+    
+    protected final PointablePool ppool = PointablePoolFactory.INSTANCE.createPointablePool();
 
     public AbstractTaggedValueArgumentScalarEvaluator(IScalarEvaluator[] args) {
         this.args = args;

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f9ec13bf/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentUnnestingEvaluator.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentUnnestingEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentUnnestingEvaluator.java
index 3a1442f..aba2501 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentUnnestingEvaluator.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentUnnestingEvaluator.java
@@ -16,6 +16,8 @@
  */
 package org.apache.vxquery.runtime.functions.base;
 
+import org.apache.vxquery.datamodel.accessors.PointablePool;
+import org.apache.vxquery.datamodel.accessors.PointablePoolFactory;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.exceptions.SystemException;
 
@@ -29,11 +31,13 @@ public abstract class AbstractTaggedValueArgumentUnnestingEvaluator implements I
 
     protected final TaggedValuePointable[] tvps;
 
+    protected final PointablePool ppool = PointablePoolFactory.INSTANCE.createPointablePool();
+
     public AbstractTaggedValueArgumentUnnestingEvaluator(IScalarEvaluator[] args) {
         this.args = args;
         tvps = new TaggedValuePointable[args.length];
         for (int i = 0; i < tvps.length; ++i) {
-            tvps[i] = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+            tvps[i] = new TaggedValuePointable();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f9ec13bf/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java
index d3b8c8c..70f2e4e 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java
@@ -62,6 +62,7 @@ import org.apache.vxquery.runtime.functions.cast.CastToUnsignedShortOperation;
 import org.apache.vxquery.runtime.functions.cast.CastToUntypedAtomicOperation;
 import org.apache.vxquery.runtime.functions.cast.CastToYMDurationOperation;
 import org.apache.vxquery.runtime.functions.comparison.AbstractValueComparisonOperation;
+import org.apache.vxquery.runtime.functions.util.AtomizeHelper;
 import org.apache.vxquery.runtime.functions.util.FunctionHelper;
 
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -90,6 +91,7 @@ public abstract class AbstractGeneralComparisonScalarEvaluatorFactory extends
         final ArrayBackedValueStorage abvsInner2 = new ArrayBackedValueStorage();
         final DataOutput dOutInner2 = abvsInner2.getDataOutput();
 
+        final AtomizeHelper ah = new AtomizeHelper();
         final FunctionHelper.TypedPointables tp1 = new FunctionHelper.TypedPointables();
         final FunctionHelper.TypedPointables tp2 = new FunctionHelper.TypedPointables();
         final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
@@ -186,25 +188,29 @@ public abstract class AbstractGeneralComparisonScalarEvaluatorFactory extends
                 boolean tagTransformed1 = false, tagTransformed2 = false;
                 abvsInner1.reset();
                 abvsInner2.reset();
-                TaggedValuePointable tvpTransform1 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
-                TaggedValuePointable tvpTransform2 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+                TaggedValuePointable tvpTransform1 = (TaggedValuePointable) TaggedValuePointable.FACTORY
+                        .createPointable();
+                TaggedValuePointable tvpTransform2 = (TaggedValuePointable) TaggedValuePointable.FACTORY
+                        .createPointable();
                 tvpTransform1.set(tvpArg1);
                 tvpTransform2.set(tvpArg2);
                 int tid1 = FunctionHelper.getBaseTypeForGeneralComparisons(tvpTransform1.getTag());
                 int tid2 = FunctionHelper.getBaseTypeForGeneralComparisons(tvpTransform2.getTag());
-                
+
                 // Converted tags
-                TaggedValuePointable tvpCompare1 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
-                TaggedValuePointable tvpCompare2 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+                TaggedValuePointable tvpCompare1 = (TaggedValuePointable) TaggedValuePointable.FACTORY
+                        .createPointable();
+                TaggedValuePointable tvpCompare2 = (TaggedValuePointable) TaggedValuePointable.FACTORY
+                        .createPointable();
                 try {
                     // Converts node tree's into untyped atomic values that can then be compared as atomic items.
                     if (tid1 == ValueTag.NODE_TREE_TAG && tid2 == ValueTag.NODE_TREE_TAG) {
-                        FunctionHelper.atomize(tvpArg1, tvpTransform1);
-                        FunctionHelper.atomize(tvpArg2, tvpTransform2);
+                        ah.atomize(tvpArg1, ppool, tvpTransform1);
+                        ah.atomize(tvpArg2, ppool, tvpTransform2);
                         tid1 = FunctionHelper.getBaseTypeForGeneralComparisons(tvpTransform1.getTag());
                         tid2 = FunctionHelper.getBaseTypeForGeneralComparisons(tvpTransform2.getTag());
                     } else if (tid1 == ValueTag.NODE_TREE_TAG) {
-                        FunctionHelper.atomize(tvpArg1, tvpTransform1);
+                        ah.atomize(tvpArg1, ppool, tvpTransform1);
                         tid1 = FunctionHelper.getBaseTypeForGeneralComparisons(tvpTransform1.getTag());
                     } else if (tid2 == ValueTag.NODE_TREE_TAG) {
                         FunctionHelper.atomize(tvpArg2, tvpTransform2);

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f9ec13bf/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/misc/FnDataScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/misc/FnDataScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/misc/FnDataScalarEvaluatorFactory.java
index b4f53ab..cd4dbb3 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/misc/FnDataScalarEvaluatorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/misc/FnDataScalarEvaluatorFactory.java
@@ -26,6 +26,7 @@ import org.apache.vxquery.exceptions.ErrorCode;
 import org.apache.vxquery.exceptions.SystemException;
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator;
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
+import org.apache.vxquery.runtime.functions.util.AtomizeHelper;
 import org.apache.vxquery.runtime.functions.util.FunctionHelper;
 
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -45,38 +46,46 @@ public class FnDataScalarEvaluatorFactory extends AbstractTaggedValueArgumentSca
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
             throws AlgebricksException {
+        return new FnDataScalarEvaluator(args);
+    }
+
+    private class FnDataScalarEvaluator extends AbstractTaggedValueArgumentScalarEvaluator {
+        final AtomizeHelper ah = new AtomizeHelper();
         final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
         final SequenceBuilder sb = new SequenceBuilder();
         final SequencePointable seq = new SequencePointable();
         final TaggedValuePointable p = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
         final TaggedValuePointable tempTVP = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
-        return new AbstractTaggedValueArgumentScalarEvaluator(args) {
-            @Override
-            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
-                try {
-                    abvs.reset();
-                    sb.reset(abvs);
-                    TaggedValuePointable tvp = args[0];
-                    if (tvp.getTag() == ValueTag.SEQUENCE_TAG) {
-                        tvp.getValue(seq);
-                        int seqLen = seq.getEntryCount();
-                        for (int j = 0; j < seqLen; ++j) {
-                            seq.getEntry(j, p);
-                            FunctionHelper.atomize(p, tempTVP);
-                            sb.addItem(tempTVP);
-                        }
-                    } else {
-                        FunctionHelper.atomize(tvp, tempTVP);
+
+        public FnDataScalarEvaluator(IScalarEvaluator[] args) {
+            super(args);
+        }
+
+        @Override
+        protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
+            try {
+                abvs.reset();
+                sb.reset(abvs);
+                TaggedValuePointable tvp = args[0];
+                if (tvp.getTag() == ValueTag.SEQUENCE_TAG) {
+                    tvp.getValue(seq);
+                    int seqLen = seq.getEntryCount();
+                    for (int j = 0; j < seqLen; ++j) {
+                        seq.getEntry(j, p);
+                        ah.atomize(p, ppool, tempTVP);
                         sb.addItem(tempTVP);
                     }
-                    sb.finish();
-                    result.set(abvs);
-                } catch (IOException e) {
-                    throw new SystemException(ErrorCode.SYSE0001);
+                } else {
+                    ah.atomize(tvp, ppool, tempTVP);
+                    sb.addItem(tempTVP);
                 }
+                sb.finish();
+                result.set(abvs);
+            } catch (IOException e) {
+                throw new SystemException(ErrorCode.SYSE0001);
             }
+        }
 
-       };
     }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f9ec13bf/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/AtomizeHelper.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/AtomizeHelper.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/AtomizeHelper.java
new file mode 100644
index 0000000..ed9cd72
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/AtomizeHelper.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.runtime.functions.util;
+
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.vxquery.datamodel.accessors.PointablePool;
+import org.apache.vxquery.datamodel.accessors.SequencePointable;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.datamodel.accessors.nodes.AttributeNodePointable;
+import org.apache.vxquery.datamodel.accessors.nodes.DocumentNodePointable;
+import org.apache.vxquery.datamodel.accessors.nodes.ElementNodePointable;
+import org.apache.vxquery.datamodel.accessors.nodes.NodeTreePointable;
+import org.apache.vxquery.datamodel.accessors.nodes.PINodePointable;
+import org.apache.vxquery.datamodel.accessors.nodes.TextOrCommentNodePointable;
+import org.apache.vxquery.datamodel.values.ValueTag;
+
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.primitive.VoidPointable;
+import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
+
+public class AtomizeHelper {
+    AttributeNodePointable anp = (AttributeNodePointable) AttributeNodePointable.FACTORY.createPointable();
+    DocumentNodePointable dnp = (DocumentNodePointable) DocumentNodePointable.FACTORY.createPointable();
+    ElementNodePointable enp = (ElementNodePointable) ElementNodePointable.FACTORY.createPointable();
+    NodeTreePointable ntp = (NodeTreePointable) NodeTreePointable.FACTORY.createPointable();
+    PINodePointable pnp = (PINodePointable) PINodePointable.FACTORY.createPointable();
+    SequencePointable sp = (SequencePointable) SequencePointable.FACTORY.createPointable();
+    TextOrCommentNodePointable tcnp = (TextOrCommentNodePointable) TextOrCommentNodePointable.FACTORY.createPointable();
+    ArrayBackedValueStorage tempABVS = new ArrayBackedValueStorage();
+    TaggedValuePointable tempTVP = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+    VoidPointable vp = (VoidPointable) VoidPointable.FACTORY.createPointable();
+
+    public void atomize(TaggedValuePointable tvp, PointablePool pp, IPointable result) throws IOException {
+        switch (tvp.getTag()) {
+            case ValueTag.NODE_TREE_TAG:
+                tvp.getValue(ntp);
+                atomizeNode(ntp, pp, result);
+                break;
+
+            default:
+                result.set(tvp);
+        }
+    }
+
+    public void atomizeNode(NodeTreePointable ntp, PointablePool pp, IPointable result) throws IOException {
+        ntp.getRootNode(tempTVP);
+        switch (tempTVP.getTag()) {
+            case ValueTag.ATTRIBUTE_NODE_TAG: {
+                tempTVP.getValue(anp);
+                anp.getValue(ntp, result);
+                break;
+            }
+
+            case ValueTag.TEXT_NODE_TAG:
+            case ValueTag.COMMENT_NODE_TAG: {
+                tempTVP.getValue(tcnp);
+                tcnp.getValue(ntp, vp);
+                tempABVS.reset();
+                tempABVS.getDataOutput().write(ValueTag.XS_UNTYPED_ATOMIC_TAG);
+                tempABVS.append(vp);
+                result.set(tempABVS.getByteArray(), tempABVS.getStartOffset(), tempABVS.getLength());
+                break;
+            }
+
+            case ValueTag.DOCUMENT_NODE_TAG: {
+                tempTVP.getValue(dnp);
+                dnp.getContent(ntp, sp);
+                buildStringConcatenation(sp, pp, tempABVS, ntp);
+                result.set(tempABVS.getByteArray(), tempABVS.getStartOffset(), tempABVS.getLength());
+                break;
+            }
+
+            case ValueTag.ELEMENT_NODE_TAG: {
+                tempTVP.getValue(enp);
+                if (enp.childrenChunkExists()) {
+                    enp.getChildrenSequence(ntp, sp);
+                    buildStringConcatenation(sp, pp, tempABVS, ntp);
+                    result.set(tempABVS.getByteArray(), tempABVS.getStartOffset(), tempABVS.getLength());
+                }
+                break;
+            }
+
+            case ValueTag.PI_NODE_TAG: {
+                tempTVP.getValue(pnp);
+                pnp.getContent(ntp, vp);
+                tempABVS.reset();
+                tempABVS.getDataOutput().write(ValueTag.XS_UNTYPED_ATOMIC_TAG);
+                tempABVS.append(vp);
+                result.set(tempABVS.getByteArray(), tempABVS.getStartOffset(), tempABVS.getLength());
+                break;
+            }
+
+        }
+    }
+
+    public static void buildConcatenationRec(SequencePointable sp, PointablePool pp, DataOutput out,
+            NodeTreePointable ntp) throws IOException {
+        TaggedValuePointable tempTVP2 = pp.takeOne(TaggedValuePointable.class);
+        int nItems = sp.getEntryCount();
+        for (int i = 0; i < nItems; ++i) {
+            sp.getEntry(i, tempTVP2);
+            switch (tempTVP2.getTag()) {
+                case ValueTag.TEXT_NODE_TAG: {
+                    TextOrCommentNodePointable tcnp = pp.takeOne(TextOrCommentNodePointable.class);
+                    VoidPointable vp = pp.takeOne(VoidPointable.class);
+                    try {
+                        tempTVP2.getValue(tcnp);
+                        tcnp.getValue(ntp, vp);
+                        out.write(vp.getByteArray(), vp.getStartOffset() + 2, vp.getLength() - 2);
+                    } finally {
+                        pp.giveBack(vp);
+                        pp.giveBack(tcnp);
+                    }
+                    break;
+                }
+                case ValueTag.ELEMENT_NODE_TAG: {
+                    ElementNodePointable enp = pp.takeOne(ElementNodePointable.class);
+                    SequencePointable sp2 = pp.takeOne(SequencePointable.class);
+                    try {
+                        tempTVP2.getValue(enp);
+                        if (enp.childrenChunkExists()) {
+                            enp.getChildrenSequence(ntp, sp2);
+                            buildConcatenationRec(sp2, pp, out, ntp);
+                        }
+                    } finally {
+                        pp.giveBack(sp2);
+                        pp.giveBack(enp);
+                    }
+                }
+            }
+        }
+        pp.giveBack(tempTVP2);
+    }
+
+    public static void buildStringConcatenation(SequencePointable sp, PointablePool pp,
+            ArrayBackedValueStorage tempABVS, NodeTreePointable ntp) throws IOException {
+        tempABVS.reset();
+        DataOutput out = tempABVS.getDataOutput();
+        out.write(ValueTag.XS_UNTYPED_ATOMIC_TAG);
+        // Leave room for the utf-8 length
+        out.write(0);
+        out.write(0);
+        buildConcatenationRec(sp, pp, out, ntp);
+        int utflen = tempABVS.getLength() - 3;
+        byte[] bytes = tempABVS.getByteArray();
+        // Patch utf-8 length at bytes 1 and 2
+        bytes[1] = (byte) ((utflen >>> 8) & 0xFF);
+        bytes[2] = (byte) ((utflen >>> 0) & 0xFF);
+    }
+
+}


[08/25] git commit: All the redundant type expression rules have been updated to improve code reuse and new use cases.

Posted by ti...@apache.org.
All the redundant type expression rules have been updated to improve code reuse and new use cases.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/c74c9865
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/c74c9865
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/c74c9865

Branch: refs/heads/westmann/prettyprint
Commit: c74c98656f9afd9ea7ead84486511c6964ff78a2
Parents: 6d7c53e
Author: Preston Carman <pr...@apache.org>
Authored: Thu Feb 13 15:06:38 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Feb 13 15:06:38 2014 -0800

----------------------------------------------------------------------
 ...tractRemoveRedundantTypeExpressionsRule.java | 97 ++++++++++++++++++++
 .../RemoveRedundantCastExpressionsRule.java     | 61 ++++++++++++
 .../RemoveRedundantDataExpressionsRule.java     | 67 ++------------
 .../RemoveRedundantPromoteExpressionsRule.java  | 92 ++++---------------
 .../RemoveRedundantTreatExpressionsRule.java    | 87 +++---------------
 .../rewriter/rules/util/ExpressionToolbox.java  | 92 ++++++++++++++++++-
 .../rewriter/rules/util/OperatorToolbox.java    | 85 ++++++++++++++---
 .../functions/type/SequenceTypeMatcher.java     | 32 ++++++-
 8 files changed, 394 insertions(+), 219 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/c74c9865/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractRemoveRedundantTypeExpressionsRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractRemoveRedundantTypeExpressionsRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractRemoveRedundantTypeExpressionsRule.java
new file mode 100644
index 0000000..752e107
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractRemoveRedundantTypeExpressionsRule.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.compiler.rewriter.rules;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.vxquery.compiler.rewriter.rules.util.ExpressionToolbox;
+import org.apache.vxquery.compiler.rewriter.rules.util.OperatorToolbox;
+import org.apache.vxquery.context.RootStaticContextImpl;
+import org.apache.vxquery.context.StaticContextImpl;
+import org.apache.vxquery.types.SequenceType;
+
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.IOptimizationContext;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
+
+public abstract class AbstractRemoveRedundantTypeExpressionsRule implements IAlgebraicRewriteRule {
+    final StaticContextImpl dCtx = new StaticContextImpl(RootStaticContextImpl.INSTANCE);
+    final int ARG_DATA = 0;
+    final int ARG_TYPE = 1;
+    final List<Mutable<ILogicalExpression>> functionList = new ArrayList<Mutable<ILogicalExpression>>();
+    
+    protected abstract FunctionIdentifier getSearchFunction();
+
+    @Override
+    public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException {
+        return false;
+    }
+
+    @Override
+    public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
+            throws AlgebricksException {
+        boolean modified = false;
+        List<Mutable<ILogicalExpression>> expressions = OperatorToolbox.getExpressions(opRef);
+        for (Mutable<ILogicalExpression> expression : expressions) {
+            if (processTypeExpression(opRef, expression)) {
+                modified = true;
+            }
+        }
+        return modified;
+    }
+
+    private boolean processTypeExpression(Mutable<ILogicalOperator> opRef, Mutable<ILogicalExpression> search) {
+        boolean modified = false;
+        SequenceType inputSequenceType;
+        functionList.clear();
+        ExpressionToolbox.findAllFunctionExpressions(search, getSearchFunction(), functionList);
+        for (Mutable<ILogicalExpression> searchM : functionList) {
+            // Get input function
+            AbstractFunctionCallExpression searchFunction = (AbstractFunctionCallExpression) searchM.getValue();
+            Mutable<ILogicalExpression> argFirstM = searchFunction.getArguments().get(ARG_DATA);
+
+            // Find the input return type.
+            inputSequenceType = ExpressionToolbox.getOutputSequenceType(opRef, argFirstM, dCtx);
+
+            // Find the treat type.
+            SequenceType sTypeArg = null;
+            if (hasTypeArgument()) {
+                sTypeArg = ExpressionToolbox.getTypeExpressionTypeArguement(searchM, dCtx);
+            }
+
+            // remove
+            if (safeToReplace(sTypeArg, inputSequenceType)) {
+                searchM.setValue(argFirstM.getValue());
+                modified = true;
+            }
+        }
+        return modified;
+    }
+
+    public abstract boolean safeToReplace(SequenceType sTypeArg, SequenceType sTypeOutput);
+
+    public boolean hasTypeArgument() {
+        return true;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/c74c9865/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantCastExpressionsRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantCastExpressionsRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantCastExpressionsRule.java
new file mode 100644
index 0000000..bf06b00
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantCastExpressionsRule.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.compiler.rewriter.rules;
+
+import org.apache.vxquery.functions.BuiltinOperators;
+import org.apache.vxquery.types.SequenceType;
+
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+
+/**
+ * The rule searches for where the xquery cast function is used. When the
+ * expression's return type matches the treat expression type, the cast is
+ * removed.
+ * 
+ * <pre>
+ * Before
+ * 
+ *   plan__parent
+ *   %OPERATOR( $v1 : cast( \@input_expression, \@type_expression ) )
+ *   plan__child
+ *   
+ *   Where treat \@type_expression is the same as the return type of \@input_expression.
+ *   
+ * After 
+ * 
+ *   plan__parent
+ *   %OPERATOR( $v1 : \@input_expression )
+ *   plan__child
+ * </pre>
+ * 
+ * @author prestonc
+ */
+
+public class RemoveRedundantCastExpressionsRule extends AbstractRemoveRedundantTypeExpressionsRule {
+    protected FunctionIdentifier getSearchFunction() {
+        return BuiltinOperators.CAST.getFunctionIdentifier();
+    }
+
+    @Override
+    public boolean safeToReplace(SequenceType sTypeArg, SequenceType sTypeOutput) {
+        if (sTypeArg != null && sTypeOutput != null && sTypeOutput.equals(sTypeArg)) {
+            // Same type.
+            return true;
+        }
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/c74c9865/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantDataExpressionsRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantDataExpressionsRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantDataExpressionsRule.java
index d9554c4..fb05e4d 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantDataExpressionsRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantDataExpressionsRule.java
@@ -16,23 +16,10 @@
  */
 package org.apache.vxquery.compiler.rewriter.rules;
 
-import java.util.List;
-
-import org.apache.commons.lang3.mutable.Mutable;
-import org.apache.vxquery.compiler.rewriter.rules.util.ExpressionToolbox;
-import org.apache.vxquery.compiler.rewriter.rules.util.OperatorToolbox;
-import org.apache.vxquery.context.RootStaticContextImpl;
-import org.apache.vxquery.context.StaticContextImpl;
 import org.apache.vxquery.functions.BuiltinFunctions;
-import org.apache.vxquery.functions.Function;
 import org.apache.vxquery.types.SequenceType;
 
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.IOptimizationContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
-import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 
 /**
  * The rule searches for where the xquery data function is used. When the
@@ -56,54 +43,20 @@ import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
  * 
  * @author prestonc
  */
-public class RemoveRedundantDataExpressionsRule implements IAlgebraicRewriteRule {
-    final StaticContextImpl dCtx = new StaticContextImpl(RootStaticContextImpl.INSTANCE);
-    final int ARG_DATA = 0;
-
-    @Override
-    public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException {
-        return false;
+public class RemoveRedundantDataExpressionsRule extends AbstractRemoveRedundantTypeExpressionsRule {
+    protected FunctionIdentifier getSearchFunction() {
+        return BuiltinFunctions.FN_DATA_1.getFunctionIdentifier();
     }
 
     @Override
-    public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
-            throws AlgebricksException {
-        boolean modified = false;
-        List<Mutable<ILogicalExpression>> expressions = OperatorToolbox.getExpression(opRef);
-        for (Mutable<ILogicalExpression> expression : expressions) {
-            if (processDataExpression(expression)) {
-                modified = true;
-            }
-        }
-        return modified;
+    public boolean hasTypeArgument() {
+        return false;
     }
 
-    private boolean processDataExpression(Mutable<ILogicalExpression> search) {
-        boolean modified = false;
-        Mutable<ILogicalExpression> dataM = ExpressionToolbox.findFunctionExpression(search,
-                BuiltinFunctions.FN_DATA_1.getFunctionIdentifier());
-        if (dataM != null) {
-            // Get input function
-            AbstractFunctionCallExpression promoteFunction = (AbstractFunctionCallExpression) dataM.getValue();
-            Mutable<ILogicalExpression> argDataM = promoteFunction.getArguments().get(ARG_DATA);
-
-            // Find the input return type.
-            SequenceType inputSequenceType = null;
-            Function function = ExpressionToolbox.getBuiltIn(argDataM);
-            if (function == null) {
-                return false;
-            } else {
-                inputSequenceType = function.getSignature().getReturnType();
-            }
-
-            // remove
-            if (inputSequenceType != null && inputSequenceType.getItemType().isAtomicType()) {
-                dataM.setValue(argDataM.getValue());
-                modified = true;
-                processDataExpression(argDataM);
-            }
+    public boolean safeToReplace(SequenceType sTypeArg, SequenceType sTypeOutput) {
+        if (sTypeOutput != null && sTypeOutput.getItemType().isAtomicType()) {
+            return true;
         }
-        return modified;
+        return false;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/c74c9865/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantPromoteExpressionsRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantPromoteExpressionsRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantPromoteExpressionsRule.java
index 81b71ae..589618d 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantPromoteExpressionsRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantPromoteExpressionsRule.java
@@ -16,27 +16,14 @@
  */
 package org.apache.vxquery.compiler.rewriter.rules;
 
-import java.util.List;
-
-import org.apache.commons.lang3.mutable.Mutable;
-import org.apache.vxquery.compiler.rewriter.rules.util.ExpressionToolbox;
-import org.apache.vxquery.compiler.rewriter.rules.util.OperatorToolbox;
-import org.apache.vxquery.context.RootStaticContextImpl;
-import org.apache.vxquery.context.StaticContextImpl;
-import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.datamodel.values.ValueTag;
 import org.apache.vxquery.functions.BuiltinOperators;
-import org.apache.vxquery.functions.Function;
+import org.apache.vxquery.runtime.functions.cast.CastToDoubleOperation;
+import org.apache.vxquery.runtime.functions.cast.CastToFloatOperation;
+import org.apache.vxquery.types.BuiltinTypeRegistry;
 import org.apache.vxquery.types.SequenceType;
 
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.IOptimizationContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalExpressionTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ConstantExpression;
-import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
-import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 
 /**
  * The rule searches for where the xquery promote function is used. When the
@@ -62,67 +49,26 @@ import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
  * @author prestonc
  */
 
-public class RemoveRedundantPromoteExpressionsRule implements IAlgebraicRewriteRule {
-    final StaticContextImpl dCtx = new StaticContextImpl(RootStaticContextImpl.INSTANCE);
-    final int ARG_DATA = 0;
-    final int ARG_TYPE = 1;
-
+public class RemoveRedundantPromoteExpressionsRule extends AbstractRemoveRedundantTypeExpressionsRule {
     @Override
-    public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException {
-        return false;
+    protected FunctionIdentifier getSearchFunction() {
+        return BuiltinOperators.PROMOTE.getFunctionIdentifier();
     }
 
     @Override
-    public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
-            throws AlgebricksException {
-        boolean modified = false;
-        List<Mutable<ILogicalExpression>> expressions = OperatorToolbox.getExpression(opRef);
-        for (Mutable<ILogicalExpression> expression : expressions) {
-            if (processPromoteExpression(expression)) {
-                modified = true;
+    public boolean safeToReplace(SequenceType sTypeArg, SequenceType sTypeOutput) {
+        if (sTypeArg != null) {
+            if (sTypeArg.getItemType() != BuiltinTypeRegistry.XS_DOUBLE
+                    && sTypeArg.getItemType() != BuiltinTypeRegistry.XS_FLOAT
+                    && sTypeArg.getItemType() != BuiltinTypeRegistry.XS_STRING) {
+                // These types can not be promoted.
+                return true;
             }
-        }
-        return modified;
-    }
-
-    private boolean processPromoteExpression(Mutable<ILogicalExpression> search) {
-        boolean modified = false;
-        Mutable<ILogicalExpression> promoteM = ExpressionToolbox.findFunctionExpression(search,
-                BuiltinOperators.PROMOTE.getFunctionIdentifier());
-        if (promoteM != null) {
-            // Get input function
-            AbstractFunctionCallExpression promoteFunction = (AbstractFunctionCallExpression) promoteM.getValue();
-            Mutable<ILogicalExpression> argDataM = promoteFunction.getArguments().get(ARG_DATA);
-            
-            // Find the input return type.
-            SequenceType inputSequenceType = null;
-            Function function = ExpressionToolbox.getBuiltIn(argDataM);
-            if (function == null) {
-                return false;
-            } else {
-                inputSequenceType = function.getSignature().getReturnType();
-            }
-
-            // Find the promote type.
-            ILogicalExpression argType = promoteFunction.getArguments().get(ARG_TYPE).getValue();
-            if (argType.getExpressionTag() != LogicalExpressionTag.CONSTANT) {
-                return false;
-            }
-            TaggedValuePointable tvp = new TaggedValuePointable();
-            ExpressionToolbox.getConstantAsPointable((ConstantExpression) argType, tvp);
-
-            IntegerPointable pTypeCode = (IntegerPointable) IntegerPointable.FACTORY.createPointable();
-            tvp.getValue(pTypeCode);
-            SequenceType sType = dCtx.lookupSequenceType(pTypeCode.getInteger());
-
-            // remove
-            if (inputSequenceType != null && inputSequenceType.equals(sType)) {
-                promoteM.setValue(argDataM.getValue());
-                modified = true;
-                processPromoteExpression(argDataM);
+            if (sTypeOutput != null && sTypeOutput.equals(sTypeArg)) {
+                // Same type.
+                return true;
             }
         }
-        return modified;
+        return false;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/c74c9865/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantTreatExpressionsRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantTreatExpressionsRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantTreatExpressionsRule.java
index 67c3d5e..63ad06f 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantTreatExpressionsRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantTreatExpressionsRule.java
@@ -16,27 +16,11 @@
  */
 package org.apache.vxquery.compiler.rewriter.rules;
 
-import java.util.List;
-
-import org.apache.commons.lang3.mutable.Mutable;
-import org.apache.vxquery.compiler.rewriter.rules.util.ExpressionToolbox;
-import org.apache.vxquery.compiler.rewriter.rules.util.OperatorToolbox;
-import org.apache.vxquery.context.RootStaticContextImpl;
-import org.apache.vxquery.context.StaticContextImpl;
-import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.functions.BuiltinOperators;
-import org.apache.vxquery.functions.Function;
+import org.apache.vxquery.runtime.functions.type.SequenceTypeMatcher;
 import org.apache.vxquery.types.SequenceType;
 
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.IOptimizationContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalExpressionTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ConstantExpression;
-import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
-import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 
 /**
  * The rule searches for where the xquery treat function is used. When the
@@ -62,67 +46,22 @@ import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
  * @author prestonc
  */
 
-public class RemoveRedundantTreatExpressionsRule implements IAlgebraicRewriteRule {
-    final StaticContextImpl dCtx = new StaticContextImpl(RootStaticContextImpl.INSTANCE);
-    final int ARG_DATA = 0;
-    final int ARG_TYPE = 1;
+public class RemoveRedundantTreatExpressionsRule extends AbstractRemoveRedundantTypeExpressionsRule {
+    final SequenceTypeMatcher stm = new SequenceTypeMatcher();
 
-    @Override
-    public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException {
-        return false;
+    protected FunctionIdentifier getSearchFunction() {
+        return BuiltinOperators.TREAT.getFunctionIdentifier();
     }
 
     @Override
-    public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
-            throws AlgebricksException {
-        boolean modified = false;
-        List<Mutable<ILogicalExpression>> expressions = OperatorToolbox.getExpression(opRef);
-        for (Mutable<ILogicalExpression> expression : expressions) {
-            if (processTreatExpression(expression)) {
-                modified = true;
-            }
-        }
-        return modified;
-    }
-
-    private boolean processTreatExpression(Mutable<ILogicalExpression> search) {
-        boolean modified = false;
-        Mutable<ILogicalExpression> treatM = ExpressionToolbox.findFunctionExpression(search,
-                BuiltinOperators.TREAT.getFunctionIdentifier());
-        if (treatM != null) {
-            // Get input function
-            AbstractFunctionCallExpression treatFunction = (AbstractFunctionCallExpression) treatM.getValue();
-            Mutable<ILogicalExpression> argDataM = treatFunction.getArguments().get(ARG_DATA);
-            
-            // Find the input return type.
-            SequenceType inputSequenceType = null;
-            Function function = ExpressionToolbox.getBuiltIn(argDataM);
-            if (function == null) {
-                return false;
-            } else {
-                inputSequenceType = function.getSignature().getReturnType();
-            }
-
-            // Find the treat type.
-            ILogicalExpression argType = treatFunction.getArguments().get(ARG_TYPE).getValue();
-            if (argType.getExpressionTag() != LogicalExpressionTag.CONSTANT) {
-                return false;
-            }
-            TaggedValuePointable tvp = new TaggedValuePointable();
-            ExpressionToolbox.getConstantAsPointable((ConstantExpression) argType, tvp);
-
-            IntegerPointable pTypeCode = (IntegerPointable) IntegerPointable.FACTORY.createPointable();
-            tvp.getValue(pTypeCode);
-            SequenceType sType = dCtx.lookupSequenceType(pTypeCode.getInteger());
-
-            // remove
-            if (inputSequenceType != null && inputSequenceType.equals(sType)) {
-                treatM.setValue(argDataM.getValue());
-                modified = true;
-                processTreatExpression(argDataM);
+    public boolean safeToReplace(SequenceType sTypeArg, SequenceType sTypeOutput) {
+        if (sTypeArg != null) {
+            stm.setSequenceType(sTypeArg);
+            if (sTypeOutput != null && stm.isSubType(sTypeOutput)) {
+                // Same type.
+                return true;
             }
         }
-        return modified;
+        return false;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/c74c9865/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java
index e494f0b..7d54068 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/ExpressionToolbox.java
@@ -16,23 +16,33 @@
  */
 package org.apache.vxquery.compiler.rewriter.rules.util;
 
+import java.util.List;
+
 import org.apache.commons.lang3.mutable.Mutable;
 import org.apache.vxquery.compiler.algebricks.VXQueryConstantValue;
+import org.apache.vxquery.context.RootStaticContextImpl;
+import org.apache.vxquery.context.StaticContextImpl;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.functions.BuiltinFunctions;
 import org.apache.vxquery.functions.BuiltinOperators;
 import org.apache.vxquery.functions.Function;
+import org.apache.vxquery.types.AnyNodeType;
+import org.apache.vxquery.types.Quantifier;
+import org.apache.vxquery.types.SequenceType;
 
 import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
 import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalExpressionTag;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
 import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ConstantExpression;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression;
 import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
+import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
 
 public class ExpressionToolbox {
-
     public static Mutable<ILogicalExpression> findVariableExpression(Mutable<ILogicalExpression> mutableLe,
             LogicalVariable lv) {
         ILogicalExpression le = mutableLe.getValue();
@@ -88,7 +98,7 @@ public class ExpressionToolbox {
         return null;
     }
 
-    public static Mutable<ILogicalExpression> findFunctionExpression(Mutable<ILogicalExpression> mutableLe,
+    public static Mutable<ILogicalExpression> findFirstFunctionExpression(Mutable<ILogicalExpression> mutableLe,
             FunctionIdentifier fi) {
         ILogicalExpression le = mutableLe.getValue();
         if (le.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
@@ -97,7 +107,7 @@ public class ExpressionToolbox {
                 return mutableLe;
             }
             for (Mutable<ILogicalExpression> argExp : afce.getArguments()) {
-                Mutable<ILogicalExpression> resultLe = findFunctionExpression(argExp, fi);
+                Mutable<ILogicalExpression> resultLe = findFirstFunctionExpression(argExp, fi);
                 if (resultLe != null) {
                     return resultLe;
                 }
@@ -106,6 +116,23 @@ public class ExpressionToolbox {
         return null;
     }
 
+    /**
+     * Find all functions for a specific expression.
+     */
+    public static void findAllFunctionExpressions(Mutable<ILogicalExpression> mutableLe, FunctionIdentifier fi,
+            List<Mutable<ILogicalExpression>> finds) {
+        ILogicalExpression le = mutableLe.getValue();
+        if (le.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
+            AbstractFunctionCallExpression afce = (AbstractFunctionCallExpression) le;
+            if (afce.getFunctionIdentifier().equals(fi)) {
+                finds.add(mutableLe);
+            }
+            for (Mutable<ILogicalExpression> argExp : afce.getArguments()) {
+                findAllFunctionExpressions(argExp, fi, finds);
+            }
+        }
+    }
+
     public static Function getBuiltIn(Mutable<ILogicalExpression> mutableLe) {
         ILogicalExpression le = mutableLe.getValue();
         if (le.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
@@ -129,4 +156,63 @@ public class ExpressionToolbox {
         tvp.set(treatTypeConstant.getValue(), 0, treatTypeConstant.getValue().length);
     }
 
+    public static int getTypeExpressionTypeArgument(Mutable<ILogicalExpression> searchM) {
+        final int ARG_TYPE = 1;
+        AbstractFunctionCallExpression searchFunction = (AbstractFunctionCallExpression) searchM.getValue();
+        ILogicalExpression argType = searchFunction.getArguments().get(ARG_TYPE).getValue();
+        if (argType.getExpressionTag() != LogicalExpressionTag.CONSTANT) {
+            return -1;
+        }
+        TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+        ExpressionToolbox.getConstantAsPointable((ConstantExpression) argType, tvp);
+
+        IntegerPointable pTypeCode = (IntegerPointable) IntegerPointable.FACTORY.createPointable();
+        tvp.getValue(pTypeCode);
+        return pTypeCode.getInteger();
+    }
+
+    public static SequenceType getTypeExpressionTypeArguement(Mutable<ILogicalExpression> searchM,
+            StaticContextImpl dCtx) {
+        int typeId = getTypeExpressionTypeArgument(searchM);
+        if (typeId > 0) {
+            return dCtx.lookupSequenceType(typeId);
+        } else {
+            return null;
+        }
+    }
+
+    public static SequenceType getOutputSequenceType(Mutable<ILogicalOperator> opRef,
+            Mutable<ILogicalExpression> argFirstM, StaticContextImpl dCtx) {
+        ILogicalExpression argFirstLe = argFirstM.getValue();
+        switch (argFirstLe.getExpressionTag()) {
+            case FUNCTION_CALL:
+                // Only process defined functions.
+                Function function = ExpressionToolbox.getBuiltIn(argFirstM);
+                if (function == null) {
+                    return null;
+                } else if (function.getFunctionIdentifier().equals(BuiltinOperators.CAST.getFunctionIdentifier())) {
+                    // Special case since case has multiple type outputs.
+                    return ExpressionToolbox.getTypeExpressionTypeArguement(argFirstM, dCtx);
+                } else {
+                    return function.getSignature().getReturnType();
+                }
+            case CONSTANT:
+                // Consider constant values.
+                ConstantExpression constantExpression = (ConstantExpression) argFirstLe;
+                VXQueryConstantValue constantValue = (VXQueryConstantValue) constantExpression.getValue();
+                return constantValue.getType();
+            case VARIABLE:
+                VariableReferenceExpression variableRefExp = (VariableReferenceExpression) argFirstLe;
+                LogicalVariable variableId = variableRefExp.getVariableReference();
+                Mutable<ILogicalOperator> variableProducer = OperatorToolbox.findProducerOf(opRef, variableId);
+                if (variableProducer == null) {
+                    return null;
+                }
+                AbstractLogicalOperator variableOp = (AbstractLogicalOperator) variableProducer.getValue();
+                if (variableOp.getOperatorTag() == LogicalOperatorTag.DATASOURCESCAN) {
+                    return SequenceType.create(AnyNodeType.INSTANCE, Quantifier.QUANT_ONE);
+                }
+        }
+        return null;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/c74c9865/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/OperatorToolbox.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/OperatorToolbox.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/OperatorToolbox.java
index fd1f501..da85f2d 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/OperatorToolbox.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/util/OperatorToolbox.java
@@ -16,8 +16,8 @@
  */
 package org.apache.vxquery.compiler.rewriter.rules.util;
 
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.commons.lang3.mutable.Mutable;
 
@@ -26,8 +26,11 @@ import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
 import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
 import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
 import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractAssignOperator;
+import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractBinaryJoinOperator;
 import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
+import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractScanOperator;
 import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractUnnestOperator;
+import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.SelectOperator;
 
 public class OperatorToolbox {
 
@@ -44,7 +47,7 @@ public class OperatorToolbox {
         }
         return opRef;
     }
-    
+
     public static AbstractLogicalOperator findLastSubplanOperator(AbstractLogicalOperator op) {
         AbstractLogicalOperator next;
         while (op.getOperatorTag() != LogicalOperatorTag.NESTEDTUPLESOURCE) {
@@ -56,8 +59,8 @@ public class OperatorToolbox {
         }
         return op;
     }
-    
-    public static List<Mutable<ILogicalExpression>> getExpression(Mutable<ILogicalOperator> opRef) {
+
+    public static List<Mutable<ILogicalExpression>> getExpressions(Mutable<ILogicalOperator> opRef) {
         AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
         List<Mutable<ILogicalExpression>> result = new ArrayList<Mutable<ILogicalExpression>>();
         switch (op.getOperatorTag()) {
@@ -67,6 +70,15 @@ public class OperatorToolbox {
                 AbstractAssignOperator aao = (AbstractAssignOperator) op;
                 result.addAll(aao.getExpressions());
                 break;
+            case INNERJOIN:
+            case LEFTOUTERJOIN:
+                AbstractBinaryJoinOperator abjo = (AbstractBinaryJoinOperator) op;
+                result.add(abjo.getCondition());
+                break;
+            case SELECT:
+                SelectOperator so = (SelectOperator) op;
+                result.add(so.getCondition());
+                break;
             case UNNEST:
             case UNNEST_MAP:
                 AbstractUnnestOperator auo = (AbstractUnnestOperator) op;
@@ -81,6 +93,51 @@ public class OperatorToolbox {
             case EXTENSION_OPERATOR:
             case GROUP:
             case INDEX_INSERT_DELETE:
+            case INSERT_DELETE:
+            case LIMIT:
+            case NESTEDTUPLESOURCE:
+            case ORDER:
+            case PARTITIONINGSPLIT:
+            case PROJECT:
+            case REPLICATE:
+            case SCRIPT:
+            case SINK:
+            case SUBPLAN:
+            case UNIONALL:
+            case UPDATE:
+            case WRITE:
+            case WRITE_RESULT:
+            default:
+                // TODO Not yet implemented.
+                break;
+        }
+        return result;
+    }
+
+    public static Mutable<ILogicalExpression> getExpressionOf(Mutable<ILogicalOperator> opRef, LogicalVariable lv) {
+        AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
+        switch (op.getOperatorTag()) {
+            case AGGREGATE:
+            case ASSIGN:
+            case RUNNINGAGGREGATE:
+                AbstractAssignOperator aao = (AbstractAssignOperator) op;
+                if (!aao.getVariables().contains(lv)) {
+                    return null;
+                }
+                return aao.getExpressions().get(aao.getVariables().indexOf(lv));
+            case UNNEST:
+            case UNNEST_MAP:
+                AbstractUnnestOperator ano = (AbstractUnnestOperator) op;
+                return ano.getExpressionRef();
+            case CLUSTER:
+            case DATASOURCESCAN:
+            case DISTINCT:
+            case DISTRIBUTE_RESULT:
+            case EMPTYTUPLESOURCE:
+            case EXCHANGE:
+            case EXTENSION_OPERATOR:
+            case GROUP:
+            case INDEX_INSERT_DELETE:
             case INNERJOIN:
             case INSERT_DELETE:
             case LEFTOUTERJOIN:
@@ -99,12 +156,12 @@ public class OperatorToolbox {
             case WRITE:
             case WRITE_RESULT:
             default:
+                // TODO Not yet implemented.
                 break;
         }
-        return result;
+        return null;
     }
 
-
     public static Mutable<ILogicalOperator> findProducerOf(Mutable<ILogicalOperator> opRef, LogicalVariable lv) {
         AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
         switch (op.getOperatorTag()) {
@@ -122,15 +179,16 @@ public class OperatorToolbox {
                     }
                 }
                 break;
+            case DATASOURCESCAN:
             case UNNEST:
             case UNNEST_MAP:
-                AbstractUnnestOperator auo = (AbstractUnnestOperator) op;
-                if (auo.getVariables().contains(lv)) {
+                AbstractScanOperator aso = (AbstractScanOperator) op;
+                if (aso.getVariables().contains(lv)) {
                     return opRef;
                 }
                 for (Mutable<ILogicalOperator> input : op.getInputs()) {
                     Mutable<ILogicalOperator> opInput = findProducerOf(input, lv);
-                     if (opInput != null) {
+                    if (opInput != null) {
                         return opInput;
                     }
                 }
@@ -139,7 +197,6 @@ public class OperatorToolbox {
             case NESTEDTUPLESOURCE:
                 return null;
             case CLUSTER:
-            case DATASOURCESCAN:
             case DISTINCT:
             case DISTRIBUTE_RESULT:
             case EXCHANGE:
@@ -163,7 +220,13 @@ public class OperatorToolbox {
             case WRITE:
             case WRITE_RESULT:
             default:
-                // TODO Not yet implemented.
+                // Skip operators and go look at input.
+                for (Mutable<ILogicalOperator> input : op.getInputs()) {
+                    Mutable<ILogicalOperator> opInput = findProducerOf(input, lv);
+                    if (opInput != null) {
+                        return opInput;
+                    }
+                }
                 break;
         }
         return null;

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/c74c9865/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/type/SequenceTypeMatcher.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/type/SequenceTypeMatcher.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/type/SequenceTypeMatcher.java
index 974abd1..5142ac4 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/type/SequenceTypeMatcher.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/type/SequenceTypeMatcher.java
@@ -153,6 +153,36 @@ public class SequenceTypeMatcher {
         return false;
     }
 
+    public boolean isSubType(SequenceType testST) {
+        Quantifier stq = sequenceType.getQuantifier();
+        ItemType it = sequenceType.getItemType();
+        if (stq.isSubQuantifier(testST.getQuantifier())) {
+            if (it instanceof AnyItemType) {
+                return true;
+            } else if (it.isAtomicType() && testST.getItemType().isAtomicType()) {
+                AtomicType ait = (AtomicType) it;
+                AtomicType testIT = (AtomicType) testST.getItemType();
+                if (BuiltinTypeRegistry.INSTANCE.isBuiltinTypeId(testIT.getTypeId())) {
+                    SchemaType vType = BuiltinTypeRegistry.INSTANCE.getSchemaTypeById(testIT.getTypeId());
+                    while (vType != null && vType.getTypeId() != ait.getTypeId()) {
+                        vType = vType.getBaseType();
+                    }
+                    return vType != null;
+                }
+            } else if (it instanceof NodeType && testST.getItemType() instanceof NodeType) {
+                NodeType nt = (NodeType) it;
+                NodeKind kind = nt.getNodeKind();
+                NodeType testNT = (NodeType) testST.getItemType();
+                NodeKind testKind = testNT.getNodeKind();
+                if (kind == NodeKind.ANY || kind == testKind) {
+                    return true;
+                }
+            }
+            return false;
+        }
+        return false;
+    }
+
     private Quantifier getSequenceQuantifier(SequencePointable seqp) {
         switch (seqp.getEntryCount()) {
             case 0:
@@ -167,7 +197,7 @@ public class SequenceTypeMatcher {
     public void setSequenceType(SequenceType sType) {
         this.sequenceType = sType;
     }
-    
+
     public String toString() {
         return "sequenceMatcher[" + this.sequenceType + "]";
     }


[10/25] git commit: new structure to help with performance testings.

Posted by ti...@apache.org.
new structure to help with performance testings.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/d146525e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/d146525e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/d146525e

Branch: refs/heads/westmann/prettyprint
Commit: d146525e32b211bc224aea2a644b80e946ead28b
Parents: f9ec13b
Author: Preston Carman <pr...@apache.org>
Authored: Thu Feb 13 15:26:44 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Feb 13 15:26:44 2014 -0800

----------------------------------------------------------------------
 .../bool/FnBooleanScalarEvaluatorFactory.java   | 171 ++++++++++---------
 1 file changed, 89 insertions(+), 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/d146525e/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/FnBooleanScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/FnBooleanScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/FnBooleanScalarEvaluatorFactory.java
index ebc8cdd..86104c8 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/FnBooleanScalarEvaluatorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/FnBooleanScalarEvaluatorFactory.java
@@ -49,6 +49,10 @@ public class FnBooleanScalarEvaluatorFactory extends AbstractTaggedValueArgument
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
             throws AlgebricksException {
+        return new FnBooleanScalarEvaluator(args);
+    }
+
+    private class FnBooleanScalarEvaluator extends AbstractTaggedValueArgumentScalarEvaluator {
         final SequencePointable seqp = new SequencePointable();
         final LongPointable lp = (LongPointable) LongPointable.FACTORY.createPointable();
         final IntegerPointable ip = (IntegerPointable) IntegerPointable.FACTORY.createPointable();
@@ -58,107 +62,110 @@ public class FnBooleanScalarEvaluatorFactory extends AbstractTaggedValueArgument
         final DoublePointable dp = (DoublePointable) DoublePointable.FACTORY.createPointable();
         final FloatPointable fp = (FloatPointable) FloatPointable.FACTORY.createPointable();
         final UTF8StringPointable utf8p = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable();
-        return new AbstractTaggedValueArgumentScalarEvaluator(args) {
-            @Override
-            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
-                TaggedValuePointable tvp = args[0];
-                boolean booleanResult = true;
-                switch (tvp.getTag()) {
-                    case ValueTag.SEQUENCE_TAG: {
-                        tvp.getValue(seqp);
-                        if (seqp.getEntryCount() == 0) {
-                            booleanResult = false;
-                        }
-                        break;
-                    }
 
-                    case ValueTag.XS_BOOLEAN_TAG: {
-                        result.set(tvp);
-                        return;
-                    }
+        public FnBooleanScalarEvaluator(IScalarEvaluator[] args) {
+            super(args);
+        }
 
-                    case ValueTag.XS_DECIMAL_TAG: {
-                        tvp.getValue(decp);
-                        if (decp.longValue() == 0) {
-                            booleanResult = false;
-                        }
-                        break;
+        @Override
+        protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
+            TaggedValuePointable tvp = args[0];
+            boolean booleanResult = true;
+            switch (tvp.getTag()) {
+                case ValueTag.SEQUENCE_TAG: {
+                    tvp.getValue(seqp);
+                    if (seqp.getEntryCount() == 0) {
+                        booleanResult = false;
                     }
+                    break;
+                }
+
+                case ValueTag.XS_BOOLEAN_TAG: {
+                    result.set(tvp);
+                    return;
+                }
 
-                    case ValueTag.XS_INTEGER_TAG:
-                    case ValueTag.XS_LONG_TAG:
-                    case ValueTag.XS_NEGATIVE_INTEGER_TAG:
-                    case ValueTag.XS_NON_POSITIVE_INTEGER_TAG:
-                    case ValueTag.XS_NON_NEGATIVE_INTEGER_TAG:
-                    case ValueTag.XS_POSITIVE_INTEGER_TAG:
-                    case ValueTag.XS_UNSIGNED_INT_TAG:
-                    case ValueTag.XS_UNSIGNED_LONG_TAG: {
-                        tvp.getValue(lp);
-                        if (lp.longValue() == 0) {
-                            booleanResult = false;
-                        }
-                        break;
+                case ValueTag.XS_DECIMAL_TAG: {
+                    tvp.getValue(decp);
+                    if (decp.longValue() == 0) {
+                        booleanResult = false;
                     }
+                    break;
+                }
 
-                    case ValueTag.XS_INT_TAG:
-                    case ValueTag.XS_UNSIGNED_SHORT_TAG: {
-                        tvp.getValue(ip);
-                        if (ip.intValue() == 0) {
-                            booleanResult = false;
-                        }
-                        break;
+                case ValueTag.XS_INTEGER_TAG:
+                case ValueTag.XS_LONG_TAG:
+                case ValueTag.XS_NEGATIVE_INTEGER_TAG:
+                case ValueTag.XS_NON_POSITIVE_INTEGER_TAG:
+                case ValueTag.XS_NON_NEGATIVE_INTEGER_TAG:
+                case ValueTag.XS_POSITIVE_INTEGER_TAG:
+                case ValueTag.XS_UNSIGNED_INT_TAG:
+                case ValueTag.XS_UNSIGNED_LONG_TAG: {
+                    tvp.getValue(lp);
+                    if (lp.longValue() == 0) {
+                        booleanResult = false;
                     }
+                    break;
+                }
 
-                    case ValueTag.XS_SHORT_TAG:
-                    case ValueTag.XS_UNSIGNED_BYTE_TAG: {
-                        tvp.getValue(sp);
-                        if (sp.shortValue() == 0) {
-                            booleanResult = false;
-                        }
-                        break;
+                case ValueTag.XS_INT_TAG:
+                case ValueTag.XS_UNSIGNED_SHORT_TAG: {
+                    tvp.getValue(ip);
+                    if (ip.intValue() == 0) {
+                        booleanResult = false;
                     }
+                    break;
+                }
 
-                    case ValueTag.XS_BYTE_TAG: {
-                        tvp.getValue(bp);
-                        if (bp.byteValue() == 0) {
-                            booleanResult = false;
-                        }
-                        break;
+                case ValueTag.XS_SHORT_TAG:
+                case ValueTag.XS_UNSIGNED_BYTE_TAG: {
+                    tvp.getValue(sp);
+                    if (sp.shortValue() == 0) {
+                        booleanResult = false;
                     }
+                    break;
+                }
 
-                    case ValueTag.XS_DOUBLE_TAG: {
-                        tvp.getValue(dp);
-                        if (dp.doubleValue() == 0 || Double.isNaN(dp.doubleValue())) {
-                            booleanResult = false;
-                        }
-                        break;
+                case ValueTag.XS_BYTE_TAG: {
+                    tvp.getValue(bp);
+                    if (bp.byteValue() == 0) {
+                        booleanResult = false;
                     }
+                    break;
+                }
 
-                    case ValueTag.XS_FLOAT_TAG: {
-                        tvp.getValue(fp);
-                        if (fp.floatValue() == 0 || Float.isNaN(fp.floatValue())) {
-                            booleanResult = false;
-                        }
-                        break;
+                case ValueTag.XS_DOUBLE_TAG: {
+                    tvp.getValue(dp);
+                    if (dp.doubleValue() == 0 || Double.isNaN(dp.doubleValue())) {
+                        booleanResult = false;
                     }
+                    break;
+                }
 
-                    case ValueTag.XS_ANY_URI_TAG:
-                    case ValueTag.XS_STRING_TAG: {
-                        tvp.getValue(utf8p);
-                        if (utf8p.getUTFLength() == 0) {
-                            booleanResult = false;
-                        }
-                        break;
+                case ValueTag.XS_FLOAT_TAG: {
+                    tvp.getValue(fp);
+                    if (fp.floatValue() == 0 || Float.isNaN(fp.floatValue())) {
+                        booleanResult = false;
                     }
-                    default:
-                        throw new SystemException(ErrorCode.FORG0006);
+                    break;
                 }
-                if (booleanResult) {
-                    XDMConstants.setTrue(result);
-                } else {
-                    XDMConstants.setFalse(result);
+
+                case ValueTag.XS_ANY_URI_TAG:
+                case ValueTag.XS_STRING_TAG: {
+                    tvp.getValue(utf8p);
+                    if (utf8p.getUTFLength() == 0) {
+                        booleanResult = false;
+                    }
+                    break;
                 }
+                default:
+                    throw new SystemException(ErrorCode.FORG0006);
+            }
+            if (booleanResult) {
+                XDMConstants.setTrue(result);
+            } else {
+                XDMConstants.setFalse(result);
             }
-        };
+        }
     }
 }
\ No newline at end of file


[04/25] git commit: Added more detailed timing information when the timing option is specified.

Posted by ti...@apache.org.
Added more detailed timing information when the timing option is specified.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/e6b5ac22
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/e6b5ac22
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/e6b5ac22

Branch: refs/heads/westmann/prettyprint
Commit: e6b5ac22b7ce97052a197b64deeff066a070f0c3
Parents: 4a81445
Author: Preston Carman <pr...@apache.org>
Authored: Thu Feb 13 09:46:15 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Feb 13 09:46:15 2014 -0800

----------------------------------------------------------------------
 .../java/org/apache/vxquery/cli/VXQuery.java    | 43 ++++++++++++++++++--
 1 file changed, 40 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/e6b5ac22/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
----------------------------------------------------------------------
diff --git a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
index 537b990..06deac5 100644
--- a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
+++ b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
@@ -78,6 +78,9 @@ public class VXQuery {
     private IHyracksDataset hds;
 
     private ResultSetId resultSetId;
+    private static List<String> timing;
+    private static int totalTiming;
+    private static String message;
 
     /**
      * Constructor to use command line options passed.
@@ -87,6 +90,7 @@ public class VXQuery {
      */
     public VXQuery(CmdLineOptions opts) {
         this.opts = opts;
+        timing = new ArrayList<String>();
     }
 
     /**
@@ -116,7 +120,18 @@ public class VXQuery {
         Date end = new Date();
         // if -timing argument passed, show the starting and ending times
         if (opts.timing) {
-            System.out.println("Execution time: " + (end.getTime() - start.getTime()) + "ms");
+            message = "Execution time: " + (end.getTime() - start.getTime()) + "ms";
+            System.out.println(message);
+            timing.add(message);
+            if (opts.repeatExec > 3) {
+                message = "Average execution time: " + (totalTiming / (opts.repeatExec - 3)) + "ms";
+                System.out.println(message);
+                timing.add(message);
+            }
+            System.out.println("Timing Summary:");
+            for (String time : timing) {
+                System.out.println("  " + time);
+            }
         }
 
     }
@@ -154,6 +169,8 @@ public class VXQuery {
      * @throws Exception
      */
     private void runQueries() throws IOException, SystemException, Exception {
+        Date start;
+        Date end;
         for (String query : opts.arguments) {
             String qStr = slurp(query);
             if (opts.showQuery) {
@@ -216,11 +233,12 @@ public class VXQuery {
                         System.err.println(new XStream(new DomDriver()).toXML(moduleNode));
                     }
                 }
-                
+
                 private StringBuilder appendPrettyPlan(StringBuilder sb, Module module) {
                     try {
                         StaticContext ctx = module.getCompilerControlBlock().getStaticContext();
-                        ILogicalExpressionVisitor<String, Integer> ev = new VXQueryLogicalExpressionPrettyPrintVisitor(ctx);
+                        ILogicalExpressionVisitor<String, Integer> ev = new VXQueryLogicalExpressionPrettyPrintVisitor(
+                                ctx);
                         LogicalOperatorPrettyPrintVisitor v = new LogicalOperatorPrettyPrintVisitor(ev);
                         PlanPrettyPrinter.printPlan(module.getBody(), sb, v, 0);
                     } catch (AlgebricksException e) {
@@ -230,11 +248,19 @@ public class VXQuery {
                 }
             };
 
+            start = new Date();
             XMLQueryCompiler compiler = new XMLQueryCompiler(listener, getNodeList(), opts.frameSize);
             resultSetId = createResultSetId();
             CompilerControlBlock ccb = new CompilerControlBlock(new StaticContextImpl(RootStaticContextImpl.INSTANCE),
                     resultSetId);
             compiler.compile(query, new StringReader(qStr), ccb, opts.optimizationLevel);
+            end = new Date();
+            // if -timing argument passed, show the starting and ending times
+            if (opts.timing) {
+                message = "Compile time: " + (end.getTime() - start.getTime()) + "ms";
+                System.out.println(message);
+                timing.add(message);
+            }
             if (opts.compileOnly) {
                 continue;
             }
@@ -248,7 +274,18 @@ public class VXQuery {
             PrintWriter writer = new PrintWriter(System.out, true);
             // Repeat execution for number of times provided in -repeatexec argument
             for (int i = 0; i < opts.repeatExec; ++i) {
+                start = new Date();
                 runJob(js, writer);
+                end = new Date();
+                // if -timing argument passed, show the starting and ending times
+                if (opts.timing) {
+                    if ((i + 1) > 3) {
+                        totalTiming += end.getTime() - start.getTime();
+                    }
+                    message = "Job (" + (i + 1) + ") execution time: " + (end.getTime() - start.getTime()) + "ms";
+                    System.out.println(message);
+                    timing.add(message);
+                }
             }
         }
     }


[25/25] git commit: Fixed a non ascii character.

Posted by ti...@apache.org.
Fixed a non ascii character.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/04ac20d1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/04ac20d1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/04ac20d1

Branch: refs/heads/westmann/prettyprint
Commit: 04ac20d126df5baaf0a3937e531c8ff74557a185
Parents: dcce8f7
Author: Preston Carman <pr...@apache.org>
Authored: Fri Feb 21 17:08:07 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Fri Feb 21 17:08:07 2014 -0800

----------------------------------------------------------------------
 .../src/main/resources/noaa-ghcn-daily/queries/q05.xq              | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/04ac20d1/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 fe455d1..3348d04 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
@@ -10,7 +10,7 @@ fn:min(
     
     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 $x/displayName eq "Oregon”))
+        and (some $x in $s/locationLabels satisfies ($x/type eq "ST" and $x/displayName eq "Oregon"))
         and $r/dataType eq "TMIN" 
         and fn:year-from-date($date) eq 2001
     return $r/value


[05/25] git commit: A bunch of little clean up items.

Posted by ti...@apache.org.
A bunch of little clean up items.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/de02fe56
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/de02fe56
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/de02fe56

Branch: refs/heads/westmann/prettyprint
Commit: de02fe56218a6d4debdb00018c354008da2b64b3
Parents: e6b5ac2
Author: Preston Carman <pr...@apache.org>
Authored: Thu Feb 13 11:11:20 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Feb 13 11:11:20 2014 -0800

----------------------------------------------------------------------
 .../algebricks/VXQueryBinaryBooleanInspectorFactory.java        | 2 +-
 .../algebricks/VXQueryBinaryIntegerInspectorFactory.java        | 2 +-
 .../compiler/algebricks/VXQueryComparatorFactoryProvider.java   | 4 ++--
 .../rewriter/rules/EliminateSubplanForSingleItemsRule.java      | 2 +-
 .../rewriter/rules/RemoveUnusedSortDistinctNodesRule.java       | 3 ---
 .../vxquery/compiler/rewriter/rules/RemoveUnusedTreatRule.java  | 4 ++--
 .../compiler/rewriter/rules/SetCollectionDataSourceRule.java    | 5 +++++
 .../compiler/rewriter/rules/SetVariableIdContextRule.java       | 4 ++++
 .../functions/aggregate/FnAvgScalarEvaluatorFactory.java        | 5 +----
 .../base/AbstractTaggedValueArgumentAggregateEvaluator.java     | 2 +-
 .../base/AbstractTaggedValueArgumentScalarEvaluator.java        | 2 +-
 .../base/AbstractTaggedValueArgumentUnnestingEvaluator.java     | 2 +-
 .../functions/step/AttributePathStepScalarEvaluator.java        | 4 +---
 13 files changed, 21 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryBooleanInspectorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryBooleanInspectorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryBooleanInspectorFactory.java
index 4e92f87..afb4d58 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryBooleanInspectorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryBooleanInspectorFactory.java
@@ -29,7 +29,7 @@ public class VXQueryBinaryBooleanInspectorFactory implements IBinaryBooleanInspe
 
     @Override
     public IBinaryBooleanInspector createBinaryBooleanInspector(IHyracksTaskContext ctx) {
-        final TaggedValuePointable tvp = new TaggedValuePointable();
+        final TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
         final BooleanPointable bp = (BooleanPointable) BooleanPointable.FACTORY.createPointable();
         return new IBinaryBooleanInspector() {
             @Override

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryIntegerInspectorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryIntegerInspectorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryIntegerInspectorFactory.java
index 13d9341..ccab60c 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryIntegerInspectorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryBinaryIntegerInspectorFactory.java
@@ -29,7 +29,7 @@ public class VXQueryBinaryIntegerInspectorFactory implements IBinaryIntegerInspe
 
     @Override
     public IBinaryIntegerInspector createBinaryIntegerInspector(IHyracksTaskContext ctx) {
-        final TaggedValuePointable tvp = new TaggedValuePointable();
+        final TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
         final IntegerPointable ip = (IntegerPointable) IntegerPointable.FACTORY.createPointable();
         return new IBinaryIntegerInspector() {
             @Override

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryComparatorFactoryProvider.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryComparatorFactoryProvider.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryComparatorFactoryProvider.java
index 67c3891..5a0e2df 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryComparatorFactoryProvider.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryComparatorFactoryProvider.java
@@ -41,8 +41,8 @@ public class VXQueryComparatorFactoryProvider implements IBinaryComparatorFactor
 
         @Override
         public IBinaryComparator createBinaryComparator() {
-            final TaggedValuePointable tvp1 = new TaggedValuePointable();
-            final TaggedValuePointable tvp2 = new TaggedValuePointable();
+            final TaggedValuePointable tvp1 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+            final TaggedValuePointable tvp2 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
             return new IBinaryComparator() {
                 @Override
                 public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateSubplanForSingleItemsRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateSubplanForSingleItemsRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateSubplanForSingleItemsRule.java
index 5c9d4f5..4ba642a 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateSubplanForSingleItemsRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/EliminateSubplanForSingleItemsRule.java
@@ -164,7 +164,7 @@ public class EliminateSubplanForSingleItemsRule implements IAlgebraicRewriteRule
         if (argType.getExpressionTag() != LogicalExpressionTag.CONSTANT) {
             return false;
         }
-        TaggedValuePointable tvp = new TaggedValuePointable();
+        TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
         ExpressionToolbox.getConstantAsPointable((ConstantExpression) argType, tvp);
 
         IntegerPointable pTypeCode = (IntegerPointable) IntegerPointable.FACTORY.createPointable();

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedSortDistinctNodesRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedSortDistinctNodesRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedSortDistinctNodesRule.java
index 89e3ffe..43d636b 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedSortDistinctNodesRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedSortDistinctNodesRule.java
@@ -39,11 +39,8 @@ import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression;
 import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractOperatorWithNestedPlans;
 import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AggregateOperator;
 import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AssignOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.InnerJoinOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.LeftOuterJoinOperator;
 import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.NestedTupleSourceOperator;
 import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.OrderOperator;
 import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.SubplanOperator;

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedTreatRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedTreatRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedTreatRule.java
index 66edbe8..4b14c50 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedTreatRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveUnusedTreatRule.java
@@ -106,7 +106,7 @@ public class RemoveUnusedTreatRule implements IAlgebraicRewriteRule {
         if (treatArg2.getExpressionTag() != LogicalExpressionTag.CONSTANT) {
             return false;
         }
-        TaggedValuePointable tvp = new TaggedValuePointable();
+        TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
         getConstantAsPointable((ConstantExpression) treatArg2, tvp);
 
         IntegerPointable pTypeCode = (IntegerPointable) IntegerPointable.FACTORY.createPointable();
@@ -124,7 +124,7 @@ public class RemoveUnusedTreatRule implements IAlgebraicRewriteRule {
                     .getValue();
             if (expressionConstant.getExpressionTag() == LogicalExpressionTag.CONSTANT) {
                 // Check constant against type supplied.
-                TaggedValuePointable tvp2 = new TaggedValuePointable();
+                TaggedValuePointable tvp2 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
                 getConstantAsPointable((ConstantExpression) expressionConstant, tvp2);
 
                 SequenceTypeMatcher stm = new SequenceTypeMatcher();

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetCollectionDataSourceRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetCollectionDataSourceRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetCollectionDataSourceRule.java
index 331a87a..1d81a8c 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetCollectionDataSourceRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetCollectionDataSourceRule.java
@@ -37,6 +37,9 @@ import edu.uci.ics.hyracks.algebricks.core.algebra.base.IOptimizationContext;
 public class SetCollectionDataSourceRule extends AbstractCollectionRule {
     @Override
     public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException {
+        if (context.checkIfInDontApplySet(this, opRef.getValue())) {
+            return false;
+        }
         VXQueryOptimizationContext vxqueryContext = (VXQueryOptimizationContext) context;
         String collectionName = getCollectionName(opRef);
 
@@ -49,6 +52,8 @@ public class SetCollectionDataSourceRule extends AbstractCollectionRule {
             VXQueryCollectionDataSource ds = new VXQueryCollectionDataSource(collectionId, collectionName,
                     types.toArray());
             vxqueryContext.putCollectionDataSourceMap(collectionName, ds);
+            
+            context.addToDontApplySet(this, opRef.getValue());
         }
         return false;
     }

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetVariableIdContextRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetVariableIdContextRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetVariableIdContextRule.java
index 58b050d..b810e39 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetVariableIdContextRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/SetVariableIdContextRule.java
@@ -33,6 +33,9 @@ import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
 public class SetVariableIdContextRule implements IAlgebraicRewriteRule {
     @Override
     public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException {
+        if (context.checkIfInDontApplySet(this, opRef.getValue())) {
+            return false;
+        }
         int variableId = 0;
 
         // TODO Move the setVarCounter to the compiler after the translator has run.
@@ -54,6 +57,7 @@ public class SetVariableIdContextRule implements IAlgebraicRewriteRule {
         if (context.getVarCounter() <= variableId) {
             context.setVarCounter(variableId + 1);
         }
+        context.addToDontApplySet(this, opRef.getValue());
         return false;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/FnAvgScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/FnAvgScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/FnAvgScalarEvaluatorFactory.java
index db1dd7c..17b1b73 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/FnAvgScalarEvaluatorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/FnAvgScalarEvaluatorFactory.java
@@ -36,7 +36,6 @@ import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
 import edu.uci.ics.hyracks.data.std.api.IPointable;
-import edu.uci.ics.hyracks.data.std.primitive.VoidPointable;
 import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
 
 public class FnAvgScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
@@ -51,7 +50,6 @@ public class FnAvgScalarEvaluatorFactory extends AbstractTaggedValueArgumentScal
             throws AlgebricksException {
         final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
         final SequencePointable seqp = new SequencePointable();
-        final VoidPointable p = (VoidPointable) VoidPointable.FACTORY.createPointable();
         final TaggedValuePointable tvpNext = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
         final TaggedValuePointable tvpSum = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
         final TaggedValuePointable tvpCount = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
@@ -72,8 +70,7 @@ public class FnAvgScalarEvaluatorFactory extends AbstractTaggedValueArgumentScal
                     } else {
                         // Add up the sequence.
                         for (int j = 0; j < seqLen; ++j) {
-                            seqp.getEntry(j, p);
-                            tvpNext.set(p.getByteArray(), p.getStartOffset(), p.getLength());
+                            seqp.getEntry(j, tvpNext);
                             if (j == 0) {
                                 // Init.
                                 tvpSum.set(tvpNext);

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentAggregateEvaluator.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentAggregateEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentAggregateEvaluator.java
index cdd5847..e39d493 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentAggregateEvaluator.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentAggregateEvaluator.java
@@ -33,7 +33,7 @@ public abstract class AbstractTaggedValueArgumentAggregateEvaluator implements I
         this.args = args;
         tvps = new TaggedValuePointable[args.length];
         for (int i = 0; i < tvps.length; ++i) {
-            tvps[i] = new TaggedValuePointable();
+            tvps[i] = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentScalarEvaluator.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentScalarEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentScalarEvaluator.java
index 7b6581f..4371db8 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentScalarEvaluator.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentScalarEvaluator.java
@@ -33,7 +33,7 @@ public abstract class AbstractTaggedValueArgumentScalarEvaluator implements ISca
         this.args = args;
         tvps = new TaggedValuePointable[args.length];
         for (int i = 0; i < tvps.length; ++i) {
-            tvps[i] = new TaggedValuePointable();
+            tvps[i] = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentUnnestingEvaluator.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentUnnestingEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentUnnestingEvaluator.java
index ee1761f..3a1442f 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentUnnestingEvaluator.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentUnnestingEvaluator.java
@@ -33,7 +33,7 @@ public abstract class AbstractTaggedValueArgumentUnnestingEvaluator implements I
         this.args = args;
         tvps = new TaggedValuePointable[args.length];
         for (int i = 0; i < tvps.length; ++i) {
-            tvps[i] = new TaggedValuePointable();
+            tvps[i] = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/de02fe56/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AttributePathStepScalarEvaluator.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AttributePathStepScalarEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AttributePathStepScalarEvaluator.java
index 303cd6f..30b50e4 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AttributePathStepScalarEvaluator.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AttributePathStepScalarEvaluator.java
@@ -49,8 +49,6 @@ public class AttributePathStepScalarEvaluator extends AbstractSinglePathStepScal
                     return;
                 }
         }
-        TaggedValuePointable seqTvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
-        XDMConstants.setEmptySequence(seqTvp);
-        seqTvp.getValue(seqp);
+        XDMConstants.setEmptySequence(seqp);
     }
 }
\ No newline at end of file


[19/25] git commit: Found the order for checking used variables was off. Moved check to after nested plans.

Posted by ti...@apache.org.
Found the order for checking used variables was off. Moved check to after nested plans.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/ed696a53
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/ed696a53
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/ed696a53

Branch: refs/heads/westmann/prettyprint
Commit: ed696a53ef52aa1bea10322ad18536afb1401579
Parents: d88a64e
Author: Preston Carman <pr...@apache.org>
Authored: Mon Feb 17 16:47:22 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Mon Feb 17 16:47:22 2014 -0800

----------------------------------------------------------------------
 .../rewriter/rules/AbstractUsedVariablesProcessingRule.java    | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/ed696a53/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractUsedVariablesProcessingRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractUsedVariablesProcessingRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractUsedVariablesProcessingRule.java
index c567909..04c6f1e 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractUsedVariablesProcessingRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractUsedVariablesProcessingRule.java
@@ -63,10 +63,9 @@ public abstract class AbstractUsedVariablesProcessingRule implements IAlgebraicR
     protected boolean rewritePreOnePass(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
             throws AlgebricksException {
         boolean modified = processOperator(opRef, context);
-
         AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
-        VariableUtilities.getUsedVariables(op, usedVariables);
 
+        // Descend into nested plans merging unnest along the way.
         if (op.hasNestedPlans()) {
             AbstractOperatorWithNestedPlans opwnp = (AbstractOperatorWithNestedPlans) op;
             for (ILogicalPlan rootPlans : opwnp.getNestedPlans()) {
@@ -78,6 +77,9 @@ public abstract class AbstractUsedVariablesProcessingRule implements IAlgebraicR
             }
         }
 
+        // Only add variables after operator is used.
+        VariableUtilities.getUsedVariables(op, usedVariables);
+
         // Descend into children merging unnest along the way.
         if (op.hasInputs()) {
             for (Mutable<ILogicalOperator> inputOpRef : op.getInputs()) {


[03/25] git commit: Added two queries to return all the functions and operators.

Posted by ti...@apache.org.
Added two queries to return all the functions and operators.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/4a814455
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/4a814455
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/4a814455

Branch: refs/heads/westmann/prettyprint
Commit: 4a8144553b5ba7191424f4d82bbcf1f7ca51b8b2
Parents: a253e2f
Author: Preston Carman <pr...@apache.org>
Authored: Thu Feb 13 09:41:12 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Feb 13 09:41:12 2014 -0800

----------------------------------------------------------------------
 .../src/main/resources/util/build_saxon_collection_xml.py |  2 +-
 .../src/main/resources/util/vxquery_functions.xq          | 10 ++++++++++
 .../src/main/resources/util/vxquery_operators.xq          | 10 ++++++++++
 3 files changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/4a814455/vxquery-benchmark/src/main/resources/util/build_saxon_collection_xml.py
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/util/build_saxon_collection_xml.py b/vxquery-benchmark/src/main/resources/util/build_saxon_collection_xml.py
index 358d0ed..02f39ee 100644
--- a/vxquery-benchmark/src/main/resources/util/build_saxon_collection_xml.py
+++ b/vxquery-benchmark/src/main/resources/util/build_saxon_collection_xml.py
@@ -25,7 +25,7 @@ def main(argv):
     except getopt.GetoptError:
         print 'The file options for build_saxon_collection_xml.py were not correctly specified.'
         print 'To see a full list of options try:'
-        print '  $ python push_benchmark.py -h'
+        print '  $ python build_saxon_collection_xml.py -h'
         sys.exit(2)
     for opt, arg in opts:
         if opt == '-h':

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/4a814455/vxquery-benchmark/src/main/resources/util/vxquery_functions.xq
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/util/vxquery_functions.xq b/vxquery-benchmark/src/main/resources/util/vxquery_functions.xq
new file mode 100644
index 0000000..4f3a2d5
--- /dev/null
+++ b/vxquery-benchmark/src/main/resources/util/vxquery_functions.xq
@@ -0,0 +1,10 @@
+(: XQuery Function List :)
+(: VXQuery function list in csv with arguments and return types :)
+let $list := "../../../../../vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-functions.xml"
+let $r :=
+    for $f in fn:doc($list)/functions/function
+        let $pl := 
+            for $p in $f/param
+            return $p/@type
+        return fn:string-join(($f/@name, fn:string-join($pl, ' '), $f/return/@type), ',')
+return fn:string-join($r , '|')
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/4a814455/vxquery-benchmark/src/main/resources/util/vxquery_operators.xq
----------------------------------------------------------------------
diff --git a/vxquery-benchmark/src/main/resources/util/vxquery_operators.xq b/vxquery-benchmark/src/main/resources/util/vxquery_operators.xq
new file mode 100644
index 0000000..e7f7dd0
--- /dev/null
+++ b/vxquery-benchmark/src/main/resources/util/vxquery_operators.xq
@@ -0,0 +1,10 @@
+(: XQuery Function List :)
+(: VXQuery function list in csv with arguments and return types :)
+let $list := "../../../../../vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-operators.xml"
+let $r :=
+    for $f in fn:doc($list)/operators/operator
+        let $pl := 
+            for $p in $f/param
+            return $p/@type
+        return fn:string-join(($f/@name, fn:string-join($pl, ' '), $f/return/@type), ',')
+return fn:string-join($r , '|')
\ No newline at end of file


[21/25] Adding the xqts test results to the vxquery-xtest project. The goal is to now have a test result version we can compare against with each release.

Posted by ti...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/ef04365e/vxquery-xtest/results/xqts.txt
----------------------------------------------------------------------
diff --git a/vxquery-xtest/results/xqts.txt b/vxquery-xtest/results/xqts.txt
new file mode 100644
index 0000000..ea1a37c
--- /dev/null
+++ b/vxquery-xtest/results/xqts.txt
@@ -0,0 +1,19221 @@
+Appendices/Annex-E//annex-1, EXPECTED_RESULT_GOT_ERROR
+Appendices/Annex-E//annex-2, EXPECTED_RESULT_GOT_ERROR
+Appendices/Annex-E//annex-3, EXPECTED_RESULT_GOT_ERROR
+Appendices/Annex-E//annex-4, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Appendices/Annex-E//annex-5, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Appendices/Annex-E//annex-6, EXPECTED_RESULT_GOT_FAILURE
+Appendices/Annex-E//annex-7, EXPECTED_RESULT_GOT_ERROR
+Appendices/Annex-E//annex-8, EXPECTED_RESULT_GOT_ERROR
+Appendices/Appendix-A4//appendix-A4-1, EXPECTED_RESULT_GOT_SAME_RESULT
+Appendices/Appendix-A4//appendix-A4-2, EXPECTED_RESULT_GOT_SAME_RESULT
+Appendices/Appendix-A4//appendix-A4-3, EXPECTED_RESULT_GOT_SAME_RESULT
+Appendices/Appendix-A4//appendix-A4-4, EXPECTED_RESULT_GOT_SAME_RESULT
+Appendices/Appendix-A4//appendix-A4-5, EXPECTED_RESULT_GOT_SAME_RESULT
+Appendices/Appendix-A4//appendix-A4-6, EXPECTED_RESULT_GOT_SAME_RESULT
+Appendices/Appendix-A4//appendix-A4-7, EXPECTED_RESULT_GOT_SAME_RESULT
+Appendices/Appendix-A4//appendix-A4-8, EXPECTED_RESULT_GOT_SAME_RESULT
+Appendices/Appendix-A4//appendix-A4-9, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/StaticContext//static-context-1, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Basics/Types/SequenceTypeSyntax//sequence-type-1, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-10, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-11, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-12, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-13, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-14, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-15, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-16, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-17, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-18, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-19, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-2, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-20, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-21, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-3, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-4, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-5, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-6, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-7, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-8, EXPECTED_RESULT_GOT_SAME_RESULT
+Basics/Types/SequenceTypeSyntax//sequence-type-9, EXPECTED_RESULT_GOT_SAME_RESULT
+CondExpr//K2-CondExpr-1, EXPECTED_ERROR_GOT_FAILURE
+CondExpr//K2-CondExpr-2, EXPECTED_RESULT_GOT_FAILURE
+CondExpr//K2-CondExpr-3, EXPECTED_RESULT_GOT_ERROR
+CondExpr//K2-CondExpr-4, EXPECTED_RESULT_GOT_FAILURE
+CondExpr//K2-CondExpr-5, EXPECTED_ERROR_GOT_SAME_ERROR
+CondExpr//K2-CondExpr-6, EXPECTED_ERROR_GOT_SAME_ERROR
+CondExpr//K2-CondExpr-7, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-1, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-10, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-11, EXPECTED_RESULT_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-12, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-13, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-14, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-15, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-16, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-17, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-18, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-19, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-2, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-20, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-21, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-22, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-23, EXPECTED_RESULT_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-24, EXPECTED_RESULT_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-25, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-26, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-27, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-28, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-29, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-3, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-30, EXPECTED_RESULT_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-31, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-32, EXPECTED_RESULT_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-33, EXPECTED_RESULT_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-34, EXPECTED_RESULT_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-35, EXPECTED_RESULT_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-36, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-37, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-38, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-39, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-4, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-40, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-41, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-42, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-43, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-44, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-45, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-46, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-47, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-48, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-49, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-5, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-50, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-51, EXPECTED_RESULT_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-52, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-53, EXPECTED_RESULT_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-54, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-55, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-56, EXPECTED_RESULT_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-57, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-58, EXPECTED_RESULT_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-59, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-6, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-60, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-61, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-7, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-8, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//K2-ComputeConAttr-9, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConAttr//comp-attr-bad-name-1, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConAttr//comp-attr-bad-name-2, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConAttr//comp-attr-bad-name-3, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConAttr//comp-attr-bad-name-4, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConAttr//comp-attr-bad-name-5, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConAttr//comp-attr-bad-name-6, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConAttr//comp-attr-bad-name-7, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConComment//K2-ComputeConComment-1, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/ComputeCon/ComputeConComment//K2-ComputeConComment-2, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/ComputeCon/ComputeConComment//K2-ComputeConComment-3, EXPECTED_RESULT_GOT_FAILURE
+Construct/ComputeCon/ComputeConComment//K2-ComputeConComment-4, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/ComputeCon/ComputeConComment//K2-ComputeConComment-5, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/ComputeCon/ComputeConElem//K2-ComputeConElem-1, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/ComputeCon/ComputeConElem//K2-ComputeConElem-10, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ComputeConElem//K2-ComputeConElem-11, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ComputeConElem//K2-ComputeConElem-12, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ComputeConElem//K2-ComputeConElem-13, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/ComputeCon/ComputeConElem//K2-ComputeConElem-14, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ComputeConElem//K2-ComputeConElem-15, EXPECTED_RESULT_GOT_FAILURE
+Construct/ComputeCon/ComputeConElem//K2-ComputeConElem-2, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/ComputeCon/ComputeConElem//K2-ComputeConElem-3, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/ComputeCon/ComputeConElem//K2-ComputeConElem-4, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConElem//K2-ComputeConElem-5, EXPECTED_ERROR_GOT_FAILURE
+Construct/ComputeCon/ComputeConElem//K2-ComputeConElem-6, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/ComputeCon/ComputeConElem//K2-ComputeConElem-7, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/ComputeCon/ComputeConElem//K2-ComputeConElem-8, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ComputeConElem//K2-ComputeConElem-9, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ComputeConElem//comp-elem-bad-name-1, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConElem//comp-elem-bad-name-2, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConElem//comp-elem-bad-name-3, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConElem//comp-elem-bad-name-4, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConElem//comp-elem-bad-name-5, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConElem//comp-elem-bad-name-6, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConPI//K2-ComputeConPI-1, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/ComputeCon/ComputeConPI//K2-ComputeConPI-10, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/ComputeCon/ComputeConPI//K2-ComputeConPI-11, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/ComputeCon/ComputeConPI//K2-ComputeConPI-2, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConPI//K2-ComputeConPI-3, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConPI//K2-ComputeConPI-4, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ComputeConPI//K2-ComputeConPI-5, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ComputeConPI//K2-ComputeConPI-6, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConPI//K2-ComputeConPI-7, EXPECTED_ERROR_GOT_RESULT
+Construct/ComputeCon/ComputeConPI//K2-ComputeConPI-8, EXPECTED_RESULT_GOT_FAILURE
+Construct/ComputeCon/ComputeConPI//K2-ComputeConPI-9, EXPECTED_RESULT_GOT_FAILURE
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-1, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-10, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-11, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-12, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-13, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-14, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-15, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-16, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-17, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-18, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-19, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-2, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-20, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-21, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-22, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-23, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-24, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-25, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-26, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-27, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-28, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-29, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-3, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-30, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-31, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-32, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-4, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-5, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-6, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-7, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-8, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/ComputeCon/ConDocNode//K2-ConDocNode-9, EXPECTED_RESULT_GOT_ERROR
+Construct/ComputeCon/ConText//K2-ConText-1, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/ComputeCon/ConText//K2-ConText-10, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/ComputeCon/ConText//K2-ConText-11, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/ComputeCon/ConText//K2-ConText-12, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/ComputeCon/ConText//K2-ConText-13, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/ComputeCon/ConText//K2-ConText-14, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/ComputeCon/ConText//K2-ConText-15, EXPECTED_RESULT_GOT_FAILURE
+Construct/ComputeCon/ConText//K2-ConText-2, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/ComputeCon/ConText//K2-ConText-3, EXPECTED_RESULT_GOT_FAILURE
+Construct/ComputeCon/ConText//K2-ConText-4, EXPECTED_RESULT_GOT_FAILURE
+Construct/ComputeCon/ConText//K2-ConText-5, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/ComputeCon/ConText//K2-ConText-6, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/ComputeCon/ConText//K2-ConText-7, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/ComputeCon/ConText//K2-ConText-8, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/ComputeCon/ConText//K2-ConText-9, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/ConInScopeNamespace//K2-ConInScopeNamespace-1, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem//K2-DirectConElem-1, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem//K2-DirectConElem-10, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/DirectConElem//K2-DirectConElem-11, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-12, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-13, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-14, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-15, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-16, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-17, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-18, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-19, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-2, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem//K2-DirectConElem-20, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-21, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-22, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-23, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-24, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-25, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-26, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-27, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-28, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem//K2-DirectConElem-29, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem//K2-DirectConElem-3, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-30, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem//K2-DirectConElem-31, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem//K2-DirectConElem-32, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem//K2-DirectConElem-33, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem//K2-DirectConElem-34, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem//K2-DirectConElem-35, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConElem//K2-DirectConElem-36, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConElem//K2-DirectConElem-37, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConElem//K2-DirectConElem-38, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem//K2-DirectConElem-39, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConElem//K2-DirectConElem-4, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-40, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConElem//K2-DirectConElem-41, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConElem//K2-DirectConElem-42, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem//K2-DirectConElem-43, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem//K2-DirectConElem-44, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem//K2-DirectConElem-45, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem//K2-DirectConElem-46, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem//K2-DirectConElem-47, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/DirectConElem//K2-DirectConElem-48, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem//K2-DirectConElem-49, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem//K2-DirectConElem-5, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-50, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-51, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem//K2-DirectConElem-52, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem//K2-DirectConElem-53, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-54, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-6, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-7, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-8, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem//K2-DirectConElem-9, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//DirectConElemAttr-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemAttr//DirectConElemAttr-2, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-1, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-10, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-11, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-12, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-13, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-14, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-15, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-16, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-17, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-18, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-19, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-2, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-20, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-21, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-22, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-23, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-24, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-25, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-26, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-27, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-28, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-29, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-3, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-30, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-31, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-32, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-33, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-34, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-35, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-36, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-37, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-38, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-39, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-4, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-40, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-41, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-42, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-43, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-44, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-45, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-46, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-47, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-48, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-49, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-5, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-50, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-51, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-52, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-53, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-54, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-55, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-56, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-57, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-58, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-59, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-6, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-60, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-61, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-62, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-63, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-64, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-65, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-66, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-67, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-68, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-69, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-7, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-70, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-71, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-72, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-73, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-74, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-75, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-76, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-8, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemAttr//K2-DirectConElemAttr-9, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-1, EXPECTED_ERROR_GOT_FAILURE
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-10, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-11, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-12, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-13, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-14, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-15, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-16, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-17, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-18, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-19, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-2, EXPECTED_ERROR_GOT_FAILURE
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-20, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-21, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-22, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-23, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-24, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-25, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-26, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-27, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-28, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-29, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-3, EXPECTED_ERROR_GOT_FAILURE
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-30, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-31, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-32, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-33, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-34, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-35, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-36, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-37, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-38, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-39, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-4, EXPECTED_ERROR_GOT_FAILURE
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-40, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-41, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-42, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-43, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-44, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-45, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-46, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-47, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-48, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-5, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-6, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-7, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-8, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemContent//K2-DirectConElemContent-9, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//DirectConElemNamespace-3, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/DirectConElem/DirectConElemNamespace//DirectConElemNamespace-4, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/DirectConElem/DirectConElemNamespace//DirectConElemNamespace-5, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemNamespace//DirectConElemNamespace-6, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-1, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-10, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-11, EXPECTED_ERROR_GOT_FAILURE
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-12, EXPECTED_ERROR_GOT_FAILURE
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-13, EXPECTED_ERROR_GOT_FAILURE
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-14, EXPECTED_ERROR_GOT_FAILURE
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-15, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-16, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-17, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-18, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-19, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-2, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-20, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-21, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-22, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-23, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-24, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-25, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-26, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-27, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-28, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-29, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-3, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-30, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-31, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-32, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-33, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-34, EXPECTED_ERROR_GOT_FAILURE
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-35, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-36, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-37, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-38, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-39, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-4, EXPECTED_ERROR_GOT_FAILURE
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-40, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-41, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-42, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-43, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-44, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-45, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-46, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-47, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-48, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-49, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-5, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-50, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-51, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-52, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-53, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-54, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-55, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-56, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-57, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-58, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-59, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-6, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-61, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-62, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-63, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-64, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-65, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-67, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-68, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-69, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-7, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-70, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-71, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-72, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-73, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-74, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-75, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-76, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-77, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-78, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-79, EXPECTED_ERROR_GOT_FAILURE
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-8, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemNamespace//K2-DirectConElemNamespace-9, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-1, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-10, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-11, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-12, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-13, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-14, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-15, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-16, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-17, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-18, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-19, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-2, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-20, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-21, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-22, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-23, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-24, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-25, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-26, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-3, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-4, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-5, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-6, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-7, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-8, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConElem/DirectConElemWhitespace//K2-DirectConElemWhitespace-9, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConOther//K2-DirectConOther-1, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConOther//K2-DirectConOther-10, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-11, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-12, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-13, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-14, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-15, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-16, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-17, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-18, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-19, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-2, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-20, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-21, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-22, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-23, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-24, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-25, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-26, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-27, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-28, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-29, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConOther//K2-DirectConOther-3, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-30, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConOther//K2-DirectConOther-31, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConOther//K2-DirectConOther-32, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConOther//K2-DirectConOther-33, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConOther//K2-DirectConOther-34, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConOther//K2-DirectConOther-35, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConOther//K2-DirectConOther-36, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConOther//K2-DirectConOther-37, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConOther//K2-DirectConOther-38, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConOther//K2-DirectConOther-39, EXPECTED_RESULT_GOT_SAME_RESULT
+Construct/DirectConOther//K2-DirectConOther-4, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-40, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConOther//K2-DirectConOther-41, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConOther//K2-DirectConOther-42, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-43, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-44, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConOther//K2-DirectConOther-45, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConOther//K2-DirectConOther-46, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConOther//K2-DirectConOther-47, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConOther//K2-DirectConOther-48, EXPECTED_ERROR_GOT_FAILURE
+Construct/DirectConOther//K2-DirectConOther-49, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConOther//K2-DirectConOther-5, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-50, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConOther//K2-DirectConOther-51, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConOther//K2-DirectConOther-52, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConOther//K2-DirectConOther-53, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConOther//K2-DirectConOther-54, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConOther//K2-DirectConOther-55, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-56, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-57, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-58, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConOther//K2-DirectConOther-59, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConOther//K2-DirectConOther-6, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-60, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConOther//K2-DirectConOther-61, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-62, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-63, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConOther//K2-DirectConOther-64, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConOther//K2-DirectConOther-65, EXPECTED_ERROR_GOT_RESULT
+Construct/DirectConOther//K2-DirectConOther-66, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConOther//K2-DirectConOther-67, EXPECTED_RESULT_GOT_ERROR
+Construct/DirectConOther//K2-DirectConOther-68, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConOther//K2-DirectConOther-69, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConOther//K2-DirectConOther-7, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-70, EXPECTED_RESULT_GOT_FAILURE
+Construct/DirectConOther//K2-DirectConOther-71, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Construct/DirectConOther//K2-DirectConOther-8, EXPECTED_ERROR_GOT_SAME_ERROR
+Construct/DirectConOther//K2-DirectConOther-9, EXPECTED_ERROR_GOT_SAME_ERROR
+ErrorsAndOptimization//errors-and-optimization-1, EXPECTED_RESULT_GOT_FAILURE
+ErrorsAndOptimization//errors-and-optimization-2, EXPECTED_ERROR_GOT_FAILURE
+ErrorsAndOptimization//errors-and-optimization-3, EXPECTED_RESULT_GOT_FAILURE
+ErrorsAndOptimization//errors-and-optimization-4, EXPECTED_ERROR_GOT_FAILURE
+ErrorsAndOptimization//errors-and-optimization-5, EXPECTED_ERROR_GOT_FAILURE
+ErrorsAndOptimization//errors-and-optimization-6, EXPECTED_ERROR_GOT_SAME_ERROR
+ErrorsAndOptimization//errors-and-optimization-7, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/CondExpr//CondExpr002, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/CondExpr//CondExpr003, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/CondExpr//CondExpr004, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//CondExpr005, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//CondExpr006, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/CondExpr//CondExpr007, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//CondExpr008, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//CondExpr009, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//CondExpr010, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/CondExpr//CondExpr011, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/CondExpr//CondExpr012, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//CondExpr013, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//CondExpr014, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/CondExpr//CondExpr015, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/CondExpr//CondExpr016, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//CondExpr017, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//CondExpr018, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//CondExpr019, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/CondExpr//CondExpr020, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//CondExpr021, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//CondExpr022, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//K-CondExpr-1, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/CondExpr//K-CondExpr-10, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//K-CondExpr-11, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//K-CondExpr-12, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//K-CondExpr-2, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/CondExpr//K-CondExpr-3, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//K-CondExpr-4, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//K-CondExpr-5, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//K-CondExpr-6, EXPECTED_RESULT_GOT_FAILURE
+Expressions/CondExpr//K-CondExpr-7, EXPECTED_ERROR_GOT_FAILURE
+Expressions/CondExpr//K-CondExpr-8, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/CondExpr//K-CondExpr-9, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-compname-1, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-compname-10, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-compname-11, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-compname-12, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-compname-13, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-compname-14, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-compname-15, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-compname-16, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-compname-17, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-compname-18, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-compname-19, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-compname-2, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-compname-3, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-compname-4, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-compname-5, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-compname-6, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-compname-7, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-compname-8, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-compname-9, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-data-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-doc-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-enclexpr-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-enclexpr-2, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-enclexpr-3, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-enclexpr-4, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-id-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-id-2, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-name-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-name-2, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-name-3, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-parent-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConAttr//Constr-compattr-string-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConAttr//constattrerr-1, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-dash-1, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-dash-2, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-dash-3, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-dash-4, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-data-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-doc-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-doubledash-1, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-doubledash-2, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-doubledash-3, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-doubledash-4, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-doubledash-5, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-enclexpr-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-enclexpr-2, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-enclexpr-3, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-enclexpr-4, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-enclexpr-5, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-nested-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-nested-2, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-nested-3, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-parent-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConComment//Constr-compcomment-string-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-adjtext-1, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-adjtext-2, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-adjtext-3, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-attr-1, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-attr-2, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-attr-3, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-attr-4, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-baseuri-1, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-baseuri-2, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-baseuri-3, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-compname-1, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-compname-10, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-compname-11, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-compname-12, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-compname-13, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-compname-14, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-compname-15, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-compname-16, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-compname-17, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-compname-18, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-compname-19, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-compname-2, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-compname-3, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-compname-4, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-compname-5, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-compname-6, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-compname-7, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-compname-8, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-compname-9, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-constrmod-3, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-constrmod-4, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-constrmod-7, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-constrmod-8, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-data-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-doc-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-enclexpr-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-enclexpr-2, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-enclexpr-3, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-enclexpr-4, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-name-1, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-name-2, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-name-3, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-nested-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-nested-2, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-nodeid-1, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-nodeid-2, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-nodeid-3, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-nodeid-4, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-nodeid-5, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-parent-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConElem//Constr-compelem-string-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-compname-1, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-compname-10, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-compname-11, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-compname-12, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-compname-13, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-compname-15, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-compname-16, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-compname-18, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-compname-19, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-compname-2, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-compname-3, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-compname-4, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-compname-5, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-compname-6, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-compname-7, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-compname-8, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-compname-9, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-data-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-doc-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-empty-1, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-empty-2, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-enclexpr-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-enclexpr-2, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-enclexpr-3, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-enclexpr-4, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-enclexpr-5, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-invalid-1, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-invalid-2, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-invalid-3, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-name-1, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-name-2, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-namexml-1, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-namexml-2, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-namexml-3, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-namexml-4, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-parent-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-space-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-space-2, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-space-3, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-space-4, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ComputeConPI//Constr-comppi-string-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-adjtext-1, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-adjtext-2, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-adjtext-3, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-attr-1, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-attr-2, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-attr-3, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-constrmod-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-constrmod-2, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-constrmod-3, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-constrmod-4, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-data-1, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-doc-1, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-enclexpr-1, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-enclexpr-2, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-enclexpr-3, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-enclexpr-4, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-nested-1, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-nested-2, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-nested-3, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-nested-4, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-nodeid-1, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-nodeid-3, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-nodeid-4, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-nodeid-5, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-parent-1, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/ComputeCon/ConDocNode//Constr-docnode-string-1, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ConText//Constr-text-adjtext-1, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/ComputeCon/ConText//Constr-text-adjtext-2, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ConText//Constr-text-count-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ConText//Constr-text-count-2, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ConText//Constr-text-count-3, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ConText//Constr-text-count-4, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Expressions/Construct/ComputeCon/ConText//Constr-text-count-5, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ComputeCon/ConText//Constr-text-count-6, EXPECTED_ERROR_GOT_DIFFERENT_ERROR
+Expressions/Construct/ComputeCon/ConText//Constr-text-data-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ConText//Constr-text-doc-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ConText//Constr-text-enclexpr-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ConText//Constr-text-enclexpr-2, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ConText//Constr-text-enclexpr-3, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ConText//Constr-text-enclexpr-4, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ConText//Constr-text-enclexpr-5, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ConText//Constr-text-nested-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ConText//Constr-text-nested-2, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/ComputeCon/ConText//Constr-text-nested-3, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/ComputeCon/ConText//Constr-text-parent-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ComputeCon/ConText//Constr-text-string-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-10, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-11, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-12, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-13, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-14, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-15, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-16, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-17, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-18, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-19, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-2, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-20, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-3, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-4, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-5, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-6, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-7, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-8, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/ConInScopeNamespace//Constr-inscope-9, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem//Constr-elem-curlybr-1, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/DirectConElem//Constr-elem-curlybr-2, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/DirectConElem//Constr-elem-curlybr-3, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/DirectConElem//Constr-elem-curlybr-4, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/DirectConElem//Constr-elem-curlybr-5, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/Construct/DirectConElem//Constr-elem-curlybr-6, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/Construct/DirectConElem//Constr-elem-empty-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem//Constr-elem-empty-2, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem//Constr-elem-empty-3, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem//Constr-elem-empty-4, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/DirectConElem//Constr-elem-empty-5, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem//Constr-elem-matchtag-1, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/Construct/DirectConElem//Constr-elem-matchtag-2, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-charref-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-content-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-content-2, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-content-3, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-content-4, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-content-5, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-distnames-1, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-distnames-2, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-distnames-3, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-distnames-4, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-enclexpr-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-enclexpr-2, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-enclexpr-3, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-enclexpr-4, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-enclexpr-5, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-enclexpr-6, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-enclexpr-7, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-enclexpr-8, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-entref-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-entref-2, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-id-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-id-2, EXPECTED_ERROR_GOT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-nsdecl-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-nsdecl-2, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-nspre-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-nspre-2, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-nsprein-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-nsprein-2, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-parent-1, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-syntax-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-syntax-10, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-syntax-2, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-syntax-3, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-syntax-4, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-syntax-5, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-syntax-6, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-syntax-7, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-syntax-8, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-syntax-9, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-ws-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-ws-2, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-ws-3, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-ws-4, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemAttr//Constr-attr-ws-5, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-adjtext-1, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-adjtext-2, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-adjtext-3, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-adjtext-4, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-attr-1, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-attr-2, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-attr-3, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-attr-4, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-attr-5, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-attr-6, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-attr-7, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-attr-8, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-attr-9, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-baseuri-1, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-baseuri-2, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-baseuri-3, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-cdata-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-charref-1, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-charref-2, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-constrmod-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-constrmod-2, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-constrmod-3, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-constrmod-4, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-constrmod-5, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-constrmod-6, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-constrmod-7, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-constrmod-8, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-data-1, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-doc-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-document-1, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-document-2, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-document-3, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-document-4, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-document-5, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-enclexpr-1, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-enclexpr-2, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-enclexpr-3, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-enclexpr-4, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-enclexpr-5, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-entref-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-entref-2, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-entref-3, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-entref-4, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-entref-5, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-eol-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-eol-2, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-eol-3, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-eol-4, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-invalid-1, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-invalid-2, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-invalid-3, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-invalid-4, EXPECTED_ERROR_GOT_SAME_ERROR
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-nested-1, EXPECTED_RESULT_GOT_DIFFERENT_RESULT
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-nested-2, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-nested-3, EXPECTED_RESULT_GOT_SAME_RESULT
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-nested-4, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-nested-5, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-nodeid-1, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-nodeid-2, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-nodeid-3, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-nodeid-4, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-nodeid-5, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-nsmode-1, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-nsmode-10, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-nsmode-11, EXPECTED_RESULT_GOT_ERROR
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-nsmode-2, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-nsmode-3, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-nsmode-4, EXPECTED_RESULT_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-nsmode-5, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-nsmode-6, EXPECTED_ERROR_GOT_FAILURE
+Expressions/Construct/DirectConElem/DirectConElemContent//Constr-cont-nsmode-7, EXPECT

<TRUNCATED>

[11/25] git commit: This commit holds three ideas: local partitioning, reusing the parser per runtime, and optimizations for child path step. Since all these activities deal with VXQueryCollectionOperatorDescriptor and they are code change I am pulling f

Posted by ti...@apache.org.
This commit holds three ideas: local partitioning, reusing the parser per runtime, and optimizations for child path step.
Since all these activities deal with VXQueryCollectionOperatorDescriptor and they are code change I am pulling from another branch, I have just kept them in this one commit.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/f72feda7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/f72feda7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/f72feda7

Branch: refs/heads/westmann/prettyprint
Commit: f72feda74fcead83e807c5168a830b91bbedbb26
Parents: d146525
Author: Preston Carman <pr...@apache.org>
Authored: Thu Feb 13 16:03:34 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Feb 13 16:03:34 2014 -0800

----------------------------------------------------------------------
 .../builders/nodes/DictionaryBuilder.java       |   7 +
 .../vxquery/functions/builtin-functions.xml     |   2 -
 .../metadata/VXQueryCollectionDataSource.java   |  12 ++
 .../VXQueryCollectionOperatorDescriptor.java    | 139 +++++++------
 .../vxquery/metadata/VXQueryIOFileFilter.java   |  37 ++++
 .../metadata/VXQueryMetadataProvider.java       |  32 +--
 ...GeneralComparisonScalarEvaluatorFactory.java |   2 +-
 .../FnCollectionScalarEvaluatorFactory.java     | 117 -----------
 .../node/FnDocScalarEvaluatorFactory.java       |  10 +-
 .../functions/step/AbstractChildPathStep.java   |  74 +++++++
 .../runtime/functions/step/ChildPathStep.java   | 200 -------------------
 .../step/ChildPathStepOperatorDescriptor.java   | 153 ++++++++++++++
 .../step/ChildPathStepScalarEvaluator.java      |  13 +-
 .../functions/step/ChildPathStepUnnesting.java  | 126 ++++++++++++
 .../step/ChildPathStepUnnestingEvaluator.java   |  44 ++++
 .../ChildPathStepUnnestingEvaluatorFactory.java |  18 +-
 .../runtime/functions/util/FunctionHelper.java  | 189 ++----------------
 .../vxquery/xmlparser/SAXContentHandler.java    |   2 +
 .../org/apache/vxquery/xmlparser/XMLParser.java |  27 +++
 19 files changed, 602 insertions(+), 602 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f72feda7/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java
index 41cc98c..20b7333 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java
@@ -78,6 +78,13 @@ public class DictionaryBuilder {
         tempOut = new DataOutputStream(tempStringData);
         tempStringPointable = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable();
     }
+    
+    public void reset() {
+        stringEndOffsets.clear();
+        sortedSlotIndexes.clear();
+        dataBuffer.reset();
+        tempStringData.reset();
+    }
 
     public void write(ArrayBackedValueStorage abvs) throws IOException {
         DataOutput out = abvs.getDataOutput();

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f72feda7/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-functions.xml
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-functions.xml b/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-functions.xml
index cb1afc2..b439a83 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-functions.xml
+++ b/vxquery-core/src/main/java/org/apache/vxquery/functions/builtin-functions.xml
@@ -125,8 +125,6 @@
     <function name="fn:collection">
         <param name="arg" type="xs:string?"/>
         <return type="node()*"/>
-        <!-- All fn:collection query plans are rewritten to use Algebricks' datasource_scan operator. -->
-        <runtime type="scalar" class="org.apache.vxquery.runtime.functions.node.FnCollectionScalarEvaluatorFactory"/>
     </function>
     
     <!-- fn:compare($comparand1  as xs:string?, $comparand2 as xs:string?)  as xs:integer?  -->

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f72feda7/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionDataSource.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionDataSource.java b/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionDataSource.java
index 3fabeda..1f9f0a7 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionDataSource.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionDataSource.java
@@ -16,6 +16,7 @@
  */
 package org.apache.vxquery.metadata;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -31,8 +32,10 @@ import edu.uci.ics.hyracks.algebricks.core.algebra.properties.RandomPartitioning
 import edu.uci.ics.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector;
 
 public class VXQueryCollectionDataSource implements IDataSource<String> {
+    private static final String DELIMITER = "\\|";
     private final int dataSourceId;
     private final String collectionName;
+    private final String[] collectionPartitions;
     private final List<Integer> childSeq;
     private int totalDataSources;
 
@@ -43,6 +46,7 @@ public class VXQueryCollectionDataSource implements IDataSource<String> {
     public VXQueryCollectionDataSource(int id, String file, Object[] types) {
         this.dataSourceId = id;
         this.collectionName = file;
+        collectionPartitions = collectionName.split(DELIMITER);
         this.types = types;
         final IPhysicalPropertiesVector vec = new StructuralPropertiesVector(new RandomPartitioningProperty(
                 new CollectionFileDomain(collectionName)), new ArrayList<ILocalStructuralProperty>());
@@ -67,6 +71,14 @@ public class VXQueryCollectionDataSource implements IDataSource<String> {
         return dataSourceId;
     }
 
+    public String[] getPartitions() {
+        return collectionPartitions;
+    }
+    
+    public int getPartitionCount() {
+        return collectionPartitions.length;
+    }
+
     @Override
     public String getId() {
         return collectionName;

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f72feda7/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java b/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java
index 7276b5a..593b8ad 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java
@@ -18,14 +18,21 @@ package org.apache.vxquery.metadata;
 
 import java.io.File;
 import java.nio.ByteBuffer;
+import java.util.Iterator;
 import java.util.List;
 
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.filefilter.TrueFileFilter;
+import org.apache.vxquery.datamodel.accessors.PointablePool;
+import org.apache.vxquery.datamodel.accessors.PointablePoolFactory;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.exceptions.SystemException;
-import org.apache.vxquery.runtime.functions.step.ChildPathStep;
+import org.apache.vxquery.runtime.functions.step.ChildPathStepOperatorDescriptor;
 import org.apache.vxquery.runtime.functions.util.FunctionHelper;
 import org.apache.vxquery.xmlparser.ITreeNodeIdProvider;
+import org.apache.vxquery.xmlparser.SAXContentHandler;
 import org.apache.vxquery.xmlparser.TreeNodeIdProvider;
+import org.apache.vxquery.xmlparser.XMLParser;
 import org.xml.sax.InputSource;
 
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -36,7 +43,6 @@ import edu.uci.ics.hyracks.api.dataflow.value.RecordDescriptor;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 import edu.uci.ics.hyracks.api.job.IOperatorDescriptorRegistry;
 import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
-import edu.uci.ics.hyracks.dataflow.common.comm.io.ArrayTupleBuilder;
 import edu.uci.ics.hyracks.dataflow.common.comm.io.FrameTupleAccessor;
 import edu.uci.ics.hyracks.dataflow.common.comm.io.FrameTupleAppender;
 import edu.uci.ics.hyracks.dataflow.common.comm.util.FrameUtils;
@@ -47,13 +53,13 @@ public class VXQueryCollectionOperatorDescriptor extends AbstractSingleActivityO
     private static final long serialVersionUID = 1L;
     private short dataSourceId;
     private short totalDataSources;
-    private String collectionName;
+    private String[] collectionPartitions;
     private List<Integer> childSeq;
 
     public VXQueryCollectionOperatorDescriptor(IOperatorDescriptorRegistry spec, VXQueryCollectionDataSource ds,
             RecordDescriptor rDesc) {
         super(spec, 1, 1);
-        collectionName = ds.getId();
+        collectionPartitions = ds.getPartitions();
         dataSourceId = (short) ds.getDataSourceId();
         totalDataSources = (short) ds.getTotalDataSources();
         childSeq = ds.getChildSeq();
@@ -65,17 +71,20 @@ public class VXQueryCollectionOperatorDescriptor extends AbstractSingleActivityO
             IRecordDescriptorProvider recordDescProvider, int partition, int nPartitions) throws HyracksDataException {
         final FrameTupleAccessor fta = new FrameTupleAccessor(ctx.getFrameSize(),
                 recordDescProvider.getInputRecordDescriptor(getActivityId(), 0));
-        final ArrayTupleBuilder tb = new ArrayTupleBuilder(recordDescProvider.getOutputRecordDescriptor(
-                getActivityId(), 0).getFieldCount());
+        final int fieldOutputCount = recordDescProvider.getOutputRecordDescriptor(getActivityId(), 0).getFieldCount();
         final ByteBuffer frame = ctx.allocateFrame();
-        final FrameTupleAppender appender = new FrameTupleAppender(ctx.getFrameSize());
+        final FrameTupleAppender appender = new FrameTupleAppender(ctx.getFrameSize(), fieldOutputCount);
         final InputSource in = new InputSource();
         final ArrayBackedValueStorage abvsFileNode = new ArrayBackedValueStorage();
         final short partitionId = (short) ctx.getTaskAttemptId().getTaskId().getPartition();
         final ITreeNodeIdProvider nodeIdProvider = new TreeNodeIdProvider(partitionId, dataSourceId, totalDataSources);
         final String nodeId = ctx.getJobletContext().getApplicationContext().getNodeId();
         final int frameSize = ctx.getFrameSize();
-        final IHyracksTaskContext ctx1 = ctx;
+        final PointablePool ppool = PointablePoolFactory.INSTANCE.createPointablePool();
+        final ChildPathStepOperatorDescriptor childPathStep = new ChildPathStepOperatorDescriptor(ctx, ppool);
+
+        final String collectionName = collectionPartitions[partition % collectionPartitions.length];
+        final XMLParser parser = new XMLParser(false, nodeIdProvider);;
 
         return new AbstractUnaryInputUnaryOutputOperatorNodePushable() {
             @Override
@@ -93,7 +102,12 @@ public class VXQueryCollectionOperatorDescriptor extends AbstractSingleActivityO
                 // Go through each tuple.
                 if (collectionDirectory.isDirectory()) {
                     for (int t = 0; t < fta.getTupleCount(); ++t) {
-                        addXmlFile(collectionDirectory, t);
+                        @SuppressWarnings("unchecked")
+                        Iterator<File> it = FileUtils.iterateFiles(collectionDirectory, new VXQueryIOFileFilter(),
+                                TrueFileFilter.INSTANCE);
+                        while (it.hasNext()) {
+                            addNextXmlNode(it.next(), t);
+                        }
                     }
                 } else {
                     throw new HyracksDataException(
@@ -101,79 +115,76 @@ public class VXQueryCollectionOperatorDescriptor extends AbstractSingleActivityO
                 }
             }
 
-            private void addXmlFile(File collectionDirectory, int t) throws HyracksDataException {
-                // Add a field for the document node to each tuple.
-                for (File file : collectionDirectory.listFiles()) {
-                    // Add the document node to the frame output.
-                    if (FunctionHelper.readableXmlFile(file.getPath())) {
-                        // TODO Make field addition based on output tuples instead of files.
-
-                        // Now add new field.
-                        abvsFileNode.reset();
-                        try {
-                            FunctionHelper.readInDocFromString(file.getPath(), in, abvsFileNode, nodeIdProvider);
-                        } catch (Exception e) {
-                            throw new HyracksDataException(e);
-                        }
+            /**
+             * Add the document node to the frame output.
+             */
+            private void addNextXmlNode(File file, int t) throws HyracksDataException {
+                // Now add new field.
+                abvsFileNode.reset();
+                try {
+                    FunctionHelper.readInDocFromString(file, in, abvsFileNode, parser);
+                } catch (Exception e) {
+                    throw new HyracksDataException(e);
+                }
 
-                        if (childSeq.isEmpty()) {
-                            // Can not fit XML file into frame.
-                            if (frameSize <= (abvsFileNode.getLength() - abvsFileNode.getStartOffset())) {
-                                throw new HyracksDataException(
-                                        "XML node is to large for the current frame size (VXQueryCollectionOperatorDescriptor.addXmlFile).");
-                            }
-                            // Return the whole XML file.
-                            tb.addField(abvsFileNode.getByteArray(), abvsFileNode.getStartOffset(),
-                                    abvsFileNode.getLength());
-                        } else {
-                            // Process child nodes.
-                            TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY
-                                    .createPointable();
-                            tvp.set(abvsFileNode.getByteArray(), abvsFileNode.getStartOffset(),
-                                    abvsFileNode.getLength());
-                            processChildStep(tb, tvp, t);
-                        }
-                    } else if (file.isDirectory()) {
-                        // Consider all XML file in sub directories.
-                        addXmlFile(file, t);
+                TaggedValuePointable tvp = ppool.takeOne(TaggedValuePointable.class);
+                if (childSeq.isEmpty()) {
+                    // Can not fit XML file into frame.
+                    if (frameSize <= (abvsFileNode.getLength() - abvsFileNode.getStartOffset())) {
+                        throw new HyracksDataException(
+                                "XML node is to large for the current frame size (VXQueryCollectionOperatorDescriptor.addXmlFile).");
                     }
+                    tvp.set(abvsFileNode.getByteArray(), abvsFileNode.getStartOffset(), abvsFileNode.getLength());
+                    addNodeToTuple(tvp, t);
+                } else {
+                    // Process child nodes.
+                    tvp.set(abvsFileNode.getByteArray(), abvsFileNode.getStartOffset(), abvsFileNode.getLength());
+                    processChildStep(tvp, t);
                 }
+                ppool.giveBack(tvp);
             }
 
-            private void processChildStep(final ArrayTupleBuilder tb, TaggedValuePointable tvp, int t)
-                    throws HyracksDataException {
-                TaggedValuePointable result = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
-                ChildPathStep childPathStep = new ChildPathStep(ctx1);
+            private void processChildStep(TaggedValuePointable tvp, int t) throws HyracksDataException {
                 try {
                     childPathStep.init(tvp, childSeq);
                 } catch (SystemException e) {
                     throw new HyracksDataException("Child path step failed to load node tree.");
                 }
                 try {
+                    TaggedValuePointable result = ppool.takeOne(TaggedValuePointable.class);
                     while (childPathStep.step(result)) {
-                        // First copy all new fields over.
-                        tb.reset();
-                        if (fta.getFieldCount() > 0) {
-                            for (int f = 0; f < fta.getFieldCount(); ++f) {
-                                tb.addField(fta, t, f);
-                            }
-                        }
-                        tb.addField(result.getByteArray(), result.getStartOffset(), result.getLength());
-                        // Send to the writer.
-                        if (!appender.append(tb.getFieldEndOffsets(), tb.getByteArray(), 0, tb.getSize())) {
-                            FrameUtils.flushFrame(frame, writer);
-                            appender.reset(frame, true);
-                            if (!appender.append(tb.getFieldEndOffsets(), tb.getByteArray(), 0, tb.getSize())) {
-                                throw new HyracksDataException(
-                                        "Could not write frame (VXQueryCollectionOperatorDescriptor.createPushRuntime).");
-                            }
-                        }
+                        addNodeToTuple(result, t);
                     }
+                    ppool.giveBack(result);
                 } catch (AlgebricksException e) {
                     throw new HyracksDataException(e);
                 }
             }
 
+            private void addNodeToTuple(TaggedValuePointable result, int t) throws HyracksDataException {
+                // Send to the writer.
+                if (!addNodeToTupleAppender(result, t)) {
+                    FrameUtils.flushFrame(frame, writer);
+                    appender.reset(frame, true);
+                    if (!addNodeToTupleAppender(result, t)) {
+                        throw new HyracksDataException(
+                                "Could not write frame (VXQueryCollectionOperatorDescriptor.createPushRuntime).");
+                    }
+                }
+            }
+
+            private boolean addNodeToTupleAppender(TaggedValuePointable result, int t) throws HyracksDataException {
+                // First copy all new fields over.
+                if (fta.getFieldCount() > 0) {
+                    for (int f = 0; f < fta.getFieldCount(); ++f) {
+                        if (!appender.appendField(fta, t, f)) {
+                            return false;
+                        }
+                    }
+                }
+                return appender.appendField(result.getByteArray(), result.getStartOffset(), result.getLength());
+            }
+
             @Override
             public void fail() throws HyracksDataException {
                 writer.fail();

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f72feda7/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryIOFileFilter.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryIOFileFilter.java b/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryIOFileFilter.java
new file mode 100644
index 0000000..104f254
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryIOFileFilter.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.metadata;
+
+import java.io.File;
+
+import org.apache.commons.io.filefilter.IOFileFilter;
+
+public class VXQueryIOFileFilter implements IOFileFilter {
+
+    @Override
+    public boolean accept(final File file) {
+        return accept(file, file.getName());
+    }
+
+    @Override
+    public boolean accept(final File file, final String name) {
+        if (name.toLowerCase().endsWith(".xml") || name.toLowerCase().endsWith(".xml.gz")) {
+            return true;
+        }
+        return false;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f72feda7/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryMetadataProvider.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryMetadataProvider.java b/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryMetadataProvider.java
index d324d80..cd323d9 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryMetadataProvider.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryMetadataProvider.java
@@ -17,6 +17,7 @@
 package org.apache.vxquery.metadata;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 
 import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint;
@@ -38,7 +39,6 @@ import edu.uci.ics.hyracks.algebricks.data.IAWriterFactory;
 import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
 import edu.uci.ics.hyracks.algebricks.data.IResultSerializerFactoryProvider;
 import edu.uci.ics.hyracks.algebricks.runtime.base.IPushRuntimeFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.operators.std.SinkWriterRuntimeFactory;
 import edu.uci.ics.hyracks.algebricks.runtime.serializer.ResultSerializerFactoryProvider;
 import edu.uci.ics.hyracks.algebricks.runtime.writers.PrinterBasedWriterFactory;
 import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
@@ -47,7 +47,6 @@ import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.api.dataflow.value.RecordDescriptor;
 import edu.uci.ics.hyracks.api.dataset.ResultSetId;
 import edu.uci.ics.hyracks.api.job.JobSpecification;
-import edu.uci.ics.hyracks.dataflow.std.file.FileSplit;
 import edu.uci.ics.hyracks.dataflow.std.result.ResultWriterOperatorDescriptor;
 
 public class VXQueryMetadataProvider implements IMetadataProvider<String, String> {
@@ -67,14 +66,26 @@ public class VXQueryMetadataProvider implements IMetadataProvider<String, String
             List<LogicalVariable> scanVariables, List<LogicalVariable> projectVariables, boolean projectPushed,
             IOperatorSchema opSchema, IVariableTypeEnvironment typeEnv, JobGenContext context,
             JobSpecification jobSpec, Object implConfig) throws AlgebricksException {
+        VXQueryCollectionDataSource ds = (VXQueryCollectionDataSource) dataSource;
         RecordDescriptor rDesc = new RecordDescriptor(new ISerializerDeserializer[opSchema.getSize()]);
-        IOperatorDescriptor scanner = new VXQueryCollectionOperatorDescriptor(jobSpec,
-                (VXQueryCollectionDataSource) dataSource, rDesc);
+        IOperatorDescriptor scanner = new VXQueryCollectionOperatorDescriptor(jobSpec, ds, rDesc);
 
-        AlgebricksAbsolutePartitionConstraint constraint = new AlgebricksAbsolutePartitionConstraint(nodeList);
+        AlgebricksPartitionConstraint constraint = getClusterLocations(nodeList, ds.getPartitionCount());
         return new Pair<IOperatorDescriptor, AlgebricksPartitionConstraint>(scanner, constraint);
     }
 
+    public AlgebricksPartitionConstraint getClusterLocations(String[] nodeList, int partitions) {
+        ArrayList<String> locs = new ArrayList<String>();
+        for (String node : nodeList) {
+            for (int j = 0; j < partitions; j++) {
+                locs.add(node);
+            }
+        }
+        String[] cluster = new String[locs.size()];
+        cluster = locs.toArray(cluster);
+        return new AlgebricksAbsolutePartitionConstraint(cluster);
+    }
+
     @Override
     public boolean scannerOperatorIsLeaf(IDataSource<String> dataSource) {
         return false;
@@ -84,16 +95,7 @@ public class VXQueryMetadataProvider implements IMetadataProvider<String, String
     public Pair<IPushRuntimeFactory, AlgebricksPartitionConstraint> getWriteFileRuntime(IDataSink sink,
             int[] printColumns, IPrinterFactory[] printerFactories, RecordDescriptor inputDesc)
             throws AlgebricksException {
-        QueryResultDataSink ds = (QueryResultDataSink) sink;
-        FileSplit[] fileSplits = ds.getFileSplits();
-        String[] locations = new String[fileSplits.length];
-        for (int i = 0; i < fileSplits.length; ++i) {
-            locations[i] = fileSplits[i].getNodeName();
-        }
-        IPushRuntimeFactory prf = new SinkWriterRuntimeFactory(printColumns, printerFactories, fileSplits[0]
-                .getLocalFile().getFile(), PrinterBasedWriterFactory.INSTANCE, inputDesc);
-        AlgebricksAbsolutePartitionConstraint constraint = new AlgebricksAbsolutePartitionConstraint(locations);
-        return new Pair<IPushRuntimeFactory, AlgebricksPartitionConstraint>(prf, constraint);
+        return null;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f72feda7/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java
index 70f2e4e..1bcd1ce 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java
@@ -213,7 +213,7 @@ public abstract class AbstractGeneralComparisonScalarEvaluatorFactory extends
                         ah.atomize(tvpArg1, ppool, tvpTransform1);
                         tid1 = FunctionHelper.getBaseTypeForGeneralComparisons(tvpTransform1.getTag());
                     } else if (tid2 == ValueTag.NODE_TREE_TAG) {
-                        FunctionHelper.atomize(tvpArg2, tvpTransform2);
+                        ah.atomize(tvpArg2, ppool, tvpTransform2);
                         tid2 = FunctionHelper.getBaseTypeForGeneralComparisons(tvpTransform2.getTag());
                     }
 

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f72feda7/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/FnCollectionScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/FnCollectionScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/FnCollectionScalarEvaluatorFactory.java
deleted file mode 100644
index d843d78..0000000
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/FnCollectionScalarEvaluatorFactory.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.vxquery.runtime.functions.node;
-
-import java.io.DataInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-
-import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
-import org.apache.vxquery.datamodel.builders.sequence.SequenceBuilder;
-import org.apache.vxquery.datamodel.values.ValueTag;
-import org.apache.vxquery.exceptions.ErrorCode;
-import org.apache.vxquery.exceptions.SystemException;
-import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator;
-import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
-import org.apache.vxquery.runtime.functions.util.FunctionHelper;
-import org.apache.vxquery.xmlparser.ITreeNodeIdProvider;
-import org.apache.vxquery.xmlparser.TreeNodeIdProvider;
-import org.xml.sax.InputSource;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
-import edu.uci.ics.hyracks.data.std.api.IPointable;
-import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
-import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
-import edu.uci.ics.hyracks.dataflow.common.comm.util.ByteBufferInputStream;
-
-public class FnCollectionScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
-    private static final long serialVersionUID = 1L;
-
-    public FnCollectionScalarEvaluatorFactory(IScalarEvaluatorFactory[] args) {
-        super(args);
-    }
-
-    @Override
-    protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
-        final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
-        final UTF8StringPointable stringp = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable();
-        final TaggedValuePointable nodep = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
-        final ByteBufferInputStream bbis = new ByteBufferInputStream();
-        final DataInputStream di = new DataInputStream(bbis);
-        final SequenceBuilder sb = new SequenceBuilder();
-        final ArrayBackedValueStorage abvsFileNode = new ArrayBackedValueStorage();
-        final InputSource in = new InputSource();
-        final int partition = ctx.getTaskAttemptId().getTaskId().getPartition();
-        final ITreeNodeIdProvider nodeIdProvider = new TreeNodeIdProvider((short) partition);
-
-        return new AbstractTaggedValueArgumentScalarEvaluator(args) {
-            @Override
-            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
-                String collectionName;
-                TaggedValuePointable tvp = args[0];
-                // TODO add support empty sequence and no argument.
-                if (tvp.getTag() != ValueTag.XS_STRING_TAG) {
-                    throw new SystemException(ErrorCode.FORG0006);
-                }
-                tvp.getValue(stringp);
-                try {
-                    // Get the list of files.
-                    bbis.setByteBuffer(ByteBuffer.wrap(Arrays.copyOfRange(stringp.getByteArray(),
-                            stringp.getStartOffset(), stringp.getLength() + stringp.getStartOffset())), 0);
-                    collectionName = di.readUTF();
-                } catch (IOException e) {
-                    throw new SystemException(ErrorCode.SYSE0001, e);
-                }
-                File collectionDirectory = new File(collectionName);
-                if (!collectionDirectory.exists()) {
-                    throw new RuntimeException("The collection directory (" + collectionName + ") does not exist.");
-                }
-
-                try {
-                    abvs.reset();
-                    sb.reset(abvs);
-                    addXmlFiles(collectionDirectory);
-                    sb.finish();
-                    result.set(abvs);
-                } catch (IOException e) {
-                    throw new SystemException(ErrorCode.SYSE0001, e);
-                }
-            }
-
-            private void addXmlFiles(File collectionDirectory) throws SystemException, IOException {
-                for (File file : collectionDirectory.listFiles()) {
-                    // Add the document node to the sequence.
-                    if (FunctionHelper.readableXmlFile(file.getPath())) {
-                        abvsFileNode.reset();
-                        FunctionHelper.readInDocFromString(file.getPath(), in, abvsFileNode, nodeIdProvider);
-                        nodep.set(abvsFileNode.getByteArray(), abvsFileNode.getStartOffset(), abvsFileNode.getLength());
-                        sb.addItem(nodep);
-                    } else if (file.isDirectory()) {
-                        // Consider all XML file in sub directories.
-                        addXmlFiles(file);
-                    }
-                }
-            }
-        };
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f72feda7/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/FnDocScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/FnDocScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/FnDocScalarEvaluatorFactory.java
index c634962..8bb8af9 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/FnDocScalarEvaluatorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/FnDocScalarEvaluatorFactory.java
@@ -29,12 +29,14 @@ import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScal
 import org.apache.vxquery.runtime.functions.util.FunctionHelper;
 import org.apache.vxquery.xmlparser.ITreeNodeIdProvider;
 import org.apache.vxquery.xmlparser.TreeNodeIdProvider;
+import org.apache.vxquery.xmlparser.XMLParser;
 import org.xml.sax.InputSource;
 
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 import edu.uci.ics.hyracks.data.std.api.IPointable;
 import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
 import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
@@ -76,7 +78,13 @@ public class FnDocScalarEvaluatorFactory extends AbstractTaggedValueArgumentScal
                     throw new SystemException(ErrorCode.FORG0006);
                 }
                 tvp.getValue(stringp);
-                FunctionHelper.readInDocFromPointable(stringp, in, bbis, di, abvs, nodeIdProvider);
+                try {
+                    // Only one document should be parsed so its ok to have a unique parser.
+                    XMLParser parser = new XMLParser(false, nodeIdProvider);
+                    FunctionHelper.readInDocFromPointable(stringp, in, bbis, di, abvs, parser);
+                } catch (Exception e) {
+                    throw new SystemException(ErrorCode.SYSE0001, e);
+                }
                 result.set(abvs);
             }
         };

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f72feda7/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AbstractChildPathStep.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AbstractChildPathStep.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AbstractChildPathStep.java
new file mode 100644
index 0000000..2668719
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AbstractChildPathStep.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.runtime.functions.step;
+
+import java.io.IOException;
+
+import org.apache.vxquery.context.DynamicContext;
+import org.apache.vxquery.datamodel.accessors.PointablePool;
+import org.apache.vxquery.datamodel.accessors.SequencePointable;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.datamodel.accessors.nodes.DocumentNodePointable;
+import org.apache.vxquery.datamodel.accessors.nodes.ElementNodePointable;
+import org.apache.vxquery.datamodel.accessors.nodes.NodeTreePointable;
+import org.apache.vxquery.datamodel.builders.nodes.NodeSubTreeBuilder;
+import org.apache.vxquery.datamodel.values.ValueTag;
+import org.apache.vxquery.datamodel.values.XDMConstants;
+
+import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
+
+public abstract class AbstractChildPathStep {
+    protected final DynamicContext dCtx;
+    protected final PointablePool pp;
+    private final ArrayBackedValueStorage nodeAbvs = new ArrayBackedValueStorage();
+    protected final NodeTreePointable ntp = (NodeTreePointable) NodeTreePointable.FACTORY.createPointable();
+    private final DocumentNodePointable dnp = (DocumentNodePointable) DocumentNodePointable.FACTORY.createPointable();
+    private final ElementNodePointable enp = (ElementNodePointable) ElementNodePointable.FACTORY.createPointable();
+    private final NodeSubTreeBuilder nstb = new NodeSubTreeBuilder();
+
+    public AbstractChildPathStep(IHyracksTaskContext ctx, PointablePool pp) {
+        dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
+        this.pp = pp;
+    }
+
+    protected void getSequence(TaggedValuePointable tvp, SequencePointable seqp) {
+        switch (tvp.getTag()) {
+            case ValueTag.DOCUMENT_NODE_TAG:
+                tvp.getValue(dnp);
+                dnp.getContent(ntp, seqp);
+                return;
+
+            case ValueTag.ELEMENT_NODE_TAG:
+                tvp.getValue(enp);
+                if (enp.childrenChunkExists()) {
+                    enp.getChildrenSequence(ntp, seqp);
+                    return;
+                }
+        }
+        XDMConstants.setEmptySequence(seqp);
+    }
+
+    protected void setNodeToResult(TaggedValuePointable tvpItem, IPointable result) throws IOException {
+        nodeAbvs.reset();
+        nstb.reset(nodeAbvs);
+        nstb.setChildNode(ntp, tvpItem);
+        nstb.finish();
+        result.set(nodeAbvs.getByteArray(), nodeAbvs.getStartOffset(), nodeAbvs.getLength());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f72feda7/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStep.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStep.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStep.java
deleted file mode 100644
index da70ca8..0000000
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStep.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.vxquery.runtime.functions.step;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.ArrayList;
-
-import org.apache.vxquery.context.DynamicContext;
-import org.apache.vxquery.datamodel.accessors.SequencePointable;
-import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
-import org.apache.vxquery.datamodel.accessors.nodes.DocumentNodePointable;
-import org.apache.vxquery.datamodel.accessors.nodes.ElementNodePointable;
-import org.apache.vxquery.datamodel.accessors.nodes.NodeTreePointable;
-import org.apache.vxquery.datamodel.builders.nodes.NodeSubTreeBuilder;
-import org.apache.vxquery.datamodel.values.ValueTag;
-import org.apache.vxquery.datamodel.values.XDMConstants;
-import org.apache.vxquery.exceptions.ErrorCode;
-import org.apache.vxquery.exceptions.SystemException;
-import org.apache.vxquery.runtime.functions.step.NodeTestFilter.INodeFilter;
-import org.apache.vxquery.types.SequenceType;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
-import edu.uci.ics.hyracks.data.std.api.IPointable;
-import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
-import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
-
-public class ChildPathStep {
-    private final DynamicContext dCtx;
-    private List<INodeFilter> filter;
-    private int indexSeqArgs;
-    private int[] indexSequence;
-    private ArrayBackedValueStorage nodeAbvs;
-    private final NodeTreePointable ntp = (NodeTreePointable) NodeTreePointable.FACTORY.createPointable();
-    private int seqArgsLength;
-    private final SequencePointable seqNtp = (SequencePointable) SequencePointable.FACTORY.createPointable();
-    private final TaggedValuePointable tvpItem = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
-
-    public ChildPathStep(IHyracksTaskContext ctx) {
-        dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
-        nodeAbvs = new ArrayBackedValueStorage();
-        filter = new ArrayList<INodeFilter>();
-    }
-
-    private void getSequence(TaggedValuePointable tvp, SequencePointable seqp) {
-        switch (tvp.getTag()) {
-            case ValueTag.DOCUMENT_NODE_TAG:
-                DocumentNodePointable dnp = (DocumentNodePointable) DocumentNodePointable.FACTORY.createPointable();
-                tvp.getValue(dnp);
-                dnp.getContent(ntp, seqp);
-                return;
-
-            case ValueTag.ELEMENT_NODE_TAG:
-                ElementNodePointable enp = (ElementNodePointable) ElementNodePointable.FACTORY.createPointable();
-                tvp.getValue(enp);
-                if (enp.childrenChunkExists()) {
-                    enp.getChildrenSequence(ntp, seqp);
-                    return;
-                }
-        }
-        TaggedValuePointable seqTvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
-        XDMConstants.setEmptySequence(seqTvp);
-        seqTvp.getValue(seqp);
-    }
-
-    public void init(TaggedValuePointable tvp, List<Integer> typeCodes) throws SystemException {
-        indexSequence = new int[typeCodes.size()];
-        for (int i = 0; i < typeCodes.size(); ++i) {
-            indexSequence[i] = 0;
-        }
-        indexSeqArgs = 0;
-
-        setFilterCode(typeCodes);
-
-        if (tvp.getTag() != ValueTag.NODE_TREE_TAG) {
-            throw new SystemException(ErrorCode.SYSE0001);
-        }
-        tvp.getValue(ntp);
-        seqArgsLength = -1;
-    }
-
-    protected void init(TaggedValuePointable[] args) throws SystemException {
-        indexSequence = new int[1];
-        indexSequence[0] = 0;
-        indexSeqArgs = 0;
-
-        if (args[1].getTag() != ValueTag.XS_INT_TAG) {
-            throw new IllegalArgumentException("Expected int value tag, got: " + args[1].getTag());
-        }
-        IntegerPointable ip = (IntegerPointable) IntegerPointable.FACTORY.createPointable();
-        args[1].getValue(ip);
-        int typeCode = ip.getInteger();
-        setFilterCode(typeCode);
-
-        if (args[0].getTag() == ValueTag.SEQUENCE_TAG) {
-            args[0].getValue(seqNtp);
-            seqArgsLength = seqNtp.getEntryCount();
-        } else if (args[0].getTag() == ValueTag.NODE_TREE_TAG) {
-            args[0].getValue(ntp);
-            seqArgsLength = -1;
-        } else {
-            throw new SystemException(ErrorCode.SYSE0001);
-        }
-    }
-
-    public void setFilterCode(int typeCode) {
-        SequenceType sType = dCtx.getStaticContext().lookupSequenceType(typeCode);
-        filter.add(NodeTestFilter.getNodeTestFilter(sType));
-    }
-
-    private void setFilterCode(List<Integer> typeCodes) {
-        for (int typeCode : typeCodes) {
-            SequenceType sType = dCtx.getStaticContext().lookupSequenceType(typeCode);
-            INodeFilter f = NodeTestFilter.getNodeTestFilter(sType);
-            filter.add(f);
-        }
-    }
-
-    private void setNodeToResult(IPointable result) throws IOException {
-        nodeAbvs.reset();
-        NodeSubTreeBuilder nstb = new NodeSubTreeBuilder();
-        nstb.reset(nodeAbvs);
-        nstb.setChildNode(ntp, tvpItem);
-        nstb.finish();
-        result.set(nodeAbvs.getByteArray(), nodeAbvs.getStartOffset(), nodeAbvs.getLength());
-    }
-
-    public boolean step(IPointable result) throws AlgebricksException {
-        TaggedValuePointable tvpRoot = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
-        if (seqArgsLength > 0) {
-            while (indexSeqArgs < seqArgsLength) {
-                TaggedValuePointable tvpNtp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
-                seqNtp.getEntry(indexSeqArgs, tvpNtp);
-                if (tvpNtp.getTag() != ValueTag.NODE_TREE_TAG) {
-                    String description = ErrorCode.SYSE0001 + ": " + ErrorCode.SYSE0001.getDescription();
-                    throw new AlgebricksException(description);
-                }
-                tvpNtp.getValue(ntp);
-                ntp.getRootNode(tvpRoot);
-                if (stepNodeTree(tvpRoot, 0, result)) {
-                    return true;
-                }
-            }
-        } else {
-            // Single node tree input.
-            ntp.getRootNode(tvpRoot);
-            if (stepNodeTree(tvpRoot, 0, result)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private boolean stepNodeTree(TaggedValuePointable tvpInput, int level, IPointable result) throws AlgebricksException {
-        SequencePointable seqItem = (SequencePointable) SequencePointable.FACTORY.createPointable();
-        getSequence(tvpInput, seqItem);
-        int seqLength = seqItem.getEntryCount();
-        while (indexSequence[level] < seqLength) {
-            // Get the next item
-            seqItem.getEntry(indexSequence[level], tvpItem);
-
-            // Test to see if the item fits the path step
-            if (filter.get(level).accept(ntp, tvpItem)) {
-                if (level + 1 < indexSequence.length) {
-                    if (stepNodeTree(tvpItem, level + 1, result)) {
-                        return true;
-                    }
-                } else {
-                    try {
-                        setNodeToResult(result);
-                        ++indexSequence[level];
-                        return true;
-                    } catch (IOException e) {
-                        String description = ErrorCode.SYSE0001 + ": " + ErrorCode.SYSE0001.getDescription();
-                        throw new AlgebricksException(description);
-                    }
-                }
-            }
-            ++indexSequence[level];
-        }
-        // Reset for next node tree.
-        indexSequence[level] = 0;
-        return false;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f72feda7/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepOperatorDescriptor.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepOperatorDescriptor.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepOperatorDescriptor.java
new file mode 100644
index 0000000..1edf0f5
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepOperatorDescriptor.java
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.runtime.functions.step;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.vxquery.datamodel.accessors.PointablePool;
+import org.apache.vxquery.datamodel.accessors.SequencePointable;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.datamodel.accessors.nodes.DocumentNodePointable;
+import org.apache.vxquery.datamodel.accessors.nodes.ElementNodePointable;
+import org.apache.vxquery.datamodel.accessors.nodes.NodeTreePointable;
+import org.apache.vxquery.datamodel.builders.nodes.NodeSubTreeBuilder;
+import org.apache.vxquery.datamodel.values.ValueTag;
+import org.apache.vxquery.datamodel.values.XDMConstants;
+import org.apache.vxquery.exceptions.ErrorCode;
+import org.apache.vxquery.exceptions.SystemException;
+import org.apache.vxquery.runtime.functions.step.NodeTestFilter.INodeFilter;
+import org.apache.vxquery.types.SequenceType;
+
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
+
+public class ChildPathStepOperatorDescriptor extends AbstractChildPathStep {
+    private List<INodeFilter> filter = new ArrayList<INodeFilter>();
+    private int[] indexSequence;
+    private final ArrayBackedValueStorage nodeAbvs = new ArrayBackedValueStorage();
+    protected final NodeTreePointable ntp = (NodeTreePointable) NodeTreePointable.FACTORY.createPointable();
+    private final TaggedValuePointable tvpItem = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+    private final DocumentNodePointable dnp = (DocumentNodePointable) DocumentNodePointable.FACTORY.createPointable();
+    private final ElementNodePointable enp = (ElementNodePointable) ElementNodePointable.FACTORY.createPointable();
+    private final TaggedValuePointable tvpStep = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+    private final NodeSubTreeBuilder nstb = new NodeSubTreeBuilder();
+
+    public ChildPathStepOperatorDescriptor(IHyracksTaskContext ctx, PointablePool pp) {
+        super(ctx, pp);
+    }
+
+    protected void getSequence(TaggedValuePointable tvp, SequencePointable seqp) {
+        switch (tvp.getTag()) {
+            case ValueTag.DOCUMENT_NODE_TAG:
+                tvp.getValue(dnp);
+                dnp.getContent(ntp, seqp);
+                return;
+
+            case ValueTag.ELEMENT_NODE_TAG:
+                tvp.getValue(enp);
+                if (enp.childrenChunkExists()) {
+                    enp.getChildrenSequence(ntp, seqp);
+                    return;
+                }
+        }
+        XDMConstants.setEmptySequence(seqp);
+    }
+
+    public void init(TaggedValuePointable tvp, List<Integer> typeCodes) throws SystemException {
+        indexSequence = new int[typeCodes.size()];
+        for (int i = 0; i < typeCodes.size(); ++i) {
+            indexSequence[i] = 0;
+        }
+        setFilterCode(typeCodes);
+        if (tvp.getTag() != ValueTag.NODE_TREE_TAG) {
+            throw new SystemException(ErrorCode.SYSE0001);
+        }
+        tvp.getValue(ntp);
+    }
+
+    protected void setFilterCode(List<Integer> typeCodes) {
+        for (int typeCode : typeCodes) {
+            SequenceType sType = dCtx.getStaticContext().lookupSequenceType(typeCode);
+            INodeFilter f = NodeTestFilter.getNodeTestFilter(sType);
+            filter.add(f);
+        }
+    }
+
+    protected void setNodeToResult(TaggedValuePointable tvpItem, IPointable result) throws IOException {
+        nodeAbvs.reset();
+        nstb.reset(nodeAbvs);
+        nstb.setChildNode(ntp, tvpItem);
+        nstb.finish();
+        result.set(nodeAbvs.getByteArray(), nodeAbvs.getStartOffset(), nodeAbvs.getLength());
+    }
+
+    /**
+     * Single node tree input.
+     * Requirement: "ntp" must be the node tree.
+     */
+    public boolean step(IPointable result) throws AlgebricksException {
+        ntp.getRootNode(tvpStep);
+        if (stepNodeTree(tvpStep, 0, result)) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Find the next node to return.
+     */
+    protected boolean stepNodeTree(TaggedValuePointable tvpInput, int level, IPointable result)
+            throws AlgebricksException {
+        SequencePointable seqItem = pp.takeOne(SequencePointable.class);
+        try {
+            getSequence(tvpInput, seqItem);
+            int seqLength = seqItem.getEntryCount();
+            while (indexSequence[level] < seqLength) {
+                // Get the next item
+                seqItem.getEntry(indexSequence[level], tvpItem);
+
+                // Test to see if the item fits the path step
+                if (filter.get(level).accept(ntp, tvpItem)) {
+                    if (level + 1 < indexSequence.length) {
+                        if (stepNodeTree(tvpItem, level + 1, result)) {
+                            return true;
+                        }
+                    } else {
+                        try {
+                            setNodeToResult(tvpItem, result);
+                            ++indexSequence[level];
+                            return true;
+                        } catch (IOException e) {
+                            String description = ErrorCode.SYSE0001 + ": " + ErrorCode.SYSE0001.getDescription();
+                            throw new AlgebricksException(description);
+                        }
+                    }
+                }
+                ++indexSequence[level];
+            }
+            // Reset for next node tree.
+            indexSequence[level] = 0;
+            return false;
+        } finally {
+            pp.giveBack(seqItem);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f72feda7/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepScalarEvaluator.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepScalarEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepScalarEvaluator.java
index d831c95..729f8a2 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepScalarEvaluator.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepScalarEvaluator.java
@@ -31,20 +31,17 @@ import edu.uci.ics.hyracks.data.std.api.IPointable;
 import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
 
 public class ChildPathStepScalarEvaluator extends AbstractTaggedValueArgumentScalarEvaluator {
-    private final SequenceBuilder seqb;
+    private final SequenceBuilder seqb = new SequenceBuilder();
 
-    private final ArrayBackedValueStorage seqAbvs;
+    private final ArrayBackedValueStorage seqAbvs = new ArrayBackedValueStorage();
 
-    private final TaggedValuePointable itemTvp;
+    private final ChildPathStepUnnesting childPathStep;
 
-    private final ChildPathStep childPathStep;
+    private final TaggedValuePointable itemTvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
 
     public ChildPathStepScalarEvaluator(IScalarEvaluator[] args, IHyracksTaskContext ctx) {
         super(args);
-        seqb = new SequenceBuilder();
-        seqAbvs = new ArrayBackedValueStorage();
-        itemTvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
-        childPathStep = new ChildPathStep(ctx);
+        childPathStep = new ChildPathStepUnnesting(ctx, ppool);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f72feda7/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepUnnesting.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepUnnesting.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepUnnesting.java
new file mode 100644
index 0000000..1e93ce3
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepUnnesting.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.runtime.functions.step;
+
+import java.io.IOException;
+
+import org.apache.vxquery.datamodel.accessors.PointablePool;
+import org.apache.vxquery.datamodel.accessors.SequencePointable;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.datamodel.values.ValueTag;
+import org.apache.vxquery.exceptions.ErrorCode;
+import org.apache.vxquery.exceptions.SystemException;
+import org.apache.vxquery.runtime.functions.step.NodeTestFilter.INodeFilter;
+import org.apache.vxquery.types.SequenceType;
+
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
+
+public class ChildPathStepUnnesting extends AbstractChildPathStep {
+    private int indexSeqArgs;
+    private int seqArgsLength;
+    private int indexSequence;
+    private final IntegerPointable ip = (IntegerPointable) IntegerPointable.FACTORY.createPointable();
+    private final SequencePointable seqItem = (SequencePointable) SequencePointable.FACTORY.createPointable();
+    private final SequencePointable seqNtp = (SequencePointable) SequencePointable.FACTORY.createPointable();
+    private final TaggedValuePointable tvpItem = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+    private final TaggedValuePointable tvpNtp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+    private final TaggedValuePointable tvpStep = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+    INodeFilter filter;
+
+    public ChildPathStepUnnesting(IHyracksTaskContext ctx, PointablePool pp) {
+        super(ctx, pp);
+    }
+
+    protected void init(TaggedValuePointable[] args) throws SystemException {
+        indexSeqArgs = 0;
+        indexSequence = 0;
+
+        if (args[1].getTag() != ValueTag.XS_INT_TAG) {
+            throw new IllegalArgumentException("Expected int value tag, got: " + args[1].getTag());
+        }
+        args[1].getValue(ip);
+        SequenceType sType = dCtx.getStaticContext().lookupSequenceType(ip.getInteger());
+        filter = NodeTestFilter.getNodeTestFilter(sType);
+
+        if (args[0].getTag() == ValueTag.SEQUENCE_TAG) {
+            args[0].getValue(seqNtp);
+            seqArgsLength = seqNtp.getEntryCount();
+        } else if (args[0].getTag() == ValueTag.NODE_TREE_TAG) {
+            args[0].getValue(ntp);
+            seqArgsLength = -1;
+        } else {
+            throw new SystemException(ErrorCode.SYSE0001);
+        }
+    }
+
+    public boolean step(IPointable result) throws AlgebricksException {
+        if (seqArgsLength > 0) {
+            while (indexSeqArgs < seqArgsLength) {
+                seqNtp.getEntry(indexSeqArgs, tvpNtp);
+                if (tvpNtp.getTag() != ValueTag.NODE_TREE_TAG) {
+                    String description = ErrorCode.SYSE0001 + ": " + ErrorCode.SYSE0001.getDescription();
+                    throw new AlgebricksException(description);
+                }
+                tvpNtp.getValue(ntp);
+                ntp.getRootNode(tvpStep);
+                if (stepNodeTree(tvpStep, 0, result)) {
+                    return true;
+                }
+            }
+        } else {
+            // Single node tree input.
+            ntp.getRootNode(tvpStep);
+            if (stepNodeTree(tvpStep, 0, result)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Find the next node to return.
+     */
+    protected boolean stepNodeTree(TaggedValuePointable tvpInput, int level, IPointable result)
+            throws AlgebricksException {
+        getSequence(tvpInput, seqItem);
+        int seqLength = seqItem.getEntryCount();
+        while (indexSequence < seqLength) {
+            // Get the next item
+            seqItem.getEntry(indexSequence, tvpItem);
+
+            // Test to see if the item fits the path step
+            if (filter.accept(ntp, tvpItem)) {
+                try {
+                    setNodeToResult(tvpItem, result);
+                    ++indexSequence;
+                    return true;
+                } catch (IOException e) {
+                    String description = ErrorCode.SYSE0001 + ": " + ErrorCode.SYSE0001.getDescription();
+                    throw new AlgebricksException(description);
+                }
+            }
+            ++indexSequence;
+        }
+        // Reset for next node tree.
+        indexSequence = 0;
+        return false;
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f72feda7/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepUnnestingEvaluator.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepUnnestingEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepUnnestingEvaluator.java
new file mode 100644
index 0000000..02515c4
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepUnnestingEvaluator.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.runtime.functions.step;
+
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.exceptions.SystemException;
+import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentUnnestingEvaluator;
+
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+
+public class ChildPathStepUnnestingEvaluator extends AbstractTaggedValueArgumentUnnestingEvaluator {
+    final ChildPathStepUnnesting childPathStep;
+
+    public ChildPathStepUnnestingEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) {
+        super(args);
+        childPathStep = new ChildPathStepUnnesting(ctx, ppool);
+    }
+
+    public boolean step(IPointable result) throws AlgebricksException {
+        return childPathStep.step(result);
+    }
+
+    @Override
+    protected void init(TaggedValuePointable[] args) throws SystemException {
+        childPathStep.init(args);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f72feda7/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepUnnestingEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepUnnestingEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepUnnestingEvaluatorFactory.java
index 78b6ae9..fc9844a 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepUnnestingEvaluatorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepUnnestingEvaluatorFactory.java
@@ -16,9 +16,6 @@
  */
 package org.apache.vxquery.runtime.functions.step;
 
-import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
-import org.apache.vxquery.exceptions.SystemException;
-import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentUnnestingEvaluator;
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentUnnestingEvaluatorFactory;
 
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -26,7 +23,6 @@ import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import edu.uci.ics.hyracks.algebricks.runtime.base.IUnnestingEvaluator;
 import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
-import edu.uci.ics.hyracks.data.std.api.IPointable;
 
 public class ChildPathStepUnnestingEvaluatorFactory extends AbstractTaggedValueArgumentUnnestingEvaluatorFactory {
     private static final long serialVersionUID = 1L;
@@ -38,18 +34,6 @@ public class ChildPathStepUnnestingEvaluatorFactory extends AbstractTaggedValueA
     @Override
     protected IUnnestingEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
             throws AlgebricksException {
-        final ChildPathStep childPathStep = new ChildPathStep(ctx);
-        
-        return new AbstractTaggedValueArgumentUnnestingEvaluator(args) {
-            @Override
-            public boolean step(IPointable result) throws AlgebricksException {
-                return childPathStep.step(result);
-            }
-
-            @Override
-            protected void init(TaggedValuePointable[] args) throws SystemException {
-                childPathStep.init(args);
-            }
-        };
+        return new ChildPathStepUnnestingEvaluator(ctx, args);
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f72feda7/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
index 9f1dba8..dbd45cb 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
@@ -20,6 +20,7 @@ import java.io.DataInputStream;
 import java.io.DataOutput;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.nio.ByteBuffer;
@@ -513,157 +514,6 @@ public class FunctionHelper {
         throw new SystemException(ErrorCode.XPTY0004);
     }
 
-    public static void atomize(TaggedValuePointable tvp, IPointable result) throws IOException {
-        NodeTreePointable ntp = (NodeTreePointable) NodeTreePointable.FACTORY.createPointable();
-        switch (tvp.getTag()) {
-            case ValueTag.NODE_TREE_TAG:
-                tvp.getValue(ntp);
-                atomizeNode(ntp, result);
-                break;
-
-            default:
-                result.set(tvp);
-        }
-    }
-
-    public static void atomizeNode(NodeTreePointable ntp, IPointable result) throws IOException {
-        ArrayBackedValueStorage tempABVS = new ArrayBackedValueStorage();
-        TaggedValuePointable tempTVP = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
-        VoidPointable vp = (VoidPointable) VoidPointable.FACTORY.createPointable();
-        PointablePool pp = PointablePoolFactory.INSTANCE.createPointablePool();
-        ntp.getRootNode(tempTVP);
-        switch (tempTVP.getTag()) {
-            case ValueTag.ATTRIBUTE_NODE_TAG: {
-                AttributeNodePointable anp = pp.takeOne(AttributeNodePointable.class);
-                try {
-                    tempTVP.getValue(anp);
-                    anp.getValue(ntp, result);
-                } finally {
-                    pp.giveBack(anp);
-                }
-                break;
-            }
-
-            case ValueTag.TEXT_NODE_TAG:
-            case ValueTag.COMMENT_NODE_TAG: {
-                TextOrCommentNodePointable tcnp = pp.takeOne(TextOrCommentNodePointable.class);
-                try {
-                    tempTVP.getValue(tcnp);
-                    tcnp.getValue(ntp, vp);
-                    tempABVS.reset();
-                    tempABVS.getDataOutput().write(ValueTag.XS_UNTYPED_ATOMIC_TAG);
-                    tempABVS.append(vp);
-                    result.set(tempABVS.getByteArray(), tempABVS.getStartOffset(), tempABVS.getLength());
-                } finally {
-                    pp.giveBack(tcnp);
-                }
-                break;
-            }
-
-            case ValueTag.DOCUMENT_NODE_TAG: {
-                DocumentNodePointable dnp = pp.takeOne(DocumentNodePointable.class);
-                SequencePointable sp = pp.takeOne(SequencePointable.class);
-                try {
-                    tempTVP.getValue(dnp);
-                    dnp.getContent(ntp, sp);
-                    buildStringConcatenation(sp, tempABVS, ntp);
-                    result.set(tempABVS.getByteArray(), tempABVS.getStartOffset(), tempABVS.getLength());
-                } finally {
-                    pp.giveBack(sp);
-                    pp.giveBack(dnp);
-                }
-                break;
-            }
-
-            case ValueTag.ELEMENT_NODE_TAG: {
-                ElementNodePointable enp = pp.takeOne(ElementNodePointable.class);
-                SequencePointable sp = pp.takeOne(SequencePointable.class);
-                try {
-                    tempTVP.getValue(enp);
-                    if (enp.childrenChunkExists()) {
-                        enp.getChildrenSequence(ntp, sp);
-                        buildStringConcatenation(sp, tempABVS, ntp);
-                        result.set(tempABVS.getByteArray(), tempABVS.getStartOffset(), tempABVS.getLength());
-                    }
-                } finally {
-                    pp.giveBack(sp);
-                    pp.giveBack(enp);
-                }
-                break;
-            }
-
-            case ValueTag.PI_NODE_TAG: {
-                PINodePointable pnp = pp.takeOne(PINodePointable.class);
-                try {
-                    tempTVP.getValue(pnp);
-                    pnp.getContent(ntp, vp);
-                    tempABVS.reset();
-                    tempABVS.getDataOutput().write(ValueTag.XS_UNTYPED_ATOMIC_TAG);
-                    tempABVS.append(vp);
-                    result.set(tempABVS.getByteArray(), tempABVS.getStartOffset(), tempABVS.getLength());
-                } finally {
-                    pp.giveBack(pnp);
-                }
-                break;
-            }
-
-        }
-    }
-
-    public static void buildStringConcatenation(SequencePointable sp, ArrayBackedValueStorage tempABVS,
-            NodeTreePointable ntp) throws IOException {
-        tempABVS.reset();
-        DataOutput out = tempABVS.getDataOutput();
-        out.write(ValueTag.XS_UNTYPED_ATOMIC_TAG);
-        // Leave room for the utf-8 length
-        out.write(0);
-        out.write(0);
-        buildConcatenationRec(sp, out, ntp);
-        int utflen = tempABVS.getLength() - 3;
-        byte[] bytes = tempABVS.getByteArray();
-        // Patch utf-8 length at bytes 1 and 2
-        bytes[1] = (byte) ((utflen >>> 8) & 0xFF);
-        bytes[2] = (byte) ((utflen >>> 0) & 0xFF);
-    }
-
-    public static void buildConcatenationRec(SequencePointable sp, DataOutput out, NodeTreePointable ntp)
-            throws IOException {
-        TaggedValuePointable tempTVP2 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
-        VoidPointable vp = (VoidPointable) VoidPointable.FACTORY.createPointable();
-        PointablePool pp = PointablePoolFactory.INSTANCE.createPointablePool();
-        int nItems = sp.getEntryCount();
-        for (int i = 0; i < nItems; ++i) {
-            sp.getEntry(i, tempTVP2);
-            switch (tempTVP2.getTag()) {
-                case ValueTag.TEXT_NODE_TAG: {
-                    TextOrCommentNodePointable tcnp = pp.takeOne(TextOrCommentNodePointable.class);
-                    try {
-                        tempTVP2.getValue(tcnp);
-                        tcnp.getValue(ntp, vp);
-                        out.write(vp.getByteArray(), vp.getStartOffset() + 2, vp.getLength() - 2);
-                    } finally {
-                        pp.giveBack(tcnp);
-                    }
-                    break;
-                }
-                case ValueTag.ELEMENT_NODE_TAG: {
-                    ElementNodePointable enp = pp.takeOne(ElementNodePointable.class);
-                    SequencePointable sp2 = pp.takeOne(SequencePointable.class);
-                    try {
-                        tempTVP2.getValue(enp);
-                        if (enp.childrenChunkExists()) {
-                            enp.getChildrenSequence(ntp, sp2);
-                            buildConcatenationRec(sp2, out, ntp);
-                        }
-                    } finally {
-                        pp.giveBack(sp2);
-                        pp.giveBack(enp);
-                    }
-                }
-            }
-        }
-    }
-
     public static boolean compareTaggedValues(AbstractValueComparisonOperation aOp, TaggedValuePointable tvp1,
             TaggedValuePointable tvp2, DynamicContext dCtx) throws SystemException {
         final TypedPointables tp1 = new TypedPointables();
@@ -1389,39 +1239,24 @@ public class FunctionHelper {
         System.err.println(" printUTF8String END");
     }
 
-    /**
-     * Checks the path has an acceptable file name extension to read in.
-     * 
-     * @param path
-     * @return
-     */
-    public static boolean readableXmlFile(String path) {
-        if (path.toLowerCase().endsWith(".xml") || path.toLowerCase().endsWith(".xml.gz")) {
-            return true;
-        }
-        return false;
-    }
-
     public static void readInDocFromPointable(UTF8StringPointable stringp, InputSource in, ByteBufferInputStream bbis,
-            DataInputStream di, ArrayBackedValueStorage abvs, ITreeNodeIdProvider treeNodeIdProvider)
-            throws SystemException {
+            DataInputStream di, ArrayBackedValueStorage abvs, XMLParser parser) throws SystemException {
         String fName = getStringFromPointable(stringp, bbis, di);
-        readInDocFromString(fName, in, abvs, treeNodeIdProvider);
+        File file = new File(fName);
+        readInDocFromString(file, in, abvs, parser);
     }
 
-    public static void readInDocFromString(String fName, InputSource in, ArrayBackedValueStorage abvs,
-            ITreeNodeIdProvider treeNodeIdProvider) throws SystemException {
-        File file = new File(fName);
-        if (!file.exists()) {
-            throw new RuntimeException("The file (" + fName + ") does not exist.");
-        }
+    public static void readInDocFromString(File file, InputSource in, ArrayBackedValueStorage abvs, XMLParser parser)
+            throws SystemException {
         try {
-            if (fName.toLowerCase().endsWith(".xml.gz")) {
-                in.setCharacterStream(new InputStreamReader(new GZIPInputStream(new FileInputStream(fName))));
+            if (file.getName().toLowerCase().endsWith(".xml.gz")) {
+                in.setCharacterStream(new InputStreamReader(new GZIPInputStream(new FileInputStream(file))));
             } else {
-                in.setCharacterStream(new InputStreamReader(new FileInputStream(fName)));
+                in.setCharacterStream(new InputStreamReader(new FileInputStream(file)));
             }
-            XMLParser.parseInputSource(in, abvs, false, treeNodeIdProvider);
+            parser.parseInputSource(in, abvs);
+        } catch (FileNotFoundException e) {
+            throw new RuntimeException("The file (" + file.getName() + ") does not exist.");
         } catch (IOException e) {
             throw new SystemException(ErrorCode.SYSE0001, e);
         }

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f72feda7/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/SAXContentHandler.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/SAXContentHandler.java b/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/SAXContentHandler.java
index ecf4d7d..a8ec0b9 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/SAXContentHandler.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/SAXContentHandler.java
@@ -162,6 +162,8 @@ public class SAXContentHandler implements ContentHandler, LexicalHandler {
     @Override
     public void startDocument() throws SAXException {
         try {
+            db.reset();
+            docABVS.reset();
             docb.reset(docABVS);
             if (createNodeIds) {
                 docb.setLocalNodeId(nodeIdCounter++);

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/f72feda7/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java b/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java
index fee41df..c2ada24 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java
@@ -20,9 +20,36 @@ import org.xml.sax.InputSource;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLReaderFactory;
 
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
 
 public class XMLParser {
+    XMLReader parser;
+    SAXContentHandler handler;
+
+    public XMLParser(boolean attachTypes, ITreeNodeIdProvider idProvider) throws HyracksDataException {
+        try {
+            parser = XMLReaderFactory.createXMLReader();
+            handler = new SAXContentHandler(attachTypes, idProvider);
+            parser.setContentHandler(handler);
+            parser.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
+        } catch (Exception e) {
+            throw new HyracksDataException(e.toString());
+        }
+    }
+
+    public void parseInputSource(InputSource in, ArrayBackedValueStorage abvs) throws HyracksDataException {
+        try {
+            parser.parse(in);
+            handler.write(abvs);
+        } catch (Exception e) {
+            throw new HyracksDataException(e.toString());
+        }
+    }
+
+    public void reset() throws SystemException {
+    }
+
     public static void parseInputSource(InputSource in, ArrayBackedValueStorage abvs, boolean attachTypes,
             ITreeNodeIdProvider idProvider) throws SystemException {
         XMLReader parser;


[24/25] git commit: Added default values for start and end date. Now they are only updated when timing is enabled.

Posted by ti...@apache.org.
Added default values for start and end date. Now they are only updated when timing is enabled.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/dcce8f7d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/dcce8f7d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/dcce8f7d

Branch: refs/heads/westmann/prettyprint
Commit: dcce8f7de63aaa807e6a8d46d82c75b4aa062b7d
Parents: b594f02
Author: Preston Carman <pr...@apache.org>
Authored: Wed Feb 19 11:21:56 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Wed Feb 19 11:21:56 2014 -0800

----------------------------------------------------------------------
 .../src/main/java/org/apache/vxquery/cli/VXQuery.java        | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/dcce8f7d/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
----------------------------------------------------------------------
diff --git a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
index da6f40b..7e3abfc 100644
--- a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
+++ b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
@@ -169,8 +169,8 @@ public class VXQuery {
      * @throws Exception
      */
     private void runQueries() throws IOException, SystemException, Exception {
-        Date start;
-        Date end;
+        Date start = null;
+        Date end = null;
         for (String query : opts.arguments) {
             String qStr = slurp(query);
             if (opts.showQuery) {
@@ -248,7 +248,7 @@ public class VXQuery {
                 }
             };
 
-            start = new Date();
+            start = opts.timing ? new Date() : null;
             XMLQueryCompiler compiler = new XMLQueryCompiler(listener, getNodeList(), opts.frameSize);
             resultSetId = createResultSetId();
             CompilerControlBlock ccb = new CompilerControlBlock(new StaticContextImpl(RootStaticContextImpl.INSTANCE),
@@ -274,7 +274,7 @@ public class VXQuery {
             PrintWriter writer = new PrintWriter(System.out, true);
             // Repeat execution for number of times provided in -repeatexec argument
             for (int i = 0; i < opts.repeatExec; ++i) {
-                start = new Date();
+                start = opts.timing ? new Date() : null;
                 runJob(js, writer);
                 // if -timing argument passed, show the starting and ending times
                 if (opts.timing) {


[06/25] git commit: Added short circuiting for both AND and OR scalar evaluators.

Posted by ti...@apache.org.
Added short circuiting for both AND and OR scalar evaluators.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/442f5845
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/442f5845
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/442f5845

Branch: refs/heads/westmann/prettyprint
Commit: 442f5845ead4dbb70442feb168cb69b3e6dc2d82
Parents: de02fe5
Author: Preston Carman <pr...@apache.org>
Authored: Thu Feb 13 11:26:31 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Feb 13 11:26:31 2014 -0800

----------------------------------------------------------------------
 .../bool/AndScalarEvaluatorFactory.java         | 41 +++++++++++++-------
 .../bool/OrScalarEvaluatorFactory.java          | 40 ++++++++++++-------
 2 files changed, 51 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/442f5845/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/AndScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/AndScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/AndScalarEvaluatorFactory.java
index b1785de..15570a8 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/AndScalarEvaluatorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/AndScalarEvaluatorFactory.java
@@ -18,8 +18,6 @@ package org.apache.vxquery.runtime.functions.bool;
 
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.values.XDMConstants;
-import org.apache.vxquery.exceptions.SystemException;
-import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator;
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
 
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -28,6 +26,7 @@ import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
 import edu.uci.ics.hyracks.data.std.api.IPointable;
 import edu.uci.ics.hyracks.data.std.primitive.BooleanPointable;
+import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class AndScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
@@ -39,20 +38,32 @@ public class AndScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalar
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
             throws AlgebricksException {
-        return new AbstractTaggedValueArgumentScalarEvaluator(args) {
-            private final BooleanPointable bp = (BooleanPointable) BooleanPointable.FACTORY.createPointable();
-
-            @Override
-            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
-                for (TaggedValuePointable arg : args) {
-                    arg.getValue(bp);
-                    if (!bp.getBoolean()) {
-                        XDMConstants.setFalse(result);
-                        return;
-                    }
+        return new AndScalarEvaluator(args);
+    }
+
+    private class AndScalarEvaluator implements IScalarEvaluator {
+        private final IScalarEvaluator[] args;
+
+        private final BooleanPointable bp = (BooleanPointable) BooleanPointable.FACTORY.createPointable();
+
+        private final TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+
+        public AndScalarEvaluator(IScalarEvaluator[] args) {
+            this.args = args;
+        }
+
+        @Override
+        public final void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+            for (int i = 0; i < args.length; ++i) {
+                args[i].evaluate(tuple, tvp);
+                tvp.getValue(bp);
+                if (!bp.getBoolean()) {
+                    XDMConstants.setFalse(result);
+                    return;
                 }
-                XDMConstants.setTrue(result);
             }
-        };
+            XDMConstants.setTrue(result);
+        }
     }
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/442f5845/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/OrScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/OrScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/OrScalarEvaluatorFactory.java
index 5309ba5..c09de95 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/OrScalarEvaluatorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/OrScalarEvaluatorFactory.java
@@ -18,8 +18,6 @@ package org.apache.vxquery.runtime.functions.bool;
 
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.values.XDMConstants;
-import org.apache.vxquery.exceptions.SystemException;
-import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator;
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
 
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -28,6 +26,7 @@ import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
 import edu.uci.ics.hyracks.data.std.api.IPointable;
 import edu.uci.ics.hyracks.data.std.primitive.BooleanPointable;
+import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class OrScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
@@ -39,20 +38,31 @@ public class OrScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarE
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
             throws AlgebricksException {
-        return new AbstractTaggedValueArgumentScalarEvaluator(args) {
-            private final BooleanPointable bp = (BooleanPointable) BooleanPointable.FACTORY.createPointable();
-
-            @Override
-            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
-                for (TaggedValuePointable arg : args) {
-                    arg.getValue(bp);
-                    if (bp.getBoolean()) {
-                        XDMConstants.setTrue(result);
-                        return;
-                    }
+        return new OrScalarEvaluator(args);
+    }
+
+    private class OrScalarEvaluator implements IScalarEvaluator {
+        private final IScalarEvaluator[] args;
+
+        private final BooleanPointable bp = (BooleanPointable) BooleanPointable.FACTORY.createPointable();
+
+        private final TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+
+        public OrScalarEvaluator(IScalarEvaluator[] args) {
+            this.args = args;
+        }
+
+        @Override
+        public final void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+            for (int i = 0; i < args.length; ++i) {
+                args[i].evaluate(tuple, tvp);
+                tvp.getValue(bp);
+                if (bp.getBoolean()) {
+                    XDMConstants.setTrue(result);
+                    return;
                 }
-                XDMConstants.setFalse(result);
             }
-        };
+            XDMConstants.setFalse(result);
+        }
     }
 }
\ No newline at end of file


[16/25] git commit: Switched out the binary search in dictionary builder for a tree map that has constant look up and items are sorted.

Posted by ti...@apache.org.
Switched out the binary search in dictionary builder for a tree map that has constant look up and items are sorted.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/63f51a7a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/63f51a7a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/63f51a7a

Branch: refs/heads/westmann/prettyprint
Commit: 63f51a7a134451ec463d7896c0547aca7bad524f
Parents: bc1ff5a
Author: Preston Carman <pr...@apache.org>
Authored: Mon Feb 17 10:05:13 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Mon Feb 17 10:05:13 2014 -0800

----------------------------------------------------------------------
 .../builders/nodes/DictionaryBuilder.java       | 45 +++++++++++++-------
 1 file changed, 29 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/63f51a7a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java
index 20b7333..6a98b3d 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java
@@ -19,6 +19,10 @@ package org.apache.vxquery.datamodel.builders.nodes;
 import java.io.DataOutput;
 import java.io.DataOutputStream;
 import java.io.IOException;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeMap;
 
 import org.apache.vxquery.util.GrowableIntArray;
 
@@ -40,9 +44,7 @@ public class DictionaryBuilder {
 
     private final ByteArrayAccessibleOutputStream tempStringData;
 
-    private final DataOutput tempOut;
-
-    private final UTF8StringPointable tempStringPointable;
+    private final TreeMap<String, Integer> hashSlotIndexes;
 
     private final IValueReferenceVector sortedStringsVector = new IValueReferenceVector() {
         @Override
@@ -75,15 +77,15 @@ public class DictionaryBuilder {
         dataBuffer = new ByteArrayAccessibleOutputStream();
         dataBufferOut = new DataOutputStream(dataBuffer);
         tempStringData = new ByteArrayAccessibleOutputStream();
-        tempOut = new DataOutputStream(tempStringData);
-        tempStringPointable = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable();
+        hashSlotIndexes = new TreeMap<String, Integer>();
     }
-    
+
     public void reset() {
         stringEndOffsets.clear();
         sortedSlotIndexes.clear();
         dataBuffer.reset();
         tempStringData.reset();
+        hashSlotIndexes.clear();
     }
 
     public void write(ArrayBackedValueStorage abvs) throws IOException {
@@ -96,23 +98,34 @@ public class DictionaryBuilder {
         for (int i = 0; i < entryCount; ++i) {
             out.writeInt(entryOffsets[i]);
         }
-        int[] sortedOffsets = sortedSlotIndexes.getArray();
-        for (int i = 0; i < entryCount; ++i) {
-            out.writeInt(sortedOffsets[i]);
+        if (hashSlotIndexes.isEmpty()) {
+            int[] sortedOffsets = sortedSlotIndexes.getArray();
+            for (int i = 0; i < entryCount; ++i) {
+                out.writeInt(sortedOffsets[i]);
+            }
+        } else {
+            for (Entry<String, Integer> me : hashSlotIndexes.entrySet()) {
+                out.writeInt((Integer) me.getValue());
+            }
         }
         out.write(dataBuffer.getByteArray(), 0, dataBuffer.size());
         IntegerPointable.setInteger(abvs.getByteArray(), sizeOffset, abvs.getLength() - sizeOffset);
     }
 
     public int lookup(String str) {
-        tempStringData.reset();
-        try {
-            tempOut.writeUTF(str);
-        } catch (IOException e) {
-            throw new IllegalStateException(e);
+        Integer slotIndex = hashSlotIndexes.get(str);
+        if (slotIndex == null) {
+            try {
+                dataBufferOut.writeUTF(str);
+                slotIndex = stringEndOffsets.getSize();
+                dataBufferOut.writeInt(slotIndex);
+            } catch (IOException e) {
+                throw new IllegalStateException(e);
+            }
+            stringEndOffsets.append(dataBuffer.size());
+            hashSlotIndexes.put(str, slotIndex);
         }
-        tempStringPointable.set(tempStringData.getByteArray(), 0, tempStringData.size());
-        return lookup(tempStringPointable);
+        return slotIndex;
     }
 
     public int lookup(UTF8StringPointable str) {


[20/25] git commit: Making sub classes static.

Posted by ti...@apache.org.
Making sub classes static.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/5673d9ea
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/5673d9ea
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/5673d9ea

Branch: refs/heads/westmann/prettyprint
Commit: 5673d9ea0352a89d9cb690923d27c037ef26c0e1
Parents: ed696a5
Author: Preston Carman <pr...@apache.org>
Authored: Tue Feb 18 09:36:54 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Tue Feb 18 10:06:09 2014 -0800

----------------------------------------------------------------------
 .../vxquery/runtime/functions/bool/AndScalarEvaluatorFactory.java  | 2 +-
 .../runtime/functions/bool/FnBooleanScalarEvaluatorFactory.java    | 2 +-
 .../vxquery/runtime/functions/bool/OrScalarEvaluatorFactory.java   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/5673d9ea/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/AndScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/AndScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/AndScalarEvaluatorFactory.java
index 15570a8..c66261c 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/AndScalarEvaluatorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/AndScalarEvaluatorFactory.java
@@ -41,7 +41,7 @@ public class AndScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalar
         return new AndScalarEvaluator(args);
     }
 
-    private class AndScalarEvaluator implements IScalarEvaluator {
+    private static class AndScalarEvaluator implements IScalarEvaluator {
         private final IScalarEvaluator[] args;
 
         private final BooleanPointable bp = (BooleanPointable) BooleanPointable.FACTORY.createPointable();

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/5673d9ea/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/FnBooleanScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/FnBooleanScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/FnBooleanScalarEvaluatorFactory.java
index 86104c8..a6a1d0b 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/FnBooleanScalarEvaluatorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/FnBooleanScalarEvaluatorFactory.java
@@ -52,7 +52,7 @@ public class FnBooleanScalarEvaluatorFactory extends AbstractTaggedValueArgument
         return new FnBooleanScalarEvaluator(args);
     }
 
-    private class FnBooleanScalarEvaluator extends AbstractTaggedValueArgumentScalarEvaluator {
+    private static class FnBooleanScalarEvaluator extends AbstractTaggedValueArgumentScalarEvaluator {
         final SequencePointable seqp = new SequencePointable();
         final LongPointable lp = (LongPointable) LongPointable.FACTORY.createPointable();
         final IntegerPointable ip = (IntegerPointable) IntegerPointable.FACTORY.createPointable();

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/5673d9ea/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/OrScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/OrScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/OrScalarEvaluatorFactory.java
index c09de95..23d7ad9 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/OrScalarEvaluatorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/OrScalarEvaluatorFactory.java
@@ -41,7 +41,7 @@ public class OrScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarE
         return new OrScalarEvaluator(args);
     }
 
-    private class OrScalarEvaluator implements IScalarEvaluator {
+    private static class OrScalarEvaluator implements IScalarEvaluator {
         private final IScalarEvaluator[] args;
 
         private final BooleanPointable bp = (BooleanPointable) BooleanPointable.FACTORY.createPointable();


[13/25] git commit: A few more little clean up items.

Posted by ti...@apache.org.
A few more little clean up items.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/e88b8e16
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/e88b8e16
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/e88b8e16

Branch: refs/heads/westmann/prettyprint
Commit: e88b8e16fdac581945540d616e4fa8af44a2f537
Parents: 6a4624e
Author: Preston Carman <pr...@apache.org>
Authored: Thu Feb 13 16:17:17 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Feb 13 16:17:17 2014 -0800

----------------------------------------------------------------------
 .../ElementNodeConstructorScalarEvaluator.java  |  5 ---
 .../AbstractNumericScalarEvaluatorFactory.java  | 42 +------------------
 ...tractNumericUnaryScalarEvaluatorFactory.java | 44 +-------------------
 .../src/main/resources/scripts/README.md        | 16 +++++++
 4 files changed, 18 insertions(+), 89 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/e88b8e16/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ElementNodeConstructorScalarEvaluator.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ElementNodeConstructorScalarEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ElementNodeConstructorScalarEvaluator.java
index f3e9065..bf9b484 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ElementNodeConstructorScalarEvaluator.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ElementNodeConstructorScalarEvaluator.java
@@ -20,8 +20,6 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.vxquery.datamodel.accessors.PointablePool;
-import org.apache.vxquery.datamodel.accessors.PointablePoolFactory;
 import org.apache.vxquery.datamodel.accessors.SequencePointable;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.accessors.atomic.CodedQNamePointable;
@@ -58,8 +56,6 @@ public class ElementNodeConstructorScalarEvaluator extends AbstractNodeConstruct
 
     private final SequencePointable seqp;
 
-    private final PointablePool ppool;
-
     public ElementNodeConstructorScalarEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) {
         super(ctx, args);
         enb = new ElementNodeBuilder();
@@ -69,7 +65,6 @@ public class ElementNodeConstructorScalarEvaluator extends AbstractNodeConstruct
         cqp = (CodedQNamePointable) CodedQNamePointable.FACTORY.createPointable();
         strp = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable();
         seqp = (SequencePointable) SequencePointable.FACTORY.createPointable();
-        ppool = PointablePoolFactory.INSTANCE.createPointablePool();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/e88b8e16/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/AbstractNumericScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/AbstractNumericScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/AbstractNumericScalarEvaluatorFactory.java
index ff7b8fa..65aaac4 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/AbstractNumericScalarEvaluatorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/AbstractNumericScalarEvaluatorFactory.java
@@ -100,7 +100,7 @@ public abstract class AbstractNumericScalarEvaluatorFactory extends AbstractTagg
                                 case ValueTag.XS_BYTE_TAG:
                                 case ValueTag.XS_UNSIGNED_BYTE_TAG:
                                     abvsInteger.reset();
-                                    getIntegerPointable(tp, tvp, dOutInteger);
+                                    FunctionHelper.getIntegerPointable(tvp, dOutInteger);
                                     longp.set(abvsInteger.getByteArray(), abvsInteger.getStartOffset() + 1,
                                             LongPointable.TYPE_TRAITS.getFixedLength());
                             }
@@ -128,46 +128,6 @@ public abstract class AbstractNumericScalarEvaluatorFactory extends AbstractTagg
                 throw new SystemException(ErrorCode.XPTY0004);
             }
 
-            private void getIntegerPointable(TypedPointables tp, TaggedValuePointable tvp, DataOutput dOut)
-                    throws SystemException, IOException {
-                long value;
-                switch (tvp.getTag()) {
-                    case ValueTag.XS_INTEGER_TAG:
-                    case ValueTag.XS_LONG_TAG:
-                    case ValueTag.XS_NEGATIVE_INTEGER_TAG:
-                    case ValueTag.XS_NON_POSITIVE_INTEGER_TAG:
-                    case ValueTag.XS_NON_NEGATIVE_INTEGER_TAG:
-                    case ValueTag.XS_POSITIVE_INTEGER_TAG:
-                    case ValueTag.XS_UNSIGNED_INT_TAG:
-                    case ValueTag.XS_UNSIGNED_LONG_TAG:
-                        tvp.getValue(tp.longp);
-                        value = tp.longp.longValue();
-                        break;
-
-                    case ValueTag.XS_INT_TAG:
-                    case ValueTag.XS_UNSIGNED_SHORT_TAG:
-                        tvp.getValue(tp.intp);
-                        value = tp.intp.longValue();
-                        break;
-
-                    case ValueTag.XS_SHORT_TAG:
-                    case ValueTag.XS_UNSIGNED_BYTE_TAG:
-                        tvp.getValue(tp.shortp);
-                        value = tp.shortp.longValue();
-                        break;
-
-                    case ValueTag.XS_BYTE_TAG:
-                        tvp.getValue(tp.bytep);
-                        value = tp.bytep.longValue();
-                        break;
-
-                    default:
-                        value = 0;
-                }
-                dOut.write(ValueTag.XS_INTEGER_TAG);
-                dOut.writeLong(value);
-            }
-
             private int getBaseTypeForArithmetics(int tid) throws SystemException {
                 while (true) {
                     switch (tid) {

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/e88b8e16/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/unary/AbstractNumericUnaryScalarEvaluatorFactory.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/unary/AbstractNumericUnaryScalarEvaluatorFactory.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/unary/AbstractNumericUnaryScalarEvaluatorFactory.java
index ba818da..9919f34 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/unary/AbstractNumericUnaryScalarEvaluatorFactory.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/unary/AbstractNumericUnaryScalarEvaluatorFactory.java
@@ -17,7 +17,6 @@
 package org.apache.vxquery.runtime.functions.unary;
 
 import java.io.DataOutput;
-import java.io.IOException;
 
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.values.ValueTag;
@@ -26,7 +25,6 @@ import org.apache.vxquery.exceptions.SystemException;
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator;
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
 import org.apache.vxquery.runtime.functions.util.FunctionHelper;
-import org.apache.vxquery.runtime.functions.util.FunctionHelper.TypedPointables;
 import org.apache.vxquery.types.BuiltinTypeRegistry;
 
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -87,7 +85,7 @@ public abstract class AbstractNumericUnaryScalarEvaluatorFactory extends
                                 case ValueTag.XS_BYTE_TAG:
                                 case ValueTag.XS_UNSIGNED_BYTE_TAG:
                                     abvsInteger.reset();
-                                    getIntegerPointable(tp, tvp, dOutInteger);
+                                    FunctionHelper.getIntegerPointable(tvp, ppool, dOutInteger);
                                     longp.set(abvsInteger.getByteArray(), abvsInteger.getStartOffset() + 1,
                                             LongPointable.TYPE_TRAITS.getFixedLength());
                             }
@@ -115,46 +113,6 @@ public abstract class AbstractNumericUnaryScalarEvaluatorFactory extends
                 throw new SystemException(ErrorCode.XPTY0004);
             }
 
-            private void getIntegerPointable(TypedPointables tp, TaggedValuePointable tvp, DataOutput dOut)
-                    throws SystemException, IOException {
-                long value;
-                switch (tvp.getTag()) {
-                    case ValueTag.XS_INTEGER_TAG:
-                    case ValueTag.XS_LONG_TAG:
-                    case ValueTag.XS_NEGATIVE_INTEGER_TAG:
-                    case ValueTag.XS_NON_POSITIVE_INTEGER_TAG:
-                    case ValueTag.XS_NON_NEGATIVE_INTEGER_TAG:
-                    case ValueTag.XS_POSITIVE_INTEGER_TAG:
-                    case ValueTag.XS_UNSIGNED_INT_TAG:
-                    case ValueTag.XS_UNSIGNED_LONG_TAG:
-                        tvp.getValue(tp.longp);
-                        value = tp.longp.longValue();
-                        break;
-
-                    case ValueTag.XS_INT_TAG:
-                    case ValueTag.XS_UNSIGNED_SHORT_TAG:
-                        tvp.getValue(tp.intp);
-                        value = tp.intp.longValue();
-                        break;
-
-                    case ValueTag.XS_SHORT_TAG:
-                    case ValueTag.XS_UNSIGNED_BYTE_TAG:
-                        tvp.getValue(tp.shortp);
-                        value = tp.shortp.longValue();
-                        break;
-
-                    case ValueTag.XS_BYTE_TAG:
-                        tvp.getValue(tp.bytep);
-                        value = tp.bytep.longValue();
-                        break;
-
-                    default:
-                        value = 0;
-                }
-                dOut.write(ValueTag.XS_INTEGER_TAG);
-                dOut.writeLong(value);
-            }
-
             private int getBaseTypeForArithmetics(int tid) throws SystemException {
                 while (true) {
                     switch (tid) {

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/e88b8e16/vxquery-server/src/main/resources/scripts/README.md
----------------------------------------------------------------------
diff --git a/vxquery-server/src/main/resources/scripts/README.md b/vxquery-server/src/main/resources/scripts/README.md
new file mode 100644
index 0000000..921e6ee
--- /dev/null
+++ b/vxquery-server/src/main/resources/scripts/README.md
@@ -0,0 +1,16 @@
+Utilities for Cluster Operations
+=====================
+
+# Introduction
+
+Helpful scripts to work with the VXQuery cluster.
+
+## Cluster Cli
+
+The CLI script includes options to deploy, start, and stop a cluster.
+
+Example commands:
+python cluster_cli.py -c ../conf/cluster.xml -a deploy -d /apache-vxquery/vxquery-server
+python cluster_cli.py -c ../conf/cluster.xml -a deploy -d /apache-vxquery/vxquery-cli
+python cluster_cli.py -c ../conf/cluster.xml -a start
+python cluster_cli.py -c ../conf/cluster.xml -a stop
\ No newline at end of file


[23/25] git commit: Changed the function name to be more consistent with other classes.

Posted by ti...@apache.org.
Changed the function name to be more consistent with other classes.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/b594f027
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/b594f027
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/b594f027

Branch: refs/heads/westmann/prettyprint
Commit: b594f0273c55119fd15e64df8a2f15fcaaa8c44b
Parents: ef04365
Author: Preston Carman <pr...@apache.org>
Authored: Wed Feb 19 11:19:37 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Wed Feb 19 11:19:37 2014 -0800

----------------------------------------------------------------------
 .../rewriter/rules/RemoveRedundantTreatExpressionsRule.java        | 2 +-
 .../apache/vxquery/runtime/functions/type/SequenceTypeMatcher.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/b594f027/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantTreatExpressionsRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantTreatExpressionsRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantTreatExpressionsRule.java
index ef23f30..60058bc 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantTreatExpressionsRule.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/RemoveRedundantTreatExpressionsRule.java
@@ -57,7 +57,7 @@ public class RemoveRedundantTreatExpressionsRule extends AbstractRemoveRedundant
     public boolean matchesAllInstancesOf(SequenceType sTypeArg, SequenceType sTypeOutput) {
         if (sTypeArg != null) {
             stm.setSequenceType(sTypeArg);
-            if (sTypeOutput != null && stm.isSubType(sTypeOutput)) {
+            if (sTypeOutput != null && stm.matchesAllInstances(sTypeOutput)) {
                 return true;
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/b594f027/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/type/SequenceTypeMatcher.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/type/SequenceTypeMatcher.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/type/SequenceTypeMatcher.java
index 5142ac4..12d0d93 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/type/SequenceTypeMatcher.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/type/SequenceTypeMatcher.java
@@ -153,7 +153,7 @@ public class SequenceTypeMatcher {
         return false;
     }
 
-    public boolean isSubType(SequenceType testST) {
+    public boolean matchesAllInstances(SequenceType testST) {
         Quantifier stq = sequenceType.getQuantifier();
         ItemType it = sequenceType.getItemType();
         if (stq.isSubQuantifier(testST.getQuantifier())) {


[07/25] git commit: Adding more variables to be reused.

Posted by ti...@apache.org.
Adding more variables to be reused.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/6d7c53ed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/6d7c53ed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/6d7c53ed

Branch: refs/heads/westmann/prettyprint
Commit: 6d7c53edf31c767bb5d29b42dc4c47ca61c713bc
Parents: 442f584
Author: Preston Carman <pr...@apache.org>
Authored: Thu Feb 13 11:27:25 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Feb 13 11:27:25 2014 -0800

----------------------------------------------------------------------
 .../functions/step/AbstractPathStepScalarEvaluator.java   | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/6d7c53ed/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AbstractPathStepScalarEvaluator.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AbstractPathStepScalarEvaluator.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AbstractPathStepScalarEvaluator.java
index 3f4d8e3..0532fda 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AbstractPathStepScalarEvaluator.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AbstractPathStepScalarEvaluator.java
@@ -35,20 +35,26 @@ import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
 public abstract class AbstractPathStepScalarEvaluator extends AbstractTaggedValueArgumentScalarEvaluator {
     protected final SequenceBuilder seqb;
 
+    private final NodeSubTreeBuilder nstb;
+    
     protected final NodeTreePointable ntp;
 
     private final ArrayBackedValueStorage nodeAbvs;
 
     protected final TaggedValuePointable itemTvp;
 
+    private final TaggedValuePointable node;
+    
     private INodeFilter filter;
-
+    
     public AbstractPathStepScalarEvaluator(IScalarEvaluator[] args, IHyracksTaskContext ctx) {
         super(args);
+        nstb = new NodeSubTreeBuilder();
         ntp = (NodeTreePointable) NodeTreePointable.FACTORY.createPointable();
         seqb = new SequenceBuilder();
         nodeAbvs = new ArrayBackedValueStorage();
         itemTvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
+        node = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
     }
 
     protected void setNodeTest(SequenceType sType) {
@@ -64,7 +70,6 @@ public abstract class AbstractPathStepScalarEvaluator extends AbstractTaggedValu
 
     protected void setNodeToResult(IPointable result) throws IOException {
         nodeAbvs.reset();
-        NodeSubTreeBuilder nstb = new NodeSubTreeBuilder();
         nstb.reset(nodeAbvs);
         nstb.setChildNode(ntp, itemTvp);
         nstb.finish();
@@ -72,7 +77,6 @@ public abstract class AbstractPathStepScalarEvaluator extends AbstractTaggedValu
     }
 
     protected void appendNodeToResult() throws IOException {
-        TaggedValuePointable node = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
         setNodeToResult(node);
         seqb.addItem(node);
     }


[17/25] git commit: Added a comment about the NodeTree structure.

Posted by ti...@apache.org.
Added a comment about the NodeTree structure.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/8a00d1b2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/8a00d1b2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/8a00d1b2

Branch: refs/heads/westmann/prettyprint
Commit: 8a00d1b270a05087e759fc479f5d1671dc030e66
Parents: 63f51a7
Author: Preston Carman <pr...@apache.org>
Authored: Mon Feb 17 13:07:26 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Mon Feb 17 13:07:26 2014 -0800

----------------------------------------------------------------------
 .../accessors/nodes/NodeTreePointable.java      | 25 ++++++++++++++++++++
 .../builders/nodes/DictionaryBuilder.java       |  2 --
 2 files changed, 25 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/8a00d1b2/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/NodeTreePointable.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/NodeTreePointable.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/NodeTreePointable.java
index 4a6afaa..4b0697f 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/NodeTreePointable.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/NodeTreePointable.java
@@ -29,6 +29,31 @@ import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
 import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
 import edu.uci.ics.hyracks.data.std.primitive.VoidPointable;
 
+/*
+ * NodeTree {
+ *  NodeTreeHeader header;
+ *  NodeId nodeId?;
+ *  Dictionary dictionary?;
+ *  ElementNode rootNode;
+ * }
+ * 
+ * ElementHeader (padded) {
+ *  bit nodeIdExists;
+ *  bit dictionaryExists;
+ *  bit headerTypeExists;
+ * }
+ * 
+ * NodeId {
+ *  int32 id;
+ * }
+ * 
+ * Dictionary {
+ *  int32 numberOfItems
+ *  int32[numberOfItems] lengthOfItem
+ *  int32[numberOfItems] sortedItemIndex
+ *  bytes[] itemData
+ * }
+ */
 public class NodeTreePointable extends AbstractPointable {
     public static final int HEADER_NODEID_EXISTS_MASK = (1 << 0);
     public static final int HEADER_DICTIONARY_EXISTS_MASK = (1 << 1);

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/8a00d1b2/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java
index 6a98b3d..db7ecf7 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java
@@ -19,9 +19,7 @@ package org.apache.vxquery.datamodel.builders.nodes;
 import java.io.DataOutput;
 import java.io.DataOutputStream;
 import java.io.IOException;
-import java.util.Map;
 import java.util.Map.Entry;
-import java.util.Set;
 import java.util.TreeMap;
 
 import org.apache.vxquery.util.GrowableIntArray;


[15/25] git commit: Cleaned up imports.

Posted by ti...@apache.org.
Cleaned up imports.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/bc1ff5ab
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/bc1ff5ab
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/bc1ff5ab

Branch: refs/heads/westmann/prettyprint
Commit: bc1ff5ab751d3ea269d1cbb04d92baab8c89df66
Parents: 80ffdd8
Author: Preston Carman <pr...@apache.org>
Authored: Thu Feb 13 16:33:39 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Feb 13 16:33:39 2014 -0800

----------------------------------------------------------------------
 .../apache/vxquery/runtime/functions/util/FunctionHelper.java    | 4 ----
 1 file changed, 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/bc1ff5ab/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
index dbd45cb..cd8d632 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
@@ -28,8 +28,6 @@ import java.util.Arrays;
 import java.util.zip.GZIPInputStream;
 
 import org.apache.vxquery.context.DynamicContext;
-import org.apache.vxquery.datamodel.accessors.PointablePool;
-import org.apache.vxquery.datamodel.accessors.PointablePoolFactory;
 import org.apache.vxquery.datamodel.accessors.SequencePointable;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.accessors.atomic.XSBinaryPointable;
@@ -59,7 +57,6 @@ import org.apache.vxquery.runtime.functions.strings.ICharacterIterator;
 import org.apache.vxquery.runtime.functions.strings.UTF8StringCharacterIterator;
 import org.apache.vxquery.types.BuiltinTypeConstants;
 import org.apache.vxquery.types.BuiltinTypeRegistry;
-import org.apache.vxquery.xmlparser.ITreeNodeIdProvider;
 import org.apache.vxquery.xmlparser.XMLParser;
 import org.xml.sax.InputSource;
 
@@ -72,7 +69,6 @@ import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
 import edu.uci.ics.hyracks.data.std.primitive.LongPointable;
 import edu.uci.ics.hyracks.data.std.primitive.ShortPointable;
 import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
-import edu.uci.ics.hyracks.data.std.primitive.VoidPointable;
 import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
 import edu.uci.ics.hyracks.dataflow.common.comm.util.ByteBufferInputStream;
 


[12/25] git commit: Update to the rules and renaming of one.

Posted by ti...@apache.org.
Update to the rules and renaming of one.


Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/6a4624e7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/6a4624e7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/6a4624e7

Branch: refs/heads/westmann/prettyprint
Commit: 6a4624e7b13c141fa8fd879f462da3d6e71ee83e
Parents: f72feda
Author: Preston Carman <pr...@apache.org>
Authored: Thu Feb 13 16:16:45 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Feb 13 16:16:45 2014 -0800

----------------------------------------------------------------------
 .../compiler/rewriter/RewriteRuleset.java       |  19 ++-
 .../rules/ConsolidateDataScanUnnestRule.java    | 151 -------------------
 .../rules/PushChildIntoDataScanRule.java        | 136 +++++++++++++++++
 3 files changed, 147 insertions(+), 159 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/6a4624e7/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/RewriteRuleset.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/RewriteRuleset.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/RewriteRuleset.java
index 4ffdd44..70a2b8e 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/RewriteRuleset.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/RewriteRuleset.java
@@ -20,7 +20,7 @@ import java.util.LinkedList;
 import java.util.List;
 
 import org.apache.vxquery.compiler.rewriter.rules.ConsolidateAssignAggregateRule;
-import org.apache.vxquery.compiler.rewriter.rules.ConsolidateDataScanUnnestRule;
+import org.apache.vxquery.compiler.rewriter.rules.PushChildIntoDataScanRule;
 import org.apache.vxquery.compiler.rewriter.rules.ConsolidateUnnestsRule;
 import org.apache.vxquery.compiler.rewriter.rules.ConvertAssignToAggregateRule;
 import org.apache.vxquery.compiler.rewriter.rules.ConvertAssignToUnnestRule;
@@ -30,6 +30,7 @@ import org.apache.vxquery.compiler.rewriter.rules.EliminateUnnestAggregateSubpla
 import org.apache.vxquery.compiler.rewriter.rules.IntroduceCollectionRule;
 import org.apache.vxquery.compiler.rewriter.rules.IntroduceTwoStepAggregateRule;
 import org.apache.vxquery.compiler.rewriter.rules.PushMapOperatorDownThroughProductRule;
+import org.apache.vxquery.compiler.rewriter.rules.RemoveRedundantCastExpressionsRule;
 import org.apache.vxquery.compiler.rewriter.rules.RemoveRedundantDataExpressionsRule;
 import org.apache.vxquery.compiler.rewriter.rules.RemoveRedundantPromoteExpressionsRule;
 import org.apache.vxquery.compiler.rewriter.rules.RemoveRedundantTreatExpressionsRule;
@@ -44,6 +45,7 @@ import edu.uci.ics.hyracks.algebricks.rewriter.rules.BreakSelectIntoConjunctsRul
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.ComplexJoinInferenceRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.ConsolidateAssignsRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.ConsolidateSelectsRule;
+import edu.uci.ics.hyracks.algebricks.rewriter.rules.CopyLimitDownRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.EliminateSubplanRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.EnforceStructuralPropertiesRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.ExtractCommonOperatorsRule;
@@ -57,7 +59,6 @@ import edu.uci.ics.hyracks.algebricks.rewriter.rules.IntroduceGroupByCombinerRul
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.IntroduceProjectsRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.IsolateHyracksOperatorsRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.PullSelectOutOfEqJoin;
-import edu.uci.ics.hyracks.algebricks.rewriter.rules.CopyLimitDownRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.PushProjectDownRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.PushProjectIntoDataSourceScanRule;
 import edu.uci.ics.hyracks.algebricks.rewriter.rules.PushSelectDownRule;
@@ -111,14 +112,11 @@ public class RewriteRuleset {
         normalization.add(new IntroduceCollectionRule());
         normalization.add(new RemoveUnusedAssignAndAggregateRule());
 
+        // Adds child steps to the data source scan.
         normalization.add(new ConsolidateUnnestsRule());
+        normalization.add(new PushChildIntoDataScanRule());
 
-        normalization.add(new RemoveRedundantTreatExpressionsRule());
-        normalization.add(new RemoveRedundantDataExpressionsRule());
-        normalization.add(new RemoveRedundantPromoteExpressionsRule());
-
-        normalization.add(new ConsolidateDataScanUnnestRule());
-
+        // Improvement for scalar child expressions
         normalization.add(new EliminateSubplanForSingleItemsRule());
         return normalization;
     }
@@ -158,6 +156,7 @@ public class RewriteRuleset {
         xquery.add(new InlineVariablesRule());
         xquery.add(new PushSelectDownRule());
         xquery.add(new PushSelectIntoJoinRule());
+        // Clean up
         xquery.add(new RemoveRedundantVariablesRule());
         xquery.add(new RemoveUnusedAssignAndAggregateRule());
         return xquery;
@@ -168,6 +167,10 @@ public class RewriteRuleset {
         normalization.add(new RemoveRedundantTreatExpressionsRule());
         normalization.add(new RemoveRedundantDataExpressionsRule());
         normalization.add(new RemoveRedundantPromoteExpressionsRule());
+        normalization.add(new RemoveRedundantCastExpressionsRule());
+        // Clean up
+        normalization.add(new RemoveRedundantVariablesRule());
+        normalization.add(new RemoveUnusedAssignAndAggregateRule());
         return normalization;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/6a4624e7/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/ConsolidateDataScanUnnestRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/ConsolidateDataScanUnnestRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/ConsolidateDataScanUnnestRule.java
deleted file mode 100644
index 8feb88b..0000000
--- a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/ConsolidateDataScanUnnestRule.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.vxquery.compiler.rewriter.rules;
-
-import org.apache.commons.lang3.mutable.Mutable;
-import org.apache.commons.lang3.mutable.MutableObject;
-import org.apache.vxquery.compiler.rewriter.rules.util.ExpressionToolbox;
-import org.apache.vxquery.context.RootStaticContextImpl;
-import org.apache.vxquery.context.StaticContextImpl;
-import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
-import org.apache.vxquery.functions.BuiltinOperators;
-import org.apache.vxquery.functions.Function;
-import org.apache.vxquery.metadata.VXQueryCollectionDataSource;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.IOptimizationContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalExpressionTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ConstantExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AssignOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.DataSourceScanOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.UnnestOperator;
-import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
-
-/**
- * The rule searches for an unnest operator immediately following a data scan
- * operator.
- * 
- * <pre>
- * Before 
- * 
- *   plan__parent
- *   UNNEST( $v2 : child( $v1 ) )
- *   DATASCAN( $source : $v1 )
- *   plan__child
- *   
- *   Where $v1 is not used in plan__parent.
- *   
- * After
- * 
- *   plan__parent
- *   DATASCAN( $source : $v1 )
- *   plan__child
- *   
- *   $source is encoded with the child parameters.
- * </pre>
- * 
- * @author prestonc
- */
-public class ConsolidateDataScanUnnestRule extends AbstractUsedVariablesProcessingRule {
-    final StaticContextImpl dCtx = new StaticContextImpl(RootStaticContextImpl.INSTANCE);
-    final int ARG_DATA = 0;
-    final int ARG_TYPE = 1;
-
-    protected boolean processOperator(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
-            throws AlgebricksException {
-        AbstractLogicalOperator op0 = (AbstractLogicalOperator) opRef.getValue();
-        if (op0.getInputs().isEmpty()) {
-            return false;
-        }
-
-        AbstractLogicalOperator op1 = (AbstractLogicalOperator) op0.getInputs().get(0).getValue();
-        if (op1.getOperatorTag() != LogicalOperatorTag.UNNEST) {
-            return false;
-        }
-        UnnestOperator unnest = (UnnestOperator) op1;
-
-        AbstractLogicalOperator op2 = (AbstractLogicalOperator) unnest.getInputs().get(0).getValue();
-        if (op2.getOperatorTag() != LogicalOperatorTag.DATASOURCESCAN) {
-            return false;
-        }
-        DataSourceScanOperator datascan = (DataSourceScanOperator) op2;
-
-        if (!usedVariables.contains(datascan.getVariables())) {
-            // Check to see if the unnest expression is a child function.
-            ILogicalExpression logicalExpression = (ILogicalExpression) unnest.getExpressionRef().getValue();
-            if (logicalExpression.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
-                return false;
-            }
-            AbstractFunctionCallExpression functionCall = (AbstractFunctionCallExpression) logicalExpression;
-            Function functionInfo = (Function) functionCall.getFunctionInfo();
-            if (!functionInfo.getFunctionIdentifier().equals(BuiltinOperators.CHILD.getFunctionIdentifier())) {
-                return false;
-            }
-
-            // Find all child functions.
-            VXQueryCollectionDataSource ds = (VXQueryCollectionDataSource) datascan.getDataSource();
-            updateDataSource(ds, unnest.getExpressionRef());
-
-            // Replace unnest with noop assign. Keeps variable chain.
-            Mutable<ILogicalExpression> varExp = ExpressionToolbox.findVariableExpression(unnest.getExpressionRef(),
-                    datascan.getVariables().get(0));
-            AssignOperator noOp = new AssignOperator(unnest.getVariable(), varExp);
-            noOp.getInputs().addAll(unnest.getInputs());
-            op0.getInputs().clear();
-            op0.getInputs().add(new MutableObject<ILogicalOperator>(noOp));
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * In reverse add them to the data source.
-     * 
-     * @param ds
-     * @param expression
-     */
-    private void updateDataSource(VXQueryCollectionDataSource ds, Mutable<ILogicalExpression> expression) {
-        ILogicalExpression logicalExpression = (ILogicalExpression) expression.getValue();
-        if (logicalExpression.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
-            return;
-        }
-        AbstractFunctionCallExpression functionCall = (AbstractFunctionCallExpression) logicalExpression;
-        Function functionInfo = (Function) functionCall.getFunctionInfo();
-        if (!functionInfo.getFunctionIdentifier().equals(BuiltinOperators.CHILD.getFunctionIdentifier())) {
-            return;
-        }
-        // Traverse down child function nesting.
-        updateDataSource(ds, functionCall.getArguments().get(ARG_DATA));
-
-        // Add the child type parameter to data source.
-        ILogicalExpression argType = functionCall.getArguments().get(ARG_TYPE).getValue();
-        if (argType.getExpressionTag() != LogicalExpressionTag.CONSTANT) {
-            return;
-        }
-        TaggedValuePointable tvp = new TaggedValuePointable();
-        ExpressionToolbox.getConstantAsPointable((ConstantExpression) argType, tvp);
-
-        IntegerPointable pTypeCode = (IntegerPointable) IntegerPointable.FACTORY.createPointable();
-        tvp.getValue(pTypeCode);
-        ds.addChildSeq(pTypeCode.getInteger());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/6a4624e7/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/PushChildIntoDataScanRule.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/PushChildIntoDataScanRule.java b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/PushChildIntoDataScanRule.java
new file mode 100644
index 0000000..d49d696
--- /dev/null
+++ b/vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/PushChildIntoDataScanRule.java
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.compiler.rewriter.rules;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
+import org.apache.vxquery.compiler.rewriter.rules.util.ExpressionToolbox;
+import org.apache.vxquery.context.RootStaticContextImpl;
+import org.apache.vxquery.context.StaticContextImpl;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.functions.BuiltinFunctions;
+import org.apache.vxquery.functions.BuiltinOperators;
+import org.apache.vxquery.functions.Function;
+import org.apache.vxquery.metadata.VXQueryCollectionDataSource;
+import org.apache.vxquery.types.SequenceType;
+
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.IOptimizationContext;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalExpressionTag;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ConstantExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
+import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AssignOperator;
+import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.DataSourceScanOperator;
+import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.UnnestOperator;
+import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
+
+/**
+ * The rule searches for an unnest operator immediately following a data scan
+ * operator.
+ * 
+ * <pre>
+ * Before 
+ * 
+ *   plan__parent
+ *   UNNEST( $v2 : child( $v1 ) )
+ *   DATASCAN( $source : $v1 )
+ *   plan__child
+ *   
+ *   Where $v1 is not used in plan__parent.
+ *   
+ * After
+ * 
+ *   plan__parent
+ *   DATASCAN( $source : $v1 )
+ *   plan__child
+ *   
+ *   $source is encoded with the child parameters.
+ * </pre>
+ * 
+ * @author prestonc
+ */
+public class PushChildIntoDataScanRule extends AbstractUsedVariablesProcessingRule {
+    final StaticContextImpl dCtx = new StaticContextImpl(RootStaticContextImpl.INSTANCE);
+    final int ARG_DATA = 0;
+    final int ARG_TYPE = 1;
+
+    protected boolean processOperator(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
+            throws AlgebricksException {
+        AbstractLogicalOperator op0 = (AbstractLogicalOperator) opRef.getValue();
+        if (op0.getInputs().isEmpty()) {
+            return false;
+        }
+
+        AbstractLogicalOperator op1 = (AbstractLogicalOperator) op0.getInputs().get(0).getValue();
+        if (op1.getOperatorTag() != LogicalOperatorTag.UNNEST) {
+            return false;
+        }
+        UnnestOperator unnest = (UnnestOperator) op1;
+
+        AbstractLogicalOperator op2 = (AbstractLogicalOperator) unnest.getInputs().get(0).getValue();
+        if (op2.getOperatorTag() != LogicalOperatorTag.DATASOURCESCAN) {
+            return false;
+        }
+        DataSourceScanOperator datascan = (DataSourceScanOperator) op2;
+
+        if (!usedVariables.contains(datascan.getVariables())) {
+            // Find all child functions.
+            VXQueryCollectionDataSource ds = (VXQueryCollectionDataSource) datascan.getDataSource();
+            if (!updateDataSource(ds, unnest.getExpressionRef())) {
+                return false;
+            }
+
+            // Replace unnest with noop assign. Keeps variable chain.
+            Mutable<ILogicalExpression> varExp = ExpressionToolbox.findVariableExpression(unnest.getExpressionRef(),
+                    datascan.getVariables().get(0));
+            AssignOperator noOp = new AssignOperator(unnest.getVariable(), varExp);
+            noOp.getInputs().addAll(unnest.getInputs());
+            op0.getInputs().clear();
+            op0.getInputs().add(new MutableObject<ILogicalOperator>(noOp));
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * In reverse add them to the data source.
+     * 
+     * @param ds
+     * @param expression
+     */
+    private boolean updateDataSource(VXQueryCollectionDataSource ds, Mutable<ILogicalExpression> expression) {
+        boolean added = false;
+        List<Mutable<ILogicalExpression>> finds = new ArrayList<Mutable<ILogicalExpression>>();
+        ExpressionToolbox.findAllFunctionExpressions(expression, BuiltinOperators.CHILD.getFunctionIdentifier(), finds);
+        for (int i = finds.size(); i > 0; --i) {
+            int typeId = ExpressionToolbox.getTypeExpressionTypeArgument(finds.get(i - 1));
+            if (typeId > 0) {
+                ds.addChildSeq(typeId);
+                added = true;
+            }
+        }
+        return added;
+    }
+}