[ 
https://issues.apache.org/jira/browse/FLINK-19038?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17185585#comment-17185585
 ] 

Nicholas Jiang edited comment on FLINK-19038 at 8/27/20, 3:37 AM:
------------------------------------------------------------------

[~twalthr],[~dwysakowicz],

 
{code:java}
private SortQueryOperation validateAndGetChildSort(QueryOperation child, 
PostResolverFactory postResolverFactory) {
   final SortQueryOperation previousSort;
   if (child instanceof SortQueryOperation) {
      previousSort = (SortQueryOperation) child;
   } else {
      previousSort = (SortQueryOperation) createSort(Collections.emptyList(), 
child, postResolverFactory);
   }

   if ((previousSort).getFetch() != -1) {
      throw new ValidationException("FETCH is already defined.");
   }

   return previousSort;
}
{code}
Why does method validateAndGetChildSort check the fetch of previousSort? In my 
opinion, this validation makes no sense if user desire to continuously fetch or 
limit.


was (Author: nicholasjiang):
[~twalthr],[~dwysakowicz],

 
{code:java}
private SortQueryOperation validateAndGetChildSort(QueryOperation child, 
PostResolverFactory postResolverFactory) {
   final SortQueryOperation previousSort;
   if (child instanceof SortQueryOperation) {
      previousSort = (SortQueryOperation) child;
   } else {
      previousSort = (SortQueryOperation) createSort(Collections.emptyList(), 
child, postResolverFactory);
   }

   if ((previousSort).getFetch() != -1) {
      throw new ValidationException("FETCH is already defined.");
   }

   return previousSort;
}
{code}
Why does method validateAndGetChildSort check the fetch of previousSort? In my 
opinion, this validation has no sense if user want to continuously fetch or 
limit.

 

> It doesn't support to call Table.limit() continuously
> -----------------------------------------------------
>
>                 Key: FLINK-19038
>                 URL: https://issues.apache.org/jira/browse/FLINK-19038
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / API
>    Affects Versions: 1.12.0
>            Reporter: Dian Fu
>            Assignee: Nicholas Jiang
>            Priority: Major
>             Fix For: 1.12.0
>
>
> For example, table.limit(3).limit(2) will failed with "FETCH is already 
> defined." 
> {code}
> org.apache.flink.table.api.ValidationException: FETCH is already defined.
>       at 
> org.apache.flink.table.operations.utils.SortOperationFactory.validateAndGetChildSort(SortOperationFactory.java:125)
>       at 
> org.apache.flink.table.operations.utils.SortOperationFactory.createLimitWithFetch(SortOperationFactory.java:105)
>       at 
> org.apache.flink.table.operations.utils.OperationTreeBuilder.limitWithFetch(OperationTreeBuilder.java:418)
> {code}
> However, as we support to call table.limit() without specifying the order, I 
> guess this should be a valid usage and should be allowed.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to