Github user lomoree commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/224#discussion_r91162501
  
    --- Diff: 
phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteIT.java ---
    @@ -1343,6 +1343,28 @@ public void initTable() throws Exception {
                             {7L, "0000000005", "T5", "0000000005", "S5"},
                             {8L, "0000000006", "T6", "0000000006", "S6"}})
                     .close();
    +
    --- End diff --
    
    While that was my initial thinking, upon looking deeper I discovered a 
different source for the issue
    
    The reason a ServerProject was being created was because of visitCall(). It 
wasn't recursively checking for sequences. Therefore, when an operator like 
SqlKind.PLUS was present and the sequence was present, the sequence would be 
pushed down to a child operand and not be seen by visitCall()
    
    PhoenixConverterRules is designed so that a ServerProject does not get 
created if a sequence is present
    
     
     ```
    private static Predicate<LogicalProject> NO_SEQUENCE = new 
Predicate<LogicalProject>() {
                @Override
                public boolean apply(LogicalProject input) {
                    return !CalciteUtils.hasSequenceValueCall(input);
                }            
            };
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to