Hi Shashwat,

Calcite does this by a Call to the "AS" Operator (basically value as v is just 
syntactic sugar for AS(value, v)).
So you need to create a call node (SqlCall) with the AS Operator 
(SqlStdOperatorTable.AS) and as operands you node and an SqlIdentifier for the 
Alias.

But your visitor should then return SqlNode not String, or?

Best
Julian

Am 31.10.18, 11:07 schrieb "Shashwat Kumar" <[email protected]>:

    I want to modify select identifiers in sql statement. For example
    SELECT value FROM Data
    to
    SELECT value as v FROM Data
    
    I am able to get SqlNode for select identifiers as follows.
    
    public String visit(SqlCall sqlCall) {
    
            SqlNodeList selectList = ((SqlSelect) sqlCall).getSelectList();
            for (SqlNode sqlNode : selectList) {
                *// do something with sqlNode*
            }
    
    }
    
    Now how to change sqlNode as per requirement?
    
    
    -- 
    Regards
    Shashwat Kumar
    

Reply via email to