| QUESTION | ANSWER |
|
It seems like Theseus is slow. Am I doing something wrong? |
Theseus is normally very fast. When Theseus is not running as fast
as you might expect, check the following:
|
|
If I use the TheseusBox API, can I call execute() more than once?
|
Yes. Once you have created a TheseusBox, you can load a plan (via loadPlan()) and call execute() for that plan as many times as you want. This is the suggested approach if you want to enable your plan to be accessed via a servlet or any other type of server-style program. |
|
The manual shows an example of operators like SELECT that take strings as inputs. Can I use streams instead of strings? |
Yes; actually, every operator input is a stream. As the note at
the front of the manual says, string literals are converted to
streams of 1 tuple and 1 attribute (name of attribute is "dummy",
but this name often does not matter).
Thus, it is possible to have an input file consisting of: RELATION data: val char 10 20 RELATION criteria: name_does_not_matter char val < 15and a plan:
PLAN p1
{
INPUT: stream data, stream criteria
OUTPUT: stream output
BODY
{
select(data, criteria : output)
}
}
|
|
How complex can SELECT criteria be? |
Complex enough to handle most boolean logical expressions
that you would like to write. For example, you could have changed the
input for the above input file to:
RELATION data: val char 10 20 RELATION criteria: name_does_not_matter char (val > 2 or (val > 10 and val < 15)) and val < 18 |
|
What do I do if I want SELECT or JOIN criteria to be dynamically generated? For example, suppose I want to find the MIN of some value in one relation R1 and then use that minimum value as the basis for a selection that I do on another relation R2.
|
You have two choices when specifying the SELECT or JOIN criteria.
One choice is to hardcode it (i.e., specify it as a literal). The
other is to make it a variable. Note from the SELECT
manual page that if you do make
it a variable, the criteria needs to be the only value in a single
tuple relation. So, what you would do is:
|
|
How do we express IF/THEN/ELSE in Theseus (or, how do we express a termination condition for a recursive plan)? |
Recursion is dataflow is the preferred method of looping
beacuse it requires fewer operators and synchronization.
To express IF/THEN/ELSE in your plans, you generally need to do the following:
|