Bugs item #1991738, was opened at 2008-06-12 11:30
Message generated for change (Comment added) made by tsheyar
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=1991738&group_id=56967
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: PF/compiler
Group: Pathfinder 0.24
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Wouter Alink (vzzzbx)
Assigned to: Nobody/Anonymous (nobody)
Summary: XQ: compilation or runtime choice
Initial Comment:
(stable nightly build, compiled from supersourcetarball, June 11, 2008)
The following query takes about 35 minutes to compile (and I have reason to
believe it was also the reason why the machine crashed after it was executed a
few times):
for $run in pf:collection("log.xml")//run
let $successCount := if ($run/success) then count($run/success/task) else 0
let $failureCount := if ($run/failure) then count($run/failure/task) else 0
let $nooutputCount := if ($run/nooutput) then (if ($run/nooutput/@count) then
zero-or-one($run/nooutput/@count) else 0) + count($run/nooutput/task) else 0
let $totalTasks := $successCount + $failureCount + $nooutputCount
return <run>
{ $run/@tool }
{ for $v in $run/prepared/date/@unixtime[. > 0] return attribute
preparation {$v - exactly-one($run/started/date/@unixtime)} }
{ for $v in $run/executed/date/@unixtime[. > 0] return attribute
execution {$v - exactly-one($run/prepared/date/@unixtime)} }
{ for $v in $run/validated/date/@unixtime[. > 0] return attribute
validation {$v - exactly-one($run/executed/date/@unixtime)} }
{ for $v in $run/committed/date/@unixtime[. > 0] return attribute
commit {$v - exactly-one($run/validated/date/@unixtime)} }
{ for $v in $run/prepared/date/@unixtime[. > 0 and $totalTasks > 0]
return attribute preparationPerTask {($v -
exactly-one($run/started/date/@unixtime)) div $totalTasks} }
{ for $v in $run/executed/date/@unixtime[. > 0 and $totalTasks > 0]
return attribute executionPerTask {($v -
exactly-one($run/prepared/date/@unixtime)) div $totalTasks} }
{ for $v in $run/validated/date/@unixtime[. > 0 and $totalTasks > 0]
return attribute validationPerTask {($v -
exactly-one($run/executed/date/@unixtime)) div $totalTasks} }
{ for $v in $run/committed/date/@unixtime[. > 0 and $totalTasks > 0]
return attribute commitPerTask {($v -
exactly-one($run/validated/date/@unixtime)) div $totalTasks} }
{attribute allowedExecution {exactly-one($run/allowedExecutionTime)
* 1000}}
{attribute successCount {$successCount}}
{attribute failureCount {$failureCount}}
{attribute nooutputCount {$nooutputCount}}
{attribute totalTasks {$totalTasks}}
</run>
but, as you might have noticed the query is not written in a very nice way...
Therefore i tried to rewrite the query to the (hopefully) equivalent:
for $run in pf:collection("log.xml")//run
let $successCount := count($run/success/task)
let $failureCount := count($run/failure/task)
let $nooutputCount := if ($run/nooutput/@count) then
exactly-one($run/nooutput/@count) cast as xs:integer else 0 +
count($run/nooutput/task)
let $totalTasks := ($successCount + $failureCount + $nooutputCount) cast as
xs:integer
let $started := $run/started/date/@unixtime cast as xs:integer?
let $prepared := $run/prepared/date/@unixtime cast as xs:integer?
let $executed := $run/executed/date/@unixtime cast as xs:integer?
let $validated := $run/validated/date/@unixtime cast as xs:integer?
let $committed := $run/committed/date/@unixtime cast as xs:integer?
return element { "run" } {
$run/@tool,
if ($prepared > 0) then attribute preparation { $prepared - $started } else
(),
if ($executed > 0) then attribute execution { $executed - $prepared } else
(),
if ($validated > 0) then attribute validation { $validated - $executed }
else (),
if ($committed > 0) then attribute commit { $committed - $validated } else
(),
if ($totalTasks > 0)
then
(if ($prepared > 0) then attribute preparationPerTask { ($prepared -
$started) div $totalTasks } else (),
if ($executed > 0) then attribute executionPerTask { ($executed -
$prepared) div $totalTasks } else (),
if ($validated > 0) then attribute vaalidationPerTask { ($validated -
$executed) div $totalTasks } else (),
if ($committed > 0) then attribute commitPerTask { ($committed -
$validated) div $totalTasks } else ())
else
(),
attribute allowedExecution {exactly-one($run/allowedExecutionTime) * 1000},
attribute successCount {$successCount},
attribute failureCount {$failureCount},
attribute nooutputCount {$nooutputCount},
attribute totalTasks {$totalTasks}
}
This query compiles within seconds, but then the runtime environment complains:
MAPI = [EMAIL PROTECTED]
QUERY = for $run in pf:collection("log.xml")//run
ERROR = !ERROR: merged_union: tail of first BAT/column of table 2 must be
sorted.
!ERROR: CMDmerged_union: operation failed.
Unfortunately I cannot provide the log.xml-document, but when leaving out the
if-statement:
"if ($totalTasks > 0) then ... else ()"
the query executes fine.
p.s. This workaround works for us at the moment.
----------------------------------------------------------------------
>Comment By: Jan Rittinger (tsheyar)
Date: 2008-06-13 09:42
Message:
Logged In: YES
user_id=993208
Originator: NO
Hi Wouter,
I'm not sure what you expect from this bug report.
The optimization of the first query screws up because the optimizer wants
to get rid of all ``for loops'' and has a harder time reaching this goal
than in the second case. If you however look at the query heavy
optimization is not needed to provide a good performance. Knowing this it
could be perhaps helpful to state that you only want to apply ``light''
optimization for this query (in comparison to others).
For the second query I cannot see anything wrong in the code generation.
To solve this problem I would need some help from you.
If you generate the query with pf -A, profile it, give the position in the
MIL code (the merged_union that is going to fail; probably one of the 3
calls with 10 arguments), and perhaps a characteristic snippet of the
second input BAT (it should be an iter/oid column), then it should be
possible to decide whether the underlying string_join() operator or an
incorrect property inference in MonetDB might be the reason for the failing
merged_union() call.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=1991738&group_id=56967
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs