You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Jiajun Xie (Jira)" <ji...@apache.org> on 2022/04/12 01:15:00 UTC
[jira] [Updated] (CALCITE-5091) RelMdRowCount can return more accurate rowCount when fetch is deterministic and offset is dynamic
[ https://issues.apache.org/jira/browse/CALCITE-5091?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jiajun Xie updated CALCITE-5091:
--------------------------------
Description:
The sql from https://issues.apache.org/jira/browse/CALCITE-5048
{code:java}
select * from emp order by ename limit 1 offset ?
{code}
*RelMdRowCount#getRowCount* will return 14d, because it always return rowCount when offset is dynamic.
{code:java}
if (rel.offset instanceof RexDynamicParam) {
return rowCount;
}
{code}
Obviously, rowCount will not exceed 1 because *LIMIT 1*. We can improve it.
was:
The sql from https://issues.apache.org/jira/browse/CALCITE-5048
{code:java}
select * from emp order by ename limit 1 offset ?
{code}
*RelMdRowCount#getRowCount* will return 14d, because it always return rowCount when offset is dynamic.
{code:java}
if (rel.offset instanceof RexDynamicParam) {
return rowCount;
}
{code}
Obviously, rowCount will not exceed 1 because* LIMIT 1*. We can improve it.
> RelMdRowCount can return more accurate rowCount when fetch is deterministic and offset is dynamic
> -------------------------------------------------------------------------------------------------
>
> Key: CALCITE-5091
> URL: https://issues.apache.org/jira/browse/CALCITE-5091
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.30.0
> Reporter: Jiajun Xie
> Assignee: Jiajun Xie
> Priority: Minor
>
> The sql from https://issues.apache.org/jira/browse/CALCITE-5048
> {code:java}
> select * from emp order by ename limit 1 offset ?
> {code}
> *RelMdRowCount#getRowCount* will return 14d, because it always return rowCount when offset is dynamic.
> {code:java}
> if (rel.offset instanceof RexDynamicParam) {
> return rowCount;
> }
> {code}
> Obviously, rowCount will not exceed 1 because *LIMIT 1*. We can improve it.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)