Project

General

Profile

Bug #40

MINUS operator fails when subtrahend is empty

Added by ronald - almost 16 years ago. Updated almost 16 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Mulgara
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
fixed

Description

The following simple example fails with an [[IllegalArgumentException]]
<br/>
(&quot;tuples must have variables in common for subtraction to occur&quot;):
<br/>

<br/>
&nbsp;&nbsp;delete select $s &lt;a:bar&gt; $o from &lt;<a href="local:///topazproject#foo">local:///topazproject#foo</a>&gt; where $s &lt;a:bar&gt; $o from &lt;<a href="local:///topazproject#foo&gt;;">local:///topazproject#foo&amp;gt;;</a>
<br/>
&nbsp;&nbsp;insert &lt;a:foo&gt; &lt;a:bar&gt; '0' into &lt;<a href="local:///topazproject#foo&gt;;">local:///topazproject#foo&amp;gt;;</a>
<br/>
&nbsp;&nbsp;select $s &lt;a:bar&gt; $o from &lt;<a href="local:///topazproject#foo">local:///topazproject#foo</a>&gt; where $s &lt;a:bar&gt; $o and $s &lt;a:bar&gt; $x minus $s &lt;a:bar&gt; '1';
<br/>

<br/>
The problem is in [[TuplesOperations]].java . Line 304,
<br/>

<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set matchingVars = getMatchingVars(minuend, subtrahend);
<br/>

<br/>
returns a non-empty set consisting of [$s]; but the sort() call on
<br/>
line 324 returns a truly empty tuples (line 749), which causes the
<br/>
exception on line 103 of Difference.java because getMatchingVars()
<br/>
now returns empty.
<br/>

<br/>
Attached is a simple patch which adds an explicit check for an empty
<br/>
minued or subtrahend.

Also available in: Atom PDF