db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-3097) Unnecessary if statement can be removed from BaseActivation.getColumnFromNow
Date Sun, 18 May 2008 00:29:55 GMT

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

Bryan Pendleton commented on DERBY-3097:

Regarding my 7-Oct-2007 request for more information on Beetle 4880, Myrna van Lunteren
posted the following to the derby-dev mailing list:

NEST_THIS definition:
	public static int NEST_THIS( int returnValue,
			   String statement1 )
		throws SQLException, StandardException
		Connection conn = getCurrentConnection();
		PreparedStatement ps = conn.prepareStatement( statement1 );
		return	returnValue;
ij> create table L_1
	pk int primary key,
	s1 int,
	b int,
	s2 int,
	s3 int
0 rows inserted/updated/deleted
ij> create unique btree index L_1_UNIQUE on L_1( s1, s2, s3 );
0 rows inserted/updated/deleted

ij> insert into L_1 ( pk, s1 ) values
  ( -16, NEST_THIS( 103, 'delete from L_1 properties index=null
where s2 = 103 and s1 =
   NEST_THIS( 103, ''insert into L_1 ( pk, s1, s2, s3 ) values
( -18, 3, 1, 1 ), ( -19, 403, 403, 403 )'' )' ) );
The info further indicates that at one time, this code caused a deadlock.
The notes say: "Consider a query like: select * from t1, t2 where
t2.c1 = MyClass::myMethod(t1.c1). Since the method call's arguments
have no local reference to t2, and the predicate is pushed down as a
qualifier, we should be able to deem it as scan-invariant and evaluate
it once per outer row, so all together row_count(t1) number of times.
And we should evaluate it outside the store, before a heap page is

I've not tried this code out; not sure the syntax even works in Derby.
I hope it helps.

> 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