db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kristian Waagan (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-4544) Referencing streaming CLOBs in (some) generated column clauses fails
Date Mon, 15 Feb 2010 14:55:28 GMT

    [ https://issues.apache.org/jira/browse/DERBY-4544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12833823#action_12833823
] 

Kristian Waagan commented on DERBY-4544:
----------------------------------------

One of the messages one might see due to this error:
Caused by: java.sql.SQLException: Java exception: 'ASSERT FAILED Less than one byte per char,
CharacterStreamBuiler@31380681:bufferable=false, isPositionAware=false, curBytePos=0, curCharPos=0,
dataOffset=2, byteLength=24932, charLength=65534, maxCharLength=9223372036854775807, stream=class
org.apache.derby.iapi.services.io.FormatIdInputStream: org.apache.derby.shared.common.sanity.AssertFailure'.

In insane builds YMMV, depending on the contents of the value you insert. You may get an IOException
when you read back the value, or you can get wrong results.
Here's an example where 65536 chars have been inserted as a stream:
id=4, clen=65536, length(myclob)=65534, String(myclob).length()=24930

clen is the generated column, length(myclob) is obtained after the insert as select length(myclob),
and the last number is obtained as rs.getString(1).length().

> Referencing streaming CLOBs in (some) generated column clauses fails
> --------------------------------------------------------------------
>
>                 Key: DERBY-4544
>                 URL: https://issues.apache.org/jira/browse/DERBY-4544
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0, 10.6.0.0
>            Reporter: Kristian Waagan
>
> Referencing a CLOB represented as a stream in generated columns can lead to data corruption
or that the query fails.
> For instance, with 10.5:
> create table t (id int, myclob clob, clen generated always as (length(myclob)));
> # Insert CLOB using the streaming APIs (setCharacterStream).
> The exception 'java.lang.ClassCastException: org.apache.derby.iapi.types.ReaderToUTF8Stream
cannot be cast to org.apache.derby.iapi.types.Resetable'
> On trunk the same query results in data corruption, and this isn't detected before the
value is read back from store.
> Workaround:
> Don't use the streaming APIs when using CLOBs in generated columns. This increases the
memory footprint, and may not feasible for large CLOBs.
> FYI, BLOB deals with this by materializing the value, which effectively equals to using
the workaround mentioned above.

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


Mime
View raw message