db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-3097) Unnecessary if statement can be removed from BaseActivation.getColumnFromNow
Date Sat, 31 May 2008 23:14:45 GMT

    [ https://issues.apache.org/jira/browse/DERBY-3097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12601421#action_12601421

Knut Anders Hatlen commented on DERBY-3097:

Not all that useful, but in case someone finds it interesting...

I tried to modify the test case so that it would run on Derby. To get the correct syntax,
I did

  a) replace getCurrentConnection() with DriverManager.getConnection("jdbc:default:connection")
in the Java method

  b) add a CREATE FUNCTION statement to create the NEST_THIS function

  c) change "create unique btree index" to "create unique index"

  d) change "properties index=null" to "--DERBY-PROPERTIES index=null"

The first problem that I ran into, was that the optimizer override caused a syntax error.
Apparently, optimizer overrides are not supported for DELETE statements. Not sure if this
is a bug or not. The documentation says that they work on FROM clauses, and I couldn't find
anything about their being limited to SELECT FROM. Anyway, it was pretty easy to enable it
in the parser (can't guarantee that it works perfectly, though). Just change a flag from false
to true in sqlgrammar.deleteBody().

Next problem was that functions don't allow SQL statements that modify data. Since the test
case indicates that it was supported in Cloudscape, it might be that only a simple change
in the parser is required, so that it accepts "MODIFIES SQL" in CREATE FUNCTION statements,
but I didn't get that far before I ran out of daylight.

> Unnecessary if statement can be removed from BaseActivation.getColumnFromNow
> ----------------------------------------------------------------------------
>                 Key: DERBY-3097
>                 URL: https://issues.apache.org/jira/browse/DERBY-3097
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions:
>            Reporter: Bryan Pendleton
>            Assignee: Bryan Pendleton
>            Priority: Minor
>         Attachments: checkNumOpens.diff
> In BaseActivation.java there is the following code:
> protected final DataValueDescriptor getColumnFromRow(int rsNumber, int colId)
> throws StandardException {
>         if( row[rsNumber] == null)
>         {
>             /* This actually happens. NoPutResultSetImpl.clearOrderableCache attempts
to prefetch invariant values
>              * into a cache. This fails in some deeply nested joins. See Beetle 4736
and 4880.
>              */
>             return null;
>         }
> return row[rsNumber].getColumn(colId);
> }
> During the investigation of DERBY-3033, I came to the conclusion that this "if" statement
is no longer necessary, and in fact is counter-productive, for it makes diagnosing other problems
harder by delaying the point at which data structure problems are exposed as errors in the
> This JIRA issue requests that this code be evaluated, to determine whether or not it
truly is necessary, and, if it is not necessary, suggests that it should be removed, to result
in simpler, clearer code.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message