VXQUERY-240: Update Hyracks Dependency to version 0.3.0.
authorPreston Carman <prestonc@apache.org>
Sun, 30 Apr 2017 05:08:46 +0000 (22:08 -0700)
committerPreston Carman <prestonc@apache.org>
Mon, 1 May 2017 04:34:16 +0000 (21:34 -0700)
Primary changes revolve around changes to UTF8StringPointable (storage layout changed) and exception handling.

199 files changed:
pom.xml
vxquery-core/pom.xml
vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryConstantValue.java
vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryExpressionRuntimeProvider.java
vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryMissingWriterFactory.java [moved from vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryNullWriterFactory.java with 80% similarity]
vxquery-core/src/main/java/org/apache/vxquery/compiler/algebricks/VXQueryPrinterFactoryProvider.java
vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/RewriteRuleset.java
vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/VXQueryOptimizationContext.java
vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/AbstractCollectionRule.java
vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/IntroduceCollectionRule.java
vxquery-core/src/main/java/org/apache/vxquery/compiler/rewriter/rules/ReplaceSourceMapInDocExpression.java
vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/atomic/XSDatePointable.java
vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/atomic/XSQNamePointable.java
vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/jsonitem/ObjectPointable.java
vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/NodeTreePointable.java
vxquery-core/src/main/java/org/apache/vxquery/datamodel/accessors/nodes/PINodePointable.java
vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/atomic/StringValueBuilder.java
vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/atomic/UTF8StringBuilder.java [deleted file]
vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/atomic/VXQueryUTF8StringBuilder.java [new file with mode: 0644]
vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/CommentNodeBuilder.java
vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java
vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/PINodeBuilder.java
vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/TextNodeBuilder.java
vxquery-core/src/main/java/org/apache/vxquery/datamodel/values/XDMConstants.java
vxquery-core/src/main/java/org/apache/vxquery/exceptions/SystemException.java
vxquery-core/src/main/java/org/apache/vxquery/exceptions/VXQueryDataException.java
vxquery-core/src/main/java/org/apache/vxquery/exceptions/VXQueryFileNotFoundException.java
vxquery-core/src/main/java/org/apache/vxquery/exceptions/VXQueryParseException.java
vxquery-core/src/main/java/org/apache/vxquery/index/IndexDocumentBuilder.java
vxquery-core/src/main/java/org/apache/vxquery/metadata/AbstractVXQueryDataSource.java
vxquery-core/src/main/java/org/apache/vxquery/metadata/QueryResultDataSink.java
vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionDataSource.java
vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java
vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryIndexingDataSource.java
vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryIndexingOperatorDescriptor.java
vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryMetadataProvider.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/AbstractMaxMinAggregateEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/AbstractMaxMinScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/AvgGlobalAggregateEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/AvgLocalAggregateEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/FnAvgAggregateEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/FnAvgScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/FnCountAggregateEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/FnCountScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/FnSumAggregateEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/aggregate/FnSumScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/arithmetic/AbstractArithmeticScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentAggregateEvaluator.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentAggregateEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentScalarEvaluator.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentUnnestingEvaluator.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/base/AbstractTaggedValueArgumentUnnestingEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/AndScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/FnBooleanScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/FnFalseScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/FnNotScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/FnTrueScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/bool/OrScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToBase64BinaryOperation.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToBooleanOperation.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToDecimalOperation.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToQNameOperation.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/cast/CastToStringOperation.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/castable/CastableScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/AbstractValueComparisonScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/comparison/general/AbstractGeneralComparisonScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/conditional/IfThenElseScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/datetime/AbstractValueFromDateTimeScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/datetime/AbstractValueFromDurationScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/datetime/FnAdjustDateTimeToTimezoneScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/datetime/FnAdjustDateToTimezoneScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/datetime/FnAdjustTimeToTimezoneScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/datetime/FnCurrentDateScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/datetime/FnCurrentDateTimeScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/datetime/FnCurrentTimeScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/datetime/FnDateTimeScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/datetime/FnImplicitTimezoneScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/error/FnErrorScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/index/ShowIndexScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/JnDocScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/JnKeysScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/JnMembersScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/JnNullScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/JnParseJsonScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/KeysOrMembersScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/LibjnAccumulateScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/LibjnDescendantArraysScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/LibjnDescendantObjectsScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/LibjnDescendantPairsScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/LibjnFlattenScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/LibjnIntersectScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/LibjnProjectScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/LibjnRemoveKeysScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/LibjnValuesScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/json/ValueScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/jsonitem/ArrayConstructorScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/jsonitem/ObjectConstructorScalarEvaluator.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/jsonitem/ObjectConstructorScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/jsonitem/SimpleObjectUnionScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/misc/FnDataScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/misc/JnSizeScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/AttributeNodeConstructorScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/CommentNodeConstructorScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/ElementNodeConstructorScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/FnDocAvailableScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/FnDocScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/FnNumberScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/IdFromNodeScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/LocalIdFromNodeScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/OpNodeAfterEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/OpNodeBeforeEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/PINodeConstructorScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/TextNodeConstructorScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/node/TreeIdFromNodeScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/nodeid/SortDistinctNodesAscOrAtomicsScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/AbstractNumericScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/numeric/FnRoundHalfToEvenScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/qname/FnLocalNameFromQNameScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/qname/FnNamespaceUriFromQNameScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/qname/FnPrefixFromQNameScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/qname/FnQNameScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/ConcatenateScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnDistinctValuesScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnEmptyScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnExactlyOneScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnExistsScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnIndexOfScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnInsertBeforeScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnOneOrMoreScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnRemoveScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnReverseScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnSubsequenceScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnUnorderedScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/FnZeroOrOneScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/IterateUnnestingEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/OpToScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/sequence/SequenceAggregateEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/serialize/FnSerializeScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/AttributePathStepScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepScalarEvaluator.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepUnnesting.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepUnnestingEvaluator.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/ChildPathStepUnnestingEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/DescendantOrSelfPathStepScalarEvaluator.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/DescendantOrSelfPathStepScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/DescendantOrSelfPathStepUnnesting.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/DescendantOrSelfPathStepUnnestingEvaluator.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/DescendantOrSelfPathStepUnnestingEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/DescendantPathStepScalarEvaluator.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/DescendantPathStepScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/DescendantPathStepUnnestingEvaluator.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/DescendantPathStepUnnestingEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/NodeTestFilter.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/step/SelfPathStepScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/AbstractCharacterIteratorCopyingEvaluator.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/AbstractTranscodingCharacterIterator.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/FnCodepointEqualEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/FnCodepointsToStringEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/FnCompareEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/FnConcatEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/FnContainsEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/FnEndsWithEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/FnLowerCaseEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/FnStartsWithEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/FnStringJoinEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/FnStringLengthEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/FnStringScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/FnStringToCodepointsEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/FnSubstringAfterEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/FnSubstringBeforeEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/FnSubstringEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/FnUpperCaseEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/strings/UTF8StringCharacterIterator.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/trace/FnTraceScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/type/InstanceOfScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/type/PromoteScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/type/TreatScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/unary/AbstractNumericUnaryScalarEvaluatorFactory.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/AtomizeHelper.java
vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
vxquery-core/src/main/java/org/apache/vxquery/serializer/XMLSerializer.java
vxquery-core/src/main/java/org/apache/vxquery/types/NameTest.java
vxquery-core/src/main/java/org/apache/vxquery/types/ProcessingInstructionType.java
vxquery-core/src/main/java/org/apache/vxquery/xmlparser/SAXContentHandler.java
vxquery-core/src/main/java/org/apache/vxquery/xmlparser/XMLParser.java
vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/VXQueryCompilationListener.java
vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryCompiler.java
vxquery-core/src/main/java/org/apache/vxquery/xmlquery/translator/XMLQueryTranslator.java
vxquery-core/src/test/java/org/apache/vxquery/xmlquery/query/SimpleXQueryTest.java
vxquery-server/src/main/java/org/apache/vxquery/cli/VXQueryClusterShutdown.java
vxquery-xtest/pom.xml
vxquery-xtest/src/main/java/org/apache/vxquery/xtest/TestRunner.java
vxquery-xtest/src/test/java/org/apache/vxquery/xtest/AbstractXQueryTest.java
vxquery-xtest/src/test/resources/ExpectedTestResults/Simple/data_types.txt [new file with mode: 0644]
vxquery-xtest/src/test/resources/Queries/XQuery/Simple/data_types.xq [new file with mode: 0644]
vxquery-xtest/src/test/resources/cat/SingleQuery.xml

diff --git a/pom.xml b/pom.xml
index cc8884f..5f03a49 100644 (file)
--- a/pom.xml
+++ b/pom.xml
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-        <hyracks.version>0.2.17-incubating</hyracks.version>
+        <hyracks.version>0.3.0</hyracks.version>
         <apache-rat-plugin.version>0.11</apache-rat-plugin.version>
     </properties>
 
index 47015a9..38908d7 100644 (file)
 
         <dependency>
             <groupId>org.apache.hyracks</groupId>
+            <artifactId>algebricks-rewriter</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.hyracks</groupId>
             <artifactId>algebricks-data</artifactId>
         </dependency>
 
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
+
         <dependency>
             <artifactId>lucene-core</artifactId>
             <groupId>org.apache.lucene</groupId>
             <type>jar</type>
             <version>5.5.1</version>
         </dependency>
+
         <dependency>
             <artifactId>lucene-queryparser</artifactId>
             <groupId>org.apache.lucene</groupId>
             <type>jar</type>
             <version>5.5.1</version>
         </dependency>
+
         <dependency>
             <artifactId>lucene-analyzers-common</artifactId>
             <groupId>org.apache.lucene</groupId>
             <type>jar</type>
             <version>5.5.1</version>
         </dependency>
+
         <dependency>
             <artifactId>lucene-demo</artifactId>
             <groupId>org.apache.lucene</groupId>
             <type>jar</type>
             <version>5.5.1</version>
         </dependency>
+
         <dependency>
             <artifactId>lucene-backward-codecs</artifactId>
             <groupId>org.apache.lucene</groupId>
             <type>jar</type>
             <version>5.5.1</version>
         </dependency>
+
         <dependency>
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-mapreduce-client-core</artifactId>
             <version>2.7.0</version>
         </dependency>
+
         <dependency>
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-common</artifactId>
             <version>2.7.0</version>
         </dependency>
+
         <dependency>
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-hdfs</artifactId>
         </dependency>
+
     </dependencies>
 
     <reporting>
index e105546..92b35ba 100644 (file)
@@ -17,9 +17,8 @@
 package org.apache.vxquery.compiler.algebricks;
 
 import org.apache.commons.codec.binary.Hex;
-import org.apache.vxquery.types.SequenceType;
-
 import org.apache.hyracks.algebricks.core.algebra.expressions.IAlgebricksConstantValue;
+import org.apache.vxquery.types.SequenceType;
 
 public class VXQueryConstantValue implements IAlgebricksConstantValue {
     private final SequenceType type;
@@ -61,4 +60,9 @@ public class VXQueryConstantValue implements IAlgebricksConstantValue {
                 .append("])");
         return buffer.toString();
     }
+
+    @Override
+    public boolean isMissing() {
+        return false;
+    }
 }
index 04d15e7..dcd285c 100644 (file)
@@ -19,10 +19,6 @@ package org.apache.vxquery.compiler.algebricks;
 import java.util.List;
 
 import org.apache.commons.lang3.mutable.Mutable;
-import org.apache.vxquery.datamodel.values.XDMConstants;
-import org.apache.vxquery.exceptions.SystemException;
-import org.apache.vxquery.functions.Function;
-
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
 import org.apache.hyracks.algebricks.core.algebra.expressions.AggregateFunctionCallExpression;
@@ -37,15 +33,18 @@ import org.apache.hyracks.algebricks.core.algebra.expressions.VariableReferenceE
 import org.apache.hyracks.algebricks.core.algebra.operators.logical.IOperatorSchema;
 import org.apache.hyracks.algebricks.core.jobgen.impl.JobGenContext;
 import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
 import org.apache.hyracks.algebricks.runtime.base.IRunningAggregateEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.evaluators.ConstantEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.evaluators.ConstantEvalFactory;
 import org.apache.hyracks.algebricks.runtime.evaluators.TupleFieldEvaluatorFactory;
 import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.BooleanPointable;
 import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.vxquery.datamodel.values.XDMConstants;
+import org.apache.vxquery.exceptions.SystemException;
+import org.apache.vxquery.functions.Function;
 
 public class VXQueryExpressionRuntimeProvider implements IExpressionRuntimeProvider {
     @Override
@@ -53,23 +52,23 @@ public class VXQueryExpressionRuntimeProvider implements IExpressionRuntimeProvi
             IOperatorSchema[] inputSchemas, JobGenContext context) throws AlgebricksException {
         switch (expr.getExpressionTag()) {
             case CONSTANT:
-                IAlgebricksConstantValue constantValue = (IAlgebricksConstantValue) ((ConstantExpression) expr)
+                IAlgebricksConstantValue constantValue = ((ConstantExpression) expr)
                         .getValue();
                 if (constantValue.isFalse()) {
                     IPointable p = (BooleanPointable) BooleanPointable.FACTORY.createPointable();
                     XDMConstants.setFalse(p);
-                    return new ConstantEvaluatorFactory(p.getByteArray());
+                    return new ConstantEvalFactory(p.getByteArray());
                 } else if (constantValue.isNull()) {
                     IPointable p = (VoidPointable) VoidPointable.FACTORY.createPointable();
                     XDMConstants.setEmptySequence(p);
-                    return new ConstantEvaluatorFactory(p.getByteArray());
+                    return new ConstantEvalFactory(p.getByteArray());
                 } else if (constantValue.isTrue()) {
                     IPointable p = (BooleanPointable) BooleanPointable.FACTORY.createPointable();
                     XDMConstants.setTrue(p);
-                    return new ConstantEvaluatorFactory(p.getByteArray());
+                    return new ConstantEvalFactory(p.getByteArray());
                 }
                 VXQueryConstantValue cv = (VXQueryConstantValue) ((ConstantExpression) expr).getValue();
-                return new ConstantEvaluatorFactory(cv.getValue());
+                return new ConstantEvalFactory(cv.getValue());
 
             case VARIABLE:
                 VariableReferenceExpression vrExpr = (VariableReferenceExpression) expr;
@@ -82,7 +81,11 @@ public class VXQueryExpressionRuntimeProvider implements IExpressionRuntimeProvi
 
                 IScalarEvaluatorFactory[] argFactories = createArgumentEvaluatorFactories(env, inputSchemas, context,
                         fcExpr.getArguments());
-                return fn.createScalarEvaluatorFactory(argFactories);
+                try {
+                    return fn.createScalarEvaluatorFactory(argFactories);
+                } catch (SystemException e) {
+                    throw new AlgebricksException(e);
+                }
         }
         throw new UnsupportedOperationException("Cannot create runtime for " + expr.getExpressionTag());
     }
@@ -106,11 +109,15 @@ public class VXQueryExpressionRuntimeProvider implements IExpressionRuntimeProvi
 
         IScalarEvaluatorFactory[] argFactories = createArgumentEvaluatorFactories(env, inputSchemas, context,
                 expr.getArguments());
-        return fn.createAggregateEvaluatorFactory(argFactories);
+        try {
+            return fn.createAggregateEvaluatorFactory(argFactories);
+        } catch (SystemException e) {
+            throw new AlgebricksException(e);
+        }
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
+    public ISerializedAggregateEvaluatorFactory createSerializableAggregateFunctionFactory(
             AggregateFunctionCallExpression expr, IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas,
             JobGenContext context) throws AlgebricksException {
         return null;
@@ -131,6 +138,10 @@ public class VXQueryExpressionRuntimeProvider implements IExpressionRuntimeProvi
 
         IScalarEvaluatorFactory[] argFactories = createArgumentEvaluatorFactories(env, inputSchemas, context,
                 expr.getArguments());
-        return fn.createUnnestingEvaluatorFactory(argFactories);
+        try {
+            return fn.createUnnestingEvaluatorFactory(argFactories);
+        } catch (SystemException e) {
+            throw new AlgebricksException(e);
+        }
     }
 }
@@ -19,22 +19,21 @@ package org.apache.vxquery.compiler.algebricks;
 import java.io.DataOutput;
 import java.io.IOException;
 
-import org.apache.vxquery.datamodel.values.XDMConstants;
-
-import org.apache.hyracks.api.dataflow.value.INullWriter;
-import org.apache.hyracks.api.dataflow.value.INullWriterFactory;
+import org.apache.hyracks.api.dataflow.value.IMissingWriter;
+import org.apache.hyracks.api.dataflow.value.IMissingWriterFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.vxquery.datamodel.values.XDMConstants;
 
-public class VXQueryNullWriterFactory implements INullWriterFactory {
+public class VXQueryMissingWriterFactory implements IMissingWriterFactory {
     private static final long serialVersionUID = 1L;
 
     @Override
-    public INullWriter createNullWriter() {
+    public IMissingWriter createMissingWriter() {
         final VoidPointable vp = (VoidPointable) VoidPointable.FACTORY.createPointable();
-        return new INullWriter() {
+        return new IMissingWriter() {
             @Override
-            public void writeNull(DataOutput out) throws HyracksDataException {
+            public void writeMissing(DataOutput out) throws HyracksDataException {
                 XDMConstants.setEmptySequence(vp);
                 try {
                     out.write(vp.getByteArray(), vp.getStartOffset(), vp.getLength());
index 65ef917..11d6204 100644 (file)
  */
 package org.apache.vxquery.compiler.algebricks;
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 import org.apache.hyracks.algebricks.data.IPrinterFactoryProvider;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 
 public class VXQueryPrinterFactoryProvider implements IPrinterFactoryProvider {
     public static final IPrinterFactoryProvider INSTANCE = new VXQueryPrinterFactoryProvider();
 
     @Override
-    public IPrinterFactory getPrinterFactory(Object type) throws AlgebricksException {
+    public IPrinterFactory getPrinterFactory(Object type) throws HyracksDataException {
 
         return new VXQueryPrinterFactory();
     }
index d5909c6..1ee4833 100644 (file)
@@ -19,33 +19,6 @@ package org.apache.vxquery.compiler.rewriter;
 import java.util.LinkedList;
 import java.util.List;
 
-import org.apache.vxquery.compiler.rewriter.rules.ConsolidateAssignAggregateRule;
-import org.apache.vxquery.compiler.rewriter.rules.ConsolidateDescandantChild;
-import org.apache.vxquery.compiler.rewriter.rules.ConvertAssignToUnnestRule;
-import org.apache.vxquery.compiler.rewriter.rules.ConvertFromAlgebricksExpressionsRule;
-import org.apache.vxquery.compiler.rewriter.rules.ConvertToAlgebricksExpressionsRule;
-import org.apache.vxquery.compiler.rewriter.rules.EliminateSubplanForSingleItemsRule;
-import org.apache.vxquery.compiler.rewriter.rules.EliminateUnnestAggregateSequencesRule;
-import org.apache.vxquery.compiler.rewriter.rules.EliminateUnnestAggregateSubplanRule;
-import org.apache.vxquery.compiler.rewriter.rules.IntroduceCollectionRule;
-import org.apache.vxquery.compiler.rewriter.rules.IntroduceIndexingRule;
-import org.apache.vxquery.compiler.rewriter.rules.IntroduceTwoStepAggregateRule;
-import org.apache.vxquery.compiler.rewriter.rules.PushChildIntoDataScanRule;
-import org.apache.vxquery.compiler.rewriter.rules.PushFunctionsOntoEqJoinBranches;
-import org.apache.vxquery.compiler.rewriter.rules.RemoveRedundantBooleanExpressionsRule;
-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;
-import org.apache.vxquery.compiler.rewriter.rules.RemoveUnusedSortDistinctNodesRule;
-import org.apache.vxquery.compiler.rewriter.rules.RemoveUnusedUnnestIterateRule;
-import org.apache.vxquery.compiler.rewriter.rules.ReplaceSourceMapInDocExpression;
-import org.apache.vxquery.compiler.rewriter.rules.SetCollectionDataSourceRule;
-import org.apache.vxquery.compiler.rewriter.rules.SetVariableIdContextRule;
-import org.apache.vxquery.compiler.rewriter.rules.algebricksalternatives.ExtractFunctionsFromJoinConditionRule;
-import org.apache.vxquery.compiler.rewriter.rules.algebricksalternatives.InlineNestedVariablesRule;
-import org.apache.vxquery.compiler.rewriter.rules.algebricksalternatives.MoveFreeVariableOperatorOutOfSubplanRule;
-
 import org.apache.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer;
 import org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
 import org.apache.hyracks.algebricks.rewriter.rules.BreakSelectIntoConjunctsRule;
@@ -55,8 +28,6 @@ import org.apache.hyracks.algebricks.rewriter.rules.ConsolidateAssignsRule;
 import org.apache.hyracks.algebricks.rewriter.rules.ConsolidateSelectsRule;
 import org.apache.hyracks.algebricks.rewriter.rules.CopyLimitDownRule;
 import org.apache.hyracks.algebricks.rewriter.rules.EliminateGroupByEmptyKeyRule;
-import org.apache.hyracks.algebricks.rewriter.rules.EliminateSubplanRule;
-import org.apache.hyracks.algebricks.rewriter.rules.EliminateSubplanWithInputCardinalityOneRule;
 import org.apache.hyracks.algebricks.rewriter.rules.EnforceStructuralPropertiesRule;
 import org.apache.hyracks.algebricks.rewriter.rules.ExtractCommonOperatorsRule;
 import org.apache.hyracks.algebricks.rewriter.rules.ExtractGbyExpressionsRule;
@@ -64,21 +35,18 @@ import org.apache.hyracks.algebricks.rewriter.rules.FactorRedundantGroupAndDecor
 import org.apache.hyracks.algebricks.rewriter.rules.InferTypesRule;
 import org.apache.hyracks.algebricks.rewriter.rules.InlineAssignIntoAggregateRule;
 import org.apache.hyracks.algebricks.rewriter.rules.InlineVariablesRule;
-import org.apache.hyracks.algebricks.rewriter.rules.InsertOuterJoinRule;
+//import org.apache.hyracks.algebricks.rewriter.rules.InsertOuterJoinRule;
 import org.apache.hyracks.algebricks.rewriter.rules.IntroJoinInsideSubplanRule;
 import org.apache.hyracks.algebricks.rewriter.rules.IntroduceAggregateCombinerRule;
 import org.apache.hyracks.algebricks.rewriter.rules.IntroduceGroupByCombinerRule;
-import org.apache.hyracks.algebricks.rewriter.rules.IntroduceGroupByForSubplanRule;
 import org.apache.hyracks.algebricks.rewriter.rules.IntroduceProjectsRule;
 import org.apache.hyracks.algebricks.rewriter.rules.IsolateHyracksOperatorsRule;
-import org.apache.hyracks.algebricks.rewriter.rules.NestedSubplanToJoinRule;
 import org.apache.hyracks.algebricks.rewriter.rules.PullSelectOutOfEqJoin;
 import org.apache.hyracks.algebricks.rewriter.rules.PushMapOperatorDownThroughProductRule;
 import org.apache.hyracks.algebricks.rewriter.rules.PushProjectDownRule;
 import org.apache.hyracks.algebricks.rewriter.rules.PushProjectIntoDataSourceScanRule;
 import org.apache.hyracks.algebricks.rewriter.rules.PushSelectDownRule;
 import org.apache.hyracks.algebricks.rewriter.rules.PushSelectIntoJoinRule;
-import org.apache.hyracks.algebricks.rewriter.rules.PushSubplanIntoGroupByRule;
 import org.apache.hyracks.algebricks.rewriter.rules.PushSubplanWithAggregateDownThroughProductRule;
 import org.apache.hyracks.algebricks.rewriter.rules.ReinferAllTypesRule;
 import org.apache.hyracks.algebricks.rewriter.rules.RemoveRedundantVariablesRule;
@@ -86,16 +54,49 @@ import org.apache.hyracks.algebricks.rewriter.rules.RemoveUnusedAssignAndAggrega
 import org.apache.hyracks.algebricks.rewriter.rules.SetAlgebricksPhysicalOperatorsRule;
 import org.apache.hyracks.algebricks.rewriter.rules.SetExecutionModeRule;
 import org.apache.hyracks.algebricks.rewriter.rules.SimpleUnnestToProductRule;
-import org.apache.hyracks.algebricks.rewriter.rules.SubplanOutOfGroupRule;
+import org.apache.hyracks.algebricks.rewriter.rules.subplan.EliminateSubplanRule;
+import org.apache.hyracks.algebricks.rewriter.rules.subplan.EliminateSubplanWithInputCardinalityOneRule;
+import org.apache.hyracks.algebricks.rewriter.rules.subplan.NestedSubplanToJoinRule;
+import org.apache.hyracks.algebricks.rewriter.rules.subplan.PushSubplanIntoGroupByRule;
+import org.apache.hyracks.algebricks.rewriter.rules.subplan.SubplanOutOfGroupRule;
+import org.apache.vxquery.compiler.rewriter.rules.ConsolidateAssignAggregateRule;
+import org.apache.vxquery.compiler.rewriter.rules.ConsolidateDescandantChild;
+import org.apache.vxquery.compiler.rewriter.rules.ConvertAssignToUnnestRule;
+import org.apache.vxquery.compiler.rewriter.rules.ConvertFromAlgebricksExpressionsRule;
+import org.apache.vxquery.compiler.rewriter.rules.ConvertToAlgebricksExpressionsRule;
+import org.apache.vxquery.compiler.rewriter.rules.EliminateSubplanForSingleItemsRule;
+import org.apache.vxquery.compiler.rewriter.rules.EliminateUnnestAggregateSequencesRule;
+import org.apache.vxquery.compiler.rewriter.rules.EliminateUnnestAggregateSubplanRule;
+import org.apache.vxquery.compiler.rewriter.rules.IntroduceCollectionRule;
+import org.apache.vxquery.compiler.rewriter.rules.IntroduceIndexingRule;
+import org.apache.vxquery.compiler.rewriter.rules.IntroduceTwoStepAggregateRule;
+import org.apache.vxquery.compiler.rewriter.rules.PushChildIntoDataScanRule;
+import org.apache.vxquery.compiler.rewriter.rules.PushFunctionsOntoEqJoinBranches;
+import org.apache.vxquery.compiler.rewriter.rules.RemoveRedundantBooleanExpressionsRule;
+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;
+import org.apache.vxquery.compiler.rewriter.rules.RemoveUnusedSortDistinctNodesRule;
+import org.apache.vxquery.compiler.rewriter.rules.RemoveUnusedUnnestIterateRule;
+import org.apache.vxquery.compiler.rewriter.rules.ReplaceSourceMapInDocExpression;
+import org.apache.vxquery.compiler.rewriter.rules.SetCollectionDataSourceRule;
+import org.apache.vxquery.compiler.rewriter.rules.SetVariableIdContextRule;
+import org.apache.vxquery.compiler.rewriter.rules.algebricksalternatives.ExtractFunctionsFromJoinConditionRule;
+import org.apache.vxquery.compiler.rewriter.rules.algebricksalternatives.InlineNestedVariablesRule;
+import org.apache.vxquery.compiler.rewriter.rules.algebricksalternatives.MoveFreeVariableOperatorOutOfSubplanRule;
 
 public class RewriteRuleset {
+    RewriteRuleset() {
+    }
+
     /**
      * Optimizations specific to XQuery.
      *
      * @return List of algebraic rewrite rules.
      */
-    public final static List<IAlgebraicRewriteRule> buildPathStepNormalizationRuleCollection() {
-        List<IAlgebraicRewriteRule> normalization = new LinkedList<IAlgebraicRewriteRule>();
+    public static final List<IAlgebraicRewriteRule> buildPathStepNormalizationRuleCollection() {
+        List<IAlgebraicRewriteRule> normalization = new LinkedList<>();
         normalization.add(new SetVariableIdContextRule());
 
         // Remove unused functions.
@@ -153,8 +154,8 @@ public class RewriteRuleset {
      *
      * @return List of algebraic rewrite rules.
      */
-    public final static List<IAlgebraicRewriteRule> buildXQueryNormalizationRuleCollection() {
-        List<IAlgebraicRewriteRule> normalization = new LinkedList<IAlgebraicRewriteRule>();
+    public static final List<IAlgebraicRewriteRule> buildXQueryNormalizationRuleCollection() {
+        List<IAlgebraicRewriteRule> normalization = new LinkedList<>();
 
         // Find assign for scalar aggregate function followed by an aggregate operator.
         normalization.add(new ConsolidateAssignAggregateRule());
@@ -179,8 +180,8 @@ public class RewriteRuleset {
      *
      * @return List of algebraic rewrite rules.
      */
-    public final static List<IAlgebraicRewriteRule> buildInlineRedundantExpressionNormalizationRuleCollection() {
-        List<IAlgebraicRewriteRule> normalization = new LinkedList<IAlgebraicRewriteRule>();
+    public static final List<IAlgebraicRewriteRule> buildInlineRedundantExpressionNormalizationRuleCollection() {
+        List<IAlgebraicRewriteRule> normalization = new LinkedList<>();
         normalization.add(new InlineNestedVariablesRule());
         normalization.add(new RemoveRedundantTreatExpressionsRule());
         normalization.add(new RemoveRedundantDataExpressionsRule());
@@ -199,8 +200,8 @@ public class RewriteRuleset {
      *
      * @return List of algebraic rewrite rules.
      */
-    public final static List<IAlgebraicRewriteRule> buildNestedDataSourceRuleCollection() {
-        List<IAlgebraicRewriteRule> xquery = new LinkedList<IAlgebraicRewriteRule>();
+    public static final List<IAlgebraicRewriteRule> buildNestedDataSourceRuleCollection() {
+        List<IAlgebraicRewriteRule> xquery = new LinkedList<>();
         xquery.add(new BreakSelectIntoConjunctsRule());
         xquery.add(new SimpleUnnestToProductRule());
         xquery.add(new PushMapOperatorDownThroughProductRule());
@@ -213,8 +214,8 @@ public class RewriteRuleset {
         return xquery;
     }
 
-    public final static List<IAlgebraicRewriteRule> buildTypeInferenceRuleCollection() {
-        List<IAlgebraicRewriteRule> typeInfer = new LinkedList<IAlgebraicRewriteRule>();
+    public static final List<IAlgebraicRewriteRule> buildTypeInferenceRuleCollection() {
+        List<IAlgebraicRewriteRule> typeInfer = new LinkedList<>();
         typeInfer.add(new InferTypesRule());
         return typeInfer;
     }
@@ -224,8 +225,8 @@ public class RewriteRuleset {
      *
      * @return List of algebraic rewrite rules.
      */
-    public final static List<IAlgebraicRewriteRule> buildUnnestingRuleCollection() {
-        List<IAlgebraicRewriteRule> xquery = new LinkedList<IAlgebraicRewriteRule>();
+    public static final List<IAlgebraicRewriteRule> buildUnnestingRuleCollection() {
+        List<IAlgebraicRewriteRule> xquery = new LinkedList<>();
 
         xquery.add(new PushSelectDownRule());
         xquery.add(new SimpleUnnestToProductRule());
@@ -235,9 +236,9 @@ public class RewriteRuleset {
         xquery.add(new IntroJoinInsideSubplanRule());
         xquery.add(new PushMapOperatorDownThroughProductRule());
         xquery.add(new PushSubplanWithAggregateDownThroughProductRule());
-        xquery.add(new IntroduceGroupByForSubplanRule());
+        //xquery.add(new IntroduceGroupByForSubplanRule());
         xquery.add(new SubplanOutOfGroupRule());
-        xquery.add(new InsertOuterJoinRule());
+        //        xquery.add(new InsertOuterJoinRule());
         xquery.add(new ExtractFunctionsFromJoinConditionRule());
 
         xquery.add(new RemoveRedundantVariablesRule());
@@ -253,8 +254,8 @@ public class RewriteRuleset {
         return xquery;
     }
 
-    public final static List<IAlgebraicRewriteRule> buildNormalizationRuleCollection() {
-        List<IAlgebraicRewriteRule> normalization = new LinkedList<IAlgebraicRewriteRule>();
+    public static final List<IAlgebraicRewriteRule> buildNormalizationRuleCollection() {
+        List<IAlgebraicRewriteRule> normalization = new LinkedList<>();
         normalization.add(new EliminateSubplanRule());
         normalization.add(new BreakSelectIntoConjunctsRule());
         normalization.add(new PushSelectIntoJoinRule());
@@ -262,8 +263,8 @@ public class RewriteRuleset {
         return normalization;
     }
 
-    public final static List<IAlgebraicRewriteRule> buildCondPushDownRuleCollection() {
-        List<IAlgebraicRewriteRule> condPushDown = new LinkedList<IAlgebraicRewriteRule>();
+    public static final List<IAlgebraicRewriteRule> buildCondPushDownRuleCollection() {
+        List<IAlgebraicRewriteRule> condPushDown = new LinkedList<>();
         condPushDown.add(new PushSelectDownRule());
         condPushDown.add(new InlineVariablesRule());
         condPushDown.add(new FactorRedundantGroupAndDecorVarsRule());
@@ -271,34 +272,34 @@ public class RewriteRuleset {
         return condPushDown;
     }
 
-    public final static List<IAlgebraicRewriteRule> buildJoinInferenceRuleCollection() {
-        List<IAlgebraicRewriteRule> joinInference = new LinkedList<IAlgebraicRewriteRule>();
+    public static final List<IAlgebraicRewriteRule> buildJoinInferenceRuleCollection() {
+        List<IAlgebraicRewriteRule> joinInference = new LinkedList<>();
         joinInference.add(new InlineVariablesRule());
         joinInference.add(new ComplexJoinInferenceRule());
         return joinInference;
     }
 
-    public final static List<IAlgebraicRewriteRule> buildOpPushDownRuleCollection() {
-        List<IAlgebraicRewriteRule> opPushDown = new LinkedList<IAlgebraicRewriteRule>();
+    public static final List<IAlgebraicRewriteRule> buildOpPushDownRuleCollection() {
+        List<IAlgebraicRewriteRule> opPushDown = new LinkedList<>();
         opPushDown.add(new PushProjectDownRule());
         opPushDown.add(new PushSelectDownRule());
         return opPushDown;
     }
 
-    public final static List<IAlgebraicRewriteRule> buildIntroduceProjectRuleCollection() {
-        List<IAlgebraicRewriteRule> project = new LinkedList<IAlgebraicRewriteRule>();
+    public static final List<IAlgebraicRewriteRule> buildIntroduceProjectRuleCollection() {
+        List<IAlgebraicRewriteRule> project = new LinkedList<>();
         project.add(new IntroduceProjectsRule());
         return project;
     }
 
-    public final static List<IAlgebraicRewriteRule> buildDataExchangeRuleCollection() {
-        List<IAlgebraicRewriteRule> dataExchange = new LinkedList<IAlgebraicRewriteRule>();
+    public static final List<IAlgebraicRewriteRule> buildDataExchangeRuleCollection() {
+        List<IAlgebraicRewriteRule> dataExchange = new LinkedList<>();
         dataExchange.add(new SetExecutionModeRule());
         return dataExchange;
     }
 
-    public final static List<IAlgebraicRewriteRule> buildConsolidationRuleCollection() {
-        List<IAlgebraicRewriteRule> consolidation = new LinkedList<IAlgebraicRewriteRule>();
+    public static final List<IAlgebraicRewriteRule> buildConsolidationRuleCollection() {
+        List<IAlgebraicRewriteRule> consolidation = new LinkedList<>();
         consolidation.add(new ConsolidateSelectsRule());
         consolidation.add(new ConsolidateAssignsRule());
         consolidation.add(new InlineAssignIntoAggregateRule());
@@ -308,8 +309,8 @@ public class RewriteRuleset {
         return consolidation;
     }
 
-    public final static List<IAlgebraicRewriteRule> buildPhysicalRewritesAllLevelsRuleCollection() {
-        List<IAlgebraicRewriteRule> physicalPlanRewrites = new LinkedList<IAlgebraicRewriteRule>();
+    public static final List<IAlgebraicRewriteRule> buildPhysicalRewritesAllLevelsRuleCollection() {
+        List<IAlgebraicRewriteRule> physicalPlanRewrites = new LinkedList<>();
         physicalPlanRewrites.add(new PullSelectOutOfEqJoin());
         physicalPlanRewrites.add(new PushFunctionsOntoEqJoinBranches());
         physicalPlanRewrites.add(new SetAlgebricksPhysicalOperatorsRule());
@@ -320,15 +321,15 @@ public class RewriteRuleset {
         return physicalPlanRewrites;
     }
 
-    public final static List<IAlgebraicRewriteRule> buildPhysicalRewritesTopLevelRuleCollection() {
-        List<IAlgebraicRewriteRule> physicalPlanRewrites = new LinkedList<IAlgebraicRewriteRule>();
+    public static final List<IAlgebraicRewriteRule> buildPhysicalRewritesTopLevelRuleCollection() {
+        List<IAlgebraicRewriteRule> physicalPlanRewrites = new LinkedList<>();
         physicalPlanRewrites.add(new CopyLimitDownRule());
         physicalPlanRewrites.add(new SetExecutionModeRule());
         return physicalPlanRewrites;
     }
 
-    public final static List<IAlgebraicRewriteRule> prepareForJobGenRuleCollection() {
-        List<IAlgebraicRewriteRule> prepareForJobGenRewrites = new LinkedList<IAlgebraicRewriteRule>();
+    public static final List<IAlgebraicRewriteRule> prepareForJobGenRuleCollection() {
+        List<IAlgebraicRewriteRule> prepareForJobGenRewrites = new LinkedList<>();
         prepareForJobGenRewrites.add(new ConvertFromAlgebricksExpressionsRule());
         prepareForJobGenRewrites
                 .add(new IsolateHyracksOperatorsRule(HeuristicOptimizer.hyraxOperatorsBelowWhichJobGenIsDisabled));
index eef9495..ec31dbc 100644 (file)
@@ -3,9 +3,9 @@
  * Licensed 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 from
- * 
+ *
  *     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.
@@ -17,34 +17,36 @@ package org.apache.vxquery.compiler.rewriter;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.cardinality.Cardinality;
-import org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.documentorder.DocumentOrder;
-import org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.uniquenodes.UniqueNodes;
-
+import org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator;
+import org.apache.hyracks.algebricks.core.algebra.expressions.IConflictingTypeResolver;
 import org.apache.hyracks.algebricks.core.algebra.expressions.IExpressionEvalSizeComputer;
 import org.apache.hyracks.algebricks.core.algebra.expressions.IExpressionTypeComputer;
 import org.apache.hyracks.algebricks.core.algebra.expressions.IMergeAggregationExpressionFactory;
-import org.apache.hyracks.algebricks.core.algebra.expressions.INullableTypeComputer;
+import org.apache.hyracks.algebricks.core.algebra.expressions.IMissableTypeComputer;
 import org.apache.hyracks.algebricks.core.algebra.prettyprint.LogicalOperatorPrettyPrintVisitor;
 import org.apache.hyracks.algebricks.core.rewriter.base.AlgebricksOptimizationContext;
 import org.apache.hyracks.algebricks.core.rewriter.base.PhysicalOptimizationConfig;
+import org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.cardinality.Cardinality;
+import org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.documentorder.DocumentOrder;
+import org.apache.vxquery.compiler.rewriter.rules.propagationpolicies.uniquenodes.UniqueNodes;
 
 public class VXQueryOptimizationContext extends AlgebricksOptimizationContext {
 
-    private final Map<ILogicalOperator, HashMap<Integer, DocumentOrder>> documentOrderOperatorVariableMap = new HashMap<ILogicalOperator, HashMap<Integer, DocumentOrder>>();
-    private final Map<ILogicalOperator, HashMap<Integer, UniqueNodes>> uniqueNodesOperatorVariableMap = new HashMap<ILogicalOperator, HashMap<Integer, UniqueNodes>>();
-    private final Map<ILogicalOperator, Cardinality> cardinalityOperatorMap = new HashMap<ILogicalOperator, Cardinality>();
+    private final Map<ILogicalOperator, HashMap<Integer, DocumentOrder>> documentOrderOperatorVariableMap = new HashMap<>();
+    private final Map<ILogicalOperator, HashMap<Integer, UniqueNodes>> uniqueNodesOperatorVariableMap = new HashMap<>();
+    private final Map<ILogicalOperator, Cardinality> cardinalityOperatorMap = new HashMap<>();
 
     private int totalDataSources = 0;
     private int collectionId = 0;
 
     public VXQueryOptimizationContext(int varCounter, IExpressionEvalSizeComputer expressionEvalSizeComputer,
             IMergeAggregationExpressionFactory mergeAggregationExpressionFactory,
-            IExpressionTypeComputer expressionTypeComputer, INullableTypeComputer nullableTypeComputer,
-            PhysicalOptimizationConfig physicalOptimizationConfig, LogicalOperatorPrettyPrintVisitor prettyPrintVisitor) {
+            IExpressionTypeComputer expressionTypeComputer, IMissableTypeComputer missableTypeComputer,
+            IConflictingTypeResolver conflictingTypeResovler, PhysicalOptimizationConfig physicalOptimizationConfig,
+            AlgebricksPartitionConstraint clusterLocations, LogicalOperatorPrettyPrintVisitor prettyPrintVisitor) {
         super(varCounter, expressionEvalSizeComputer, mergeAggregationExpressionFactory, expressionTypeComputer,
-                nullableTypeComputer, physicalOptimizationConfig, prettyPrintVisitor);
+                missableTypeComputer, conflictingTypeResovler, physicalOptimizationConfig, clusterLocations, prettyPrintVisitor);
     }
 
     public void incrementTotalDataSources() {
index 2e8a8ac..b62242b 100644 (file)
@@ -17,9 +17,6 @@
 package org.apache.vxquery.compiler.rewriter.rules;
 
 import java.io.DataInputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
 import java.util.Set;
 
 import org.apache.commons.lang3.mutable.Mutable;
@@ -79,7 +76,7 @@ public abstract class AbstractCollectionRule implements IAlgebraicRewriteRule {
         AssignOperator assign = (AssignOperator) op2;
 
         // Check to see if the expression is a function and fn:Collection.
-        ILogicalExpression logicalExpression = (ILogicalExpression) assign.getExpressions().get(0).getValue();
+        ILogicalExpression logicalExpression = assign.getExpressions().get(0).getValue();
         if (logicalExpression.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
             return null;
         }
@@ -92,7 +89,7 @@ public abstract class AbstractCollectionRule implements IAlgebraicRewriteRule {
         // Get arguments
         int size = functionCall.getArguments().size();
         if (size > 0) {
-            String args[] = new String[size];
+            String[] args = new String[size];
             for (int i = 0; i < size; i++) {
                 args[i] = getArgument(functionCall, opRef, i);
             }
@@ -103,7 +100,7 @@ public abstract class AbstractCollectionRule implements IAlgebraicRewriteRule {
 
     private String getArgument(AbstractFunctionCallExpression functionCall, Mutable<ILogicalOperator> opRef, int pos) {
         VXQueryConstantValue constantValue;
-        ILogicalExpression logicalExpression2 = (ILogicalExpression) functionCall.getArguments().get(pos).getValue();
+        ILogicalExpression logicalExpression2 = functionCall.getArguments().get(pos).getValue();
         if (logicalExpression2.getExpressionTag() != LogicalExpressionTag.VARIABLE) {
             return null;
         } else if (logicalExpression2 == null) {
@@ -118,7 +115,7 @@ public abstract class AbstractCollectionRule implements IAlgebraicRewriteRule {
             AssignOperator assign2 = (AssignOperator) op3;
 
             // Check to see if the expression is a constant expression and type string.
-            ILogicalExpression logicalExpression3 = (ILogicalExpression) assign2.getExpressions().get(0).getValue();
+            ILogicalExpression logicalExpression3 = assign2.getExpressions().get(0).getValue();
             if (logicalExpression3.getExpressionTag() != LogicalExpressionTag.CONSTANT) {
                 return null;
             }
@@ -132,17 +129,9 @@ public abstract class AbstractCollectionRule implements IAlgebraicRewriteRule {
         }
         // Constant value is now in a TaggedValuePointable. Convert the value into a java String.
         tvp.set(constantValue.getValue(), 0, constantValue.getValue().length);
-        String collectionName = null;
         if (tvp.getTag() == ValueTag.XS_STRING_TAG) {
             tvp.getValue(stringp);
-            try {
-                bbis.setByteBuffer(ByteBuffer.wrap(Arrays.copyOfRange(stringp.getByteArray(), stringp.getStartOffset(),
-                        stringp.getLength() + stringp.getStartOffset())), 0);
-                collectionName = di.readUTF();
-                return collectionName;
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
+            return stringp.toString();
         }
         return null;
     }
index 42d59aa..20283d8 100644 (file)
@@ -60,7 +60,7 @@ public class IntroduceCollectionRule extends AbstractCollectionRule {
     @Override
     public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) {
         VXQueryOptimizationContext vxqueryContext = (VXQueryOptimizationContext) context;
-        String args[] = getFunctionalArguments(opRef, VXQueryCommons.collectionFunctions);
+        String[] args = getFunctionalArguments(opRef, VXQueryCommons.collectionFunctions);
 
         if (args != null) {
             String collectionName = args[0];
index 8f241b3..08766b0 100644 (file)
@@ -23,18 +23,6 @@ import java.io.IOException;
 import java.util.List;
 
 import org.apache.commons.lang3.mutable.Mutable;
-import org.apache.vxquery.compiler.algebricks.VXQueryConstantValue;
-import org.apache.vxquery.compiler.rewriter.rules.util.ExpressionToolbox;
-import org.apache.vxquery.compiler.rewriter.rules.util.OperatorToolbox;
-import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
-import org.apache.vxquery.datamodel.builders.atomic.StringValueBuilder;
-import org.apache.vxquery.datamodel.values.ValueTag;
-import org.apache.vxquery.functions.BuiltinFunctions;
-import org.apache.vxquery.metadata.VXQueryMetadataProvider;
-import org.apache.vxquery.types.BuiltinTypeRegistry;
-import org.apache.vxquery.types.Quantifier;
-import org.apache.vxquery.types.SequenceType;
-
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator;
@@ -47,27 +35,38 @@ import org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream;
+import org.apache.vxquery.compiler.algebricks.VXQueryConstantValue;
+import org.apache.vxquery.compiler.rewriter.rules.util.ExpressionToolbox;
+import org.apache.vxquery.compiler.rewriter.rules.util.OperatorToolbox;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.datamodel.builders.atomic.StringValueBuilder;
+import org.apache.vxquery.datamodel.values.ValueTag;
+import org.apache.vxquery.functions.BuiltinFunctions;
+import org.apache.vxquery.metadata.VXQueryMetadataProvider;
+import org.apache.vxquery.types.BuiltinTypeRegistry;
+import org.apache.vxquery.types.Quantifier;
+import org.apache.vxquery.types.SequenceType;
 
 /**
  * The rule searches for where the function_doc1 function is in the plan in place of XQuery function.
  * It replaces the string contained in the function with its absolute file path.
- * 
+ *
  * <pre>
  * Before
- * 
+ *
  *   plan__parent
  *   %OPERATOR( $v1 : fn:doc( \@string ) )
  *   plan__child
- *   
+ *
  *   Where xquery_function creates an atomic value.
- *   
- * After 
- * 
+ *
+ * After
+ *
  *   plan__parent
  *   %OPERATOR( $v1 : fn:doc( \@absolute_file_path ) ) )
  *   plan__child
  * </pre>
- * 
+ *
  * @author shivanim
  */
 
index d728927..f635b1d 100644 (file)
  */
 package org.apache.vxquery.datamodel.accessors.atomic;
 
-import org.apache.vxquery.datamodel.api.IDate;
-import org.apache.vxquery.datamodel.api.ITimezone;
-
 import org.apache.hyracks.api.dataflow.value.ITypeTraits;
 import org.apache.hyracks.data.std.api.AbstractPointable;
 import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.api.IPointableFactory;
 import org.apache.hyracks.data.std.primitive.BytePointable;
 import org.apache.hyracks.data.std.primitive.ShortPointable;
+import org.apache.vxquery.datamodel.api.IDate;
+import org.apache.vxquery.datamodel.api.ITimezone;
 
 /**
  * The date is split up into five sections. Due to leap year, we have decided to keep the
  * storage simple by saving each date section separately. For calculations you can access
  * YearMonth (months) and DayTime (milliseconds) values.
  * The date pointable is also used for GDay, GMonth, GYear, GDayMonth and GMonthYear.
- * 
- * @author prestoncarman
  */
 public class XSDatePointable extends AbstractPointable implements IDate, ITimezone {
     public final static int YEAR_OFFSET = 0;
index f8e63b6..977101b 100644 (file)
@@ -20,7 +20,7 @@ import org.apache.hyracks.api.dataflow.value.ITypeTraits;
 import org.apache.hyracks.data.std.api.AbstractPointable;
 import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.api.IPointableFactory;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.util.string.UTF8StringUtil;
 
 /**
  * The XSQNamePointable holds three strings: URI, Prefix and Local Name.
@@ -59,7 +59,8 @@ public class XSQNamePointable extends AbstractPointable {
     }
 
     public static int getUriLength(byte[] bytes, int start) {
-        return getUriUTFLength(bytes, start) + 2;
+        int utfLength = getUriUTFLength(bytes, start);
+        return utfLength + UTF8StringUtil.getNumBytesToStoreLength(utfLength);
     }
 
     public int getUriUTFLength() {
@@ -67,7 +68,7 @@ public class XSQNamePointable extends AbstractPointable {
     }
 
     public static int getUriUTFLength(byte[] bytes, int start) {
-        return UTF8StringPointable.getUTFLength(bytes, start);
+        return UTF8StringUtil.getUTFLength(bytes, start);
     }
 
     public int getPrefixLength() {
@@ -75,7 +76,8 @@ public class XSQNamePointable extends AbstractPointable {
     }
 
     public static int getPrefixLength(byte[] bytes, int start) {
-        return getPrefixUTFLength(bytes, start) + 2;
+        int utfLength = getPrefixUTFLength(bytes, start);
+        return utfLength + UTF8StringUtil.getNumBytesToStoreLength(utfLength);
     }
 
     public int getPrefixUTFLength() {
@@ -83,7 +85,7 @@ public class XSQNamePointable extends AbstractPointable {
     }
 
     public static int getPrefixUTFLength(byte[] bytes, int start) {
-        return UTF8StringPointable.getUTFLength(bytes, start + getUriLength(bytes, start));
+        return UTF8StringUtil.getUTFLength(bytes, start + getUriLength(bytes, start));
     }
 
     public int getLocalNameLength() {
@@ -91,7 +93,8 @@ public class XSQNamePointable extends AbstractPointable {
     }
 
     public static int getLocalNameLength(byte[] bytes, int start) {
-        return getLocalNameUTFLength(bytes, start) + 2;
+        int utfLength = getLocalNameUTFLength(bytes, start);
+        return utfLength + UTF8StringUtil.getNumBytesToStoreLength(utfLength);
     }
 
     public int getLocalNameUTFLength() {
@@ -99,7 +102,7 @@ public class XSQNamePointable extends AbstractPointable {
     }
 
     public static int getLocalNameUTFLength(byte[] bytes, int start) {
-        return UTF8StringPointable.getUTFLength(bytes,
+        return UTF8StringUtil.getUTFLength(bytes,
                 start + getUriLength(bytes, start) + getPrefixLength(bytes, start));
     }
 
index ac96210..5311342 100644 (file)
@@ -16,6 +16,8 @@
  */
 package org.apache.vxquery.datamodel.accessors.jsonitem;
 
+import java.io.IOException;
+
 import org.apache.hyracks.api.dataflow.value.ITypeTraits;
 import org.apache.hyracks.data.std.api.AbstractPointable;
 import org.apache.hyracks.data.std.api.IMutableValueStorage;
@@ -24,12 +26,11 @@ import org.apache.hyracks.data.std.api.IPointableFactory;
 import org.apache.hyracks.data.std.primitive.IntegerPointable;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.hyracks.util.string.UTF8StringUtil;
 import org.apache.vxquery.datamodel.builders.sequence.SequenceBuilder;
 import org.apache.vxquery.datamodel.values.ValueTag;
 import org.apache.vxquery.runtime.functions.util.FunctionHelper;
 
-import java.io.IOException;
-
 /**
  * The datamodel of the JSON object is represented in this class:
  * Byte 1: Value tag of object (109)
@@ -65,8 +66,9 @@ public class ObjectPointable extends AbstractPointable {
         return IntegerPointable.getInteger(bytes, start);
     }
 
-    private static int getKeyLength(byte[] b, int s) {
-        return UTF8StringPointable.getUTFLength(b, s) + 2;
+    private static int getKeyLength(byte[] bytes, int start) {
+        int utfLength = UTF8StringUtil.getUTFLength(bytes, start);
+        return utfLength + UTF8StringUtil.getNumBytesToStoreLength(utfLength);
     }
 
     private static int getSlotArrayOffset(int start) {
index db03e28..c0c447c 100644 (file)
@@ -16,8 +16,6 @@
  */
 package org.apache.vxquery.datamodel.accessors.nodes;
 
-import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
-
 import org.apache.hyracks.api.dataflow.value.ITypeTraits;
 import org.apache.hyracks.data.std.algorithms.BinarySearchAlgorithm;
 import org.apache.hyracks.data.std.api.AbstractPointable;
@@ -28,6 +26,8 @@ import org.apache.hyracks.data.std.primitive.BytePointable;
 import org.apache.hyracks.data.std.primitive.IntegerPointable;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.hyracks.util.string.UTF8StringUtil;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 
 /*
  * NodeTree {
@@ -36,17 +36,17 @@ import org.apache.hyracks.data.std.primitive.VoidPointable;
  *  Dictionary dictionary?;
  *  ElementNode rootNode;
  * }
- * 
+ *
  * ElementHeader (padded) {
  *  bit nodeIdExists;
  *  bit dictionaryExists;
  *  bit headerTypeExists;
  * }
- * 
+ *
  * NodeId {
  *  int32 id;
  * }
- * 
+ *
  * Dictionary {
  *  int32 numberOfItems
  *  int32[numberOfItems] lengthOfItem
@@ -97,14 +97,15 @@ public class NodeTreePointable extends AbstractPointable {
         public int getStart(int index) {
             int dataAreaStart = getDictionaryDataAreaStartOffset();
             int sortedPtrArrayStart = getDictionarySortedPointerArrayOffset();
-            int sortedSlotValue = IntegerPointable
-                    .getInteger(bytes, sortedPtrArrayStart + index * SORTED_PTR_SLOT_SIZE);
+            int sortedSlotValue = IntegerPointable.getInteger(bytes,
+                    sortedPtrArrayStart + index * SORTED_PTR_SLOT_SIZE);
             return dataAreaStart + sortedSlotValue;
         }
 
         @Override
         public int getLength(int index) {
-            return UTF8StringPointable.getUTFLength(bytes, getStart(index)) + 2;
+            int utfLength = UTF8StringUtil.getUTFLength(bytes, getStart(index));
+            return utfLength + UTF8StringUtil.getNumBytesToStoreLength(utfLength);
         }
     };
 
@@ -130,16 +131,18 @@ public class NodeTreePointable extends AbstractPointable {
         return dictionaryExists() ? IntegerPointable.getInteger(bytes, getDictionaryEntryCountOffset()) : 0;
     }
 
-    public void getString(int idx, IPointable string) {
+    public void getString(int idx, UTF8StringPointable string) {
         int nEntries = getDictionaryEntryCount();
         if (idx < 0 || idx >= nEntries) {
             throw new IllegalArgumentException(idx + " not within [0, " + nEntries + ")");
         }
         int dataAreaStart = getDictionaryDataAreaStartOffset();
-        int idxSlotValue = idx == 0 ? 0 : IntegerPointable.getInteger(bytes, getDictionaryIndexPointerArrayOffset()
-                + (idx - 1) * IDX_PTR_SLOT_SIZE);
-        int strLen = UTF8StringPointable.getUTFLength(bytes, dataAreaStart + idxSlotValue);
-        string.set(bytes, dataAreaStart + idxSlotValue, strLen + 2);
+        int idxSlotValue = idx == 0 ? 0
+                : IntegerPointable.getInteger(bytes,
+                        getDictionaryIndexPointerArrayOffset() + (idx - 1) * IDX_PTR_SLOT_SIZE);
+        int strLen = UTF8StringUtil.getUTFLength(bytes, dataAreaStart + idxSlotValue);
+        int strMetaLen = UTF8StringUtil.getNumBytesToStoreLength(strLen);
+        string.set(bytes, dataAreaStart + idxSlotValue, strMetaLen + strLen);
     }
 
     public int lookupString(UTF8StringPointable key) {
@@ -197,8 +200,8 @@ public class NodeTreePointable extends AbstractPointable {
     }
 
     private int getDictionaryDataAreaStartOffset() {
-        return getDictionaryIndexPointerArrayOffset() + getDictionaryEntryCount()
-                * (IDX_PTR_SLOT_SIZE + SORTED_PTR_SLOT_SIZE);
+        return getDictionaryIndexPointerArrayOffset()
+                + getDictionaryEntryCount() * (IDX_PTR_SLOT_SIZE + SORTED_PTR_SLOT_SIZE);
     }
 
     private int getRootNodeOffset() {
index 3ae5126..6aee42b 100644 (file)
@@ -19,8 +19,8 @@ package org.apache.vxquery.datamodel.accessors.nodes;
 import org.apache.hyracks.api.dataflow.value.ITypeTraits;
 import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.api.IPointableFactory;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.hyracks.util.string.UTF8StringUtil;
 
 /*
  * PI {
@@ -66,7 +66,8 @@ public class PINodePointable extends AbstractNodePointable {
     }
 
     private int getTargetSize(NodeTreePointable nodeTree) {
-        return UTF8StringPointable.getUTFLength(bytes, getTargetOffset(nodeTree)) + 2;
+        int utfLength = UTF8StringUtil.getUTFLength(bytes, getTargetOffset(nodeTree));
+        return utfLength + UTF8StringUtil.getNumBytesToStoreLength(utfLength);
     }
 
     private int getContentOffset(NodeTreePointable nodeTree) {
@@ -74,6 +75,7 @@ public class PINodePointable extends AbstractNodePointable {
     }
 
     private int getContentSize(NodeTreePointable nodeTree) {
-        return UTF8StringPointable.getUTFLength(bytes, getContentOffset(nodeTree)) + 2;
+        int utfLength = UTF8StringUtil.getUTFLength(bytes, getContentOffset(nodeTree));
+        return utfLength + UTF8StringUtil.getNumBytesToStoreLength(utfLength);
     }
 }
index 215d1b1..453ffe0 100644 (file)
@@ -19,7 +19,7 @@ package org.apache.vxquery.datamodel.builders.atomic;
 import java.io.DataOutput;
 import java.io.IOException;
 
-import org.apache.hyracks.data.std.primitive.UTF8StringWriter;
+import org.apache.hyracks.util.string.UTF8StringWriter;
 
 public class StringValueBuilder {
     private final UTF8StringWriter writer;
@@ -29,6 +29,6 @@ public class StringValueBuilder {
     }
 
     public void write(CharSequence string, DataOutput out) throws IOException {
-        writer.writeUTF8String(string, out);
+        writer.writeUTF8(string, out);
     }
 }
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/atomic/UTF8StringBuilder.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/atomic/UTF8StringBuilder.java
deleted file mode 100644 (file)
index a4d301d..0000000
+++ /dev/null
@@ -1,51 +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.datamodel.builders.atomic;
-
-import java.io.DataOutput;
-import java.io.IOException;
-import java.io.UTFDataFormatException;
-
-import org.apache.hyracks.data.std.api.IMutableValueStorage;
-import org.apache.hyracks.data.std.primitive.BytePointable;
-import org.apache.vxquery.datamodel.builders.base.IBuilder;
-import org.apache.vxquery.runtime.functions.util.FunctionHelper;
-
-public class UTF8StringBuilder implements IBuilder {
-    private IMutableValueStorage mvs;
-    private DataOutput out;
-
-    public void reset(IMutableValueStorage mvs) throws IOException {
-        this.mvs = mvs;
-        out = mvs.getDataOutput();
-        out.write(0);
-        out.write(0);
-    }
-
-    public void finish() throws IOException {
-        int utflen = mvs.getLength() - 2;
-        BytePointable.setByte(mvs.getByteArray(), 0, (byte) ((utflen >>> 8) & 0xFF));
-        BytePointable.setByte(mvs.getByteArray(), 1, (byte) ((utflen >>> 0) & 0xFF));
-    }
-
-    public void appendCharArray(char[] ch, int start, int length) throws IOException {
-        FunctionHelper.writeCharArray(ch, start, length, out);
-        if (mvs.getLength() > 65535) {
-            throw new UTFDataFormatException("encoded string too long: " + mvs.getLength() + " bytes");
-        }
-    }
-}
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/atomic/VXQueryUTF8StringBuilder.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/atomic/VXQueryUTF8StringBuilder.java
new file mode 100644 (file)
index 0000000..dcf5bbc
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * 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.datamodel.builders.atomic;
+
+import java.io.IOException;
+
+import org.apache.hyracks.data.std.util.UTF8StringBuilder;
+
+public class VXQueryUTF8StringBuilder extends UTF8StringBuilder {
+
+    public void appendUtf8Bytes(byte[] bytes, int byteStartOffset, int byteLength) throws IOException {
+        out.write(bytes, byteStartOffset, byteLength);
+    }
+
+}
index d596c3d..68f5d4d 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.vxquery.datamodel.builders.nodes;
 import java.io.IOException;
 
 import org.apache.hyracks.data.std.api.IValueReference;
+import org.apache.hyracks.data.std.util.GrowableArray;
 import org.apache.vxquery.datamodel.values.ValueTag;
 
 public class CommentNodeBuilder extends AbstractNodeBuilder {
@@ -39,4 +40,8 @@ public class CommentNodeBuilder extends AbstractNodeBuilder {
     public void setValue(IValueReference value) throws IOException {
         out.write(value.getByteArray(), value.getStartOffset(), value.getLength());
     }
+
+    public void setValue(GrowableArray value) throws IOException {
+        out.write(value.getByteArray(), 0, value.getLength());
+    }
 }
index dae149f..cf13bfe 100644 (file)
@@ -22,14 +22,15 @@ import java.io.IOException;
 import java.util.Map.Entry;
 import java.util.TreeMap;
 
-import org.apache.vxquery.util.GrowableIntArray;
-
 import org.apache.hyracks.data.std.algorithms.BinarySearchAlgorithm;
 import org.apache.hyracks.data.std.collections.api.IValueReferenceVector;
 import org.apache.hyracks.data.std.primitive.IntegerPointable;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
+import org.apache.hyracks.util.string.UTF8StringUtil;
+import org.apache.hyracks.util.string.UTF8StringWriter;
+import org.apache.vxquery.util.GrowableIntArray;
 
 public class DictionaryBuilder {
     private final GrowableIntArray stringEndOffsets;
@@ -46,6 +47,8 @@ public class DictionaryBuilder {
 
     private boolean cacheReady;
 
+    private final UTF8StringWriter UTF8Writer = new UTF8StringWriter();
+
     private final IValueReferenceVector sortedStringsVector = new IValueReferenceVector() {
         @Override
         public int getStart(int index) {
@@ -60,7 +63,8 @@ public class DictionaryBuilder {
 
         @Override
         public int getLength(int index) {
-            return UTF8StringPointable.getUTFLength(dataBuffer.getByteArray(), getStart(index)) + 2;
+            int utfLength = UTF8StringUtil.getUTFLength(dataBuffer.getByteArray(), getStart(index));
+            return utfLength + UTF8StringUtil.getNumBytesToStoreLength(utfLength);
         }
 
         @Override
@@ -77,7 +81,7 @@ public class DictionaryBuilder {
         dataBuffer = new ByteArrayAccessibleOutputStream();
         dataBufferOut = new DataOutputStream(dataBuffer);
         cache = new ArrayBackedValueStorage();
-        hashSlotIndexes = new TreeMap<String, Integer>();
+        hashSlotIndexes = new TreeMap<>();
         cacheReady = false;
     }
 
@@ -120,6 +124,7 @@ public class DictionaryBuilder {
             }
         }
         out.write(dataBuffer.getByteArray(), 0, dataBuffer.size());
+        // TODO can this value be determined before writing. Could this be append only.
         IntegerPointable.setInteger(abvs.getByteArray(), sizeOffset, abvs.getLength() - sizeOffset);
     }
 
@@ -127,7 +132,7 @@ public class DictionaryBuilder {
         Integer slotIndex = hashSlotIndexes.get(str);
         if (slotIndex == null) {
             try {
-                dataBufferOut.writeUTF(str);
+                UTF8Writer.writeUTF8(str, dataBufferOut);
                 slotIndex = stringEndOffsets.getSize();
                 dataBufferOut.writeInt(slotIndex);
             } catch (IOException e) {
index 0e62762..05a1a88 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.vxquery.datamodel.builders.nodes;
 import java.io.IOException;
 
 import org.apache.hyracks.data.std.api.IValueReference;
+import org.apache.hyracks.data.std.util.GrowableArray;
 import org.apache.vxquery.datamodel.values.ValueTag;
 
 public class PINodeBuilder extends AbstractNodeBuilder {
@@ -43,4 +44,12 @@ public class PINodeBuilder extends AbstractNodeBuilder {
     public void setContent(IValueReference value) throws IOException {
         out.write(value.getByteArray(), value.getStartOffset(), value.getLength());
     }
+
+    public void setTarget(GrowableArray value) throws IOException {
+        out.write(value.getByteArray(), 0, value.getLength());
+    }
+
+    public void setContent(GrowableArray value) throws IOException {
+        out.write(value.getByteArray(), 0, value.getLength());
+    }
 }
index 67aa487..4456b35 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.vxquery.datamodel.builders.nodes;
 import java.io.IOException;
 
 import org.apache.hyracks.data.std.api.IValueReference;
+import org.apache.hyracks.data.std.util.GrowableArray;
 import org.apache.vxquery.datamodel.values.ValueTag;
 
 public class TextNodeBuilder extends AbstractNodeBuilder {
@@ -39,4 +40,8 @@ public class TextNodeBuilder extends AbstractNodeBuilder {
     public void setValue(IValueReference value) throws IOException {
         out.write(value.getByteArray(), value.getStartOffset(), value.getLength());
     }
+
+    public void setValue(GrowableArray value) throws IOException {
+        out.write(value.getByteArray(), 0, value.getLength());
+    }
 }
index 3dc7e9e..c74c0b0 100644 (file)
@@ -54,10 +54,9 @@ public class XDMConstants {
         }
         EMPTY_SEQUENCE = Arrays.copyOf(abvs.getByteArray(), abvs.getLength());
 
-        EMPTY_STRING = new byte[3];
+        EMPTY_STRING = new byte[2];
         EMPTY_STRING[0] = ValueTag.XS_STRING_TAG;
         EMPTY_STRING[1] = 0;
-        EMPTY_STRING[2] = 0;
 
         JS_NULL_CONSTANT = new byte[1];
         JS_NULL_CONSTANT[0] = ValueTag.JS_NULL_TAG;
index fccbc55..a3f7bf8 100644 (file)
@@ -19,10 +19,10 @@ package org.apache.vxquery.exceptions;
 import java.text.MessageFormat;
 import java.util.Arrays;
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.vxquery.util.SourceLocation;
 
-public class SystemException extends AlgebricksException {
+public class SystemException extends HyracksDataException {
     private static final long serialVersionUID = 1L;
 
     private final ErrorCode code;
index e41872c..28c556f 100644 (file)
@@ -26,8 +26,8 @@ public class VXQueryDataException extends HyracksDataException {
 
     private File file;
 
-    public VXQueryDataException(String message, Exception ex, File file) {
-        super(message, ex);
+    public VXQueryDataException(String message, Exception ex, File file, String nodeId) {
+        super(message, ex, nodeId);
         this.file = file;
     }
 
index 2856178..22dc754 100644 (file)
@@ -22,8 +22,8 @@ public class VXQueryFileNotFoundException extends VXQueryDataException {
 
     private static final long serialVersionUID = 1L;
 
-    public VXQueryFileNotFoundException(Exception ex, File file) {
-        super("The file ([nodeId]:[path]) can not be found.", ex, file);
+    public VXQueryFileNotFoundException(Exception ex, File file, String nodeId) {
+        super("The file ([nodeId]:[path]) can not be found.", ex, file, nodeId);
     }
 
 }
index f0d66fb..8a367e3 100644 (file)
@@ -22,8 +22,8 @@ public class VXQueryParseException extends VXQueryDataException {
 
     private static final long serialVersionUID = 1L;
 
-    public VXQueryParseException(Exception ex, File file) {
-        super("The file ([nodeId]:[path]) threw a SAXException during parsing.", ex, file);
+    public VXQueryParseException(Exception ex, File file, String nodeId) {
+        super("The file ([nodeId]:[path]) threw a SAXException during parsing.", ex, file, nodeId);
     }
 
 }
index bccd28d..7524da4 100644 (file)
@@ -117,7 +117,7 @@ public class IndexDocumentBuilder extends XMLSerializer {
         print(bstart, sstart, lstart, "0", "");
         for (int i = 1; i < results.size() - 1; i++) {
             //TODO: Since each doc is a file,
-            //we can only handle files 
+            //we can only handle files
             //small enough to fit in memory
             doc.add(results.get(i).sf);
         }
@@ -813,8 +813,8 @@ public class IndexDocumentBuilder extends XMLSerializer {
     }
 
     private String[] printString(UTF8StringPointable utf8sp, String path) {
-        int utfLen = utf8sp.getUTFLength();
-        int offset = 2;
+        int utfLen = utf8sp.getUTF8Length();
+        int offset = utf8sp.getMetaDataLength();
         String[] result = { "", path };
         while (utfLen > 0) {
             char c = utf8sp.charAt(offset);
@@ -843,7 +843,7 @@ public class IndexDocumentBuilder extends XMLSerializer {
                     result[0] += Character.toString(c);
                     break;
             }
-            int cLen = UTF8StringPointable.getModifiedUTF8Len(c);
+            int cLen = utf8sp.charSize(offset);
             offset += cLen;
             utfLen -= cLen;
 
index dd9898c..df6fb4b 100644 (file)
  */
 package org.apache.vxquery.metadata;
 
-import org.apache.hyracks.algebricks.core.algebra.metadata.IDataSourcePropertiesProvider;
-
 import java.util.List;
 
-public abstract class AbstractVXQueryDataSource {
+import org.apache.hyracks.algebricks.core.algebra.metadata.IDataSource;
+import org.apache.hyracks.algebricks.core.algebra.metadata.IDataSourcePropertiesProvider;
+import org.apache.hyracks.algebricks.core.algebra.properties.INodeDomain;
+
+public abstract class AbstractVXQueryDataSource implements IDataSource<String> {
     protected static final String DELIMITER = "\\|";
     protected int dataSourceId;
     protected String collectionName;
@@ -36,4 +38,17 @@ public abstract class AbstractVXQueryDataSource {
     protected IDataSourcePropertiesProvider propProvider;
 
     public abstract String getFunctionCall();
+
+    @Override
+    public boolean isScanAccessPathALeaf() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public INodeDomain getDomain() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
 }
index 8286d1b..f8d6d1d 100644 (file)
@@ -20,7 +20,7 @@ import org.apache.hyracks.algebricks.core.algebra.metadata.IDataSink;
 import org.apache.hyracks.algebricks.core.algebra.properties.FileSplitDomain;
 import org.apache.hyracks.algebricks.core.algebra.properties.IPartitioningProperty;
 import org.apache.hyracks.algebricks.core.algebra.properties.RandomPartitioningProperty;
-import org.apache.hyracks.dataflow.std.file.FileSplit;
+import org.apache.hyracks.api.io.FileSplit;
 
 public class QueryResultDataSink implements IDataSink {
     private final FileSplit[] fileSplits;
index b4bc858..bee7c7b 100644 (file)
@@ -19,18 +19,16 @@ package org.apache.vxquery.metadata;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.vxquery.compiler.rewriter.rules.CollectionFileDomain;
-
 import org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import org.apache.hyracks.algebricks.core.algebra.metadata.IDataSource;
 import org.apache.hyracks.algebricks.core.algebra.metadata.IDataSourcePropertiesProvider;
 import org.apache.hyracks.algebricks.core.algebra.properties.FunctionalDependency;
 import org.apache.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty;
 import org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector;
 import org.apache.hyracks.algebricks.core.algebra.properties.RandomPartitioningProperty;
 import org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector;
+import org.apache.vxquery.compiler.rewriter.rules.CollectionFileDomain;
 
-public class VXQueryCollectionDataSource extends AbstractVXQueryDataSource implements IDataSource<String> {
+public class VXQueryCollectionDataSource extends AbstractVXQueryDataSource {
 
     private VXQueryCollectionDataSource(int id, String file, Object[] types) {
         this.dataSourceId = id;
index 7736edd..be95f93 100644 (file)
@@ -80,7 +80,7 @@ public class VXQueryCollectionOperatorDescriptor extends AbstractSingleActivityO
     protected static final Logger LOGGER = Logger.getLogger(VXQueryCollectionOperatorDescriptor.class.getName());
     private HDFSFunctions hdfs;
     private String tag;
-    private final String START_TAG = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
+    private static final String START_TAG = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
     private final String hdfsConf;
     private final Map<String, NodeControllerInfo> nodeControllerInfos;
 
@@ -277,7 +277,7 @@ public class VXQueryCollectionOperatorDescriptor extends AbstractSingleActivityO
             public void close() throws HyracksDataException {
                 // Check if needed?
                 if (appender.getTupleCount() > 0) {
-                    appender.flush(writer, true);
+                    appender.flush(writer);
                 }
                 writer.close();
             }
index da75108..ddbc984 100644 (file)
 */
 package org.apache.vxquery.metadata;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import org.apache.hyracks.algebricks.core.algebra.metadata.IDataSource;
 import org.apache.hyracks.algebricks.core.algebra.metadata.IDataSourcePropertiesProvider;
 import org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector;
 import org.apache.hyracks.algebricks.core.algebra.properties.RandomPartitioningProperty;
 import org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector;
 import org.apache.vxquery.compiler.rewriter.rules.CollectionFileDomain;
 
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  * Datasource object for indexing.
  */
-public class VXQueryIndexingDataSource extends AbstractVXQueryDataSource implements IDataSource<String> {
+public class VXQueryIndexingDataSource extends AbstractVXQueryDataSource {
 
     protected Object[] types;
 
index ae637ac..a24a629 100644 (file)
@@ -43,7 +43,6 @@ import org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream;
 import org.apache.hyracks.dataflow.common.comm.util.FrameUtils;
 import org.apache.hyracks.dataflow.std.base.AbstractSingleActivityOperatorDescriptor;
 import org.apache.hyracks.dataflow.std.base.AbstractUnaryInputUnaryOutputOperatorNodePushable;
-import org.apache.vxquery.context.DynamicContext;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.builders.sequence.SequenceBuilder;
 import org.apache.vxquery.datamodel.values.XDMConstants;
@@ -87,11 +86,10 @@ public class VXQueryIndexingOperatorDescriptor extends AbstractSingleActivityOpe
         final short partitionId = (short) ctx.getTaskAttemptId().getTaskId().getPartition();
         final ITreeNodeIdProvider nodeIdProvider = new TreeNodeIdProvider(partitionId, dataSourceId, totalDataSources);
         final String nodeId = ctx.getJobletContext().getApplicationContext().getNodeId();
-        final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
         final String collectionName = collectionPartitions[partition % collectionPartitions.length];
         String collectionModifiedName = collectionName.replace("${nodeId}", nodeId);
         IndexCentralizerUtil indexCentralizerUtil = new IndexCentralizerUtil(
-                ctx.getIOManager().getIODevices().get(0).getPath());
+                ctx.getIOManager().getIODevices().get(0).getMount());
         indexCentralizerUtil.readIndexDirectory();
 
         return new AbstractUnaryInputUnaryOutputOperatorNodePushable() {
@@ -158,7 +156,7 @@ public class VXQueryIndexingOperatorDescriptor extends AbstractSingleActivityOpe
                             XDMConstants.setTrue(result);
                             FrameUtils.appendFieldToWriter(writer, appender, result.getByteArray(),
                                     result.getStartOffset(), result.getLength());
-                        } catch (IOException | SystemException e) {
+                        } catch (IOException e) {
                             throw new HyracksDataException(
                                     "Could not update index in " + indexModifiedName + " " + e.getMessage());
                         }
@@ -174,7 +172,7 @@ public class VXQueryIndexingOperatorDescriptor extends AbstractSingleActivityOpe
                             XDMConstants.setTrue(result);
                             FrameUtils.appendFieldToWriter(writer, appender, result.getByteArray(),
                                     result.getStartOffset(), result.getLength());
-                        } catch (SystemException | IOException e) {
+                        } catch (IOException e) {
                             throw new HyracksDataException(
                                     "Could not delete index in " + indexModifiedName + " " + e.getMessage());
                         }
@@ -208,7 +206,7 @@ public class VXQueryIndexingOperatorDescriptor extends AbstractSingleActivityOpe
             public void close() throws HyracksDataException {
                 // Check if needed?
                 if (appender.getTupleCount() > 0) {
-                    appender.flush(writer, true);
+                    appender.flush(writer);
                 }
                 writer.close();
                 indexCentralizerUtil.writeIndexDirectory();
index b7b37b9..e552f68 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.vxquery.metadata;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -87,7 +88,7 @@ public class VXQueryMetadataProvider implements IMetadataProvider<String, String
             List<LogicalVariable> scanVariables, List<LogicalVariable> projectVariables, boolean projectPushed,
             List<LogicalVariable> minFilterVars, List<LogicalVariable> maxFilterVars, IOperatorSchema opSchema,
             IVariableTypeEnvironment typeEnv, JobGenContext context, JobSpecification jobSpec, Object implConfig)
-                    throws AlgebricksException {
+            throws AlgebricksException {
         VXQueryCollectionDataSource ds = null;
         VXQueryIndexingDataSource ids = null;
 
@@ -126,10 +127,10 @@ public class VXQueryMetadataProvider implements IMetadataProvider<String, String
             constraint = getClusterLocations(nodeList, ids.getPartitionCount());
         }
 
-        return new Pair<IOperatorDescriptor, AlgebricksPartitionConstraint>(scanner, constraint);
+        return new Pair<>(scanner, constraint);
     }
 
-    public static AlgebricksPartitionConstraint getClusterLocations(String[] nodeList) {
+    public static AlgebricksAbsolutePartitionConstraint getClusterLocations(String[] nodeList) {
         int availableProcessors = Runtime.getRuntime().availableProcessors();
         if (availableProcessors < 1) {
             availableProcessors = 1;
@@ -137,8 +138,8 @@ public class VXQueryMetadataProvider implements IMetadataProvider<String, String
         return getClusterLocations(nodeList, availableProcessors);
     }
 
-    public static AlgebricksPartitionConstraint getClusterLocations(String[] nodeList, int partitions) {
-        ArrayList<String> locs = new ArrayList<String>();
+    public static AlgebricksAbsolutePartitionConstraint getClusterLocations(String[] nodeList, int partitions) {
+        ArrayList<String> locs = new ArrayList<>();
         for (String node : nodeList) {
             for (int j = 0; j < partitions; j++) {
                 locs.add(node);
@@ -150,14 +151,9 @@ public class VXQueryMetadataProvider implements IMetadataProvider<String, String
     }
 
     @Override
-    public boolean scannerOperatorIsLeaf(IDataSource<String> dataSource) {
-        return false;
-    }
-
-    @Override
     public Pair<IPushRuntimeFactory, AlgebricksPartitionConstraint> getWriteFileRuntime(IDataSink sink,
             int[] printColumns, IPrinterFactory[] printerFactories, RecordDescriptor inputDesc)
-                    throws AlgebricksException {
+            throws AlgebricksException {
         throw new UnsupportedOperationException();
     }
 
@@ -183,7 +179,7 @@ public class VXQueryMetadataProvider implements IMetadataProvider<String, String
             IOperatorSchema[] inputSchemas, IVariableTypeEnvironment typeEnv, List<LogicalVariable> primaryKeys,
             List<LogicalVariable> secondaryKeys, List<LogicalVariable> additionalNonKeyFields,
             ILogicalExpression filterExpr, RecordDescriptor recordDesc, JobGenContext context, JobSpecification spec)
-                    throws AlgebricksException {
+            throws AlgebricksException {
         throw new UnsupportedOperationException();
     }
 
@@ -201,6 +197,7 @@ public class VXQueryMetadataProvider implements IMetadataProvider<String, String
                 return fid;
             }
 
+            @Override
             public boolean isFunctional() {
                 return true;
             }
@@ -212,7 +209,7 @@ public class VXQueryMetadataProvider implements IMetadataProvider<String, String
             int[] printColumns, IPrinterFactory[] printerFactories, RecordDescriptor inputDesc, boolean ordered,
             JobSpecification spec) throws AlgebricksException {
         QueryResultSetDataSink rsds = (QueryResultSetDataSink) sink;
-        ResultSetId rssId = (ResultSetId) rsds.getId();
+        ResultSetId rssId = rsds.getId();
 
         IResultSerializerFactoryProvider resultSerializerFactoryProvider = ResultSerializerFactoryProvider.INSTANCE;
         IAWriterFactory writerFactory = PrinterBasedWriterFactory.INSTANCE;
@@ -227,15 +224,7 @@ public class VXQueryMetadataProvider implements IMetadataProvider<String, String
             throw new AlgebricksException(e);
         }
 
-        return new Pair<IOperatorDescriptor, AlgebricksPartitionConstraint>(resultWriter, null);
-    }
-
-    @Override
-    public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getInsertRuntime(IDataSource<String> dataSource,
-            IOperatorSchema propagatedSchema, IVariableTypeEnvironment typeEnv, List<LogicalVariable> keys,
-            LogicalVariable payLoadVar, List<LogicalVariable> additionalNonKeyFields, RecordDescriptor recordDesc,
-            JobGenContext context, JobSpecification jobSpec, boolean bulkload) throws AlgebricksException {
-        throw new UnsupportedOperationException();
+        return new Pair<>(resultWriter, null);
     }
 
     @Override
@@ -257,4 +246,38 @@ public class VXQueryMetadataProvider implements IMetadataProvider<String, String
         throw new UnsupportedOperationException();
     }
 
+    @Override
+    public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getInsertRuntime(IDataSource<String> dataSource,
+            IOperatorSchema propagatedSchema, IVariableTypeEnvironment typeEnv, List<LogicalVariable> keys,
+            LogicalVariable payLoadVar, List<LogicalVariable> additionalFilterKeyFields,
+            List<LogicalVariable> additionalNonFilteringFields, RecordDescriptor recordDesc, JobGenContext context,
+            JobSpecification jobSpec, boolean bulkload) throws AlgebricksException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getUpsertRuntime(IDataSource<String> dataSource,
+            IOperatorSchema inputSchema, IVariableTypeEnvironment typeEnv, List<LogicalVariable> keys,
+            LogicalVariable payLoadVar, List<LogicalVariable> additionalFilterFields,
+            List<LogicalVariable> additionalNonFilteringFields, RecordDescriptor recordDesc, JobGenContext context,
+            JobSpecification jobSpec) throws AlgebricksException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getIndexUpsertRuntime(
+            IDataSourceIndex<String, String> dataSourceIndex, IOperatorSchema propagatedSchema,
+            IOperatorSchema[] inputSchemas, IVariableTypeEnvironment typeEnv, List<LogicalVariable> primaryKeys,
+            List<LogicalVariable> secondaryKeys, List<LogicalVariable> additionalFilteringKeys,
+            ILogicalExpression filterExpr, List<LogicalVariable> prevSecondaryKeys,
+            LogicalVariable prevAdditionalFilteringKeys, RecordDescriptor inputDesc, JobGenContext context,
+            JobSpecification spec) throws AlgebricksException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Map<String, String> getConfig() {
+        return new HashMap<>();
+    }
+
 }
index 325fb71..bd628e4 100644 (file)
@@ -19,6 +19,12 @@ package org.apache.vxquery.runtime.functions.aggregate;
 import java.io.DataOutput;
 import java.io.IOException;
 
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.vxquery.datamodel.accessors.SequencePointable;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.accessors.TypedPointables;
@@ -31,13 +37,6 @@ import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentAggr
 import org.apache.vxquery.runtime.functions.comparison.AbstractValueComparisonOperation;
 import org.apache.vxquery.runtime.functions.util.FunctionHelper;
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
 public abstract class AbstractMaxMinAggregateEvaluatorFactory extends
         AbstractTaggedValueArgumentAggregateEvaluatorFactory {
     private static final long serialVersionUID = 1L;
@@ -46,7 +45,8 @@ public abstract class AbstractMaxMinAggregateEvaluatorFactory extends
         super(args);
     }
 
-    protected IAggregateEvaluator createEvaluator(IScalarEvaluator[] args) throws AlgebricksException {
+    @Override
+    protected IAggregateEvaluator createEvaluator(IScalarEvaluator[] args) throws HyracksDataException {
         final AbstractValueComparisonOperation aOpComparison = createValueComparisonOperation();
         final TaggedValuePointable tvp2 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
         final SequencePointable seqp = (SequencePointable) SequencePointable.FACTORY.createPointable();
@@ -60,17 +60,17 @@ public abstract class AbstractMaxMinAggregateEvaluatorFactory extends
             long count;
 
             @Override
-            public void init() throws AlgebricksException {
+            public void init() {
                 count = 0;
             }
 
             @Override
-            public void finishPartial(IPointable result) throws AlgebricksException {
+            public void finishPartial(IPointable result) {
                 finish(result);
             }
 
             @Override
-            public void finish(IPointable result) throws AlgebricksException {
+            public void finish(IPointable result) {
                 if (count == 0) {
                     XDMConstants.setEmptySequence(result);
                 } else {
@@ -79,7 +79,7 @@ public abstract class AbstractMaxMinAggregateEvaluatorFactory extends
             }
 
             @Override
-            protected void step(TaggedValuePointable[] args) throws SystemException {
+            protected void step(TaggedValuePointable[] args) throws HyracksDataException {
                 TaggedValuePointable tvp1 = args[0];
                 if (tvp1.getTag() == ValueTag.SEQUENCE_TAG) {
                     // The local aggregate did not find a value so the global aggregate is receiving a empty sequence.
index 82d938e..06762d1 100644 (file)
  */
 package org.apache.vxquery.runtime.functions.aggregate;
 
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 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.TypedPointables;
 import org.apache.vxquery.datamodel.values.ValueTag;
 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 org.apache.vxquery.runtime.functions.comparison.AbstractValueComparisonOperation;
 import org.apache.vxquery.runtime.functions.util.FunctionHelper;
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.VoidPointable;
-
 public abstract class AbstractMaxMinScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
 
@@ -44,7 +42,7 @@ public abstract class AbstractMaxMinScalarEvaluatorFactory extends AbstractTagge
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
         final SequencePointable seqp = (SequencePointable) SequencePointable.FACTORY.createPointable();
         final AbstractValueComparisonOperation aOpComparison = createValueComparisonOperation();
@@ -56,7 +54,7 @@ public abstract class AbstractMaxMinScalarEvaluatorFactory extends AbstractTagge
 
         return new AbstractTaggedValueArgumentScalarEvaluator(args) {
             @Override
-            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
+            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws HyracksDataException {
                 // TODO Update the results to be based on specs when different types in sequence.
                 TaggedValuePointable tvp = args[0];
                 if (tvp.getTag() == ValueTag.SEQUENCE_TAG) {
index 828efd4..f33aa9d 100644 (file)
@@ -18,6 +18,13 @@ package org.apache.vxquery.runtime.functions.aggregate;
 
 import java.io.DataOutput;
 
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.LongPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.vxquery.datamodel.accessors.SequencePointable;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.values.ValueTag;
@@ -30,14 +37,6 @@ import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentAggr
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentAggregateEvaluatorFactory;
 import org.apache.vxquery.runtime.functions.util.ArithmeticHelper;
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.LongPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
 public class AvgGlobalAggregateEvaluatorFactory extends AbstractTaggedValueArgumentAggregateEvaluatorFactory {
     private static final long serialVersionUID = 1L;
 
@@ -46,7 +45,7 @@ public class AvgGlobalAggregateEvaluatorFactory extends AbstractTaggedValueArgum
     }
 
     @Override
-    protected IAggregateEvaluator createEvaluator(IScalarEvaluator[] args) throws AlgebricksException {
+    protected IAggregateEvaluator createEvaluator(IScalarEvaluator[] args) throws HyracksDataException {
         final ArrayBackedValueStorage abvsCount = new ArrayBackedValueStorage();
         final DataOutput dOutCount = abvsCount.getDataOutput();
         final ArrayBackedValueStorage abvsSum = new ArrayBackedValueStorage();
@@ -65,7 +64,7 @@ public class AvgGlobalAggregateEvaluatorFactory extends AbstractTaggedValueArgum
             TaggedValuePointable tvpCount = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
 
             @Override
-            public void init() throws AlgebricksException {
+            public void init() throws HyracksDataException {
                 try {
                     abvsCount.reset();
                     dOutCount.write(ValueTag.XS_INTEGER_TAG);
@@ -76,17 +75,17 @@ public class AvgGlobalAggregateEvaluatorFactory extends AbstractTaggedValueArgum
                     dOutSum.writeLong(0);
                     tvpSum.set(abvsSum);
                 } catch (Exception e) {
-                    throw new AlgebricksException(e);
+                    throw new HyracksDataException(e);
                 }
             }
 
             @Override
-            public void finishPartial(IPointable result) throws AlgebricksException {
+            public void finishPartial(IPointable result) throws HyracksDataException {
                 finish(result);
             }
 
             @Override
-            public void finish(IPointable result) throws AlgebricksException {
+            public void finish(IPointable result) throws HyracksDataException {
                 tvpCount.getValue(longp);
                 if (longp.getLong() == 0) {
                     XDMConstants.setEmptySequence(result);
@@ -96,13 +95,13 @@ public class AvgGlobalAggregateEvaluatorFactory extends AbstractTaggedValueArgum
                         divide.compute(tvpSum, tvpCount, tvpSum);
                         result.set(tvpSum);
                     } catch (Exception e) {
-                        throw new AlgebricksException(e);
+                        throw new HyracksDataException(e);
                     }
                 }
             }
 
             @Override
-            protected void step(TaggedValuePointable[] args) throws SystemException {
+            protected void step(TaggedValuePointable[] args) throws HyracksDataException {
                 TaggedValuePointable tvp = args[0];
                 if (tvp.getTag() == ValueTag.SEQUENCE_TAG) {
                     tvp.getValue(seq);
index db2aa57..bdfc1ad 100644 (file)
@@ -18,23 +18,21 @@ package org.apache.vxquery.runtime.functions.aggregate;
 
 import java.io.DataOutput;
 
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 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.datamodel.values.XDMConstants;
-import org.apache.vxquery.exceptions.SystemException;
 import org.apache.vxquery.runtime.functions.arithmetic.AddOperation;
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentAggregateEvaluator;
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentAggregateEvaluatorFactory;
 import org.apache.vxquery.runtime.functions.util.ArithmeticHelper;
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
 public class AvgLocalAggregateEvaluatorFactory extends AbstractTaggedValueArgumentAggregateEvaluatorFactory {
     private static final long serialVersionUID = 1L;
 
@@ -43,7 +41,7 @@ public class AvgLocalAggregateEvaluatorFactory extends AbstractTaggedValueArgume
     }
 
     @Override
-    protected IAggregateEvaluator createEvaluator(IScalarEvaluator[] args) throws AlgebricksException {
+    protected IAggregateEvaluator createEvaluator(IScalarEvaluator[] args) throws HyracksDataException {
         final TaggedValuePointable tvpCount = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
         final ArrayBackedValueStorage abvsCount = new ArrayBackedValueStorage();
         final DataOutput dOutCount = abvsCount.getDataOutput();
@@ -53,13 +51,13 @@ public class AvgLocalAggregateEvaluatorFactory extends AbstractTaggedValueArgume
         final SequenceBuilder sb = new SequenceBuilder();
         final AddOperation aOpAdd = new AddOperation();
         final ArithmeticHelper add = new ArithmeticHelper(aOpAdd, dCtx);
-        
+
         return new AbstractTaggedValueArgumentAggregateEvaluator(args) {
             long count;
             TaggedValuePointable tvpSum = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
 
             @Override
-            public void init() throws AlgebricksException {
+            public void init() throws HyracksDataException {
                 count = 0;
                 try {
                     abvsSum.reset();
@@ -67,17 +65,17 @@ public class AvgLocalAggregateEvaluatorFactory extends AbstractTaggedValueArgume
                     dOutSum.writeLong(0);
                     tvpSum.set(abvsSum);
                 } catch (Exception e) {
-                    throw new AlgebricksException(e);
+                    throw new HyracksDataException(e);
                 }
             }
 
             @Override
-            public void finishPartial(IPointable result) throws AlgebricksException {
+            public void finishPartial(IPointable result) throws HyracksDataException {
                 finish(result);
             }
 
             @Override
-            public void finish(IPointable result) throws AlgebricksException {
+            public void finish(IPointable result) throws HyracksDataException {
                 if (count == 0) {
                     XDMConstants.setEmptySequence(result);
                 } else {
@@ -96,13 +94,13 @@ public class AvgLocalAggregateEvaluatorFactory extends AbstractTaggedValueArgume
                         sb.finish();
                         result.set(abvsSeq);
                     } catch (Exception e) {
-                        throw new AlgebricksException(e);
+                        throw new HyracksDataException(e);
                     }
                 }
             }
 
             @Override
-            protected void step(TaggedValuePointable[] args) throws SystemException {
+            protected void step(TaggedValuePointable[] args) throws HyracksDataException {
                 TaggedValuePointable tvp = args[0];
                 add.compute(tvp, tvpSum, tvpSum);
                 count++;
index 09a611f..2ce95cb 100644 (file)
@@ -19,6 +19,12 @@ package org.apache.vxquery.runtime.functions.aggregate;
 import java.io.DataOutput;
 import java.io.IOException;
 
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.values.ValueTag;
 import org.apache.vxquery.datamodel.values.XDMConstants;
@@ -30,13 +36,6 @@ import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentAggr
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentAggregateEvaluatorFactory;
 import org.apache.vxquery.runtime.functions.util.ArithmeticHelper;
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
 public class FnAvgAggregateEvaluatorFactory extends AbstractTaggedValueArgumentAggregateEvaluatorFactory {
     private static final long serialVersionUID = 1L;
 
@@ -45,7 +44,7 @@ public class FnAvgAggregateEvaluatorFactory extends AbstractTaggedValueArgumentA
     }
 
     @Override
-    protected IAggregateEvaluator createEvaluator(IScalarEvaluator[] args) throws AlgebricksException {
+    protected IAggregateEvaluator createEvaluator(IScalarEvaluator[] args) throws HyracksDataException {
         final TaggedValuePointable tvpCount = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
         final ArrayBackedValueStorage abvsSum = new ArrayBackedValueStorage();
         final DataOutput dOutSum = abvsSum.getDataOutput();
@@ -61,17 +60,17 @@ public class FnAvgAggregateEvaluatorFactory extends AbstractTaggedValueArgumentA
             TaggedValuePointable tvpSum = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
 
             @Override
-            public void init() throws AlgebricksException {
+            public void init() throws HyracksDataException {
                 count = 0;
             }
 
             @Override
-            public void finishPartial(IPointable result) throws AlgebricksException {
+            public void finishPartial(IPointable result) throws HyracksDataException {
                 finish(result);
             }
 
             @Override
-            public void finish(IPointable result) throws AlgebricksException {
+            public void finish(IPointable result) throws HyracksDataException {
                 if (count == 0) {
                     XDMConstants.setEmptySequence(result);
                 } else {
@@ -85,13 +84,13 @@ public class FnAvgAggregateEvaluatorFactory extends AbstractTaggedValueArgumentA
                         divide.compute(tvpSum, tvpCount, tvpSum);
                         result.set(tvpSum);
                     } catch (Exception e) {
-                        throw new AlgebricksException(e);
+                        throw new HyracksDataException(e);
                     }
                 }
             }
 
             @Override
-            protected void step(TaggedValuePointable[] args) throws SystemException {
+            protected void step(TaggedValuePointable[] args) throws HyracksDataException {
                 TaggedValuePointable tvp = args[0];
                 if (count == 0) {
                     // Init.
index 9a511cd..435d4e4 100644 (file)
@@ -18,6 +18,12 @@ package org.apache.vxquery.runtime.functions.aggregate;
 
 import java.io.DataOutput;
 
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.vxquery.context.DynamicContext;
 import org.apache.vxquery.datamodel.accessors.SequencePointable;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
@@ -31,13 +37,6 @@ import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScal
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
 import org.apache.vxquery.runtime.functions.util.ArithmeticHelper;
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
 public class FnAvgScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
 
@@ -47,7 +46,7 @@ public class FnAvgScalarEvaluatorFactory extends AbstractTaggedValueArgumentScal
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
         final SequencePointable seqp = (SequencePointable) SequencePointable.FACTORY.createPointable();
         final TaggedValuePointable tvpNext = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
@@ -62,7 +61,7 @@ public class FnAvgScalarEvaluatorFactory extends AbstractTaggedValueArgumentScal
 
         return new AbstractTaggedValueArgumentScalarEvaluator(args) {
             @Override
-            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
+            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws HyracksDataException {
                 TaggedValuePointable tvp = args[0];
                 if (tvp.getTag() == ValueTag.SEQUENCE_TAG) {
                     tvp.getValue(seqp);
index 8c55630..77ff018 100644 (file)
@@ -18,18 +18,16 @@ package org.apache.vxquery.runtime.functions.aggregate;
 
 import java.io.DataOutput;
 
-import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
-import org.apache.vxquery.datamodel.values.ValueTag;
-import org.apache.vxquery.exceptions.SystemException;
-import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentAggregateEvaluator;
-import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentAggregateEvaluatorFactory;
-
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.datamodel.values.ValueTag;
+import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentAggregateEvaluator;
+import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentAggregateEvaluatorFactory;
 
 public class FnCountAggregateEvaluatorFactory extends AbstractTaggedValueArgumentAggregateEvaluatorFactory {
     private static final long serialVersionUID = 1L;
@@ -39,36 +37,36 @@ public class FnCountAggregateEvaluatorFactory extends AbstractTaggedValueArgumen
     }
 
     @Override
-    protected IAggregateEvaluator createEvaluator(IScalarEvaluator[] args) throws AlgebricksException {
+    protected IAggregateEvaluator createEvaluator(IScalarEvaluator[] args) throws HyracksDataException {
         final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
         final DataOutput dOut = abvs.getDataOutput();
         return new AbstractTaggedValueArgumentAggregateEvaluator(args) {
             long count;
 
             @Override
-            public void init() throws AlgebricksException {
+            public void init() throws HyracksDataException {
                 count = 0;
             }
 
             @Override
-            public void finishPartial(IPointable result) throws AlgebricksException {
+            public void finishPartial(IPointable result) throws HyracksDataException {
                 finish(result);
             }
 
             @Override
-            public void finish(IPointable result) throws AlgebricksException {
+            public void finish(IPointable result) throws HyracksDataException {
                 try {
                     abvs.reset();
                     dOut.write(ValueTag.XS_INTEGER_TAG);
                     dOut.writeLong(count);
                     result.set(abvs);
                 } catch (Exception e) {
-                    throw new AlgebricksException(e);
+                    throw new HyracksDataException(e);
                 }
             }
 
             @Override
-            protected void step(TaggedValuePointable[] args) throws SystemException {
+            protected void step(TaggedValuePointable[] args) throws HyracksDataException {
                 count++;
             }
 
index 0912f29..ba3e70f 100644 (file)
@@ -18,6 +18,12 @@ package org.apache.vxquery.runtime.functions.aggregate;
 
 import java.io.DataOutput;
 
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.vxquery.datamodel.accessors.SequencePointable;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.values.ValueTag;
@@ -26,13 +32,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.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
 public class FnCountScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
 
@@ -42,15 +41,15 @@ public class FnCountScalarEvaluatorFactory extends AbstractTaggedValueArgumentSc
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         final SequencePointable seqp = (SequencePointable) SequencePointable.FACTORY.createPointable();
         final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
         final DataOutput dOut = abvs.getDataOutput();
         return new AbstractTaggedValueArgumentScalarEvaluator(args) {
             @Override
-            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
+            protected void evaluate(TaggedValuePointable[] args, IPointable result) throws HyracksDataException {
                 TaggedValuePointable tvp = args[0];
-                long count = 0;
+                long count;
                 if (tvp.getTag() == ValueTag.SEQUENCE_TAG) {
                     tvp.getValue(seqp);
                     count = seqp.getEntryCount();
index b4fdcdc..d03394a 100644 (file)
@@ -19,21 +19,19 @@ package org.apache.vxquery.runtime.functions.aggregate;
 import java.io.DataOutput;
 import java.io.IOException;
 
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.values.ValueTag;
-import org.apache.vxquery.exceptions.SystemException;
 import org.apache.vxquery.runtime.functions.arithmetic.AddOperation;
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentAggregateEvaluator;
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentAggregateEvaluatorFactory;
 import org.apache.vxquery.runtime.functions.util.ArithmeticHelper;
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
 public class FnSumAggregateEvaluatorFactory extends AbstractTaggedValueArgumentAggregateEvaluatorFactory {
     private static final long serialVersionUID = 1L;
 
@@ -42,7 +40,7 @@ public class FnSumAggregateEvaluatorFactory extends AbstractTaggedValueArgumentA
     }
 
     @Override
-    protected IAggregateEvaluator createEvaluator(IScalarEvaluator[] args) throws AlgebricksException {
+    protected IAggregateEvaluator createEvaluator(IScalarEvaluator[] args) throws HyracksDataException {
         final ArrayBackedValueStorage abvsSum = new ArrayBackedValueStorage();
         final DataOutput dOutSum = abvsSum.getDataOutput();
         final AddOperation aOpAdd = new AddOperation();
@@ -54,29 +52,29 @@ public class FnSumAggregateEvaluatorFactory extends AbstractTaggedValueArgumentA
             // TODO Check if the second argument is supplied as the zero value.
 
             @Override
-            public void init() throws AlgebricksException {
+            public void init() throws HyracksDataException {
                 try {
                     abvsSum.reset();
                     dOutSum.write(ValueTag.XS_INTEGER_TAG);
                     dOutSum.writeLong(0);
                     tvpSum.set(abvsSum);
                 } catch (IOException e) {
-                    throw new AlgebricksException(e.toString());
+                    throw new HyracksDataException(e.toString());
                 }
             }
 
             @Override
-            public void finishPartial(IPointable result) throws AlgebricksException {
+            public void finishPartial(IPointable result) throws HyracksDataException {
                 finish(result);
             }
 
             @Override
-            public void finish(IPointable result) throws AlgebricksException {
+            public void finish(IPointable result) throws HyracksDataException {
                 result.set(tvpSum);
             }
 
             @Override
-            protected void step(TaggedValuePointable[] args) throws SystemException {
+            protected void step(TaggedValuePointable[] args) throws HyracksDataException {
                 TaggedValuePointable tvp = args[0];
                 add.compute(tvp, tvpSum, tvpSum);
             }
index 635fa8a..8055239 100644 (file)
@@ -18,6 +18,13 @@ package org.apache.vxquery.runtime.functions.aggregate;
 
 import java.io.DataOutput;
 
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.vxquery.context.DynamicContext;
 import org.apache.vxquery.datamodel.accessors.SequencePointable;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
@@ -29,14 +36,6 @@ import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScal
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
 import org.apache.vxquery.runtime.functions.util.ArithmeticHelper;
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.VoidPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
 public class FnSumScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
 
@@ -46,7 +45,7 @@ public class FnSumScalarEvaluatorFactory extends AbstractTaggedValueArgumentScal
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
         final SequencePointable seqp = (SequencePointable) SequencePointable.FACTORY.createPointable();
         final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
index eb253a6..b99354a 100644 (file)
 */
 package org.apache.vxquery.runtime.functions.arithmetic;
 
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.vxquery.context.DynamicContext;
 import org.apache.vxquery.datamodel.accessors.SequencePointable;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
@@ -26,12 +31,6 @@ import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScal
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
 import org.apache.vxquery.runtime.functions.util.ArithmeticHelper;
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.data.std.api.IPointable;
-
 public abstract class AbstractArithmeticScalarEvaluatorFactory extends
         AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
@@ -42,7 +41,7 @@ public abstract class AbstractArithmeticScalarEvaluatorFactory extends
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
         final ArithmeticHelper aHelper = new ArithmeticHelper(createArithmeticOperation(), dCtx);
         final SequencePointable seqp = (SequencePointable) SequencePointable.FACTORY.createPointable();
index 895294a..c0e7f2c 100644 (file)
  */
 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;
-
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+import org.apache.vxquery.datamodel.accessors.PointablePool;
+import org.apache.vxquery.datamodel.accessors.PointablePoolFactory;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 
 public abstract class AbstractTaggedValueArgumentAggregateEvaluator implements IAggregateEvaluator {
     private final IScalarEvaluator[] args;
@@ -42,12 +40,12 @@ public abstract class AbstractTaggedValueArgumentAggregateEvaluator implements I
     }
 
     @Override
-    public void step(IFrameTupleReference tuple) throws AlgebricksException {
+    public void step(IFrameTupleReference tuple) throws HyracksDataException {
         for (int i = 0; i < args.length; ++i) {
             args[i].evaluate(tuple, tvps[i]);
         }
         step(tvps);
     }
 
-    protected abstract void step(TaggedValuePointable[] args) throws SystemException;
+    protected abstract void step(TaggedValuePointable[] args) throws HyracksDataException;
 }
index 2ab0b66..b6d9feb 100644 (file)
  */
 package org.apache.vxquery.runtime.functions.base;
 
-import org.apache.vxquery.context.DynamicContext;
-
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.vxquery.context.DynamicContext;
 
 public abstract class AbstractTaggedValueArgumentAggregateEvaluatorFactory implements IAggregateEvaluatorFactory {
     private static final long serialVersionUID = 1L;
@@ -37,7 +36,7 @@ public abstract class AbstractTaggedValueArgumentAggregateEvaluatorFactory imple
     }
 
     @Override
-    public final IAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+    public final IAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
         dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
         IScalarEvaluator[] es = new IScalarEvaluator[args.length];
         for (int i = 0; i < es.length; ++i) {
@@ -46,5 +45,5 @@ public abstract class AbstractTaggedValueArgumentAggregateEvaluatorFactory imple
         return createEvaluator(es);
     }
 
-    protected abstract IAggregateEvaluator createEvaluator(IScalarEvaluator[] args) throws AlgebricksException;
+    protected abstract IAggregateEvaluator createEvaluator(IScalarEvaluator[] args) throws HyracksDataException;
 }
index 20f24f6..857b142 100644 (file)
  */
 package org.apache.vxquery.runtime.functions.base;
 
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.vxquery.datamodel.accessors.ArrayBackedValueStoragePool;
 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.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public abstract class AbstractTaggedValueArgumentScalarEvaluator implements IScalarEvaluator {
     private final IScalarEvaluator[] args;
@@ -44,12 +42,12 @@ public abstract class AbstractTaggedValueArgumentScalarEvaluator implements ISca
     }
 
     @Override
-    public final void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+    public final void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
         for (int i = 0; i < args.length; ++i) {
             args[i].evaluate(tuple, tvps[i]);
         }
         evaluate(tvps, result);
     }
 
-    protected abstract void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException;
+    protected abstract void evaluate(TaggedValuePointable[] args, IPointable result) throws HyracksDataException;
 }
index d07361b..a5a910e 100644 (file)
  */
 package org.apache.vxquery.runtime.functions.base;
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 
 public abstract class AbstractTaggedValueArgumentScalarEvaluatorFactory implements IScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
@@ -31,7 +31,7 @@ public abstract class AbstractTaggedValueArgumentScalarEvaluatorFactory implemen
     }
 
     @Override
-    public final IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+    public final IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
         IScalarEvaluator[] es = new IScalarEvaluator[args.length];
         for (int i = 0; i < es.length; ++i) {
             es[i] = args[i].createScalarEvaluator(ctx);
@@ -40,5 +40,5 @@ public abstract class AbstractTaggedValueArgumentScalarEvaluatorFactory implemen
     }
 
     protected abstract IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException;
+            throws HyracksDataException;
 }
index 3db1a0e..4117774 100644 (file)
  */
 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;
-
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluator;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+import org.apache.vxquery.datamodel.accessors.PointablePool;
+import org.apache.vxquery.datamodel.accessors.PointablePoolFactory;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 
 public abstract class AbstractTaggedValueArgumentUnnestingEvaluator implements IUnnestingEvaluator {
     private final IScalarEvaluator[] args;
@@ -42,12 +40,12 @@ public abstract class AbstractTaggedValueArgumentUnnestingEvaluator implements I
     }
 
     @Override
-    public final void init(IFrameTupleReference tuple) throws AlgebricksException {
+    public final void init(IFrameTupleReference tuple) throws HyracksDataException {
         for (int i = 0; i < args.length; ++i) {
             args[i].evaluate(tuple, tvps[i]);
         }
         init(tvps);
     }
 
-    protected abstract void init(TaggedValuePointable[] args) throws SystemException;
+    protected abstract void init(TaggedValuePointable[] args) throws HyracksDataException;
 }
index f32a734..88247b9 100644 (file)
 package org.apache.vxquery.runtime.functions.base;
 
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 
 public abstract class AbstractTaggedValueArgumentUnnestingEvaluatorFactory implements IUnnestingEvaluatorFactory {
     private static final long serialVersionUID = 1L;
-    
+
     protected IHyracksTaskContext ctxview;
 
     private final IScalarEvaluatorFactory[] args;
@@ -36,7 +36,7 @@ public abstract class AbstractTaggedValueArgumentUnnestingEvaluatorFactory imple
     }
 
     @Override
-    public final IUnnestingEvaluator createUnnestingEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+    public final IUnnestingEvaluator createUnnestingEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
        ctxview = ctx;
         IScalarEvaluator[] es = new IScalarEvaluator[args.length];
         for (int i = 0; i < es.length; ++i) {
@@ -45,5 +45,5 @@ public abstract class AbstractTaggedValueArgumentUnnestingEvaluatorFactory imple
         return createEvaluator(ctx, es);
     }
 
-    protected abstract IUnnestingEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) throws AlgebricksException;
+    protected abstract IUnnestingEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) throws HyracksDataException;
 }
index 599a4d7..f006087 100644 (file)
  */
 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.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
-
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.BooleanPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.datamodel.values.XDMConstants;
+import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
 
 public class AndScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
@@ -37,7 +36,7 @@ public class AndScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalar
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         return new AndScalarEvaluator(args);
     }
 
@@ -53,7 +52,7 @@ public class AndScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalar
         }
 
         @Override
-        public final void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+        public final void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
             for (int i = 0; i < args.length; ++i) {
                 args[i].evaluate(tuple, tvp);
                 tvp.getValue(bp);
index 7d83a19..b40cfb1 100644 (file)
  */
 package org.apache.vxquery.runtime.functions.bool;
 
-import org.apache.vxquery.datamodel.accessors.SequencePointable;
-import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
-import org.apache.vxquery.datamodel.accessors.atomic.XSDecimalPointable;
-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.base.AbstractTaggedValueArgumentScalarEvaluator;
-import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
-
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.BytePointable;
 import org.apache.hyracks.data.std.primitive.DoublePointable;
@@ -38,6 +28,15 @@ import org.apache.hyracks.data.std.primitive.IntegerPointable;
 import org.apache.hyracks.data.std.primitive.LongPointable;
 import org.apache.hyracks.data.std.primitive.ShortPointable;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.vxquery.datamodel.accessors.SequencePointable;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.datamodel.accessors.atomic.XSDecimalPointable;
+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.base.AbstractTaggedValueArgumentScalarEvaluator;
+import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
 
 public class FnBooleanScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
@@ -48,7 +47,7 @@ public class FnBooleanScalarEvaluatorFactory extends AbstractTaggedValueArgument
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         return new FnBooleanScalarEvaluator(args);
     }
 
@@ -153,7 +152,7 @@ public class FnBooleanScalarEvaluatorFactory extends AbstractTaggedValueArgument
                 case ValueTag.XS_ANY_URI_TAG:
                 case ValueTag.XS_STRING_TAG: {
                     tvp.getValue(utf8p);
-                    if (utf8p.getUTFLength() == 0) {
+                    if (utf8p.getStringLength() == 0) {
                         booleanResult = false;
                     }
                     break;
index 53778d2..cb9ad8a 100644 (file)
  */
 package org.apache.vxquery.runtime.functions.bool;
 
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
 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 org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.data.std.api.IPointable;
-
 public class FnFalseScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
 
@@ -37,7 +36,7 @@ public class FnFalseScalarEvaluatorFactory extends AbstractTaggedValueArgumentSc
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         return new AbstractTaggedValueArgumentScalarEvaluator(args) {
             @Override
             protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
index b9d4585..f1a3213 100644 (file)
  */
 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 org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.BooleanPointable;
+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;
 
 public class FnNotScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
@@ -38,7 +37,7 @@ public class FnNotScalarEvaluatorFactory extends AbstractTaggedValueArgumentScal
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         return new AbstractTaggedValueArgumentScalarEvaluator(args) {
             private final BooleanPointable bp = (BooleanPointable) BooleanPointable.FACTORY.createPointable();
 
index a94d2df..9de862e 100644 (file)
  */
 package org.apache.vxquery.runtime.functions.bool;
 
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
 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 org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.data.std.api.IPointable;
-
 public class FnTrueScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
 
@@ -37,7 +36,7 @@ public class FnTrueScalarEvaluatorFactory extends AbstractTaggedValueArgumentSca
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         return new AbstractTaggedValueArgumentScalarEvaluator(args) {
             @Override
             protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException {
index da31e14..83db663 100644 (file)
  */
 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.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
-
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.BooleanPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
+import org.apache.vxquery.datamodel.values.XDMConstants;
+import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
 
 public class OrScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
@@ -37,7 +36,7 @@ public class OrScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarE
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         return new OrScalarEvaluator(args);
     }
 
@@ -53,7 +52,7 @@ public class OrScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarE
         }
 
         @Override
-        public final void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+        public final void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
             for (int i = 0; i < args.length; ++i) {
                 args[i].evaluate(tuple, tvp);
                 tvp.getValue(bp);
index 739e197..6cfd9a8 100644 (file)
@@ -18,6 +18,12 @@ package org.apache.vxquery.runtime.functions.cast;
 
 import java.io.DataOutput;
 
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.accessors.TypedPointables;
 import org.apache.vxquery.datamodel.values.ValueTag;
@@ -27,13 +33,6 @@ import org.apache.vxquery.runtime.functions.type.AbstractTypeScalarEvaluatorFact
 import org.apache.vxquery.types.BuiltinTypeRegistry;
 import org.apache.vxquery.types.SequenceType;
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
 public class CastScalarEvaluatorFactory extends AbstractTypeScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
 
@@ -43,7 +42,7 @@ public class CastScalarEvaluatorFactory extends AbstractTypeScalarEvaluatorFacto
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         return new AbstractTypeScalarEvaluator(args, ctx) {
             final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
             final DataOutput dOut = abvs.getDataOutput();
@@ -62,140 +61,117 @@ public class CastScalarEvaluatorFactory extends AbstractTypeScalarEvaluatorFacto
                         case ValueTag.XS_ANY_URI_TAG:
                             tvp.getValue(tp.utf8sp);
                             aOp.convertAnyURI(tp.utf8sp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_BASE64_BINARY_TAG:
                             tvp.getValue(tp.binaryp);
                             aOp.convertBase64Binary(tp.binaryp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_BOOLEAN_TAG:
                             tvp.getValue(tp.boolp);
                             aOp.convertBoolean(tp.boolp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_DATE_TAG:
                             tvp.getValue(tp.datep);
                             aOp.convertDate(tp.datep, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_DATETIME_TAG:
                             tvp.getValue(tp.datetimep);
                             aOp.convertDatetime(tp.datetimep, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_DAY_TIME_DURATION_TAG:
                             tvp.getValue(tp.longp);
                             aOp.convertDTDuration(tp.longp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_DECIMAL_TAG:
                             tvp.getValue(tp.decp);
                             aOp.convertDecimal(tp.decp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_DOUBLE_TAG:
                             tvp.getValue(tp.doublep);
                             aOp.convertDouble(tp.doublep, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_DURATION_TAG:
                             tvp.getValue(tp.durationp);
                             aOp.convertDuration(tp.durationp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_FLOAT_TAG:
                             tvp.getValue(tp.floatp);
                             aOp.convertFloat(tp.floatp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_G_DAY_TAG:
                             tvp.getValue(tp.datep);
                             aOp.convertGDay(tp.datep, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_G_MONTH_TAG:
                             tvp.getValue(tp.datep);
                             aOp.convertGMonth(tp.datep, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_G_MONTH_DAY_TAG:
                             tvp.getValue(tp.datep);
                             aOp.convertGMonthDay(tp.datep, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_G_YEAR_TAG:
                             tvp.getValue(tp.datep);
                             aOp.convertGYear(tp.datep, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_G_YEAR_MONTH_TAG:
                             tvp.getValue(tp.datep);
                             aOp.convertGYearMonth(tp.datep, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_HEX_BINARY_TAG:
                             tvp.getValue(tp.binaryp);
                             aOp.convertHexBinary(tp.binaryp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_INTEGER_TAG:
                             tvp.getValue(tp.longp);
                             aOp.convertInteger(tp.longp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_NOTATION_TAG:
                             tvp.getValue(tp.utf8sp);
                             aOp.convertNotation(tp.utf8sp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_QNAME_TAG:
                             tvp.getValue(tp.qnamep);
                             aOp.convertQName(tp.qnamep, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_STRING_TAG:
                             tvp.getValue(tp.utf8sp);
                             aOp.convertString(tp.utf8sp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_TIME_TAG:
                             tvp.getValue(tp.timep);
                             aOp.convertTime(tp.timep, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_UNTYPED_ATOMIC_TAG:
                             tvp.getValue(tp.utf8sp);
                             aOp.convertUntypedAtomic(tp.utf8sp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
                             tvp.getValue(tp.intp);
                             aOp.convertYMDuration(tp.intp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         /**
                          * Derived Numeric Datatypes (Alphabetical)
@@ -203,74 +179,62 @@ public class CastScalarEvaluatorFactory extends AbstractTypeScalarEvaluatorFacto
                         case ValueTag.XS_BYTE_TAG:
                             tvp.getValue(tp.bytep);
                             aOp.convertByte(tp.bytep, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_INT_TAG:
                             tvp.getValue(tp.intp);
                             aOp.convertInt(tp.intp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_LONG_TAG:
                             tvp.getValue(tp.longp);
                             aOp.convertLong(tp.longp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_NEGATIVE_INTEGER_TAG:
                             tvp.getValue(tp.longp);
                             aOp.convertNegativeInteger(tp.longp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_NON_NEGATIVE_INTEGER_TAG:
                             tvp.getValue(tp.longp);
                             aOp.convertNonNegativeInteger(tp.longp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_NON_POSITIVE_INTEGER_TAG:
                             tvp.getValue(tp.longp);
                             aOp.convertNonPositiveInteger(tp.longp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_POSITIVE_INTEGER_TAG:
                             tvp.getValue(tp.longp);
                             aOp.convertPositiveInteger(tp.longp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_SHORT_TAG:
                             tvp.getValue(tp.shortp);
                             aOp.convertShort(tp.shortp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_UNSIGNED_BYTE_TAG:
                             tvp.getValue(tp.shortp);
                             aOp.convertUnsignedByte(tp.shortp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_UNSIGNED_INT_TAG:
                             tvp.getValue(tp.longp);
                             aOp.convertUnsignedInt(tp.longp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_UNSIGNED_LONG_TAG:
                             tvp.getValue(tp.longp);
                             aOp.convertUnsignedLong(tp.longp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_UNSIGNED_SHORT_TAG:
                             tvp.getValue(tp.intp);
                             aOp.convertUnsignedShort(tp.intp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         /**
                          * Derived String Datatypes (Alphabetical)
@@ -278,71 +242,65 @@ public class CastScalarEvaluatorFactory extends AbstractTypeScalarEvaluatorFacto
                         case ValueTag.XS_ENTITY_TAG:
                             tvp.getValue(tp.utf8sp);
                             aOp.convertEntity(tp.utf8sp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_ID_TAG:
                             tvp.getValue(tp.utf8sp);
                             aOp.convertID(tp.utf8sp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_IDREF_TAG:
                             tvp.getValue(tp.utf8sp);
                             aOp.convertIDREF(tp.utf8sp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_LANGUAGE_TAG:
                             tvp.getValue(tp.utf8sp);
                             aOp.convertIDREF(tp.utf8sp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_NAME_TAG:
                             tvp.getValue(tp.utf8sp);
                             aOp.convertName(tp.utf8sp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_NCNAME_TAG:
                             tvp.getValue(tp.utf8sp);
                             aOp.convertNCName(tp.utf8sp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_NMTOKEN_TAG:
                             tvp.getValue(tp.utf8sp);
                             aOp.convertNMToken(tp.utf8sp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_NORMALIZED_STRING_TAG:
                             tvp.getValue(tp.utf8sp);
                             aOp.convertNormalizedString(tp.utf8sp, dOut);
-                            result.set(abvs);
-                            return;
+                            break;
 
                         case ValueTag.XS_TOKEN_TAG:
                             tvp.getValue(tp.utf8sp);
                             aOp.convertToken(tp.utf8sp, dOut);
-                            result.set(abvs);
-                            return;
-                        
+                            break;
+
                         /**
                          * JSON null
                          */
                         case ValueTag.JS_NULL_TAG:
                             aOp.convertNull(dOut);
-                            result.set(abvs);
-                            return;
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
+                    result.set(abvs.getByteArray(), abvs.getStartOffset(), abvs.getLength());
                 } catch (SystemException se) {
                     throw se;
                 } catch (Exception e) {
                     throw new SystemException(ErrorCode.SYSE0001, e);
                 }
-                throw new SystemException(ErrorCode.XPTY0004);
+
             }
 
             @Override
index 680ce08..8e9aaa7 100644 (file)
@@ -20,13 +20,12 @@ import java.io.DataOutput;
 import java.io.IOException;
 
 import org.apache.commons.codec.binary.Base64OutputStream;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
 import org.apache.vxquery.datamodel.accessors.atomic.XSBinaryPointable;
 import org.apache.vxquery.datamodel.values.ValueTag;
 import org.apache.vxquery.exceptions.SystemException;
 
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
-
 public class CastToBase64BinaryOperation extends AbstractCastToOperation {
     private ByteArrayAccessibleOutputStream baaos = new ByteArrayAccessibleOutputStream();
 
@@ -46,13 +45,14 @@ public class CastToBase64BinaryOperation extends AbstractCastToOperation {
     public void convertString(UTF8StringPointable stringp, DataOutput dOut) throws SystemException, IOException {
         baaos.reset();
         Base64OutputStream b64os = new Base64OutputStream(baaos, false);
-        b64os.write(stringp.getByteArray(), stringp.getStartOffset() + 2, stringp.getLength() - 2);
-        b64os.close();
+        b64os.write(stringp.getByteArray(), stringp.getCharStartOffset(), stringp.getUTF8Length());
 
         dOut.write(ValueTag.XS_BASE64_BINARY_TAG);
         dOut.write((byte) ((baaos.size() >>> 8) & 0xFF));
         dOut.write((byte) ((baaos.size() >>> 0) & 0xFF));
         dOut.write(baaos.getByteArray(), 0, baaos.size());
+
+        b64os.close();
     }
 
     @Override
index edfae66..e37d55d 100644 (file)
@@ -19,6 +19,11 @@ package org.apache.vxquery.runtime.functions.cast;
 import java.io.DataOutput;
 import java.io.IOException;
 
+import org.apache.hyracks.data.std.primitive.BooleanPointable;
+import org.apache.hyracks.data.std.primitive.DoublePointable;
+import org.apache.hyracks.data.std.primitive.FloatPointable;
+import org.apache.hyracks.data.std.primitive.LongPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.vxquery.datamodel.accessors.atomic.XSDecimalPointable;
 import org.apache.vxquery.datamodel.values.ValueTag;
 import org.apache.vxquery.exceptions.ErrorCode;
@@ -27,12 +32,6 @@ import org.apache.vxquery.runtime.functions.strings.ICharacterIterator;
 import org.apache.vxquery.runtime.functions.strings.LowerCaseCharacterIterator;
 import org.apache.vxquery.runtime.functions.strings.UTF8StringCharacterIterator;
 
-import org.apache.hyracks.data.std.primitive.BooleanPointable;
-import org.apache.hyracks.data.std.primitive.DoublePointable;
-import org.apache.hyracks.data.std.primitive.FloatPointable;
-import org.apache.hyracks.data.std.primitive.LongPointable;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-
 public class CastToBooleanOperation extends AbstractCastToOperation {
 
     @Override
@@ -82,7 +81,7 @@ public class CastToBooleanOperation extends AbstractCastToOperation {
     }
 
     @Override
-    public void convertString(UTF8StringPointable stringp, DataOutput dOut) throws SystemException, IOException {
+    public void convertString(UTF8StringPointable stringp, DataOutput dOut) throws IOException {
         byte result = 2;
         ICharacterIterator charIterator = new LowerCaseCharacterIterator(new UTF8StringCharacterIterator(stringp));
         charIterator.reset();
index 8117d0e..cea4cf2 100644 (file)
@@ -19,13 +19,6 @@ package org.apache.vxquery.runtime.functions.cast;
 import java.io.DataOutput;
 import java.io.IOException;
 
-import org.apache.vxquery.datamodel.accessors.atomic.XSDecimalPointable;
-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.strings.ICharacterIterator;
-import org.apache.vxquery.runtime.functions.strings.UTF8StringCharacterIterator;
-
 import org.apache.hyracks.data.std.api.INumeric;
 import org.apache.hyracks.data.std.primitive.BooleanPointable;
 import org.apache.hyracks.data.std.primitive.BytePointable;
@@ -36,12 +29,20 @@ import org.apache.hyracks.data.std.primitive.LongPointable;
 import org.apache.hyracks.data.std.primitive.ShortPointable;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.util.string.UTF8StringWriter;
+import org.apache.vxquery.datamodel.accessors.atomic.XSDecimalPointable;
+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.strings.ICharacterIterator;
+import org.apache.vxquery.runtime.functions.strings.UTF8StringCharacterIterator;
 
 public class CastToDecimalOperation extends AbstractCastToOperation {
     private ArrayBackedValueStorage abvsInner = new ArrayBackedValueStorage();
     private DataOutput dOutInner = abvsInner.getDataOutput();
     private CastToStringOperation castToString = new CastToStringOperation();
     private UTF8StringPointable stringp = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable();
+    private UTF8StringWriter sw = new UTF8StringWriter();
 
     @Override
     public void convertBoolean(BooleanPointable boolp, DataOutput dOut) throws SystemException, IOException {
@@ -70,9 +71,11 @@ public class CastToDecimalOperation extends AbstractCastToOperation {
             throw new SystemException(ErrorCode.FORG0001);
         }
         abvsInner.reset();
-        dOutInner.write(ValueTag.XS_STRING_TAG);
-        dOutInner.writeUTF(Double.toString(doublep.getDouble()));
-        stringp.set(abvsInner.getByteArray(), abvsInner.getStartOffset() + 1, abvsInner.getLength() - 1);
+        sw.writeUTF8(Double.toString(doublep.getDouble()), dOutInner);
+        stringp.set(abvsInner.getByteArray(), abvsInner.getStartOffset(), abvsInner.getLength());
+//        dOutInner.write(ValueTag.XS_STRING_TAG);
+//        sw.writeUTF8(Double.toString(doublep.getDouble()), dOutInner);
+//        stringp.set(abvsInner.getByteArray(), abvsInner.getStartOffset() + 1, abvsInner.getLength() - 1);
         convertStringExtra(stringp, dOut, true);
     }
 
@@ -169,7 +172,7 @@ public class CastToDecimalOperation extends AbstractCastToOperation {
 
         dOut.write(ValueTag.XS_DECIMAL_TAG);
         dOut.write(decimalPlace);
-        dOut.writeLong((negativeValue ? -value : value));
+        dOut.writeLong(negativeValue ? -value : value);
     }
 
     @Override
index e400af7..12d4702 100644 (file)
@@ -19,6 +19,10 @@ package org.apache.vxquery.runtime.functions.cast;
 import java.io.DataOutput;
 import java.io.IOException;
 
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.util.GrowableArray;
+import org.apache.hyracks.data.std.util.UTF8StringBuilder;
 import org.apache.vxquery.datamodel.accessors.atomic.XSQNamePointable;
 import org.apache.vxquery.datamodel.values.ValueTag;
 import org.apache.vxquery.exceptions.SystemException;
@@ -26,10 +30,11 @@ import org.apache.vxquery.runtime.functions.strings.ICharacterIterator;
 import org.apache.vxquery.runtime.functions.strings.UTF8StringCharacterIterator;
 import org.apache.vxquery.runtime.functions.util.FunctionHelper;
 
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
 public class CastToQNameOperation extends AbstractCastToOperation {
+    private static final int STRING_EXPECTED_LENGTH = 300;
+    private final GrowableArray ga = new GrowableArray();
+    private final UTF8StringBuilder sb = new UTF8StringBuilder();
+
     ArrayBackedValueStorage abvsInner = new ArrayBackedValueStorage();
     DataOutput dOutInner = abvsInner.getDataOutput();
 
@@ -44,29 +49,43 @@ public class CastToQNameOperation extends AbstractCastToOperation {
         abvsInner.reset();
         ICharacterIterator charIterator = new UTF8StringCharacterIterator(stringp);
         charIterator.reset();
-        int c = 0;
-        int prefixLength = 0;
+        int c;
+        boolean prefixFound = false;
+
+        dOut.write(ValueTag.XS_QNAME_TAG);
+
+        // URI
+        dOut.write((byte) 0);
+
+        // Prefix and Local Name
+        ga.reset();
+        sb.reset(ga, STRING_EXPECTED_LENGTH);
         while ((c = charIterator.next()) != ICharacterIterator.EOS_CHAR) {
             if (c == Character.valueOf(':')) {
-                prefixLength = abvsInner.getLength();
+                prefixFound = true;
+                break;
             } else {
-                FunctionHelper.writeChar((char) c, dOutInner);
+                FunctionHelper.writeChar((char) c, sb);
             }
         }
+        if (prefixFound) {
+            // Finish Prefix
+            sb.finish();
+            dOut.write(ga.getByteArray(), 0, ga.getLength());
 
-        dOut.write(ValueTag.XS_QNAME_TAG);
-        dOut.write((byte) ((0 >>> 8) & 0xFF));
-        dOut.write((byte) ((0 >>> 0) & 0xFF));
-        // No URI
-
-        dOut.write((byte) ((prefixLength >>> 8) & 0xFF));
-        dOut.write((byte) ((prefixLength >>> 0) & 0xFF));
-        dOut.write(abvsInner.getByteArray(), abvsInner.getStartOffset(), prefixLength);
-
-        int localNameLength = abvsInner.getLength() - prefixLength;
-        dOut.write((byte) ((localNameLength >>> 8) & 0xFF));
-        dOut.write((byte) ((localNameLength >>> 0) & 0xFF));
-        dOut.write(abvsInner.getByteArray(), abvsInner.getStartOffset() + prefixLength, localNameLength);
+            // Local Name
+            ga.reset();
+            sb.reset(ga, STRING_EXPECTED_LENGTH);
+            while ((c = charIterator.next()) != ICharacterIterator.EOS_CHAR) {
+                FunctionHelper.writeChar((char) c, sb);
+            }
+        } else {
+            // No Prefix
+            dOut.write((byte) 0);
+            // Local Name is in ga variable
+        }
+        sb.finish();
+        dOut.write(ga.getByteArray(), 0, ga.getLength());
     }
 
 }
index dcc0d07..d541ccd 100644 (file)
@@ -20,6 +20,17 @@ import java.io.DataOutput;
 import java.io.IOException;
 
 import org.apache.commons.codec.binary.Base64OutputStream;
+import org.apache.hyracks.data.std.primitive.BooleanPointable;
+import org.apache.hyracks.data.std.primitive.BytePointable;
+import org.apache.hyracks.data.std.primitive.DoublePointable;
+import org.apache.hyracks.data.std.primitive.FloatPointable;
+import org.apache.hyracks.data.std.primitive.IntegerPointable;
+import org.apache.hyracks.data.std.primitive.LongPointable;
+import org.apache.hyracks.data.std.primitive.ShortPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
+import org.apache.hyracks.data.std.util.GrowableArray;
 import org.apache.vxquery.datamodel.accessors.atomic.XSBinaryPointable;
 import org.apache.vxquery.datamodel.accessors.atomic.XSDatePointable;
 import org.apache.vxquery.datamodel.accessors.atomic.XSDateTimePointable;
@@ -28,28 +39,22 @@ import org.apache.vxquery.datamodel.accessors.atomic.XSDurationPointable;
 import org.apache.vxquery.datamodel.accessors.atomic.XSQNamePointable;
 import org.apache.vxquery.datamodel.accessors.atomic.XSTimePointable;
 import org.apache.vxquery.datamodel.builders.atomic.StringValueBuilder;
+import org.apache.vxquery.datamodel.builders.atomic.VXQueryUTF8StringBuilder;
 import org.apache.vxquery.datamodel.util.DateTime;
 import org.apache.vxquery.datamodel.values.ValueTag;
 import org.apache.vxquery.exceptions.SystemException;
 import org.apache.vxquery.runtime.functions.util.FunctionHelper;
 
-import org.apache.hyracks.data.std.primitive.BooleanPointable;
-import org.apache.hyracks.data.std.primitive.BytePointable;
-import org.apache.hyracks.data.std.primitive.DoublePointable;
-import org.apache.hyracks.data.std.primitive.FloatPointable;
-import org.apache.hyracks.data.std.primitive.IntegerPointable;
-import org.apache.hyracks.data.std.primitive.LongPointable;
-import org.apache.hyracks.data.std.primitive.ShortPointable;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
-
 public class CastToStringOperation extends AbstractCastToOperation {
+    private static final int STRING_EXPECTED_LENGTH = 300;
+    private final GrowableArray ga = new GrowableArray();
+    private final VXQueryUTF8StringBuilder sb = new VXQueryUTF8StringBuilder();
     private ByteArrayAccessibleOutputStream baaos = new ByteArrayAccessibleOutputStream();
     private ArrayBackedValueStorage abvsInner = new ArrayBackedValueStorage();
     private DataOutput dOutInner = abvsInner.getDataOutput();
-    int returnTag = ValueTag.XS_STRING_TAG;
+    protected int returnTag = ValueTag.XS_STRING_TAG;
     private final char[] hex = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+    private final UTF8StringPointable stringp = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable();
 
     @Override
     public void convertAnyURI(UTF8StringPointable stringp, DataOutput dOut) throws SystemException, IOException {
@@ -59,63 +64,60 @@ public class CastToStringOperation extends AbstractCastToOperation {
 
     @Override
     public void convertBase64Binary(XSBinaryPointable binaryp, DataOutput dOut) throws SystemException, IOException {
-        baaos.reset();
-        @SuppressWarnings("resource")
+        // Read binary
         Base64OutputStream b64os = new Base64OutputStream(baaos, true);
         b64os.write(binaryp.getByteArray(), binaryp.getStartOffset() + 2, binaryp.getLength() - 2);
 
-        dOut.write(returnTag);
-        dOut.write((byte) ((baaos.size() >>> 8) & 0xFF));
-        dOut.write((byte) ((baaos.size() >>> 0) & 0xFF));
-        dOut.write(baaos.getByteArray(), 0, baaos.size());
+        // Write string
+        startString();
+        sb.appendUtf8Bytes(baaos.getByteArray(), 0, baaos.size());
+        sendStringDataOutput(dOut);
     }
 
     @Override
     public void convertBoolean(BooleanPointable boolp, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
+        startString();
         if (boolp.getBoolean()) {
-            FunctionHelper.writeCharSequence("true", dOutInner);
+            FunctionHelper.writeCharSequence("true", sb);
         } else {
-            FunctionHelper.writeCharSequence("false", dOutInner);
+            FunctionHelper.writeCharSequence("false", sb);
         }
         sendStringDataOutput(dOut);
     }
 
     @Override
     public void convertDate(XSDatePointable datep, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
-        FunctionHelper.writeDateAsString(datep, dOutInner);
-        FunctionHelper.writeTimezoneAsString(datep, dOutInner);
-
+        startString();
+        FunctionHelper.writeDateAsString(datep, sb);
+        FunctionHelper.writeTimezoneAsString(datep, sb);
         sendStringDataOutput(dOut);
     }
 
     @Override
     public void convertDatetime(XSDateTimePointable datetimep, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
-        FunctionHelper.writeDateAsString(datetimep, dOutInner);
-        FunctionHelper.writeChar('T', dOutInner);
-        FunctionHelper.writeTimeAsString(datetimep, dOutInner);
-        FunctionHelper.writeTimezoneAsString(datetimep, dOutInner);
-
+        startString();
+        FunctionHelper.writeDateAsString(datetimep, sb);
+        FunctionHelper.writeChar('T', sb);
+        FunctionHelper.writeTimeAsString(datetimep, sb);
+        FunctionHelper.writeTimezoneAsString(datetimep, sb);
         sendStringDataOutput(dOut);
     }
 
     @Override
     public void convertDecimal(XSDecimalPointable decp, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
+        startString();
         byte decimalPlace = decp.getDecimalPlace();
         long value = decp.getDecimalValue();
         byte nDigits = decp.getDigitCount();
 
         if (!FunctionHelper.isNumberPostive(value)) {
             // Negative result, but the rest of the calculations can be based on a positive value.
-            FunctionHelper.writeChar('-', dOutInner);
+            FunctionHelper.writeChar('-', sb);
             value *= -1;
         }
 
         if (value == 0) {
-            FunctionHelper.writeChar('0', dOutInner);
+            FunctionHelper.writeChar('0', sb);
         } else {
             long pow10 = (long) Math.pow(10, nDigits - 1);
             int start = Math.max(decimalPlace, nDigits - 1);
@@ -123,14 +125,14 @@ public class CastToStringOperation extends AbstractCastToOperation {
 
             for (int i = start; i >= end; --i) {
                 if (i >= nDigits || i < 0) {
-                    FunctionHelper.writeChar('0', dOutInner);
+                    FunctionHelper.writeChar('0', sb);
                 } else {
-                    FunctionHelper.writeChar((char) ('0' + (value / pow10)), dOutInner);
+                    FunctionHelper.writeChar((char) ('0' + (value / pow10)), sb);
                     value %= pow10;
                     pow10 /= 10;
                 }
                 if (i == decimalPlace && value > 0) {
-                    FunctionHelper.writeChar('.', dOutInner);
+                    FunctionHelper.writeChar('.', sb);
                 }
             }
         }
@@ -140,29 +142,30 @@ public class CastToStringOperation extends AbstractCastToOperation {
     @Override
     public void convertDouble(DoublePointable doublep, DataOutput dOut) throws SystemException, IOException {
         abvsInner.reset();
+        startString();
         double value = doublep.getDouble();
 
         if (Double.isInfinite(value)) {
             if (value == Double.NEGATIVE_INFINITY) {
-                FunctionHelper.writeCharSequence("-", dOutInner);
+                FunctionHelper.writeCharSequence("-", sb);
             }
-            FunctionHelper.writeCharSequence("INF", dOutInner);
+            FunctionHelper.writeCharSequence("INF", sb);
             sendStringDataOutput(dOut);
         } else if (Double.isNaN(value)) {
-            FunctionHelper.writeCharSequence("NaN", dOutInner);
+            FunctionHelper.writeCharSequence("NaN", sb);
             sendStringDataOutput(dOut);
         } else if (value == -0.0 || value == 0.0) {
             long bits = Double.doubleToLongBits(value);
             boolean negative = ((bits >> 63) == 0) ? false : true;
 
             if (negative) {
-                FunctionHelper.writeChar('-', dOutInner);
+                FunctionHelper.writeCharSequence("-", sb);
             }
-            FunctionHelper.writeCharSequence("0", dOutInner);
+            FunctionHelper.writeCharSequence("0", sb);
             sendStringDataOutput(dOut);
         } else if (Math.abs(value) >= 0.000001 && Math.abs(value) <= 10000000) {
-            //the jdk (toString function) does not output number in desired format when 
-            //a number is between one and ten million, so we take care of this 
+            //the jdk (toString function) does not output number in desired format when
+            //a number is between one and ten million, so we take care of this
             //case separately here.
             CastToDecimalOperation castToDecimal = new CastToDecimalOperation();
             castToDecimal.convertDouble(doublep, dOutInner);
@@ -175,67 +178,65 @@ public class CastToStringOperation extends AbstractCastToOperation {
                 decimalToScientificNotn(decp, dOut);
             }
         } else {
-            dOut.write(returnTag);
-            dOut.writeUTF(Double.toString(value));
+            FunctionHelper.writeCharSequence(Double.toString(value), sb);
+            sendStringDataOutput(dOut);
         }
     }
 
     public void convertDoubleCanonical(DoublePointable doublep, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
+        startString();
         double value = doublep.getDouble();
-
-        dOut.write(returnTag);
-        dOut.writeUTF(Double.toString(value));
-        return;
+        FunctionHelper.writeCharSequence(Double.toString(value), sb);
+        sendStringDataOutput(dOut);
     }
 
     @Override
     public void convertDTDuration(LongPointable longp, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
+        startString();
         long dayTime = longp.getLong();
 
         if (dayTime == 0) {
-            FunctionHelper.writeCharSequence("PT0S", dOutInner);
+            FunctionHelper.writeCharSequence("PT0S", sb);
         } else {
             if (dayTime < 0) {
-                FunctionHelper.writeChar('-', dOutInner);
+                FunctionHelper.writeChar('-', sb);
                 dayTime *= -1;
             }
-            FunctionHelper.writeChar('P', dOutInner);
+            FunctionHelper.writeChar('P', sb);
 
             // Day
             if (dayTime >= DateTime.CHRONON_OF_DAY) {
-                FunctionHelper.writeNumberWithPadding(dayTime / DateTime.CHRONON_OF_DAY, 1, dOutInner);
-                FunctionHelper.writeChar('D', dOutInner);
+                FunctionHelper.writeNumberWithPadding(dayTime / DateTime.CHRONON_OF_DAY, 1, sb);
+                FunctionHelper.writeChar('D', sb);
                 dayTime %= DateTime.CHRONON_OF_DAY;
             }
 
             if (dayTime > 0) {
-                FunctionHelper.writeChar('T', dOutInner);
+                FunctionHelper.writeChar('T', sb);
             }
 
             // Hour
             if (dayTime >= DateTime.CHRONON_OF_HOUR) {
-                FunctionHelper.writeNumberWithPadding(dayTime / DateTime.CHRONON_OF_HOUR, 1, dOutInner);
-                FunctionHelper.writeChar('H', dOutInner);
+                FunctionHelper.writeNumberWithPadding(dayTime / DateTime.CHRONON_OF_HOUR, 1, sb);
+                FunctionHelper.writeChar('H', sb);
                 dayTime %= DateTime.CHRONON_OF_HOUR;
             }
 
             // Minute
             if (dayTime >= DateTime.CHRONON_OF_MINUTE) {
-                FunctionHelper.writeNumberWithPadding(dayTime / DateTime.CHRONON_OF_MINUTE, 1, dOutInner);
-                FunctionHelper.writeChar('M', dOutInner);
+                FunctionHelper.writeNumberWithPadding(dayTime / DateTime.CHRONON_OF_MINUTE, 1, sb);
+                FunctionHelper.writeChar('M', sb);
                 dayTime %= DateTime.CHRONON_OF_MINUTE;
             }
 
             // Milliseconds
             if (dayTime > 0) {
-                FunctionHelper.writeNumberWithPadding(dayTime / DateTime.CHRONON_OF_SECOND, 1, dOutInner);
+                FunctionHelper.writeNumberWithPadding(dayTime / DateTime.CHRONON_OF_SECOND, 1, sb);
                 if (dayTime % DateTime.CHRONON_OF_SECOND != 0) {
-                    FunctionHelper.writeChar('.', dOutInner);
-                    FunctionHelper.writeNumberWithPadding(dayTime % DateTime.CHRONON_OF_SECOND, 3, dOutInner);
+                    FunctionHelper.writeChar('.', sb);
+                    FunctionHelper.writeNumberWithPadding(dayTime % DateTime.CHRONON_OF_SECOND, 3, sb);
                 }
-                FunctionHelper.writeChar('S', dOutInner);
+                FunctionHelper.writeChar('S', sb);
             }
         }
         sendStringDataOutput(dOut);
@@ -243,62 +244,62 @@ public class CastToStringOperation extends AbstractCastToOperation {
 
     @Override
     public void convertDuration(XSDurationPointable durationp, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
+        startString();
         int yearMonth = durationp.getYearMonth();
         long dayTime = durationp.getDayTime();
 
         if (yearMonth < 0 || dayTime < 0) {
-            FunctionHelper.writeChar('-', dOutInner);
+            FunctionHelper.writeChar('-', sb);
             yearMonth *= -1;
             dayTime *= -1;
         }
-        FunctionHelper.writeChar('P', dOutInner);
+        FunctionHelper.writeChar('P', sb);
 
         // Year
         if (yearMonth >= 12) {
-            FunctionHelper.writeNumberWithPadding(yearMonth / 12, 1, dOutInner);
-            FunctionHelper.writeChar('Y', dOutInner);
+            FunctionHelper.writeNumberWithPadding(yearMonth / 12, 1, sb);
+            FunctionHelper.writeChar('Y', sb);
         }
 
         // Month
         if (yearMonth % 12 > 0) {
-            FunctionHelper.writeNumberWithPadding(yearMonth % 12, 1, dOutInner);
-            FunctionHelper.writeChar('M', dOutInner);
+            FunctionHelper.writeNumberWithPadding(yearMonth % 12, 1, sb);
+            FunctionHelper.writeChar('M', sb);
         }
 
         // Day
         if (dayTime >= DateTime.CHRONON_OF_DAY) {
-            FunctionHelper.writeNumberWithPadding(dayTime / DateTime.CHRONON_OF_DAY, 1, dOutInner);
-            FunctionHelper.writeChar('D', dOutInner);
+            FunctionHelper.writeNumberWithPadding(dayTime / DateTime.CHRONON_OF_DAY, 1, sb);
+            FunctionHelper.writeChar('D', sb);
             dayTime %= DateTime.CHRONON_OF_DAY;
         }
 
         if (dayTime > 0) {
-            FunctionHelper.writeChar('T', dOutInner);
+            FunctionHelper.writeChar('T', sb);
         }
 
         // Hour
         if (dayTime >= DateTime.CHRONON_OF_HOUR) {
-            FunctionHelper.writeNumberWithPadding(dayTime / DateTime.CHRONON_OF_HOUR, 1, dOutInner);
-            FunctionHelper.writeChar('H', dOutInner);
+            FunctionHelper.writeNumberWithPadding(dayTime / DateTime.CHRONON_OF_HOUR, 1, sb);
+            FunctionHelper.writeChar('H', sb);
             dayTime %= DateTime.CHRONON_OF_HOUR;
         }
 
         // Minute
         if (dayTime >= DateTime.CHRONON_OF_MINUTE) {
-            FunctionHelper.writeNumberWithPadding(dayTime / DateTime.CHRONON_OF_MINUTE, 1, dOutInner);
-            FunctionHelper.writeChar('M', dOutInner);
+            FunctionHelper.writeNumberWithPadding(dayTime / DateTime.CHRONON_OF_MINUTE, 1, sb);
+            FunctionHelper.writeChar('M', sb);
             dayTime %= DateTime.CHRONON_OF_MINUTE;
         }
 
         // Milliseconds
         if (dayTime > 0) {
-            FunctionHelper.writeNumberWithPadding(dayTime / DateTime.CHRONON_OF_SECOND, 1, dOutInner);
+            FunctionHelper.writeNumberWithPadding(dayTime / DateTime.CHRONON_OF_SECOND, 1, sb);
             if (dayTime % DateTime.CHRONON_OF_SECOND != 0) {
-                FunctionHelper.writeChar('.', dOutInner);
-                FunctionHelper.writeNumberWithPadding(dayTime % DateTime.CHRONON_OF_SECOND, 3, dOutInner);
+                FunctionHelper.writeChar('.', sb);
+                FunctionHelper.writeNumberWithPadding(dayTime % DateTime.CHRONON_OF_SECOND, 3, sb);
             }
-            FunctionHelper.writeChar('S', dOutInner);
+            FunctionHelper.writeChar('S', sb);
         }
 
         sendStringDataOutput(dOut);
@@ -307,6 +308,7 @@ public class CastToStringOperation extends AbstractCastToOperation {
     @Override
     public void convertFloat(FloatPointable floatp, DataOutput dOut) throws SystemException, IOException {
         abvsInner.reset();
+        startString();
         float value = floatp.getFloat();
 
         if (!Float.isInfinite(value) && !Float.isNaN(value) && Math.abs(value) >= 0.000001
@@ -321,9 +323,9 @@ public class CastToStringOperation extends AbstractCastToOperation {
             boolean negative = ((bits >> 31) == 0) ? false : true;
 
             if (negative) {
-                FunctionHelper.writeChar('-', dOutInner);
+                FunctionHelper.writeChar('-', sb);
             }
-            FunctionHelper.writeCharSequence("0", dOutInner);
+            FunctionHelper.writeCharSequence("0", sb);
             sendStringDataOutput(dOut);
         } else {
             convertFloatCanonical(floatp, dOut);
@@ -331,128 +333,126 @@ public class CastToStringOperation extends AbstractCastToOperation {
     }
 
     public void convertFloatCanonical(FloatPointable floatp, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
+        startString();
         float value = floatp.getFloat();
 
         if (Float.isInfinite(value)) {
             if (value == Float.NEGATIVE_INFINITY) {
-                FunctionHelper.writeCharSequence("-", dOutInner);
+                FunctionHelper.writeCharSequence("-", sb);
             }
-            FunctionHelper.writeCharSequence("INF", dOutInner);
+            FunctionHelper.writeCharSequence("INF", sb);
         } else if (Float.isNaN(value)) {
-            FunctionHelper.writeCharSequence("NaN", dOutInner);
+            FunctionHelper.writeCharSequence("NaN", sb);
         } else {
-            dOut.write(returnTag);
-            dOut.writeUTF(Float.toString(value));
-            return;
+            FunctionHelper.writeCharSequence(Float.toString(value), sb);
         }
         sendStringDataOutput(dOut);
     }
 
     @Override
     public void convertGDay(XSDatePointable datep, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
+        startString();
         // Default
-        FunctionHelper.writeChar('-', dOutInner);
+        FunctionHelper.writeChar('-', sb);
 
         // Year
-        FunctionHelper.writeChar('-', dOutInner);
+        FunctionHelper.writeChar('-', sb);
 
         // Month
-        FunctionHelper.writeChar('-', dOutInner);
+        FunctionHelper.writeChar('-', sb);
 
         // Day
-        FunctionHelper.writeNumberWithPadding(datep.getDay(), 2, dOutInner);
+        FunctionHelper.writeNumberWithPadding(datep.getDay(), 2, sb);
 
         // Timezone
-        FunctionHelper.writeTimezoneAsString(datep, dOutInner);
+        FunctionHelper.writeTimezoneAsString(datep, sb);
 
         sendStringDataOutput(dOut);
     }
 
     @Override
     public void convertGMonth(XSDatePointable datep, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
+        startString();
         // Default
-        FunctionHelper.writeChar('-', dOutInner);
+        FunctionHelper.writeChar('-', sb);
 
         // Year
-        FunctionHelper.writeChar('-', dOutInner);
+        FunctionHelper.writeChar('-', sb);
 
         // Month
-        FunctionHelper.writeNumberWithPadding(datep.getMonth(), 2, dOutInner);
+        FunctionHelper.writeNumberWithPadding(datep.getMonth(), 2, sb);
 
         // Timezone
-        FunctionHelper.writeTimezoneAsString(datep, dOutInner);
+        FunctionHelper.writeTimezoneAsString(datep, sb);
 
         sendStringDataOutput(dOut);
     }
 
     @Override
     public void convertGMonthDay(XSDatePointable datep, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
+        startString();
         // Default
-        FunctionHelper.writeChar('-', dOutInner);
+        FunctionHelper.writeChar('-', sb);
 
         // Year
-        FunctionHelper.writeChar('-', dOutInner);
+        FunctionHelper.writeChar('-', sb);
 
         // Month
-        FunctionHelper.writeNumberWithPadding(datep.getMonth(), 2, dOutInner);
-        FunctionHelper.writeChar('-', dOutInner);
+        FunctionHelper.writeNumberWithPadding(datep.getMonth(), 2, sb);
+        FunctionHelper.writeChar('-', sb);
 
         // Day
-        FunctionHelper.writeNumberWithPadding(datep.getDay(), 2, dOutInner);
+        FunctionHelper.writeNumberWithPadding(datep.getDay(), 2, sb);
 
         // Timezone
-        FunctionHelper.writeTimezoneAsString(datep, dOutInner);
+        FunctionHelper.writeTimezoneAsString(datep, sb);
 
         sendStringDataOutput(dOut);
     }
 
     @Override
     public void convertGYear(XSDatePointable datep, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
+        startString();
         // Year
-        FunctionHelper.writeNumberWithPadding(datep.getYear(), 4, dOutInner);
+        FunctionHelper.writeNumberWithPadding(datep.getYear(), 4, sb);
 
         // Timezone
-        FunctionHelper.writeTimezoneAsString(datep, dOutInner);
+        FunctionHelper.writeTimezoneAsString(datep, sb);
 
         sendStringDataOutput(dOut);
     }
 
     @Override
     public void convertGYearMonth(XSDatePointable datep, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
+        startString();
         // Year
-        FunctionHelper.writeNumberWithPadding(datep.getYear(), 4, dOutInner);
-        FunctionHelper.writeChar('-', dOutInner);
+        FunctionHelper.writeNumberWithPadding(datep.getYear(), 4, sb);
+        FunctionHelper.writeChar('-', sb);
 
         // Month
-        FunctionHelper.writeNumberWithPadding(datep.getMonth(), 2, dOutInner);
+        FunctionHelper.writeNumberWithPadding(datep.getMonth(), 2, sb);
 
         // Timezone
-        FunctionHelper.writeTimezoneAsString(datep, dOutInner);
+        FunctionHelper.writeTimezoneAsString(datep, sb);
 
         sendStringDataOutput(dOut);
     }
 
     @Override
     public void convertHexBinary(XSBinaryPointable binaryp, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
+        startString();
         for (int index = 0; index < binaryp.getBinaryLength(); ++index) {
             int bi = binaryp.getByteArray()[binaryp.getBinaryStart() + index] & 0xff;
-            FunctionHelper.writeChar(hex[(bi >> 4)], dOutInner);
-            FunctionHelper.writeChar(hex[(bi & 0xf)], dOutInner);
+            FunctionHelper.writeChar(hex[bi >> 4], sb);
+            FunctionHelper.writeChar(hex[bi & 0xf], sb);
         }
         sendStringDataOutput(dOut);
     }
 
     @Override
     public void convertInteger(LongPointable longp, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
-        FunctionHelper.writeNumberWithPadding(longp.getLong(), 1, dOutInner);
+        startString();
+        FunctionHelper.writeNumberWithPadding(longp.getLong(), 1, sb);
         sendStringDataOutput(dOut);
     }
 
@@ -464,16 +464,14 @@ public class CastToStringOperation extends AbstractCastToOperation {
 
     @Override
     public void convertQName(XSQNamePointable qnamep, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
+        startString();
         if (qnamep.getPrefixUTFLength() > 0) {
-            dOutInner.write(qnamep.getByteArray(), qnamep.getStartOffset() + qnamep.getUriLength() + 2,
-                    qnamep.getPrefixUTFLength());
-            FunctionHelper.writeChar(':', dOutInner);
+            qnamep.getPrefix(stringp);
+            sb.appendUtf8StringPointable(stringp);
+            FunctionHelper.writeChar(':', sb);
         }
-        dOutInner.write(qnamep.getByteArray(),
-                qnamep.getStartOffset() + qnamep.getUriLength() + qnamep.getPrefixLength() + 2,
-                qnamep.getLocalNameUTFLength());
-
+        qnamep.getLocalName(stringp);
+        sb.appendUtf8StringPointable(stringp);
         sendStringDataOutput(dOut);
     }
 
@@ -485,10 +483,9 @@ public class CastToStringOperation extends AbstractCastToOperation {
 
     @Override
     public void convertTime(XSTimePointable timep, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
-        FunctionHelper.writeTimeAsString(timep, dOutInner);
-        FunctionHelper.writeTimezoneAsString(timep, dOutInner);
-
+        startString();
+        FunctionHelper.writeTimeAsString(timep, sb);
+        FunctionHelper.writeTimezoneAsString(timep, sb);
         sendStringDataOutput(dOut);
     }
 
@@ -499,28 +496,28 @@ public class CastToStringOperation extends AbstractCastToOperation {
 
     @Override
     public void convertYMDuration(IntegerPointable intp, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
+        startString();
         int yearMonth = intp.getInteger();
 
         if (yearMonth == 0) {
-            FunctionHelper.writeCharSequence("P0M", dOutInner);
+            FunctionHelper.writeCharSequence("P0M", sb);
         } else {
             if (yearMonth < 0) {
-                FunctionHelper.writeChar('-', dOutInner);
+                FunctionHelper.writeChar('-', sb);
                 yearMonth *= -1;
             }
-            FunctionHelper.writeChar('P', dOutInner);
+            FunctionHelper.writeChar('P', sb);
 
             // Year
             if (yearMonth >= 12) {
-                FunctionHelper.writeNumberWithPadding(yearMonth / 12, 1, dOutInner);
-                FunctionHelper.writeChar('Y', dOutInner);
+                FunctionHelper.writeNumberWithPadding(yearMonth / 12, 1, sb);
+                FunctionHelper.writeChar('Y', sb);
             }
 
             // Month
             if (yearMonth % 12 > 0) {
-                FunctionHelper.writeNumberWithPadding(yearMonth % 12, 1, dOutInner);
-                FunctionHelper.writeChar('M', dOutInner);
+                FunctionHelper.writeNumberWithPadding(yearMonth % 12, 1, sb);
+                FunctionHelper.writeChar('M', sb);
             }
         }
         sendStringDataOutput(dOut);
@@ -530,74 +527,74 @@ public class CastToStringOperation extends AbstractCastToOperation {
      * Derived Numeric Datatypes
      */
     public void convertByte(BytePointable bytep, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
-        FunctionHelper.writeNumberWithPadding(bytep.longValue(), 1, dOutInner);
+        startString();
+        FunctionHelper.writeNumberWithPadding(bytep.longValue(), 1, sb);
         sendStringDataOutput(dOut);
     }
 
     public void convertInt(IntegerPointable intp, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
-        FunctionHelper.writeNumberWithPadding(intp.longValue(), 1, dOutInner);
+        startString();
+        FunctionHelper.writeNumberWithPadding(intp.longValue(), 1, sb);
         sendStringDataOutput(dOut);
     }
 
     public void convertLong(LongPointable longp, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
-        FunctionHelper.writeNumberWithPadding(longp.longValue(), 1, dOutInner);
+        startString();
+        FunctionHelper.writeNumberWithPadding(longp.longValue(), 1, sb);
         sendStringDataOutput(dOut);
     }
 
     public void convertNegativeInteger(LongPointable longp, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
-        FunctionHelper.writeNumberWithPadding(longp.longValue(), 1, dOutInner);
+        startString();
+        FunctionHelper.writeNumberWithPadding(longp.longValue(), 1, sb);
         sendStringDataOutput(dOut);
     }
 
     public void convertNonNegativeInteger(LongPointable longp, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
-        FunctionHelper.writeNumberWithPadding(longp.longValue(), 1, dOutInner);
+        startString();
+        FunctionHelper.writeNumberWithPadding(longp.longValue(), 1, sb);
         sendStringDataOutput(dOut);
     }
 
     public void convertNonPositiveInteger(LongPointable longp, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
-        FunctionHelper.writeNumberWithPadding(longp.longValue(), 1, dOutInner);
+        startString();
+        FunctionHelper.writeNumberWithPadding(longp.longValue(), 1, sb);
         sendStringDataOutput(dOut);
     }
 
     public void convertPositiveInteger(LongPointable longp, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
-        FunctionHelper.writeNumberWithPadding(longp.longValue(), 1, dOutInner);
+        startString();
+        FunctionHelper.writeNumberWithPadding(longp.longValue(), 1, sb);
         sendStringDataOutput(dOut);
     }
 
     public void convertShort(ShortPointable shortp, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
-        FunctionHelper.writeNumberWithPadding(shortp.longValue(), 1, dOutInner);
+        startString();
+        FunctionHelper.writeNumberWithPadding(shortp.longValue(), 1, sb);
         sendStringDataOutput(dOut);
     }
 
     public void convertUnsignedByte(ShortPointable shortp, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
-        FunctionHelper.writeNumberWithPadding(shortp.longValue(), 1, dOutInner);
+        startString();
+        FunctionHelper.writeNumberWithPadding(shortp.longValue(), 1, sb);
         sendStringDataOutput(dOut);
     }
 
     public void convertUnsignedInt(LongPointable longp, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
-        FunctionHelper.writeNumberWithPadding(longp.longValue(), 1, dOutInner);
+        startString();
+        FunctionHelper.writeNumberWithPadding(longp.longValue(), 1, sb);
         sendStringDataOutput(dOut);
     }
 
     public void convertUnsignedLong(LongPointable longp, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
-        FunctionHelper.writeNumberWithPadding(longp.longValue(), 1, dOutInner);
+        startString();
+        FunctionHelper.writeNumberWithPadding(longp.longValue(), 1, sb);
         sendStringDataOutput(dOut);
     }
 
     public void convertUnsignedShort(IntegerPointable intp, DataOutput dOut) throws SystemException, IOException {
-        abvsInner.reset();
-        FunctionHelper.writeNumberWithPadding(intp.longValue(), 1, dOutInner);
+        startString();
+        FunctionHelper.writeNumberWithPadding(intp.longValue(), 1, sb);
         sendStringDataOutput(dOut);
     }
 
@@ -647,8 +644,8 @@ public class CastToStringOperation extends AbstractCastToOperation {
     }
 
     @Override
-    public void convertNormalizedString(UTF8StringPointable stringp, DataOutput dOut) throws SystemException,
-            IOException {
+    public void convertNormalizedString(UTF8StringPointable stringp, DataOutput dOut)
+            throws SystemException, IOException {
         // TODO Add check to verify string consists of limited character set.
         convertString(stringp, dOut);
     }
@@ -659,36 +656,40 @@ public class CastToStringOperation extends AbstractCastToOperation {
         convertString(stringp, dOut);
     }
 
+    private void startString() throws IOException {
+        ga.reset();
+        sb.reset(ga, STRING_EXPECTED_LENGTH);
+    }
+
     private void sendStringDataOutput(DataOutput dOut) throws SystemException, IOException {
         dOut.write(returnTag);
-        dOut.write((byte) ((abvsInner.getLength() >>> 8) & 0xFF));
-        dOut.write((byte) ((abvsInner.getLength() >>> 0) & 0xFF));
-        dOut.write(abvsInner.getByteArray(), abvsInner.getStartOffset(), abvsInner.getLength());
+        sb.finish();
+        dOut.write(ga.getByteArray(), 0, ga.getLength());
     }
 
     public void decimalToScientificNotn(XSDecimalPointable decp, DataOutput dOut) throws SystemException, IOException {
         byte decimalPlace = decp.getDecimalPlace();
         long value = decp.getDecimalValue();
         byte nDigits = decp.getDigitCount();
-        abvsInner.reset();
+        startString();
 
         if (!FunctionHelper.isNumberPostive(value)) {
             // Negative result, but the rest of the calculations can be based on a positive value.
-            FunctionHelper.writeChar('-', dOutInner);
+            FunctionHelper.writeChar('-', sb);
             value *= -1;
         }
 
         if (value == 0) {
-            FunctionHelper.writeChar('0', dOutInner);
+            FunctionHelper.writeChar('0', sb);
         } else {
             long pow10 = (long) Math.pow(10, nDigits - 1);
-            FunctionHelper.writeNumberWithPadding((value / pow10), 0, dOutInner);
-            FunctionHelper.writeChar('.', dOutInner);
+            FunctionHelper.writeNumberWithPadding((value / pow10), 0, sb);
+            FunctionHelper.writeChar('.', sb);
             long mod = value % pow10;
-            FunctionHelper.writeNumberWithPadding(mod, (nDigits - 1), dOutInner);
-            FunctionHelper.writeChar('E', dOutInner);
+            FunctionHelper.writeNumberWithPadding(mod, (nDigits - 1), sb);
+            FunctionHelper.writeChar('E', sb);
             long power = (nDigits - 1) - decimalPlace;
-            FunctionHelper.writeNumberWithPadding(power, 0, dOutInner);
+            FunctionHelper.writeNumberWithPadding(power, 0, sb);
         }
         sendStringDataOutput(dOut);
     }
@@ -697,6 +698,6 @@ public class CastToStringOperation extends AbstractCastToOperation {
     public void convertNull(DataOutput dOut) throws SystemException, IOException {
         StringValueBuilder svb = new StringValueBuilder();
         dOut.write(returnTag);
-        svb.write("null",dOut);
+        svb.write("null", dOut);
     }
 }
index a3da889..5334c92 100644 (file)
@@ -18,6 +18,12 @@ package org.apache.vxquery.runtime.functions.castable;
 
 import java.io.DataOutput;
 
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.accessors.TypedPointables;
 import org.apache.vxquery.datamodel.values.ValueTag;
@@ -28,13 +34,6 @@ import org.apache.vxquery.runtime.functions.type.AbstractTypeScalarEvaluatorFact
 import org.apache.vxquery.types.BuiltinTypeRegistry;
 import org.apache.vxquery.types.SequenceType;
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
 public class CastableScalarEvaluatorFactory extends AbstractTypeScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
 
@@ -44,7 +43,7 @@ public class CastableScalarEvaluatorFactory extends AbstractTypeScalarEvaluatorF
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         return new AbstractTypeScalarEvaluator(args, ctx) {
             final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
             final DataOutput dOut = abvs.getDataOutput();
index 4d5eca2..58aa35d 100644 (file)
@@ -18,6 +18,13 @@ package org.apache.vxquery.runtime.functions.comparison;
 
 import java.io.DataOutput;
 
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.LongPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.vxquery.context.DynamicContext;
 import org.apache.vxquery.datamodel.accessors.SequencePointable;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
@@ -30,14 +37,6 @@ import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScal
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
 import org.apache.vxquery.runtime.functions.util.FunctionHelper;
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.LongPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
 public abstract class AbstractValueComparisonScalarEvaluatorFactory extends
         AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
@@ -48,7 +47,7 @@ public abstract class AbstractValueComparisonScalarEvaluatorFactory extends
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
         final DataOutput dOut = abvs.getDataOutput();
         final AbstractValueComparisonOperation aOp = createValueComparisonOperation();
index cc1e117..ea156f0 100644 (file)
@@ -18,6 +18,14 @@ package org.apache.vxquery.runtime.functions.comparison.general;
 
 import java.io.DataOutput;
 
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.DoublePointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.vxquery.context.DynamicContext;
 import org.apache.vxquery.datamodel.accessors.SequencePointable;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
@@ -66,15 +74,6 @@ import org.apache.vxquery.runtime.functions.comparison.AbstractValueComparisonOp
 import org.apache.vxquery.runtime.functions.util.AtomizeHelper;
 import org.apache.vxquery.runtime.functions.util.FunctionHelper;
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.DoublePointable;
-import org.apache.hyracks.data.std.primitive.VoidPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
 public abstract class AbstractGeneralComparisonScalarEvaluatorFactory extends
         AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
@@ -85,7 +84,7 @@ public abstract class AbstractGeneralComparisonScalarEvaluatorFactory extends
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         final AbstractValueComparisonOperation aOp = createValueComparisonOperation();
         final ArrayBackedValueStorage abvsInner1 = new ArrayBackedValueStorage();
         final DataOutput dOutInner1 = abvsInner1.getDataOutput();
index a7df0cb..806e067 100644 (file)
  */
 package org.apache.vxquery.runtime.functions.conditional;
 
-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.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
-
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.BooleanPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+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.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
 
 public class IfThenElseScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
@@ -42,28 +41,24 @@ public class IfThenElseScalarEvaluatorFactory extends AbstractTaggedValueArgumen
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, final IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         final TaggedValuePointable conditionTvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
         final BooleanPointable bp = (BooleanPointable) BooleanPointable.FACTORY.createPointable();
 
         return new IScalarEvaluator() {
             @Override
-            public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+            public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                 args[CONDITION].evaluate(tuple, conditionTvp);
 
-                try {
-                    if (conditionTvp.getTag() != ValueTag.XS_BOOLEAN_TAG) {
-                        throw new SystemException(ErrorCode.FORG0006);
-                    }
-                    conditionTvp.getValue(bp);
+                if (conditionTvp.getTag() != ValueTag.XS_BOOLEAN_TAG) {
+                    throw new SystemException(ErrorCode.FORG0006);
+                }
+                conditionTvp.getValue(bp);
 
-                    if (bp.getBoolean()) {
-                        args[TRUE_CONDITION].evaluate(tuple, result);
-                    } else {
-                        args[FALSE_CONDITION].evaluate(tuple, result);
-                    }
-                } catch (SystemException e) {
-                    throw new AlgebricksException(e);
+                if (bp.getBoolean()) {
+                    args[TRUE_CONDITION].evaluate(tuple, result);
+                } else {
+                    args[FALSE_CONDITION].evaluate(tuple, result);
                 }
             }
         };
index 8c8a091..5437383 100644 (file)
@@ -19,6 +19,12 @@ package org.apache.vxquery.runtime.functions.datetime;
 import java.io.DataOutput;
 import java.io.IOException;
 
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.vxquery.datamodel.accessors.SequencePointable;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.values.ValueTag;
@@ -28,13 +34,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.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
 public abstract class AbstractValueFromDateTimeScalarEvaluatorFactory extends
         AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
@@ -45,7 +44,7 @@ public abstract class AbstractValueFromDateTimeScalarEvaluatorFactory extends
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         final ArrayBackedValueStorage abvsInner = new ArrayBackedValueStorage();
         final DataOutput dOutInner = abvsInner.getDataOutput();
         final SequencePointable seqp = (SequencePointable) SequencePointable.FACTORY.createPointable();
index e7479b0..f675207 100644 (file)
@@ -19,6 +19,14 @@ package org.apache.vxquery.runtime.functions.datetime;
 import java.io.DataOutput;
 import java.io.IOException;
 
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.IntegerPointable;
+import org.apache.hyracks.data.std.primitive.LongPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.vxquery.datamodel.accessors.SequencePointable;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.accessors.atomic.XSDurationPointable;
@@ -29,15 +37,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.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.IntegerPointable;
-import org.apache.hyracks.data.std.primitive.LongPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
 public abstract class AbstractValueFromDurationScalarEvaluatorFactory extends
         AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
@@ -48,7 +47,7 @@ public abstract class AbstractValueFromDurationScalarEvaluatorFactory extends
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         final XSDurationPointable durationp = (XSDurationPointable) XSDurationPointable.FACTORY.createPointable();
         final LongPointable longp = (LongPointable) LongPointable.FACTORY.createPointable();
         final IntegerPointable intp = (IntegerPointable) IntegerPointable.FACTORY.createPointable();
index f645fe6..d7299f6 100644 (file)
@@ -19,6 +19,13 @@ package org.apache.vxquery.runtime.functions.datetime;
 import java.io.DataOutput;
 import java.io.IOException;
 
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.LongPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.vxquery.context.DynamicContext;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.accessors.atomic.XSDateTimePointable;
@@ -29,14 +36,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.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.LongPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
 public class FnAdjustDateTimeToTimezoneScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
 
@@ -46,7 +45,7 @@ public class FnAdjustDateTimeToTimezoneScalarEvaluatorFactory extends AbstractTa
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
         final XSDateTimePointable datetimep = (XSDateTimePointable) XSDateTimePointable.FACTORY.createPointable();
         final XSDateTimePointable ctxDatetimep = (XSDateTimePointable) XSDateTimePointable.FACTORY.createPointable();
index 21d08d1..2787771 100644 (file)
@@ -19,6 +19,13 @@ package org.apache.vxquery.runtime.functions.datetime;
 import java.io.DataOutput;
 import java.io.IOException;
 
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.LongPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.vxquery.context.DynamicContext;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.accessors.atomic.XSDatePointable;
@@ -30,14 +37,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.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.LongPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
 public class FnAdjustDateToTimezoneScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
 
@@ -47,7 +46,7 @@ public class FnAdjustDateToTimezoneScalarEvaluatorFactory extends AbstractTagged
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
         final XSDatePointable datep = (XSDatePointable) XSDatePointable.FACTORY.createPointable();
         final XSDateTimePointable ctxDatetimep = (XSDateTimePointable) XSDateTimePointable.FACTORY.createPointable();
index 80a519b..baf861f 100644 (file)
@@ -19,6 +19,13 @@ package org.apache.vxquery.runtime.functions.datetime;
 import java.io.DataOutput;
 import java.io.IOException;
 
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.LongPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.vxquery.context.DynamicContext;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.accessors.atomic.XSDateTimePointable;
@@ -30,14 +37,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.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.LongPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
 public class FnAdjustTimeToTimezoneScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
 
@@ -47,7 +46,7 @@ public class FnAdjustTimeToTimezoneScalarEvaluatorFactory extends AbstractTagged
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
         final XSTimePointable timep = (XSTimePointable) XSTimePointable.FACTORY.createPointable();
         final XSDateTimePointable datetimep = (XSDateTimePointable) XSDateTimePointable.FACTORY.createPointable();
index 965ce08..4341cfc 100644 (file)
@@ -19,6 +19,12 @@ package org.apache.vxquery.runtime.functions.datetime;
 import java.io.DataOutput;
 import java.io.IOException;
 
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.vxquery.context.DynamicContext;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.accessors.atomic.XSDateTimePointable;
@@ -28,13 +34,6 @@ import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScal
 import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluatorFactory;
 import org.apache.vxquery.runtime.functions.cast.CastToDateOperation;
 
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
 public class FnCurrentDateScalarEvaluatorFactory extends AbstractTaggedValueArgumentScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
 
@@ -44,7 +43,7 @@ public class FnCurrentDateScalarEvaluatorFactory extends AbstractTaggedValueArgu
 
     @Override
     protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args)
-            throws AlgebricksException {
+            throws HyracksDataException {
         final DynamicContext dCtx = (DynamicContext) ctx.getJobletContext().getGlobalJobData();
         final XSDateTimePointable datetimep = (XSDateTimePointable) XSDateTimePointable.FACTORY.createPointable();
         final CastToDateOperation castToDate = new CastToDateOperation();
index 8ad2af0..c722ce2 100644 (file)
@@ -19,6 +19,12 @@ package org.apache.vxquery.runtime.functions.datetime;
 import java.io.DataOutput;
 import java.io.IOException;
 
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.vxquery.context.DynamicContext;
 import org.apache.vxquery.datamodel.accessors.TaggedValuePointable;
 import org.apache.vxquery.datamodel.accessors.atomic.XSDateTimePointable;
@@ -28,13 +34,6 @@ import org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScal
 import org.apache.vxquery.runtime.functions.bas