[
https://issues.apache.org/jira/browse/DERBY-3613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12590731#action_12590731
]
Bryan Pendleton commented on DERBY-3613:
----------------------------------------
This page suggests that certain versions of Sybase may have similar behavior to
Derby:
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0.sqlug/html/sqlug/sqlug126.htm
It seems like Derby could recognize that:
select distinct a from t group by a, b
is identical to
select distinct a from t group by a
I can think of 3 possible ways to give Derby this behavior:
1) When processing GROUP by columns, and deciding whether to pull them up
into the result column list as generated columns, detect this particular case
and
don't pull up the generated GROUP BY column "b" into the result list.
2) In the compilation process, prior to generating the distinct scan result set,
detect that un-necessary column "b" has been included into the result column
list
and skip it when generating the data structures for execution.
3) At execution time, when setting up the sorter, recognize that column "b"
isn't
needed in the sort key, and only sort/collapse the records on column "a".
It seems best to detect this situation earlier rather than later, so I'm partial
to solutions which can solve the problem at compilation time, not execution
time.
> SELECT DISTINCT field FROM TABLE_NAME GROUP BY field, field2
> -------------------------------------------------------------
>
> Key: DERBY-3613
> URL: https://issues.apache.org/jira/browse/DERBY-3613
> Project: Derby
> Issue Type: Bug
> Affects Versions: 10.3.2.1
> Environment: Windows XP
> Reporter: Artur Kuś
>
> Query 'SELECT DISTINCT field FROM TABLE_NAME GROUP BY field, field2' not
> work ok.
> Distinct is ignored !!!
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.