openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Lee" <tsunfang...@gmail.com>
Subject Re: [jira] Commented: (OPENJPA-312) derby fails with duplicate primary key(s) in group by list
Date Mon, 13 Aug 2007 17:13:13 GMT
The problem with indexOf() is with a column name as a substring of an
existing ones.  For example, BC is part of ABCD and using indexOf will
overlook and miss the column BC if we don't check the leading and tailing
characters of the target column name.  Tokenizer is then chosen for this
reason.

A better fundamental change should be keeping a List of column objects just
like rderBY which keeps more context (semantic information) for better query
processing but the fixing cost and risk is much higher and may not worth it
on processing group by.

Thanks,
Daniel


On 8/13/07, Kevin Sutter (JIRA) <jira@apache.org> wrote:
>
>
>    [
> https://issues.apache.org/jira/browse/OPENJPA-312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12519456]
>
> Kevin Sutter commented on OPENJPA-312:
> --------------------------------------
>
> Daniel,
> The code is much cleaner now.  Thanks.  But, I don't think the performance
> of StringTokenizer is worth any advantages it might provide.  Is there some
> reason why the previous mechanism of just using indexOf() wasn't
> sufficient?  I like the idea of isolating this check to a single boolean
> method like you have, but I would like to see a better performing
> implementation.
>
> Thanks,
> Kevin
>
> > derby fails with duplicate primary key(s) in group by list
> > ----------------------------------------------------------
> >
> >                 Key: OPENJPA-312
> >                 URL: https://issues.apache.org/jira/browse/OPENJPA-312
> >             Project: OpenJPA
> >          Issue Type: Bug
> >          Components: sql
> >    Affects Versions: 1.0.0
> >            Reporter: Daniel Lee
> >            Assignee: Daniel Lee
> >            Priority: Minor
> >             Fix For: 1.0.0
> >
> >         Attachments: OPENJPA-312.patch, OPENJPA-312.patch
> >
> >
> > derby fails with duplicate primary key(s) in group by list
> > With query "select o.customer, avg(o.amount) from Order o group by
> o.customer" the push-down query contains duplicate columns in the group by
> clause.  This is okay when DB2 and other DB that tolerate the duplicates but
> Derby returns error.
> > Of course, we can ask fix on Derby but we can also easy fix in OpenJPA
> to avoid duplicates in the group by list.  Please refer to the following for
> the error result and the attach patch for the fix.
> > Output from running the query that generate duplicate in the group by
> list:
> > 6429  demo  TRACE  [main] openjpa.Query - Executing query: select
> o.customer, avg(o.amount) from Order o group by o.customer
> > 6639  demo  TRACE  [main] openjpa.jdbc.SQL - <t 1094861122, conn
> 1639735740> executing prepstmnt 1405375428 SELECT t1.countryCode, t1.id,
> t1.version, t1.city, t1.state, t1.street, t1.zip, t1.creditRating, t1.name,
> AVG(t0.amount) FROM Order t0 INNER JOIN Customer t1 ON
> t0.customer_countryCode = t1.countryCode AND t0.customer_id = t1.id GROUP
> BY t1.countryCode, t1.id, t1.version, t1.countryCode, t1.id, t1.city,
> t1.state, t1.street, t1.zip, t1.countryCode, t1.id, t1.creditRating,
> t1.name
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message