I think that throwing them is fine.
The problem might be that they are too deeply nested into other exceptions that we need to wrap around them in order to work well with the Hyracks/Algebricks interfaces. If that's the problem we could either unwrap them or derive our exceptions from the Hyracks/Algebricks exceptions. However, we probably need more investigation to find out if deriving the exceptions would solve the problem.

Cheers,
Till

On 18 Feb 2015, at 21:49, Eldon Carman wrote:

I am looking at the testing framework for VXQuery that we use to run XQTS.
I have a question about how to throw SystemExceptions.

Consider the following query that should return XPTY0004 error.

(:*******************************************************:)
(: Test: K-NumericAdd-38                                 :)
(: Written by: Frans Englich                             :)
(: Date: 2007-11-22T11:31:20+01:00                       :)
(: Purpose: Arithmethics involving operands of integer type but with wrong
cardinality. :)
(:*******************************************************:)
empty((1, 2) + ())

The actual exception thrown is the following:

Exception in thread "main"
edu.uci.ics.hyracks.api.exceptions.HyracksDataException:
edu.uci.ics.hyracks.api.exceptions.HyracksDataException:
edu.uci.ics.hyracks.api.exceptions.HyracksDataException:
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException:
org.apache.vxquery.exceptions.SystemException: XPTY0004: It is a type error
if, during the static analysis phase, an expression is found to have a
static type that is not appropriate for the context in which the expression occurs, or during the dynamic evaluation phase, the dynamic type of a value does not match a required type as specified by the matching rules in 2.5.4
SequenceType Matching.
at
edu.uci.ics.hyracks.client.dataset.HyracksDatasetReader.nextPartition(HyracksDatasetReader.java:117)
at
edu.uci.ics.hyracks.client.dataset.HyracksDatasetReader.read(HyracksDatasetReader.java:127)
at org.apache.vxquery.cli.VXQuery.runJob(VXQuery.java:348)
at org.apache.vxquery.cli.VXQuery.runQueries(VXQuery.java:288)
at org.apache.vxquery.cli.VXQuery.execute(VXQuery.java:161)
at org.apache.vxquery.cli.VXQuery.main(VXQuery.java:121)
Caused by: edu.uci.ics.hyracks.api.exceptions.HyracksDataException:
edu.uci.ics.hyracks.api.exceptions.HyracksDataException:
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException:
org.apache.vxquery.exceptions.SystemException: XPTY0004: It is a type error
if, during the static analysis phase, an expression is found to have a
static type that is not appropriate for the context in which the expression occurs, or during the dynamic evaluation phase, the dynamic type of a value does not match a required type as specified by the matching rules in 2.5.4
SequenceType Matching.
at
edu.uci.ics.hyracks.control.common.utils.ExceptionUtils.setNodeIds(ExceptionUtils.java:41)
at edu.uci.ics.hyracks.control.nc.Task.run(Task.java:296)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: edu.uci.ics.hyracks.api.exceptions.HyracksDataException:
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException:
org.apache.vxquery.exceptions.SystemException: XPTY0004: It is a type error
if, during the static analysis phase, an expression is found to have a
static type that is not appropriate for the context in which the expression occurs, or during the dynamic evaluation phase, the dynamic type of a value does not match a required type as specified by the matching rules in 2.5.4
SequenceType Matching.
at
edu.uci.ics.hyracks.algebricks.runtime.operators.std.AssignRuntimeFactory$1.produceTuple(AssignRuntimeFactory.java:146)
at
edu.uci.ics.hyracks.algebricks.runtime.operators.std.AssignRuntimeFactory$1.nextFrame(AssignRuntimeFactory.java:127)
at
edu.uci.ics.hyracks.dataflow.common.comm.util.FrameUtils.flushFrame(FrameUtils.java:38)
at
edu.uci.ics.hyracks.algebricks.runtime.operators.std.EmptyTupleSourceRuntimeFactory$1.open(EmptyTupleSourceRuntimeFactory.java:55)
at
edu.uci.ics.hyracks.algebricks.runtime.operators.meta.AlgebricksMetaOperatorDescriptor$1.initialize(AlgebricksMetaOperatorDescriptor.java:104)
at
edu.uci.ics.hyracks.api.rewriter.runtime.SuperActivityOperatorNodePushable.initialize(SuperActivityOperatorNodePushable.java:81)
at edu.uci.ics.hyracks.control.nc.Task.run(Task.java:239)
... 3 more
Caused by:
edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException:
org.apache.vxquery.exceptions.SystemException: XPTY0004: It is a type error
if, during the static analysis phase, an expression is found to have a
static type that is not appropriate for the context in which the expression occurs, or during the dynamic evaluation phase, the dynamic type of a value does not match a required type as specified by the matching rules in 2.5.4
SequenceType Matching.
at
org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator.evaluate(AbstractTaggedValueArgumentScalarEvaluator.java:52)
at
org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator.evaluate(AbstractTaggedValueArgumentScalarEvaluator.java:47)
at
edu.uci.ics.hyracks.algebricks.runtime.operators.std.AssignRuntimeFactory$1.produceTuple(AssignRuntimeFactory.java:144)
... 9 more
Caused by: org.apache.vxquery.exceptions.SystemException: XPTY0004: It is a type error if, during the static analysis phase, an expression is found to have a static type that is not appropriate for the context in which the expression occurs, or during the dynamic evaluation phase, the dynamic type
of a value does not match a required type as specified by the matching
rules in 2.5.4 SequenceType Matching.
at
org.apache.vxquery.runtime.functions.arithmetic.AbstractArithmeticScalarEvaluatorFactory$1.evaluate(AbstractArithmeticScalarEvaluatorFactory.java:61)
at
org.apache.vxquery.runtime.functions.base.AbstractTaggedValueArgumentScalarEvaluator.evaluate(AbstractTaggedValueArgumentScalarEvaluator.java:50)
... 11 more

Is this an issue with our testing software identifying the correct
exception or with VXQuery's method of throwing the SystemException?

Reply via email to