Issue Details (XML | Word | Printable)

Key: DERBY-2805
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: A B
Reporter: A B
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

ASSERT failure with sane build if DISTINCT and ORDER BY are present in a query that selects from a diagnostic table function.

Created: 11/Jun/07 11:14 PM   Updated: 24/Jan/08 04:57 PM
Return to search
Component/s: SQL
Affects Version/s: 10.3.1.4
Fix Version/s: 10.3.1.4

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works d2805_v1.patch 2007-06-13 05:03 PM A B 13 kB
File Licensed for inclusion in ASF works d2805_v1.stat 2007-06-13 05:03 PM A B 0.7 kB
Issue Links:
Reference
 

Resolution Date: 14/Jun/07 12:14 AM


 Description  « Hide
Attempts to execute the following query will lead to an ASSERT failure with sane jars:

ij> select distinct * from table(syscs_diag.space_table('T1')) X order by 3;

ERROR XJ001: Java exception: 'ASSERT FAILED markOrderingDependent() not expected to be called for org.apache.derby.impl.sql.compile.FromVTI: org.apache.derby.shared.common.sanity.AssertFailure'.

Stack trace is:

at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
at ResultSetNode.markOrderingDependent(ResultSetNode.java:1881)
at SingleChildResultSetNode.markOrderingDependent(SingleChildResultSetNode.java:578)
at SingleChildResultSetNode.markOrderingDependent(SingleChildResultSetNode.java:578)
at SingleChildResultSetNode.markOrderingDependent(SingleChildResultSetNode.java:578)
at SelectNode.genProjectRestrict(SelectNode.java:1409)
at SelectNode.modifyAccessPaths(SelectNode.java:1816)
at SingleChildResultSetNode.modifyAccessPaths(SingleChildResultSetNode.java:439)
at DMLStatementNode.optimizeStatement(DMLStatementNode.java:307)
at CursorNode.optimizeStatement(CursorNode.java:515)

I was able to avoid this by adding an empty implementation of "markOrderingDependent" to the FromVTI class, so that's probably the fix that I will post (after looking a bit more closely at the code to see if this makes sense).

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
A B added a comment - 13/Jun/07 05:03 PM
Attaching d2805_v1.patch to address this issue. Patch does the following:

  1 - Renames the "markOrderingDependent()" method and related variables to
      reflect their use: which is, so far as I can tell, to indicate that
the optimizer has eliminated a sort and thus that the underlying
result sets *may* need to make adjustments to compensate for the
dropped sort. At the moment the only result set node which needs
to make such an adjustment is IndexRowToBaseRowNode.

  2 - Updates comments where appropriate to more explicitly describe the
intended use of the new "adjustForSortElimination()" method
(which is what "markOrderingDependent()" was renamed to).

  3 - Adds a void implementation of "adjustForSortElimination()" to the
FromVTI class since that class doesn't need to make any adjustments.
This void method is what solves the failure reported in this issue.

  4 - Adds appropriate test cases to a new fixture in the existing
lang/SysDiagVTIMappingTest JUnit test.

Note that this patch touches several files due the method renaming mentioned in #1.

I'm running derbyall and suites.All now and will post when they are done. In the meantime, it would be great if someone could review the renaming and associated comments to see if they do in fact make things clearer; if not, perhaps I can give it another go before committing...

A B made changes - 13/Jun/07 05:03 PM
Field Original Value New Value
Attachment d2805_v1.patch [ 12359617 ]
Attachment d2805_v1.stat [ 12359618 ]
A B made changes - 13/Jun/07 05:03 PM
Derby Info [Patch Available]
Repository Revision Date User Message
ASF #547066 Thu Jun 14 00:10:38 UTC 2007 abrown DERBY-2805: Fix FromVTI to not throw an ASSERT when sort elimination occurs.
In particular this patch does the following:

  1 - Renames the "markOrderingDependent()" method and related variables to
      reflect their use, which is to indicate that the optimizer has eliminated
      a sort and thus that the underlying result sets *may* need to make
      adjustments to compensate for the dropped sort. At the moment the only
      result set node which needs to make such an adjustment is
      IndexRowToBaseRowNode.

  2 - Updates comments where appropriate to more explicitly describe the
      intended use of the "adjustForSortElimination()" method (which is
      what "markOrderingDependent()" was renamed to).

  3 - Adds a void implementation of "adjustForSortElimination()" to the
      FromVTI class since that class doesn't need to make any adjustments.
      This void method is what solves the failure reported in DERBY-2805.

  4 - Adds appropriate test cases to a new fixture in the existing
      lang/SysDiagVTIMappingTest JUnit test.
Files Changed
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromBaseTable.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/RowResultSetNode.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SysDiagVTIMappingTest.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SingleChildResultSetNode.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultSetNode.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/IndexToBaseRowNode.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/SelectNode.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TableOperatorNode.java

A B added a comment - 14/Jun/07 12:14 AM
derbyall and suites.All ran cleanly on SUSE Linux with ibm142, so I committed the changes with svn # 547066:

  URL: http://svn.apache.org/viewvc?view=rev&rev=547066

Marking this issue as resolved. If there are any suggestions about how to make the code comments and/or relevant method names more clear, I can address those in a subsequent patch. Otherwise I think this issue is complete.

A B made changes - 14/Jun/07 12:14 AM
Derby Info [Patch Available]
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Bryan Pendleton made changes - 15/Jun/07 04:44 AM
Link This issue relates to DERBY-2351 [ DERBY-2351 ]
A B made changes - 24/Jan/08 04:57 PM
Status Resolved [ 5 ] Closed [ 6 ]