001package gudusoft.gsqlparser.nodes;
002
003import gudusoft.gsqlparser.*;
004import gudusoft.gsqlparser.compiler.*;
005import gudusoft.gsqlparser.nodes.couchbase.*;
006import gudusoft.gsqlparser.nodes.hive.THiveVariable;
007import gudusoft.gsqlparser.nodes.teradata.TDataConversion;
008import gudusoft.gsqlparser.stmt.TSelectSqlStatement;
009
010import java.util.ArrayDeque;
011import java.util.ArrayList;
012import java.util.Deque;
013import java.util.Stack;
014
015
016class calculateExprVisitor implements IExpressionVisitor {
017
018    TCustomSqlStatement sqlStatement;
019
020    Stack<TFrame> frameStack;
021
022    public calculateExprVisitor(Stack<TFrame> pframeStack, TCustomSqlStatement pSqlStatement){
023        sqlStatement = pSqlStatement;
024        this.frameStack = pframeStack;
025    }
026
027    Stack<TExpression> expressionStack = new Stack<>();
028
029    void evaluateLeafExpr(TExpression expr){
030        String plainText = expr.getPlainText();
031
032        switch (expr.getExpressionType()){
033            case simple_constant_t:
034                TConstant constant = expr.getConstantOperand();
035                switch (constant.getLiteralType()){
036                    case etString:
037                        plainText = TBaseType.getStringInsideLiteral(plainText);
038                        expr.setVal(plainText);
039                        expr.setDataType(TPrimitiveType.String);
040                        if (constant.getStartToken() != null){
041                           expr.setPlainTextLineNo(constant.getStartToken().lineNo);
042                           expr.setPlainTextColumnNo(constant.getStartToken().columnNo);
043                        }
044
045                        break;
046                    case etNumber:
047                        break;
048                }
049                break;
050            case function_t:
051                plainText = expr.getFunctionCall().getFunctionName().toString();
052                expr.setPlainTextLineNo(expr.getFunctionCall().getFunctionName().getStartToken().lineNo);
053                expr.setPlainTextColumnNo(expr.getFunctionCall().getFunctionName().getStartToken().columnNo);
054                break;
055            case simple_object_name_t:
056                boolean getValueFromVar = false;
057                TVariable symbolVariable =  TSymbolTableManager.searchSymbolVariable(frameStack,plainText);
058                if (symbolVariable != null){
059                    if (symbolVariable.getVariableStr() != null){
060                        plainText = symbolVariable.getVariableStr();
061                        expr.setPlainTextLineNo( symbolVariable.getLineNo());
062                        expr.setPlainTextColumnNo(symbolVariable.getColumnNo());
063                        getValueFromVar = true;
064                        // variableStr is only recorded for resolved string values,
065                        // so a successful lookup carries a real value
066                        expr.setVal(plainText);
067                        expr.setValPartial(symbolVariable.isVariableStrPartial());
068                        //System.out.println("variable name:"+symbolVariable.getName()+", value: "+plainText);
069                    }
070                }
071                if (!getValueFromVar){
072                    plainText = plainText.replace(".", "_");
073                }
074
075//                if (expr.getObjectOperand().getDbObjectType() == EDbObjectType.variable){
076//                }else {
077//                    plainText = plainText.replace(".", "_");
078//                }
079
080                break;
081            case case_t:
082                TExpression resultExpr = expr.getCaseExpression().getWhenClauseItemList().getWhenClauseItem(0).getReturn_expr();
083                resultExpr.evaluate(frameStack,sqlStatement);
084                plainText = resultExpr.getPlainText();
085                expr.setVal(resultExpr.getVal());
086                expr.setValPartial(resultExpr.isValPartial());
087
088                //System.out.println(plainText);
089                break;
090            default:
091                break;
092        }
093
094          expr.setPlainText(plainText);
095    }
096
097    public boolean exprVisit(TParseTreeNode pNode, boolean isLeafNode){
098        if (isLeafNode){
099            evaluateLeafExpr(((TExpression)pNode));
100            expressionStack.push((TExpression)pNode);
101        }
102
103        TExpression expr = (TExpression)pNode;
104        switch (expr.getExpressionType()){
105            case concatenate_t:
106            case arithmetic_plus_t:
107                TExpression expr1 = expressionStack.pop();
108                TExpression expr2 = expressionStack.pop();
109                ((TExpression)pNode).setPlainText(expr2.getPlainText() + expr1.getPlainText());
110                // a concatenation carries a real string value when at least one
111                // operand resolved to one; unresolved operands stay in the text
112                // as placeholder identifiers (e.g. 'WHERE id = ' || v_id) and
113                // mark the value as partially resolved
114                if (expr1.getVal() != null || expr2.getVal() != null){
115                    ((TExpression)pNode).setVal(expr2.getPlainText() + expr1.getPlainText());
116                    ((TExpression)pNode).setValPartial(expr1.getVal() == null || expr2.getVal() == null
117                            || expr1.isValPartial() || expr2.isValPartial());
118                }
119                expressionStack.push((TExpression)pNode);
120                break;
121        }
122        return true;
123    };
124
125}
126
127class columnVisitor extends TParseTreeVisitor {
128    ArrayList<TObjectName> columns;
129
130    public columnVisitor( ArrayList<TObjectName> columnsInsideExpression){
131        columns = columnsInsideExpression;
132    }
133
134    @Override
135    public void preVisit(TObjectName node) {
136        if (node.getDbObjectType() == EDbObjectType.column){
137            columns.add(node);
138        }
139    }
140
141//    public boolean exprVisit(TParseTreeNode pNode,boolean isLeafNode){
142//        TExpression expr = (TExpression)pNode;
143//        switch (expr.getExpressionType()){
144//            case simple_object_name_t:
145//                columns.add(expr.getObjectOperand());
146//                break;
147//            case function_t:
148//                if (expr.getFunctionCall().getArgs() != null){
149//                    for(int i=0;i<expr.getFunctionCall().getArgs().size();i++){
150//                        ArrayList<TObjectName>  list = expr.getFunctionCall().getArgs().getExpression(i).getColumnsInsideExpression();
151//                        for(int j=0;j<list.size();j++){
152//                            columns.add(list.get(j));
153//                        }
154//                    }
155//                }
156//                break;
157//            default:
158//                break;
159//        }
160//        return true;
161//    };
162}
163
164
165/**
166 * @deprecated As of v2.0.5.6, use class ColumnVisitor in package demos.columnInWhereClause instead.
167 */
168class searchColumnVisitor implements IExpressionVisitor {
169    private TExpressionList _resultList;
170    private String _targetColumn;
171
172    public searchColumnVisitor(String targetColumn, TExpressionList resultList){
173        _resultList = resultList;
174        _targetColumn = targetColumn;
175    }
176
177    public boolean exprVisit(TParseTreeNode pNode,boolean isLeafNode){
178        TExpression expr = (TExpression)pNode;
179        if (expr.getExpressionType() == EExpressionType.simple_object_name_t){
180            if (_targetColumn.contains(".")){
181                if (_targetColumn.equalsIgnoreCase(expr.getObjectOperand().toString())){
182                    _resultList.addExpression(expr);
183                }
184            }else{
185                if (_targetColumn.equalsIgnoreCase(expr.getObjectOperand().getColumnNameOnly())){
186                    _resultList.addExpression(expr);
187                }
188            }
189        }else if ((expr.getExpressionType() == EExpressionType.function_t)&&(expr.getFunctionCall().getArgs() != null)){
190            if (expr.getFunctionCall().getArgs().size() > 0){
191                TExpressionList list1;
192                for(int i=0;i<expr.getFunctionCall().getArgs().size();i++){
193                    list1 = expr.getFunctionCall().getArgs().getExpression(i).searchColumn(_targetColumn);
194                    if (list1.size() > 0){
195                        for(int j=0;j<list1.size();j++){
196                            _resultList.addExpression(list1.getExpression(j));
197                        }
198                    }
199                }
200                //expr.getFunctionCall().getArgs().getExpression(0).
201            }
202        }
203        return true;
204    };
205}
206
207class TFlattenVisitor implements IExpressionVisitor {
208
209    private ArrayList flattedAndOrExprs = new ArrayList();
210
211    public ArrayList getFlattedAndOrExprs() {
212        return flattedAndOrExprs;
213    }
214
215    public boolean exprVisit(TParseTreeNode pNode,boolean isLeafNode){
216        TExpression expr = (TExpression)pNode;
217        if (isLeafNode) flattedAndOrExprs.add(expr);
218        return true;
219    }
220
221}
222
223/**
224* An expression is a combination of one or more values, operators, and SQL functions that evaluates to a value.
225* There are lots of types of expression in this SQL parser, {@link #getExpressionType()} was used to distinguish these types.
226 *
227 * <p>
228 *     OBJECT NAME/CONSTANT/SOURCE TOKEN/FUNCTION CALL
229 *     <ul>
230  *         <li>object name, usually this is a column reference like emp.ename
231  *         <ul>
232   *             <li>type: {@link EExpressionType#simple_object_name_t}</li>
233 *               <li>object name: {@link #getObjectOperand()}</li>
234   *             <li>left operand:  N/A</li>
235   *             <li>right operand: N/A </li>
236   *             <li>operator: N/A </li>
237   *             </ul>
238   *         </li>
239 *         <li>constant
240 *         <ul>
241  *             <li>type: {@link EExpressionType#simple_constant_t}</li>
242*               <li>constant: {@link #getConstantOperand()}</li>
243  *             <li>left operand:  N/A</li>
244  *             <li>right operand: N/A </li>
245  *             <li>operator: N/A </li>
246  *             </ul>
247  *         </li>
248 *         <li>sourcetoken
249 *         <ul>
250  *             <li>type: {@link EExpressionType#simple_source_token_t}</li>
251*               <li>source token: {@link #getSourcetokenOperand()}</li>
252  *             <li>left operand:  N/A</li>
253  *             <li>right operand: N/A </li>
254  *             <li>operator: N/A </li>
255  *             </ul>
256  *         </li>
257 *         <li>function call
258 *         <ul>
259  *             <li>type: {@link EExpressionType#function_t}</li>
260*               <li>funcation call: {@link #getFunctionCall()}</li>
261  *             <li>left operand:  N/A</li>
262  *             <li>right operand: N/A </li>
263  *             <li>operator: N/A </li>
264  *             </ul>
265  *         </li>
266  *         </ul>
267 *
268 *     UNARY
269 *     <ul>
270 *         <li>  + expr1
271 *         <ul>
272  *             <li>type: {@link EExpressionType#unary_plus_t}</li>
273  *             <li>left operand:  N/A</li>
274  *             <li>right operand: getRightOperand</li>
275  *             <li>operator: {@link #getOperatorToken()}</li>
276  *             </ul>
277  *         </li>
278 *         <li>  - expr1
279 *         <ul>
280  *             <li>type: {@link EExpressionType#unary_minus_t}</li>
281 *             <li>left operand:  N/A</li>
282 *             <li>right operand: getRightOperand</li>
283 *             <li>operator: {@link #getOperatorToken()}</li>
284  *             </ul>
285  *         </li>
286 *         <li>  expr1 !
287 *         <ul>
288  *             <li>type: {@link EExpressionType#unary_factorial_t}</li>
289 *             <li>left operand:  {@link #getLeftOperand()}</li>
290 *             <li>right operand: N/A</li>
291 *             <li>operator: {@link #getOperatorToken()}</li>
292  *             </ul>
293  *         </li>
294 *         <li>  ~ expr1
295 *         <ul>
296  *             <li>type: {@link EExpressionType#unary_bitwise_not_t}</li>
297 *             <li>left operand:  N/A</li>
298 *             <li>right operand: {@link #getRightOperand()}</li>
299 *             <li>operator: {@link #getOperatorToken()}</li>
300  *             </ul>
301  *         </li>
302 *         <li>  @ expr1
303 *         <ul>
304  *             <li>type: {@link EExpressionType#unary_absolutevalue_t}</li>
305 *             <li>left operand:  N/A</li>
306 *             <li>right operand: {@link #getRightOperand()}</li>
307 *             <li>operator: {@link #getOperatorToken()}</li>
308  *             </ul>
309  *         </li>
310 *         <li>  |/ expr1
311 *         <ul>
312  *             <li>type: {@link EExpressionType#unary_squareroot_t}</li>
313 *             <li>left operand:  N/A</li>
314 *             <li>right operand: {@link #getRightOperand()}</li>
315 *             <li>operator: {@link #getOperatorToken()}</li>
316  *             </ul>
317  *         </li>
318 *         <li>  ||/ expr1
319 *         <ul>
320  *             <li>type: {@link EExpressionType#unary_cuberoot_t}</li>
321 *             <li>left operand:  N/A</li>
322 *             <li>right operand: {@link #getRightOperand()}</li>
323 *             <li>operator: {@link #getOperatorToken()}</li>
324  *             </ul>
325  *         </li>
326 *         <li>  !! expr1
327 *         <ul>
328  *             <li>type: {@link EExpressionType#unary_factorialprefix_t}</li>
329 *             <li>left operand:  N/A</li>
330 *             <li>right operand: {@link #getRightOperand()}</li>
331 *             <li>operator: {@link #getOperatorToken()}</li>
332  *             </ul>
333  *         </li>
334 *         <li>  Oracle: PRIOR expr1
335 *         <ul>
336  *             <li>type: {@link EExpressionType#unary_prior_t}</li>
337 *             <li>left operand:  N/A</li>
338 *             <li>right operand: getRightOperand</li>
339 *             <li>operator: {@link #getOperatorToken()}</li>
340  *             </ul>
341  *         </li>
342 *         <li>  Oracle: CONNECT_BY_ROOT expr1
343 *         <ul>
344  *             <li>type: {@link EExpressionType#unary_connect_by_root_t}</li>
345 *             <li>left operand:  N/A</li>
346 *             <li>right operand: getRightOperand</li>
347 *             <li>operator: {@link #getOperatorToken()}</li>
348  *             </ul>
349  *         </li>
350 *         <li>  MySQL: BINARY expr1
351 *         <ul>
352  *             <li>type: {@link EExpressionType#unary_prior_t}</li>
353 *             <li>left operand:  N/A</li>
354 *             <li>right operand: getRightOperand</li>
355 *             <li>operator: {@link #getOperatorToken()}</li>
356  *             </ul>
357  *         </li>
358 *         </ul>
359 *
360 *     ARITHMETIC
361 *     <ul>
362 *         <li>Addition: expr1 + expr2
363 *         <ul>
364 *             <li>type: {@link EExpressionType#arithmetic_plus_t}</li>
365 *             <li>left operand:  {@link #getLeftOperand()}</li>
366 *             <li>right operand: {@link #getRightOperand()} </li>
367 *             <li>operator: {@link #getOperatorToken()} </li>
368 *             </ul>
369 *         </li>
370 *         <li>Subtraction: expr1 - expr2
371 *         <ul>
372 *             <li>type: {@link EExpressionType#arithmetic_minus_t}</li>
373 *             <li>left operand:  {@link #getLeftOperand()}</li>
374 *             <li>right operand: {@link #getRightOperand()} </li>
375 *             <li>operator: {@link #getOperatorToken()} </li>
376 *             </ul>
377 *         </li>
378 *         <li>Multiplication: expr1 * expr2
379 *         <ul>
380 *             <li>type: {@link EExpressionType#arithmetic_times_t}</li>
381 *             <li>left operand:  {@link #getLeftOperand()}</li>
382 *             <li>right operand: {@link #getRightOperand()} </li>
383 *             <li>operator: {@link #getOperatorToken()} </li>
384 *             </ul>
385 *         </li>
386 *         <li>Division: expr1 / expr2
387 *         <ul>
388 *             <li>type: {@link EExpressionType#arithmetic_divide_t}</li>
389 *             <li>left operand:  {@link #getLeftOperand()}</li>
390 *             <li>right operand: {@link #getRightOperand()} </li>
391 *             <li>operator: {@link #getOperatorToken()} </li>
392 *             </ul>
393 *         </li>
394 *         <li>Modula: expr1 % expr2
395 *         <ul>
396 *             <li>type: {@link EExpressionType#arithmetic_modulo_t}</li>
397 *             <li>left operand:  {@link #getLeftOperand()}</li>
398 *             <li>right operand: {@link #getRightOperand()} </li>
399 *             <li>operator: {@link #getOperatorToken()} </li>
400 *             </ul>
401 *         </li>
402 *         <li>exponentiate: expr1 ^ expr2
403 *         <ul>
404 *             <li>type: {@link EExpressionType#exponentiate_t}</li>
405 *             <li>left operand:  {@link #getLeftOperand()}</li>
406 *             <li>right operand: {@link #getRightOperand()} </li>
407 *             <li>operator: {@link #getOperatorToken()} </li>
408 *             </ul>
409 *         </li>
410 *         <li>sql server 2008 +=,-=,*=,/=,%=: expr1 [+=|-=|*=|/=|%=] expr2
411 *         <ul>
412 *             <li>type: {@link EExpressionType#arithmetic_compound_operator_t}</li>
413 *             <li>left operand:  {@link #getLeftOperand()}</li>
414 *             <li>right operand: {@link #getRightOperand()} </li>
415 *             <li>operator: {@link #getOperatorToken()} </li>
416 *             </ul>
417 *         </li>
418 *     </uL>
419 *
420 *     LOGICAL
421 *     <ul>
422 *         <li>expr1 AND|&amp;&amp; expr2</li>
423  *             <li>type: {@link EExpressionType#logical_and_t}</li>
424  *             <li>left operand:  {@link #getLeftOperand()}</li>
425  *             <li>right operand: {@link #getRightOperand()} </li>
426  *             <li>operator: {@link #getOperatorToken()} </li>
427  *
428 *         <li>expr1 OR | || expr2
429 *         <ul>
430  *             <li>type: {@link EExpressionType#logical_or_t}</li>
431  *             <li>left operand:  {@link #getLeftOperand()}</li>
432  *             <li>right operand: {@link #getRightOperand()} </li>
433  *             <li>operator: {@link #getOperatorToken()} </li>
434  *             </ul>
435  *         </li>
436 *         <li>expr1 XOR expr2
437 *         <ul>
438  *             <li>type: {@link EExpressionType#logical_xor_t}</li>
439  *             <li>left operand:  {@link #getLeftOperand()}</li>
440  *             <li>right operand: {@link #getRightOperand()} </li>
441  *             <li>operator: {@link #getOperatorToken()} </li>
442  *             </ul>
443  *         </li>
444 *         <li>NOT|! expr1
445 *         <ul>
446  *             <li>type: {@link EExpressionType#logical_not_t}</li>
447  *             <li>left operand:  N/A</li>
448  *             <li>right operand: {@link #getRightOperand()} </li>
449  *             <li>operator: {@link #getOperatorToken()} </li>
450  *             </ul>
451  *         </li>
452 *         </ul>
453 *
454 *     ASSIGNMENT
455 *     <ul>
456 *         <li>ASSIGNMENT: expr1 [:=|=] expr2
457 *         <ul>
458  *             <li>type: {@link EExpressionType#assignment_t}</li>
459  *             <li>left operand:  {@link #getLeftOperand()}</li>
460  *             <li>right operand: {@link #getRightOperand()} </li>
461  *             <li>operator: {@link #getOperatorToken()} </li>
462  *             </ul>
463  *         </li>
464 *         </ul>
465 *
466 *     CONCATENATE
467 *     <ul>
468 *         <li>CONCATENATE: expr1 || expr2
469 *         <ul>
470  *             <li>type: {@link EExpressionType#concatenate_t}</li>
471  *             <li>left operand:  {@link #getLeftOperand()}</li>
472  *             <li>right operand: {@link #getRightOperand()} </li>
473  *             <li>operator: {@link #getOperatorToken()} </li>
474  *             </ul>
475  *         </li>
476 *         </ul>
477 *
478 *     AT TIME ZONE
479 *     <ul>
480 *         <li>expr1 at time zone expr2
481 *         <ul>
482  *             <li>type: {@link EExpressionType#at_time_zone_t}</li>
483  *             <li>left operand:  {@link #getLeftOperand()}</li>
484  *             <li>right operand: {@link #getRightOperand()} </li>
485  *             <li>operator: N/A</li>
486  *             </ul>
487  *         </li>
488 *         </ul>
489 *
490 *     AT LOCAL
491 *     <ul>
492 *         <li>expr1 at local
493 *         <ul>
494  *             <li>type: {@link EExpressionType#at_local_t}</li>
495  *             <li>left operand:  {@link #getLeftOperand()}</li>
496  *             <li>right operand: N/A </li>
497  *             <li>operator: N/A</li>
498  *             </ul>
499  *         </li>
500 *         </ul>
501 *
502 *     BITWISE
503 *     <ul>
504 *         <li>Bitwise and : expr1 &amp; expr2
505 *         <ul>
506  *             <li>type: {@link EExpressionType#bitwise_and_t}</li>
507  *             <li>left operand:  {@link #getLeftOperand()}</li>
508  *             <li>right operand: {@link #getRightOperand()} </li>
509  *             <li>operator: {@link #getOperatorToken()} </li>
510  *             </ul>
511  *         </li>
512 *         <li>Bitwise or : expr1 | expr2
513 *         <ul>
514  *             <li>type: {@link EExpressionType#bitwise_or_t}</li>
515  *             <li>left operand:  {@link #getLeftOperand()}</li>
516  *             <li>right operand: {@link #getRightOperand()} </li>
517  *             <li>operator: {@link #getOperatorToken()} </li>
518  *             </ul>
519  *         </li>
520 *         <li>Bitwise exclusive or : expr1 ^ expr2
521 *         <ul>
522  *             <li>type: {@link EExpressionType#bitwise_exclusive_or_t}</li>
523  *             <li>left operand:  {@link #getLeftOperand()}</li>
524  *             <li>right operand: {@link #getRightOperand()} </li>
525  *             <li>operator: {@link #getOperatorToken()} </li>
526  *             </ul>
527  *         </li>
528 *         <li>Bitwise xor : expr1 ^ expr2
529 *         <ul>
530  *             <li>type: {@link EExpressionType#bitwise_xor_t}</li>
531  *             <li>left operand:  {@link #getLeftOperand()}</li>
532  *             <li>right operand: {@link #getRightOperand()} </li>
533  *             <li>operator: {@link #getOperatorToken()} </li>
534  *             </ul>
535  *         </li>
536 *         <li>Bitwise shift left : expr1 &lt;&lt; expr2
537 *         <ul>
538  *             <li>type: {@link EExpressionType#bitwise_shift_left_t}</li>
539  *             <li>left operand:  {@link #getLeftOperand()}</li>
540  *             <li>right operand: {@link #getRightOperand()} </li>
541  *             <li>operator: {@link #getOperatorToken()} </li>
542  *             </ul>
543  *         </li>
544 *         <li><pre>Bitwise shift right : expr1 &gt;&gt; expr2</pre>
545 *         <ul>
546  *             <li>type: {@link EExpressionType#bitwise_shift_right_t}</li>
547  *             <li>left operand:  {@link #getLeftOperand()}</li>
548  *             <li>right operand: {@link #getRightOperand()} </li>
549  *             <li>operator: {@link #getOperatorToken()} </li>
550  *             </ul>
551  *         </li>
552 *         </ul>
553 *
554 *     SUBQUERY
555 *     <ul>
556 *         <li> A scalar subquery expression is a subquery that returns exactly one column value from one row.
557 *         <ul>
558  *             <li>type: {@link EExpressionType#subquery_t}</li>
559 *              <li>subquery: {@link #getSubQuery()} </li>
560  *             <li>left operand:  N/A</li>
561  *             <li>right operand: N/A </li>
562  *             <li>operator: N/A</li>
563  *             </ul>
564  *         </li>
565 *         </ul>
566 *
567 *     EXPRESSION WITH PARENTHESIS
568 *     <ul>
569 *         <li> ( expr1 )
570 *         <ul>
571  *             <li>type: {@link EExpressionType#parenthesis_t}</li>
572  *             <li>left operand is expr1:  {@link #getLeftOperand()}</li>
573  *             <li>right operand: N/A </li>
574  *             <li>operator: use {@link #getStartToken()} to get ( and {@link #getEndToken()} to get )</li>
575  *             </ul>
576  *         </li>
577 *         </ul>
578 *
579 *     LIST EXPRESSION
580 *     <ul>
581 *         <li>An expression list inside parenthesis like (expr,expr,...),
582 *         or one or more set of expressions: ((expr1,expr2,...),(expr1,expr2,...),(expr1,expr2,...)...)
583 *         <ul>
584  *             <li>type: {@link EExpressionType#list_t}</li>
585 *              <li>expr list: {@link #getExprList()}, may return null when expression list in syntax like this: () </li>
586  *             <li>left operand:  N/A</li>
587  *             <li>right operand: N/A </li>
588  *             <li>operator: open parenthsis ( can be fetched via {@link #getStartToken()},
589 *             close parenthesis ) can be fetched via {@link #getEndToken()} </li>
590  *             </ul>
591  *         </li>
592 *         </ul>
593 *
594 *    COLLECTION CONSTRUCTORS (informix)
595 *    <ul>
596 *        <li>Use a collection constructor to specify values for a collection column.
597 *        SET|MULTISET|LIST { epxr_list }
598 *          <ul>
599 *             <li>type: {@link EExpressionType#collection_constructor_set_t}</li>
600 *             <li>type: {@link EExpressionType#collection_constructor_multiset_t}</li>
601 *             <li>type: {@link EExpressionType#collection_constructor_list_t}</li>
602 *              <li>expr list: {@link #getExprList()}, may return null when expression list in syntax like this: () </li>
603 *             <li>left operand:  N/A</li>
604 *             <li>right operand: N/A </li>
605 *          </ul>
606 *        </li>
607 *
608 *
609 *    </ul>
610 *
611 *     GROUP EXPRESSION,  @deprecated As of v1.4.3.3
612 *     <ul>
613 *         <li>
614  *         </li>
615 *         </ul>
616 *
617 *     COMPARISON
618 *     <ul>
619 *         <li>A <b>simple comparison condition</b> specifies a comparison with expressions or subquery results.
620 *         <br>expr1 EQUAL|NOT_EQUAL|LESS_THAN|GRREAT_THAN|LESS_EQUAL_THAN|GREATE_EQUAL_THAN expr2,
621 *         or, (expr_list) EQUAL|NOT_EQUAL (subquery)
622 *             <ul>
623 *             <li>type: {@link EExpressionType#simple_comparison_t}</li>
624 *             <li>left operand:  {@link #getLeftOperand()}</li>
625 *             <li>right operand: {@link #getRightOperand()} </li>
626 *             <li>operator: {@link #getOperatorToken()}</li>
627 *             </ul>
628 *         </li>
629 *         <li>A <b>group comparison condition</b> specifies a comparison with any or all members
630 *         in a list or subquery.
631 *         <br>expr EQUAL|NOT_EQUAL|LESS_THAN|GRREAT_THAN|LESS_EQUAL_THAN|GREATE_EQUAL_THAN ANY|SOME|ALL (expr_list|subquery),
632 *         or, (expr_list) EQUAL|NOT_EQUAL ANY|SOME|ALL (expr_list|subquery)
633 *             <ul>
634 *             <li>type: {@link EExpressionType#group_comparison_t}</li>
635 *             <li>left operand:  {@link #getLeftOperand()}</li>
636 *             <li>right operand: {@link #getRightOperand()} </li>
637 *             <li>operator: {@link #getOperatorToken()}</li>
638 *             <li> ANY|SOME|ALL: {@link #getQuantifier()}</li>
639 *             </ul>
640 *         </li>
641 *         </ul>
642 *
643 *     IN
644 *     <ul>
645 *         <li>(expr|expr_list) |NOT] IN (expr_list)|(subquery)|expr
646 *         <ul>
647  *             <li>type: {@link EExpressionType#in_t}</li>
648 *             <li>left operand:  {@link #getLeftOperand()}</li>
649 *             <li>right operand: {@link #getRightOperand()} </li>
650  *            <li>operator is IN: {@link #getOperatorToken()} </li>
651 *             <li>NOT keyword: {@link #getNotToken()} </li>
652  *             </ul>
653  *         </li>
654 *         </ul>
655 *
656 *     CASE
657 *     <ul>
658 *         <li>case expression,let you use IF ... THEN ... ELSE logic in SQL statements without having to invoke procedures.
659 *         <ul>
660  *             <li>type: {@link EExpressionType#case_t}</li>
661 *              <li> case expression: {@link #getCaseExpression()}}</li>
662  *             <li>left operand:  N/A</li>
663  *             <li>right operand: N/A </li>
664  *             <li>operator: N/A </li>
665  *             </ul>
666  *         </li>
667 *         </ul>
668 *
669 *     CURSOR
670 *     <ul>
671 *         <li>CURSOR subquery
672 *         <ul>
673  *             <li>type: {@link EExpressionType#cursor_t}</li>
674 *              <li>subquery: {@link #getSubQuery()}</li>
675  *             <li>left operand:  N/A</li>
676  *             <li>right operand: N/A </li>
677  *             <li>operator: CURSOR can be fetched via {@link #getStartToken()} </li>
678  *             </ul>
679  *         </li>
680 *         </ul>
681 *
682 *     PATTERN MATCHING
683 *     <ul>
684 *         <li>expr1 [NOT] [LIKE|ILIKE|RLIKE|REGEXP|SIMILAR TO] [ALL|ANY|SOME]expr2 [ESCAPE expr3]
685 *         <ul>
686  *             <li>type: {@link EExpressionType#pattern_matching_t}</li>
687  *             <li>left operand:  {@link #getLeftOperand()}</li>
688  *             <li>right operand:{@link #getRightOperand()} </li>
689 *              <li>expr3: {@link #getLikeEscapeOperand()} </li>
690  *             <li>operator: {@link #getOperatorToken()}</li>
691 *              <li>NOT keyword: {@link #getNotToken()}</li>
692 *              <li>ALL|ANY|SOME keyword: {@link #getQuantifier()}</li>
693 *              <li>ESCAPE keyword: N/A</li>
694  *             </ul>
695  *         </li>
696 *         </ul>
697 *
698 *     NULL
699 *     <ul>
700 *         <li>expr ISNULL|NOTNULL|IS [NOT] NULL
701 *         <ul>
702  *             <li>type: {@link EExpressionType#null_t}</li>
703  *             <li>left operand:  {@link #getLeftOperand()}</li>
704  *             <li>right operand: N/A </li>
705  *             <li>operator is NULL: {@link #getOperatorToken()}</li>
706 *              <li>NOT keyword: {@link #getNotToken()}</li>
707  *             </ul>
708  *         </li>
709 *         </ul>
710 *
711 *     BETWEEN
712 *     <ul>
713 *         <li>expr1 [NOT] BETWEEN expr2 AND expr3
714 *         <ul>
715  *             <li>type: {@link EExpressionType#between_t}</li>
716 *              <li>expr1:  {@link #getBetweenOperand()}</li>
717  *             <li>expr2:  {@link #getLeftOperand()}</li>
718  *             <li>expr3: {@link #getRightOperand()} </li>
719  *             <li>operator is BETWEEN: {@link #getOperatorToken()}</li>
720 *              <li>NOT keyword: {@link #getNotToken()}</li>
721  *             </ul>
722  *         </li>
723 *         </ul>
724 *
725 *     EXISTS
726 *     <ul>
727 *         <li>EXISTS (subquery)
728 *         <ul>
729  *             <li>type: {@link EExpressionType#exists_t}</li>
730 *              <li>left operand:  N/A</li>
731  *             <li>right operand: N/A</li>
732  *             <li>subquery: {@link #getSubQuery()} </li>
733  *             <li>EXISTS: {@link #getStartToken()}</li>
734  *             </ul>
735  *         </li>
736 *         </ul>
737 *
738 *    IS UNKNOWN
739 *     <ul>
740 *         <li> expr1 IS [NOT] UNKNOWN
741 *         <ul>
742  *             <li>type: {@link EExpressionType#is_unknown_t}</li>
743 *             <li>left operand:  {@link #getLeftOperand()}</li>
744 *             <li>right operand: N/A </li>
745  *             <li>operator: {@link #getOperatorToken()}</li>
746 *             <li>NOT keyword: {@link #getNotToken()}</li>
747  *             </ul>
748  *         </li>
749 *         </ul>
750 *
751 *    IS TRUE
752 *     <ul>
753 *         <li> expr1 IS [NOT] TRUE
754 *         <ul>
755  *             <li>type: {@link EExpressionType#is_true_t}</li>
756 *             <li>left operand:  {@link #getLeftOperand()}</li>
757 *             <li>right operand: N/A </li>
758  *             <li>operator: {@link #getOperatorToken()}</li>
759 *             <li>NOT keyword: {@link #getNotToken()}</li>
760  *             </ul>
761  *         </li>
762 *         </ul>
763 *
764 *    IS FALSE
765 *     <ul>
766 *         <li> expr1 IS [NOT] FALSE
767 *         <ul>
768  *             <li>type: {@link EExpressionType#is_false_t}</li>
769 *             <li>left operand:  {@link #getLeftOperand()}</li>
770 *             <li>right operand: N/A </li>
771  *             <li>operator: {@link #getOperatorToken()}</li>
772 *             <li>NOT keyword: {@link #getNotToken()}</li>
773  *             </ul>
774  *         </li>
775 *         </ul>
776 *
777 *     DAY TO SECOND
778 *     <ul>
779 *         <li>expr DAY [( integer )] TO SECOND [( integer )]
780 *         <ul>
781  *             <li>type: {@link EExpressionType#day_to_second_t}</li>
782  *             <li>left operand:  {@link #getLeftOperand()}</li>
783  *             <li>right operand: N/A </li>
784  *             <li>operator: N/A</li>
785  *             </ul>
786  *         </li>
787 *         </ul>
788 *
789 *     YEAR TO MONTH
790 *     <ul>
791 *         <li>expr YEAR [( integer )] TO MONTH
792 *         <ul>
793  *             <li>type: {@link EExpressionType#year_to_month_t}</li>
794  *             <li>left operand:  {@link #getLeftOperand()}</li>
795  *             <li>right operand: N/A </li>
796  *             <li>operator: N/A</li>
797  *             </ul>
798  *         </li>
799 *         </ul>
800 *
801 *     INTERVAL(teradata)
802 *     <ul>
803 *         <li>( date_time_expression date_time_term ) start TO end
804 *         <ul>
805  *             <li>type: {@link EExpressionType#interval_t}</li>
806 *              <li>date_time_expression: {@link #getIntervalExpr()} </li>
807  *             <li>left operand:  N/A</li>
808  *             <li>right operand: N/A </li>
809  *             <li>operator: N/A</li>
810  *             </ul>
811  *         </li>
812 *         </ul>
813 *
814 *     NEW STRUCTURED TYPE
815 *     <ul>
816 *         <li>NEW function_call
817 *         <ul>
818  *             <li>type: {@link EExpressionType#new_structured_type_t}</li>
819 *              <li>function_call: {@link #getFunctionCall()} </li>
820  *             <li>left operand:  N/A</li>
821  *             <li>right operand: N/A </li>
822  *             <li>operator: N/A</li>
823  *             </ul>
824  *         </li>
825 *         </ul>
826 *
827 *     NEW VARIANT_TYPE
828 *     <ul>
829 *         <li>NEW VARIANT_TYPE ( type_argument_list )
830 *         <ul>
831  *             <li>type: {@link EExpressionType#new_variant_type_t}</li>
832 *              <li>type_argument_list: {@link #getNewVariantTypeArgumentList()} </li>
833  *             <li>left operand:  N/A</li>
834  *             <li>right operand: N/A </li>
835  *             <li>operator: N/A</li>
836  *             </ul>
837  *         </li>
838 *         </ul>
839 *
840 *     LDIFF,RDIFF,P_INTERSECT,P_NORMALIZE
841 *     <ul>
842 *         <li> expr1 LDIFF|RDIFF|P_INTERSECT|P_NORMALIZE expr2
843 *         <ul>
844  *             <li>type: {@link EExpressionType#new_variant_type_t}</li>
845 *             <li>left operand:  {@link #getLeftOperand()}</li>
846 *             <li>right operand: {@link #getRightOperand()} </li>
847  *             <li>operator: {@link #getOperatorToken()}</li>
848  *             </ul>
849  *         </li>
850 *         </ul>
851 *
852 *    UNTIL CHANGED
853 *     <ul>
854 *         <li> expr1 IS [NOT] UNTIL_CHANGED
855 *         <ul>
856  *             <li>type: {@link EExpressionType#new_variant_type_t}</li>
857 *             <li>left operand:  {@link #getLeftOperand()}</li>
858 *             <li>right operand: N/A </li>
859  *             <li>operator: {@link #getOperatorToken()}</li>
860 *             <li>NOT keyword: {@link #getNotToken()}</li>
861  *             </ul>
862  *         </li>
863 *         </ul>
864 *
865 *     LEFT SHIFT
866 *     <ul>
867 *         <li><pre>expr1 &lt;&lt; expr2</pre>
868 *         <ul>
869  *             <li>type: {@link EExpressionType#left_shift_t}</li>
870  *             <li>left operand:  {@link #getLeftOperand()}</li>
871  *             <li>right operand: {@link #getRightOperand()} </li>
872  *             <li>operator: {@link #getOperatorToken()} </li>
873  *             </ul>
874  *         </li>
875 *         </ul>
876 *
877 *     RIGHT SHIFT
878 *     <ul>
879 *         <li>expr1 &gt;&gt; expr2
880 *         <ul>
881  *             <li>type: {@link EExpressionType#right_shift_t}</li>
882  *             <li>left operand:  {@link #getLeftOperand()}</li>
883  *             <li>right operand: {@link #getRightOperand()} </li>
884  *             <li>operator: {@link #getOperatorToken()} </li>
885  *             </ul>
886  *         </li>
887 *         </ul>
888 *
889 *    IS DOCUMENT
890 *     <ul>
891 *         <li> expr1 IS [NOT] DOCUMENT
892 *         <ul>
893  *             <li>type: {@link EExpressionType#is_document_t}</li>
894 *             <li>left operand:  {@link #getLeftOperand()}</li>
895 *             <li>right operand: N/A </li>
896  *             <li>operator: {@link #getOperatorToken()}</li>
897 *             <li>NOT keyword: {@link #getNotToken()}</li>
898  *             </ul>
899  *         </li>
900 *         </ul>
901 *
902 *     IS DISTINCT FROM
903 *     <ul>
904 *         <li> expr1 IS [NOT] DISTINCT FROM expr2
905 *         <ul>
906  *             <li>type: {@link EExpressionType#is_distinct_from_t}</li>
907 *             <li>left operand:  {@link #getLeftOperand()}</li>
908 *             <li>right operand: {@link #getRightOperand()} </li>
909  *             <li>operator: {@link #getOperatorToken()}</li>
910 *             <li>NOT keyword: {@link #getNotToken()}</li>
911  *             </ul>
912  *         </li>
913 *         </ul>
914 *
915 *     SQL SERVER left join
916 *     <ul>
917 *         <li> expr1 *= expr2
918 *         <ul>
919  *             <li>type: {@link EExpressionType#left_join_t}</li>
920 *             <li>left operand:  {@link #getLeftOperand()}</li>
921 *             <li>right operand: {@link #getRightOperand()} </li>
922  *            <li>operator: {@link #getOperatorToken()}</li>
923  *             </ul>
924  *         </li>
925 *         </ul>
926 *
927 *     SQL SERVER right join
928 *     <ul>
929 *         <li> expr1 =* expr2
930 *         <ul>
931  *             <li>type: {@link EExpressionType#right_join_t}</li>
932 *             <li>left operand:  {@link #getLeftOperand()}</li>
933 *             <li>right operand: {@link #getRightOperand()} </li>
934  *            <li>operator: {@link #getOperatorToken()}</li>
935  *             </ul>
936  *         </li>
937 *         </ul>
938 *
939 *     COLLATE
940 *     <ul>
941 *         <li> expr1 COLLATE expr2
942 *         <ul>
943  *             <li>type: {@link EExpressionType#collate_t}</li>
944 *             <li>left operand:  {@link #getLeftOperand()}</li>
945 *             <li>right operand: {@link #getRightOperand()} </li>
946  *             <li>operator: {@link #getOperatorToken()}</li>
947 *             <li>NOT keyword: {@link #getNotToken()}</li>
948  *             </ul>
949  *         </li>
950 *         </ul>
951 *
952 *     MEMBER OF
953 *     <ul>
954 *         <li> expr1 MEMBER OF expr2
955 *         <ul>
956  *             <li>type: {@link EExpressionType#member_of_t}</li>
957 *             <li>left operand:  {@link #getLeftOperand()}</li>
958 *             <li>right operand: {@link #getRightOperand()} </li>
959  *             <li>operator: {@link #getOperatorToken()}</li>
960  *             </ul>
961  *         </li>
962 *         </ul>
963 *
964 *     NEXT VALUE FOR
965 *     <ul>
966 *         <li> <pre>NEXT VALUE FOR &lt;sequence name&gt;, or NEXT &lt;integer expression&gt;VALUE FOR &lt;sequence name&gt;</pre></li>
967  *             <li>type: {@link EExpressionType#next_value_for_t}</li>
968 *             <li>sequence name: {@link #getSequenceName()}   </li>
969 *             <li>over_clause : {@link #getOver_clause()}} </li>
970 *             <li>left operand(integer expression):  {@link #getLeftOperand()}</li>
971 *         </ul>
972 *
973 *     REF ARROW(named parameters in function call)
974 *     <ul>
975 *         <li> expr1 =&gt; expr2
976 *         <ul>
977  *             <li>type: {@link EExpressionType#ref_arrow_t}</li>
978  *             <li>left operand:  {@link #getLeftOperand()}</li>
979  *             <li>right operand: {@link #getRightOperand()} </li>
980  *             <li>operator: {@link #getOperatorToken()} </li>
981  *             </ul>
982  *         </li>
983 *         </ul>
984 *
985 *     TYPECAST
986 *     <ul>
987 *         <li> expr1 TYPECAST typename
988 *         <ul>
989  *             <li>type: {@link EExpressionType#typecast_t}</li>
990 *              <li>typename: {@link #getTypeName()}</li>
991  *             <li>left operand:  {@link #getLeftOperand()}</li>
992  *             <li>right operand: N/A </li>
993  *             <li>operator: {@link #getOperatorToken()} </li>
994  *         </ul>
995  *         </li>
996 *     </ul>
997 *
998 *     MULTISET
999 *     <ul>
1000 *         <li>MULTISET subquery
1001 *         <ul>
1002  *             <li>type: {@link EExpressionType#multiset_t}</li>
1003 *              <li>subquery: {@link #getSubQuery()}</li>
1004  *             <li>left operand:  N/A</li>
1005  *             <li>right operand: N/A </li>
1006  *             <li>operator: MULTISET can be fetched via {@link #getStartToken()} </li>
1007  *             </ul>
1008  *         </li>
1009 *         </ul>
1010 *
1011 *     FLOATING POINT
1012 *     <ul>
1013 *         <li>expr is [NOT] NAN|INFINITE
1014 *         <ul>
1015  *             <li>type: {@link EExpressionType#floating_point_t}</li>
1016  *             <li>left operand:  {@link #getLeftOperand()}</li>
1017  *             <li>right operand: N/A </li>
1018  *             <li>operator is IS: {@link #getOperatorToken()}</li>
1019 *              <li>NOT keyword: {@link #getNotToken()}</li>
1020  *             </ul>
1021  *         </li>
1022 *         </ul>
1023 *
1024 *     ROW CONSTRUCTOR
1025 *     <ul>
1026 *         <li>ROW ( expr_list )
1027 *         <ul>
1028  *             <li>type: {@link EExpressionType#row_constructor_t}</li>
1029 *              <li>expr_list:  {@link #getExprList()}</li>
1030  *             <li>left operand:  N/A</li>
1031  *             <li>right operand: N/A </li>
1032  *             <li>operator is ROW: {@link #getStartToken()}</li>
1033  *             </ul>
1034  *         </li>
1035 *         </ul>
1036 *
1037 *     IS OF TYPE
1038 *     <ul>
1039 *         <li>expr is of type ( datatype,...)
1040 *         <ul>
1041  *             <li>type: {@link EExpressionType#is_of_type_t}</li>
1042  *             <li>left operand:  {@link #getLeftOperand()}</li>
1043  *             <li>right operand: N/A </li>
1044  *             <li>operator: N/A</li>
1045  *             </ul>
1046  *         </li>
1047 *         </ul>
1048 *
1049 *     PLACE HOLDER
1050 *     <ul>
1051 *         <li>place holder expression
1052 *         <ul>
1053  *             <li>type: {@link EExpressionType#place_holder_t}</li>
1054  *             <li>left operand:  N/A</li>
1055  *             <li>right operand: N/A </li>
1056  *             <li>operator: N/A</li>
1057  *             </ul>
1058  *         </li>
1059 *         </ul>
1060 *
1061 *     TYPE_CONSTRUCTOR_EXPRESSION
1062 *     <ul>
1063 *         <li>[NEW] type_name( expr_list )
1064 *         <ul>
1065  *             <li>type: {@link EExpressionType#type_constructor_t}</li>
1066  *             <li>type_name(expr_list): {@link #getFunctionCall()}</li>
1067  *             <li>left operand:  N/A</li>
1068  *             <li>right operand: N/A </li>
1069  *             <li>operator: N/A</li>
1070  *             </ul>
1071  *         </li>
1072 *         </ul>
1073 *
1074 *     ARRAY ACCESS
1075 *     <ul>
1076 *         <li>array_name(index1)(index2)(index3)
1077 *         <ul>
1078  *             <li>type: {@link EExpressionType#arrayaccess_t}</li>
1079  *             <li>array_name(index1)(index2)(index3): {@link #getArrayAccess()}</li>
1080  *             <li>left operand:  N/A</li>
1081  *             <li>right operand: N/A </li>
1082  *             <li>operator: N/A</li>
1083  *             </ul>
1084  *         </li>
1085 *         </ul>
1086 *
1087 *     OBJECT ACCESS EXPRESSION
1088 *     <ul>
1089 *         <li>objectExpr.[attributes].method()
1090 *         <ul>
1091  *             <li>type: {@link EExpressionType#object_access_t}</li>
1092  *             <li>objectExpr.[attributes].method(): {@link #getObjectAccess()}</li>
1093  *             <li>left operand:  N/A</li>
1094  *             <li>right operand: N/A </li>
1095  *             <li>operator: N/A</li>
1096  *             </ul>
1097  *         </li>
1098 *      </ul>
1099 *
1100 *     Unknown
1101 *     <ul>
1102 *         <li>expr OPERATOR expr, means this expression was not recognized by SQL parser yet.
1103 *         <ul>
1104  *             <li>type: {@link EExpressionType#unknown_t}</li>
1105  *             <li>left operand: {@link #getLeftOperand()}</li>
1106  *             <li>right operand: {@link #getRightOperand()} </li>
1107  *             <li>operator: {@link #getOperatorToken()}</li>
1108  *             </ul>
1109  *         </li>
1110 *         </ul>
1111 *
1112 *     Unknown unary left
1113 *     <ul>
1114 *         <li>OPERATOR expr, means this expression was not recognized by SQL parser yet.
1115 *         <ul>
1116  *             <li>type: {@link EExpressionType#unary_left_unknown_t}</li>
1117  *             <li>left operand: N/A</li>
1118  *             <li>right operand: {@link #getRightOperand()} </li>
1119  *             <li>operator: {@link #getOperatorToken()}</li>
1120  *             </ul>
1121  *         </li>
1122 *         </ul>
1123 *
1124 *     Unknown unary right
1125 *     <ul>
1126 *         <li> expr OPERATOR, means this expression was not recognized by SQL parser yet.
1127 *         <ul>
1128  *             <li>type: {@link EExpressionType#unary_right_unknown_t}</li>
1129  *             <li>left operand: {@link #getLeftOperand()}</li>
1130  *             <li>right operand: N/A </li>
1131  *             <li>operator: {@link #getOperatorToken()}</li>
1132  *             </ul>
1133  *         </li>
1134 *         </ul>
1135 *
1136 *     ARRAY CONSTRUCTOR
1137 *     <ul>
1138 *         <li>
1139 * An array constructor is an expression that builds an array value using values for its member elements.
1140 * <p> like this: ARRAY[1,2,3+4]
1141 * <p> array element values can be accessed via {@link #getExprList()},
1142 * <p> or {@link #getExprList()} can be null when it is: array[]
1143 * <p>
1144 * <p> It is also possible to construct an array from the results of a subquery like this:
1145 * <p> SELECT ARRAY(SELECT oid FROM pg_proc WHERE proname LIKE 'bytea%');
1146 * <p> thus, subquery can be access via {@link #getSubQuery()}
1147 *         <ul>
1148  *             <li>type: {@link EExpressionType#array_constructor_t}</li>
1149 *             <li>array element values: {@link #getExprList()} </li>
1150 *             <li>subquery: {@link #getSubQuery()}</li>
1151  *             <li>left operand:  N/A</li>
1152  *             <li>right operand: N/A </li>
1153  *             <li>operator: N/A</li>
1154  *             </ul>
1155  *         </li>
1156 *         </ul>
1157 *
1158 *     FIELD SELECTION
1159 *     <ul>
1160 *         <li>
1161 * If an expression yields a value of a composite type (row type), then a specific field of the row can be extracted by writing
1162 * <p> expression.fieldname
1163 * <p> In general the row expression must be parenthesized, but the parentheses can be omitted
1164 * <p> when the expression to be selected from is just a table reference or positional parameter.
1165 * <p> For example:
1166 * <p> mytable.mycolumn
1167 * <p> $1.somecolumn
1168 * <p> (rowfunction(a,b)).col3
1169 * <p>
1170 * <p> (Thus, a qualified column reference is actually just a special case of the field selection syntax.) An important special case is extracting a field from a table column that is of a composite type:
1171 * <p> (compositecol).somefield
1172 * <p> (mytable.compositecol).somefield
1173 * <p> The parentheses are required here to show that compositecol is a column name not a table name,
1174 * <p> or that mytable is a table name not a schema name in the second case.
1175 * <p>
1176 * <p> n a select list, you can ask for all fields of a composite value by writing .*:
1177 * <p> (compositecol).*
1178 * <p>
1179 * <p>
1180 * <p> When expression in following syntax, it will be marked as {@link #fieldSelection}, and check {@link #getFieldName()}
1181 * <p> (rowfunction(a,b)).col3
1182 * <p> (compositecol).somefield
1183 * <p> (mytable.compositecol).somefield
1184 * <p> (compositecol).*
1185 * <p>
1186 * <p> Otherwise, it will be marked as {@link #simpleObjectname}:
1187 * <p> mytable.mycolumn
1188 * <p> $1.somecolumn
1189  *         <ul>
1190  *             <li>type: {@link EExpressionType#fieldselection_t}</li>
1191  *             <li>left operand:  N/A</li>
1192  *             <li>right operand: N/A </li>
1193  *             <li>operator: N/A</li>
1194  *         </ul>
1195 *       </li>
1196 *     </ul>
1197 *
1198 *
1199 * HIVE ARRAY ACCESS
1200 *   <ul>
1201 *     <li>  HIVE field expression syntax like fieldexpr[expr_subscript]
1202 *         <ul>
1203 *             <li>type: {@link EExpressionType#array_access_expr_t}</li>
1204 *             <li>fieldexpr:  {@link #getLeftOperand()}</li>
1205 *             <li>expr_subscript: {@link #getRightOperand()} </li>
1206 *             <li>operator: N/A</li>
1207 *         </ul>
1208*       </li>
1209*     </ul>
1210 *
1211 *
1212 * HIVE FIELD ACCESS
1213 *   <ul>
1214 *     <li>  HIVE field access syntax like fieldexpr.identifier.identifier...
1215 *         <ul>
1216 *             <li>type: {@link EExpressionType#object_access_t}</li>
1217 *             <li>fieldexpr:  {@link #getLeftOperand()}</li>
1218 *             <li>identifier.identifier...: {@link #getFieldList()} </li>
1219 *             <li>operator: N/A</li>
1220 *         </ul>
1221*       </li>
1222*    </ul>
1223*
1224 *     JSON Operators (PostgreSQL)
1225 *
1226 *     <ul>
1227 *         <li> expr1 -&gt; expr2
1228 *         <ul>
1229 *             <li>type: {@link EExpressionType#json_get_object}</li>
1230 *             <li>left operand:  {@link #getLeftOperand()}</li>
1231 *             <li>right operand: {@link #getLeftOperand()} </li>
1232 *         </ul>
1233 *         </li>
1234 *         <li> expr1 -&gt;&gt; expr2
1235 *         <ul>
1236 *             <li>type: {@link EExpressionType#json_get_text}</li>
1237 *             <li>left operand:  {@link #getLeftOperand()}</li>
1238 *             <li>right operand: {@link #getLeftOperand()} </li>
1239 *         </ul>
1240 *         </li>
1241 *         <li> expr1 #&gt; expr2
1242 *         <ul>
1243 *             <li>type: {@link EExpressionType#json_get_object_at_path}</li>
1244 *             <li>left operand:  {@link #getLeftOperand()}</li>
1245 *             <li>right operand: {@link #getLeftOperand()} </li>
1246 *         </ul>
1247 *         </li>
1248 *         <li> expr1 #&gt;&gt; expr2
1249 *         <ul>
1250 *             <li>type: {@link EExpressionType#json_get_text_at_path}</li>
1251 *             <li>left operand:  {@link #getLeftOperand()}</li>
1252 *             <li>right operand: {@link #getLeftOperand()} </li>
1253 *         </ul>
1254 *         </li>
1255 *         <li> expr1 @&gt; expr2
1256 *         <ul>
1257 *             <li>type: {@link EExpressionType#json_left_contain}</li>
1258 *             <li>left operand:  {@link #getLeftOperand()}</li>
1259 *             <li>right operand: {@link #getLeftOperand()} </li>
1260 *         </ul>
1261 *         </li>
1262 *         <li> expr1 &gt;@ expr2
1263 *         <ul>
1264 *             <li>type: {@link EExpressionType#json_right_contain}</li>
1265 *             <li>left operand:  {@link #getLeftOperand()}</li>
1266 *             <li>right operand: {@link #getLeftOperand()} </li>
1267 *         </ul>
1268 *         </li>
1269 *         <li> expr1 ? expr2
1270 *         <ul>
1271 *             <li>type: {@link EExpressionType#json_exist}</li>
1272 *             <li>left operand:  {@link #getLeftOperand()}</li>
1273 *             <li>right operand: {@link #getLeftOperand()} </li>
1274 *         </ul>
1275 *         </li>
1276 *         <li> expr1 ?| expr2
1277 *         <ul>
1278 *             <li>type: {@link EExpressionType#json_any_exist}</li>
1279 *             <li>left operand:  {@link #getLeftOperand()}</li>
1280 *             <li>right operand: {@link #getLeftOperand()} </li>
1281 *         </ul>
1282 *         </li>
1283 *         <li> expr1 ?&amp; expr2</li>
1284 *             <li>type: {@link EExpressionType#json_all_exist}</li>
1285 *             <li>left operand:  {@link #getLeftOperand()}</li>
1286 *             <li>right operand: {@link #getLeftOperand()} </li>
1287 *
1288 *     </ul>
1289 *
1290 *      IS [NOT] A SET
1291 *     <ul>
1292 *         <li>Oracle set operator: IS [NOT] A SET
1293 *         <ul>
1294 *             <li>type: {@link EExpressionType#is_a_set_t}</li>
1295 *             <li>left operand:  {@link #getLeftOperand()}</li>
1296 *             <li>operator: N/A</li>
1297 *             </ul>
1298 *         </li>
1299 *         </ul>
1300 *
1301 *      Big Query ARRAY &lt;T&gt;[ expr_list ]
1302 *     <ul>
1303 *         <li>ARRAY &lt;T&gt;[ expr_list ], expr_list maybe empty
1304 *         <ul>
1305 *             <li>type: {@link EExpressionType#array_t}</li>
1306 *             <li>left operand:  {@link #getExprList()}</li>
1307 *             <li>{@link #getTypeName()} returns the T of this Array if specified.</li>
1308 *         </ul>
1309 *         </li>
1310 *      </ul>
1311 */
1312
1313public class TExpression extends TParseTreeNode{
1314
1315    private ArrayList<TObjectName> columnsInsideExpression = null;
1316
1317    public ArrayList<TObjectName> getColumnsInsideExpression(){
1318        if (columnsInsideExpression == null){
1319            columnsInsideExpression = new ArrayList<>();
1320        }
1321        if (!columnsInsideExpression.isEmpty()){
1322            return columnsInsideExpression;
1323        }
1324
1325        columnVisitor visitor = new columnVisitor(columnsInsideExpression);
1326        this.acceptChildren(visitor);
1327        return columnsInsideExpression;
1328    }
1329
1330    /**
1331     *  bigint(expr) in databricks, return EDataType.bigint_t
1332     *
1333     * @return datatype
1334     */
1335    public EDataType getCastDatatype() {
1336        return castDatatype;
1337    }
1338
1339    private EDataType castDatatype;
1340
1341//    public void setBigQueryExceptReplaceClause(TExceptReplaceClause node){
1342//        if (node == null) return;
1343//        this.fieldList = node.getColumnList();
1344//        //this.
1345//
1346//    }
1347
1348    public void setLeftUnary(TSourceToken st){
1349        switch (st.tokencode){
1350            case '+':
1351                this.expressionType = EExpressionType.unary_plus_t;
1352                break;
1353            case '-':
1354                this.expressionType = EExpressionType.unary_minus_t;
1355                break;
1356            case '@':
1357                this.expressionType = EExpressionType.unary_absolutevalue_t;
1358                break;
1359            case '~':
1360                this.expressionType = EExpressionType.unary_bitwise_not_t;
1361                break;
1362            default:
1363                break;
1364        }
1365    }
1366
1367    public void setRightUnary(TSourceToken st){
1368        switch (st.tokencode){
1369            case '!':
1370                this.expressionType = EExpressionType.unary_factorial_t;
1371                break;
1372            default:
1373                break;
1374        }
1375    }
1376
1377    private ArrayList<TDataConversion> dataConversions = null;
1378
1379    public void setDataConversions(ArrayList<TDataConversion> dataConversions) {
1380        this.dataConversions = dataConversions;
1381    }
1382
1383    public ArrayList<TDataConversion> getDataConversions() {
1384        if (this.dataConversions == null){
1385            this.dataConversions = new ArrayList<>();
1386        }
1387        return dataConversions;
1388    }
1389
1390    private String value;
1391
1392    public void setStringValue(String value) {
1393        this.value = value;
1394    }
1395
1396    public String getStringValue() {
1397        return value;
1398    }
1399
1400    private IType dataType = TPrimitiveType.Undefined;
1401
1402    public void setDataType(IType dataType) {
1403        this.dataType = dataType;
1404    }
1405
1406    public IType getDataType() {
1407        return dataType;
1408    }
1409
1410    private TCollectionArray collectionArray;
1411    private TCollectionCondition collectionCondition;
1412
1413    public TCollectionCondition getCollectionCondition() {
1414        return collectionCondition;
1415    }
1416
1417    public TCollectionArray getCollectionArray() {
1418        return collectionArray;
1419    }
1420
1421    private TNamedParameter namedParameter;
1422    private TPositionalParameter positionalParameter;
1423
1424    public TNamedParameter getNamedParameter() {
1425        return namedParameter;
1426    }
1427
1428    public TPositionalParameter getPositionalParameter() {
1429        return positionalParameter;
1430    }
1431
1432    private TObjectConstruct objectConstruct;
1433
1434    public TArrayConstruct getArrayConstruct() {
1435        return arrayConstruct;
1436    }
1437
1438    public TObjectConstruct getObjectConstruct() {
1439        return objectConstruct;
1440    }
1441
1442    private TArrayConstruct arrayConstruct;
1443
1444    private boolean onlyAndOrIsNonLeaf = false;
1445
1446
1447    public void  evaluate(Stack<TFrame> frameStack , TCustomSqlStatement sqlStatement){
1448        calculateExprVisitor cv = new calculateExprVisitor(frameStack, sqlStatement);
1449        this.postOrderTraverse(cv);
1450    }
1451    public Object evaluate(IEvaluationContext context){
1452        TExpressionEvaluator expressionEvaluator = new TExpressionEvaluator(context);
1453        this.postOrderTraverse(expressionEvaluator);
1454        return  this.getStringValue();
1455    }
1456
1457    /**
1458     * @deprecated As of v2.0.5.6, use class ColumnVisitor in package demos.columnInWhereClause instead.
1459     */
1460    public TExpressionList searchColumn(String columnName){
1461        TExpressionList resultList = new TExpressionList();
1462        this.inOrderTraverse(new searchColumnVisitor(columnName,resultList));
1463        return  resultList;
1464    }
1465
1466    private TFlattenVisitor flattenVisitor;
1467
1468    /**
1469     *
1470     * @return AND/OR token before expression when you get flattened expression using {@link #getFlattedAndOrExprs}
1471     */
1472    public TSourceToken getAndOrTokenBeforeExpr(){
1473        TSourceToken lcToken = getStartToken();
1474        if (lcToken == null)  return null;
1475        TSourceToken lcPrevToken = lcToken.prevSolidToken();
1476        if ((lcPrevToken.tokencode == TBaseType.rrw_and)||(lcPrevToken.tokencode == TBaseType.rrw_or)){
1477            return lcPrevToken;
1478        }else{
1479            return  null;
1480        }
1481    }
1482
1483    /**
1484     * Binary tree structure representation of expression makes AND/OR expression nested deeply
1485     * when there are lots of AND/OR condition is used.
1486     * Recursively function call on those nested AND/OR expression will cause stack overflow exception.
1487     * After flatten those expressions. we can iterate those expression in a linear way.
1488     * @return null if this is not AND/OR expression
1489     */
1490    public ArrayList getFlattedAndOrExprs(){
1491        if (!((expressionType == EExpressionType.logical_and_t)||(expressionType == EExpressionType.logical_or_t))){
1492            return  null;
1493        }
1494        if (flattenVisitor.getFlattedAndOrExprs().size() == 0){
1495            onlyAndOrIsNonLeaf = true;
1496            this.inOrderTraverse(flattenVisitor);
1497            onlyAndOrIsNonLeaf = false;
1498        }
1499        return flattenVisitor.getFlattedAndOrExprs();
1500    }
1501
1502//    private int flatAndOrExpr(){
1503//        int ret = 0;
1504//        if (!((expressionType == EExpressionType.logical_and_t)||(expressionType == EExpressionType.logical_or_t))){
1505//            return  0;
1506//        }
1507//        if (getFlattedAndOrExprs().size() > 0){
1508//            //already flatten, just return size
1509//            return  getFlattedAndOrExprs().size();
1510//        }
1511//
1512//        onlyAndOrIsNonLeaf = true;
1513//        this.inOrderTraverse(flattenVisitor);
1514//        onlyAndOrIsNonLeaf = false;
1515//        return  ret;
1516//    }
1517
1518    public void setTokenToIdentifier()
1519    {
1520        if (getExpressionType() == EExpressionType.simple_object_name_t){
1521            if (getObjectOperand().getEndToken() != null){
1522                getObjectOperand().getEndToken().tokencode = TBaseType.ident;
1523                getObjectOperand().getEndToken().tokentype = ETokenType.ttidentifier;
1524            }
1525        }else if (getExpressionType() == EExpressionType.simple_source_token_t){
1526            getSourcetokenOperand().tokencode = TBaseType.ident;
1527            getSourcetokenOperand().tokentype = ETokenType.ttidentifier;
1528        }
1529    }
1530
1531    public void setComparisonType(EComparisonType comparisonType) {
1532        this.comparisonType = comparisonType;
1533    }
1534
1535    static  public  EComparisonType getComparisonType(TSourceToken comparisonOperator){
1536        String tokenStr = comparisonOperator.getAstext();
1537        EComparisonType ret = EComparisonType.equals;
1538        switch (comparisonOperator.tokencode){
1539            case TBaseType.not_equal:
1540                if ((tokenStr.startsWith("!")) && (tokenStr.endsWith("=") )){
1541                    ret = EComparisonType.notEqualToExclamation;
1542                }else if ((tokenStr.startsWith("^")) && (tokenStr.endsWith("=") )){
1543                    ret = EComparisonType.notEqualToCaret;
1544                }else if ((tokenStr.startsWith("<")) && (tokenStr.endsWith(">") )){
1545                    if ((tokenStr.indexOf("=",1) > 0)&&((tokenStr.startsWith("<")) && (tokenStr.endsWith(">") ))) {
1546                        ret = EComparisonType.nullSafeEquals;
1547                    }else{
1548                        ret = EComparisonType.notEqualToBrackets;
1549                    }
1550                }
1551                break;
1552            case TBaseType.great_equal:
1553                ret = EComparisonType.greaterThanOrEqualTo;
1554                break;
1555            case TBaseType.less_equal:
1556                ret = EComparisonType.lessThanOrEqualTo;
1557                break;
1558            case TBaseType.not_great:
1559                ret = EComparisonType.notGreaterThan;
1560                if (tokenStr.startsWith("^")){
1561                    ret = EComparisonType.notGreaterThanToCaret;
1562                }
1563                break;
1564            case TBaseType.not_less:
1565                ret = EComparisonType.notLessThan;
1566                if (tokenStr.startsWith("^")){
1567                    ret = EComparisonType.notLessThanToCaret;
1568                }
1569
1570                break;
1571            case '=':
1572                ret = EComparisonType.equals;
1573                if ((tokenStr.indexOf("=",1) > 0)&&((tokenStr.startsWith("<")) && (tokenStr.endsWith(">") ))) {
1574                  ret = EComparisonType.nullSafeEquals;
1575                }
1576                break;
1577            case '>':
1578                ret = EComparisonType.greaterThan;
1579                break;
1580            case '<':
1581                ret = EComparisonType.lessThan;
1582                break;
1583            default:
1584                if (comparisonOperator.toString().equalsIgnoreCase("includes")){
1585                    ret = EComparisonType.includes;
1586                }else if (comparisonOperator.toString().equalsIgnoreCase("excludes")){
1587                    ret = EComparisonType.excludes;
1588                }else if (comparisonOperator.toString().equalsIgnoreCase("above")){
1589                    ret = EComparisonType.above;
1590                }else if (comparisonOperator.toString().equalsIgnoreCase("at")){
1591                    ret = EComparisonType.at;
1592                }else if (comparisonOperator.toString().equalsIgnoreCase("above_or_below")){
1593                    ret = EComparisonType.above_or_below;
1594                }else if (comparisonOperator.toString().equalsIgnoreCase("below")){
1595                    ret = EComparisonType.below;
1596                }
1597                break;
1598        }
1599        return ret;
1600    }
1601
1602    private TAliasClause exprAlias;
1603
1604    /**
1605     * In Teradata, it is possible there is an alias for expression
1606     * @return expression alias
1607     */
1608    public TAliasClause getExprAlias() {
1609        return exprAlias;
1610    }
1611
1612    public void setExprAlias(TAliasClause exprAlias) {
1613
1614        this.exprAlias = exprAlias;
1615    }
1616
1617    private TPTNodeList <TExplicitDataTypeConversion> dataTypeConversionList = null;
1618
1619    public void setDataTypeConversionList(TPTNodeList<TExplicitDataTypeConversion> dataTypeConversionList) {
1620        this.dataTypeConversionList = dataTypeConversionList;
1621    }
1622
1623    /**
1624     *
1625     * @deprecated since v2.5.3.1, replaced by {@link #getDataConversions()}
1626     */
1627    public TPTNodeList<TExplicitDataTypeConversion> getDataTypeConversionList() {
1628
1629        return dataTypeConversionList;
1630    }
1631
1632    private TExplicitDataTypeConversion dataTypeConversion;
1633
1634    public void setDataTypeConversion(TExplicitDataTypeConversion dataTypeConversion) {
1635        this.dataTypeConversion = dataTypeConversion;
1636    }
1637
1638    /**
1639     *
1640     * @return the first DataTypeConversion in {@link #getDataTypeConversionList}
1641     *
1642     * @deprecated since v2.5.3.1, replaced by {@link #getDataConversions()}
1643     */
1644    public TExplicitDataTypeConversion getDataTypeConversion() {
1645        if (dataTypeConversionList == null) return  null;
1646        return dataTypeConversionList.getElement(0);
1647    }
1648
1649    private TAnalyticFunction over_clause;
1650    private TObjectName sequenceName;
1651
1652    public TObjectName getSequenceName() {
1653        return sequenceName;
1654    }
1655
1656    public TAnalyticFunction getOver_clause() {
1657        return over_clause;
1658    }
1659
1660    public THiveVariable getHive_variable() {
1661        return hive_variable;
1662    }
1663
1664    private THiveVariable hive_variable = null;
1665
1666    public void setHive_variable(THiveVariable hive_variable) {
1667        this.hive_variable = hive_variable;
1668    }
1669
1670    private boolean isSymmetric = false;
1671
1672    public void setSymmetric(boolean symmetric) {
1673        isSymmetric = symmetric;
1674    }
1675
1676    /**
1677     * PostgreSQL
1678     *
1679     * BETWEEN SYMMETRIC is the same as BETWEEN except there is no requirement
1680     * that the argument to the left of AND be less than or equal to the argument
1681     * on the right. If it is not, those two arguments are automatically swapped,
1682     * so that a nonempty range is always implied.
1683     *
1684     * @return true if SYMMETRIC is used
1685     */
1686    public boolean isSymmetric() {
1687
1688        return isSymmetric;
1689    }
1690
1691    private TObjectAccess objectAccess = null;
1692
1693    public void setObjectAccess(TObjectAccess objectAccess) {
1694        this.objectAccess = objectAccess;
1695    }
1696
1697    public TObjectAccess getObjectAccess() {
1698
1699        return objectAccess;
1700    }
1701
1702    private TSourceToken operatorToken = null;
1703    private TSourceToken notToken = null;
1704    private boolean notOperator = false;
1705
1706    public boolean isNotOperator() {
1707        return notOperator;
1708    }
1709
1710    public void setNotToken(TSourceToken notToken) {
1711        this.notToken = notToken;
1712        notOperator = (this.notToken != null);
1713    }
1714
1715    public TSourceToken getNotToken() {
1716
1717        return notToken;
1718    }
1719
1720    private long plainTextLineNo = -1;
1721
1722    public void setPlainTextLineNo(long plainTextLineNo) {
1723        this.plainTextLineNo = plainTextLineNo;
1724    }
1725
1726    public void setPlainTextColumnNo(long plainTextColumnNo) {
1727        this.plainTextColumnNo = plainTextColumnNo;
1728    }
1729
1730    public long getPlainTextLineNo() {
1731        return plainTextLineNo;
1732    }
1733
1734    public long getPlainTextColumnNo() {
1735        return plainTextColumnNo;
1736    }
1737
1738    private  long plainTextColumnNo = -1;
1739
1740    public TExpression(){
1741
1742    }
1743
1744    public TExpression(TObjectName objectOperand){
1745        this.expressionType = EExpressionType.simple_object_name_t;
1746        this.objectOperand = objectOperand;
1747    }
1748
1749    public TExpression(TConstant constantOperand){
1750//        if ((constantOperand != null) && (constantOperand.getLiteralType() == ELiteralType.etFakeDate)){
1751//            this.expressionType = EExpressionType.function_t;
1752//            this.functionCall = new TFunctionCall();
1753//            this.functionCall.setFunctionType(EFunctionType.date_t);
1754//            this.functionCall.setFunctionName(new TObjectName(EDbObjectType.function, constantOperand.getStartToken()));
1755//            this.functionCall.setStartToken(constantOperand.getStartToken());
1756//            this.functionCall.setEndToken(constantOperand.getEndToken());
1757//
1758//        }else{
1759            this.expressionType = EExpressionType.simple_constant_t;
1760            this.constantOperand = constantOperand;
1761//        }
1762    }
1763
1764    public TExpression(TFunctionCall functionCall){
1765        this.expressionType = EExpressionType.function_t;
1766        this.functionCall = functionCall;
1767    }
1768
1769    public void setExecuteSqlNode(TExecuteSqlNode executeSqlNode) {
1770        this.executeSqlNode = executeSqlNode;
1771    }
1772
1773    public TExpression(EExpressionType pExpressionType){
1774        this.expressionType = pExpressionType;
1775    }
1776
1777    public TExpression(EExpressionType pExpressionType, TExpression pLeft, TExpression pRight){
1778        this(pExpressionType);
1779        this.leftOperand = pLeft;
1780        this.rightOperand = pRight;
1781    }
1782
1783    public TExpression(EExpressionType pExpressionType, TExpression pLeft, TExpression pRight, EComparisonType pComparisonType){
1784        this(pExpressionType,pLeft,pRight);
1785        this.comparisonType = pComparisonType;
1786    }
1787
1788    public static TExpression createExpression(EDbVendor dbVendor, TConstant constantOperand){
1789        TExpression expression = new TExpression(EExpressionType.simple_constant_t);
1790        expression.setConstantOperand(constantOperand);
1791        expression.dbvendor = dbVendor;
1792        return expression;
1793
1794    }
1795    public static TExpression createExpression(EDbVendor dbVendor, TObjectName objectOperand){
1796        TExpression expression = new TExpression(EExpressionType.simple_object_name_t);
1797        expression.setObjectOperand(objectOperand);
1798        expression.dbvendor = dbVendor;
1799        return expression;
1800    }
1801    public static TExpression createExpression(EDbVendor dbVendor,EExpressionType pExpressionType, TSourceToken pOperatorToken, TObjectName pLeft, TObjectName pRight){
1802        return TExpression.createExpression(dbVendor, pExpressionType, pOperatorToken
1803                , TExpression.createExpression(dbVendor, pLeft)
1804                , TExpression.createExpression(dbVendor, pRight)
1805        );
1806    }
1807
1808    public static TExpression createExpression(EDbVendor dbVendor,EExpressionType pExpressionType, TSourceToken pOperatorToken, TObjectName pLeft, TConstant pRight){
1809        return TExpression.createExpression(dbVendor, pExpressionType, pOperatorToken
1810                , TExpression.createExpression(dbVendor, pLeft)
1811                , TExpression.createExpression(dbVendor, pRight)
1812        );
1813    }
1814
1815    public static TExpression createExpression(EDbVendor dbVendor,EExpressionType pExpressionType, TSourceToken pOperatorToken, TExpression pLeft, TExpression pRight){
1816        TExpression expression = new TExpression(pExpressionType);
1817        expression.setOperatorToken(pOperatorToken);
1818        expression.setLeftOperand(pLeft);
1819        expression.setRightOperand(pRight);
1820        expression.dbvendor = dbVendor;
1821        return expression;
1822    }
1823
1824    public static TExpression createParenthesisExpression(TExpression pLeft){
1825        TExpression expression = new TExpression(EExpressionType.parenthesis_t);
1826        expression.setLeftOperand(pLeft);
1827        expression.dbvendor = pLeft.dbvendor;
1828        return expression;
1829    }
1830
1831    public void init(Object arg1){
1832        expressionType = (EExpressionType)arg1;
1833        if ((expressionType == EExpressionType.logical_and_t)||(expressionType == EExpressionType.logical_or_t)){
1834            flattenVisitor = new TFlattenVisitor();
1835        }
1836    }
1837    private TSourceToken leadingPrecision;
1838    private TSourceToken fractionalSecondsPrecision;
1839
1840    public void setLeadingPrecision(TSourceToken leadingPrecision) {
1841        this.leadingPrecision = leadingPrecision;
1842    }
1843
1844    public void setFractionalSecondsPrecision(TSourceToken fractionalSecondsPrecision) {
1845        this.fractionalSecondsPrecision = fractionalSecondsPrecision;
1846    }
1847
1848    public TSourceToken getLeadingPrecision() {
1849
1850        return leadingPrecision;
1851    }
1852
1853    public TSourceToken getFractionalSecondsPrecision() {
1854        return fractionalSecondsPrecision;
1855    }
1856
1857    public void init(Object arg1, Object arg2){
1858         init(arg1);
1859         switch (expressionType){
1860             case next_value_for_t:
1861                sequenceName = (TObjectName)arg2;
1862                break;
1863             case array_constructor_t:
1864                 if (arg2 instanceof TSelectSqlNode){
1865                     this.subQueryNode = (TSelectSqlNode)arg2;
1866                 }else if (arg2 instanceof TExpressionList){
1867                     this.exprList = (TExpressionList)arg2;
1868                 }else if (arg2 instanceof TArrayConstruct){
1869                     this.arrayConstruct = (TArrayConstruct)arg2;
1870                 }else if (arg2 instanceof TColumnDefinitionList){
1871                     this.colDefList = (TColumnDefinitionList) arg2;
1872                 }
1873                  break;
1874             case objectConstruct_t:
1875                 objectConstruct = (TObjectConstruct)arg2;
1876                 break;
1877             case namedParameter_t:
1878                 namedParameter = (TNamedParameter)arg2;
1879                 break;
1880             case positionalParameter_t:
1881                 positionalParameter = (TPositionalParameter)arg2;
1882                 break;
1883             case collectionArray_t:
1884                 collectionArray = (TCollectionArray)arg2;
1885                 break;
1886             case collectionCondition_t:
1887                 collectionCondition = (TCollectionCondition)arg2;
1888                 break;
1889             case year_to_month_t:
1890             case day_to_second_t:
1891             case at_local_t:
1892                 leftOperand = (TExpression)arg2;
1893                 break;
1894             case teradata_at_t:
1895                    leftOperand = (TExpression)arg1;
1896                    rightOperand = (TExpression)arg2;
1897                    break;
1898             case unnest_t:
1899                 leftOperand = (TExpression)arg2;
1900                 break;
1901             case list_t:
1902             case collection_constructor_list_t:
1903             case collection_constructor_multiset_t:
1904             case collection_constructor_set_t:
1905                 exprList = (TExpressionList)arg2;
1906                 break;
1907             case json_path_t:
1908                 this.json_path = (ArrayList<TIndices>)arg2;
1909                 break;
1910             case type_constructor_t:
1911                 objectOperand = (TObjectName) arg2;
1912                 break;
1913             case new_structured_type_t:
1914                 exprList = (TExpressionList)arg2;
1915                 break;
1916             default:
1917                 break;
1918         }
1919    }
1920
1921    public void init(Object arg1, Object arg2, Object arg3){
1922         init(arg1);
1923         switch (expressionType){
1924             case next_value_for_t:
1925                sequenceName = (TObjectName)arg2;
1926                 if (arg3 == null){
1927                 }else if (arg3 instanceof TExpression){
1928                     leftOperand = (TExpression)arg3;
1929                 }else if (arg3 instanceof TAnalyticFunction){
1930                    over_clause = (TAnalyticFunction)arg3;
1931                 }
1932                break;
1933             case assignment_t:
1934                 leftOperand = (TExpression)arg2;
1935                 rightOperand   = (TExpression)arg3;
1936                 break;
1937             case typecast_datatype_t:
1938                 //castDatatype = (EDataType)arg2;
1939                 typeName = (TTypeName)arg2;
1940                 leftOperand = (TExpression)arg3;
1941                 break;
1942             case json_access_t:
1943                 leftOperand = (TExpression)arg2;
1944                 rightOperand   = (TExpression)arg3;
1945                     break;
1946             case type_constructor_t:
1947                 objectOperand = (TObjectName) arg2;
1948                 exprList = (TExpressionList)arg3;
1949                 break;
1950             case cursor_attribute_t:
1951                 break;
1952             default:
1953                 leftOperand = (TExpression)arg2;
1954                 rightOperand   = (TExpression)arg3;
1955                 break;
1956         }
1957    }
1958
1959    /**
1960     * initialize a new instance of TExpression.
1961     *
1962     * @param arg1 type of this expression, a value of type {@link EExpressionType}
1963     * @param arg2 operator, a value of {@link TSourceToken}
1964     * @param arg3 left operand, a value of {@link TExpression}
1965     * the meaning of this parameter varies depends on the value of arg1.
1966     * @param arg4 right operand, a value of {@link TExpression}
1967     */
1968    public void init(Object arg1,Object arg2,Object arg3,Object arg4){
1969        init(arg1);
1970        operatorToken = (TSourceToken)arg2;
1971        switch (expressionType){
1972            case simple_object_name_t:
1973                objectOperand = (TObjectName)arg3;
1974                setStartToken(objectOperand);
1975                setEndToken(objectOperand);
1976                break;
1977            case simple_source_token_t:
1978                sourcetokenOperand = (TSourceToken)arg3;
1979                setStartToken(sourcetokenOperand);
1980                setEndToken(sourcetokenOperand);
1981                break;
1982            case simple_constant_t:
1983                constantOperand = (TConstant)arg3;
1984                setStartToken(constantOperand);
1985                setEndToken(constantOperand);
1986                break;
1987            case function_t:
1988                functionCall = (TFunctionCall)arg3;
1989                break;
1990//            case type_constructor_t:
1991//                functionCall = (TFunctionCall)arg3;
1992//                break;
1993            case arrayaccess_t:
1994                arrayAccess = (TArrayAccess)arg3;
1995                break;
1996            case array_access_expr_t:
1997                leftOperand = (TExpression)arg3;
1998                rightOperand   = (TExpression)arg4;
1999                break;
2000            case list_t:
2001            case collection_constructor_list_t:
2002            case collection_constructor_multiset_t:
2003            case collection_constructor_set_t:
2004                exprList = (TExpressionList)arg3;
2005                break;
2006            case field_doubt_t:
2007                TExpression l = (TExpression)arg3;
2008                if (l.getExpressionType() == EExpressionType.simple_object_name_t){
2009                    TObjectName objectName = l.getObjectOperand();
2010                    objectName.setSchemaToken(objectName.getObjectToken());
2011                    objectName.setObjectToken(objectName.getPartToken());
2012                    objectName.setPartToken((TSourceToken)arg4);
2013
2014                    expressionType = EExpressionType.simple_object_name_t;
2015                    this.objectOperand = l.getObjectOperand();
2016                }else {
2017                    expressionType = EExpressionType.field_t;
2018                }
2019                break;
2020            case column_definition_list_t:
2021                colDefList = (TColumnDefinitionList)arg3;
2022                break;
2023            case simple_comparison_t:
2024                leftOperand = (TExpression)arg3;
2025                leftOperand.setParentExpr(this);
2026                rightOperand = (TExpression)arg4;
2027                rightOperand.setParentExpr(this);
2028                comparisonOperator  = operatorToken;
2029                break;
2030            case implicit_datatype_cast_as_t:
2031                leftOperand = (TExpression)arg3;
2032                typeName = (TTypeName)arg4;
2033                break;
2034            default:
2035                if (arg3 != null){
2036                    leftOperand = (TExpression)arg3;
2037                    leftOperand.setParentExpr(this);
2038                }
2039                if (arg4 != null){
2040                    rightOperand = (TExpression)arg4;
2041                    rightOperand.setParentExpr(this);
2042                }
2043                break;
2044        }
2045    }
2046
2047    public void setOperatorToken(TSourceToken operatorToken) {
2048        this.operatorToken = operatorToken;
2049        switch (this.getExpressionType()){
2050            case unknown_t:
2051                switch (this.operatorToken.tokencode){
2052                    case TBaseType.OP_MINUS_GREAT:
2053                        this.expressionType =  EExpressionType.json_get_object;
2054                        break;
2055                    case TBaseType.OP_MINUS_GREAT_GREAT:
2056                        this.expressionType =  EExpressionType.json_get_text;
2057                        break;
2058                    case TBaseType.OP_POUND_GREAT_GREAT:
2059                        this.expressionType =  EExpressionType.json_get_text_at_path;
2060                        break;
2061                    case TBaseType.OP_POUND_GREAT:
2062                        this.expressionType =  EExpressionType.json_get_object_at_path;
2063                        break;
2064                    case TBaseType.OP_AT_GREAT:
2065                        this.expressionType =  EExpressionType.json_left_contain;
2066                        break;
2067                    case TBaseType.OP_LESS_AT:
2068                        this.expressionType =  EExpressionType.json_right_contain;
2069                        break;
2070                    case TBaseType.OP_JSONB_QUESTION: // ?
2071                        this.expressionType =  EExpressionType.json_exist;
2072                        break;
2073                    case TBaseType.OP_QUESTION_BAR:
2074                        this.expressionType =  EExpressionType.json_any_exist;
2075                        break;
2076                    case TBaseType.OP_QUESTION_PUNCTUATION:
2077                        this.expressionType =  EExpressionType.json_all_exist;
2078                        break;
2079                    case TBaseType.OP_TILDE_TILDE:
2080                        this.expressionType =  EExpressionType.pattern_matching_t;
2081                        break;
2082                    case TBaseType.OP_TILDE_TILDE_STAR:
2083                        this.expressionType =  EExpressionType.pattern_matching_t;
2084                        break;
2085                    case TBaseType.OP_EXCLAMATION_TIDLE_TIDLE:
2086                        this.expressionType =  EExpressionType.pattern_matching_t;
2087                        break;
2088                    case TBaseType.OP_EXCLAMATION_TIDLE_TIDLE_STAR:
2089                        this.expressionType =  EExpressionType.pattern_matching_t;
2090                        break;
2091                    case TBaseType.OP_TILDE_STAR:
2092                        this.expressionType =  EExpressionType.pattern_matching_t;
2093                        break;
2094                    case TBaseType.OP_EXCLAMATION_TILDE:
2095                        this.expressionType =  EExpressionType.pattern_matching_t;
2096                        this.setNotToken(operatorToken);
2097                        break;
2098                    case TBaseType.OP_EXCLAMATION_TIDLE_STAR:
2099                        this.expressionType =  EExpressionType.pattern_matching_t;
2100                        break;
2101                    case TBaseType.OP_TILDE_GREAT_TILDE:
2102                    case TBaseType.OP_TILDE_LESS_TILDE:
2103                    case TBaseType.OP_TILDE_GREAT_EQUAL_TILDE:
2104                    case TBaseType.OP_TILDE_LESS_EQUAL_TILDE:
2105                        this.expressionType =  EExpressionType.pattern_matching_t;
2106                        break;
2107                    case '~':
2108                        this.expressionType =  EExpressionType.pattern_matching_t;
2109                        break;
2110                    case TBaseType.OP_AT_MINUS_AT:
2111                    case TBaseType.OP_POUND_POUND:
2112                    case TBaseType.OP_PUNCTUATION_LESS:
2113                    case TBaseType.OP_PUNCTUATION_GREAT:
2114                    case TBaseType.OP_LESS_LESS_BAR:
2115                    case TBaseType.OP_BAR_GREAT_GREAT:
2116                    case TBaseType.OP_PUNCTUATION_LESS_BAR:
2117                    case TBaseType.OP_BAR_PUNCTUATION_GREAT:
2118                    case TBaseType.OP_LESS_CARET:
2119                    case TBaseType.OP_GREAT_CARET:
2120                    case TBaseType.OP_QUESTION_POUND:
2121                    case TBaseType.OP_QUESTION_MINUS:
2122                    case TBaseType.OP_QUESTION_MINUS_BAR:
2123                    case TBaseType.OP_QUESTION_BAR_BAR:
2124                    case TBaseType.OP_TILDE_EQUAL:
2125                    case TBaseType.OP_LESS_PERCENT:
2126                    case TBaseType.OP_GREAT_PERCENT:
2127                        this.expressionType =  EExpressionType.geo_t;
2128                        break;
2129                    case TBaseType.OP_LESS_LESS_EQUAL:
2130                    case TBaseType.OP_GREAT_GREAT_EQUAL:
2131                        this.expressionType =  EExpressionType.network_t;
2132                        break;
2133                    case TBaseType.OP_AT_AT_AT:
2134                    case TBaseType.OP_LESS_MINUS_GREAT:
2135                    case TBaseType.OP_LESS_HASH_GREAT:
2136                    case TBaseType.OP_LESS_EQUAL_GREAT:
2137                    case TBaseType.OP_LESS_PLUS_GREAT:
2138                    case TBaseType.OP_LESS_TILDE_GREAT:
2139                    case TBaseType.OP_LESS_PERCENT_GREAT:
2140                        this.expressionType =  EExpressionType.text_search_t;
2141                        break;
2142                    case TBaseType.OP_MINUS_BAR_MINUS:
2143                        this.expressionType = EExpressionType.range_t;
2144                        break;
2145                    case TBaseType.rrw_netezza_op_less_less:
2146                        this.expressionType = EExpressionType.left_shift_t;
2147                        break;
2148                    case TBaseType.rrw_netezza_op_great_great:
2149                        this.expressionType = EExpressionType.right_shift_t;
2150                        break;
2151                    case TBaseType.OP_POUND_MINUS:
2152                        this.expressionType = EExpressionType.json_delete_path;
2153                        break;
2154                    case TBaseType.OP_AT_QUESTION:
2155                        this.expressionType = EExpressionType.json_path_exists;
2156                        break;
2157                    case TBaseType.OP_AT_AT:
2158                        this.expressionType = EExpressionType.json_path_match;
2159                        break;
2160                    default:
2161                        break;
2162                }
2163
2164
2165                if (this.getExpressionType() == EExpressionType.unknown_t) {
2166                    if(this.operatorToken.toString().equalsIgnoreCase("%")){
2167                        this.expressionType =  EExpressionType.arithmetic_modulo_t;
2168                    }else if(this.operatorToken.toString().equalsIgnoreCase("&")){
2169                        this.expressionType = EExpressionType.bitwise_and_t;
2170                    }else if(this.operatorToken.toString().equalsIgnoreCase("|")){
2171                        this.expressionType = EExpressionType.bitwise_or_t;
2172                    }else if(this.operatorToken.toString().equalsIgnoreCase("#")){
2173                        this.expressionType = EExpressionType.bitwise_xor_t;
2174                    }else if(this.operatorToken.toString().equalsIgnoreCase("<<")){
2175                        this.expressionType = EExpressionType.left_shift_t;
2176                    }else if(this.operatorToken.toString().equalsIgnoreCase(">>")){
2177                        this.expressionType = EExpressionType.right_shift_t;
2178                    }
2179                }
2180
2181                break;
2182            case unary_left_unknown_t:
2183                if(this.operatorToken.toString().equalsIgnoreCase("|/")){
2184                    this.expressionType = EExpressionType.unary_squareroot_t;
2185                }else if(this.operatorToken.toString().equalsIgnoreCase("||/")){
2186                    this.expressionType = EExpressionType.unary_cuberoot_t;
2187                }else if(this.operatorToken.toString().equalsIgnoreCase("!!")){
2188                    this.expressionType = EExpressionType.unary_factorialprefix_t;
2189                }else if(this.operatorToken.toString().equalsIgnoreCase("@")){
2190                    this.expressionType = EExpressionType.unary_absolutevalue_t;
2191                }else if(this.operatorToken.toString().equalsIgnoreCase("~")){
2192                    this.expressionType = EExpressionType.unary_bitwise_not_t;
2193                }else if(this.operatorToken.toString().equalsIgnoreCase("-")){
2194                    this.expressionType = EExpressionType.unary_minus_t;
2195                }else if(this.operatorToken.toString().equalsIgnoreCase("+")){
2196                    this.expressionType = EExpressionType.unary_plus_t;
2197                }
2198
2199                break;
2200            case unary_right_unknown_t:
2201                if(this.operatorToken.toString().equalsIgnoreCase("!")) {
2202                    this.expressionType = EExpressionType.unary_factorial_t;
2203                }
2204                break;
2205            default:
2206                break;
2207        }
2208
2209    }
2210
2211
2212    private ArrayList<TSourceToken> operatorTokens = null;
2213
2214    /**
2215     * Operator token used in expression which contains multiple operator tokens such as SIMILAR TO , IS DISTINCT FROM and etc
2216     * added since v3.0.8.6
2217     *
2218     * @return operator token list
2219     */
2220    public ArrayList<TSourceToken> getOperatorTokens() {
2221        if (operatorTokens == null){
2222            operatorTokens = new ArrayList<>();
2223        }
2224        return operatorTokens;
2225    }
2226
2227    /**
2228     * Operator token used in expression such as +,-,*,/ and etc
2229     * @return operator token
2230     */
2231    public TSourceToken getOperatorToken() {
2232
2233        return operatorToken;
2234    }
2235
2236    public void setVal(Object val) {
2237        this.val = val;
2238    }
2239
2240    private boolean valPartial = false;
2241
2242    /**
2243     * True when {@link #getVal()} holds a string value that contains
2244     * placeholder identifiers for unknowable parts (unresolved variables,
2245     * function calls), e.g. a concatenation where only some operands are
2246     * string literals. Partially resolved dynamic SQL is still analyzed for
2247     * approximate lineage, but parse failures must not be reported as syntax
2248     * errors because the text was never the real SQL.
2249     */
2250    public boolean isValPartial() {
2251        return valPartial;
2252    }
2253
2254    public void setValPartial(boolean valPartial) {
2255        this.valPartial = valPartial;
2256    }
2257
2258    /**
2259     * value of this expression, valid only after evaluate this expression.
2260     * @return a value object
2261     */
2262    public Object getVal() {
2263
2264        return val;
2265    }
2266
2267    private Object val = null;
2268
2269    // expression type value
2270
2271    // simple expression
2272
2273
2274    public TConstant getConstantOperand() {
2275        return constantOperand;
2276    }
2277
2278
2279    public void setNewVariantTypeArgumentList(TNewVariantTypeArgumentList newVariantTypeArgumentList) {
2280        this.newVariantTypeArgumentList = newVariantTypeArgumentList;
2281    }
2282
2283    public TNewVariantTypeArgumentList getNewVariantTypeArgumentList() {
2284        return newVariantTypeArgumentList;
2285    }
2286
2287    private TNewVariantTypeArgumentList newVariantTypeArgumentList = null;
2288
2289    /**
2290     * PLSQL:
2291     * <p> expr typecast typename
2292     * <p>
2293     * <p> Postgresql
2294     * <p> expr::typename
2295     * <p>
2296     * <p> Informix
2297     * <p> expr::typename
2298     * <p>
2299     * <p> expr can be accessed via {@link #leftOperand}, typename can be accessed via {@link #getTypeName()}
2300     */
2301
2302    private  TTypeName typeName;
2303
2304    public void setTypeName(TTypeName typeName) {
2305        this.typeName = typeName;
2306    }
2307
2308    public TTypeName getTypeName() {
2309
2310        return typeName;
2311    }
2312
2313    /**
2314     * valid when {@link #getExpressionType() } is {@link TExpression#fieldSelection}
2315     * @return field name
2316     */
2317    public TObjectName getFieldName() {
2318        return fieldName;
2319    }
2320
2321    private  TObjectName fieldName;
2322
2323    public void setIndirection(TIndirection indirection) {
2324        if (indirection != null){
2325            if (indirection.isRealIndices()){
2326                this.subscripts = true;
2327            }else{
2328                //this.setExpressionType(TExpression.fieldSelection);
2329                setExpressionType(EExpressionType.fieldselection_t);
2330                this.fieldName = indirection.getIndices().getElement(0).getAttributeName();
2331                //this.fieldName.setObjectType(TObjectName.ttobjFieldName);
2332                this.fieldName.setDbObjectType(EDbObjectType.fieldName);
2333            }
2334            this.indirection = indirection;
2335        }
2336    }
2337
2338    private  boolean  subscripts;
2339
2340    /**
2341     * If an expression yields a value of an array type, then a specific element of the array value can be extracted by writing
2342     * <p> expression[subscript]
2343     * <p> or multiple adjacent elements (an "array slice") can be extracted by writing
2344     * <p> expression[lower_subscript:upper_subscript]
2345     * <p> In general the array expression must be parenthesized, but the parentheses can be omitted when the expression to be subscripted is just a column reference or positional parameter.
2346     * <p> Also, multiple subscripts can be concatenated when the original array is multidimensional. For example:
2347     * <p>
2348     * <p> when sytnax like this:
2349     * <p> mytable.arraycolumn[4]
2350     * <p> mytable.two_d_column[17][34]
2351     * <p> $1[10:42]
2352     * <p>
2353     * <p> check {@link #getObjectOperand()} for more detailed information about subscript.
2354     * <p>
2355     * <p> when syntax like this:
2356     * <p> (arrayfunction(a,b))[42]
2357     * <p>
2358     * <p> check {@link #getIndirection()} when {@link #isSubscripts()} is true.
2359     * @return tells whether it is an expression with subscript.
2360     */
2361    public boolean isSubscripts() {
2362        return subscripts;
2363    }
2364
2365    public ArrayList<TIndices> getJson_path() {
2366        return json_path;
2367    }
2368
2369    private ArrayList<TIndices> json_path;
2370
2371    public TIndirection getIndirection() {
2372        return indirection;
2373    }
2374
2375    private TIndirection indirection;
2376
2377    private boolean notModifier;
2378
2379    /**
2380     * return true for expression like this: <expr> NOT IS NULL, <expr> NOT LIKE <expr> , <expr> NOT BETWEEN <expr> AND <expr>
2381     * and return false for expression like this: <expr> IS NULL, <expr> LIKE <expr> , <expr> BETWEEN <expr> AND <expr>
2382     * @return
2383     */
2384
2385    /**
2386     * @deprecated As of v1.4.3.0, replaced by {@link #getNotToken()}
2387     */
2388    public boolean isNotModifier() {
2389        notModifier = (getOperatorToken() != null);
2390        if (notModifier){
2391            notModifier = (getOperatorToken().tokencode == TBaseType.rrw_not);
2392        }
2393        return notModifier;
2394    }
2395
2396    private  TOutputFormatPhraseList outputFormatPhraseList;
2397
2398    public void setOutputFormatPhraseList(TOutputFormatPhraseList outputFormatPhraseList) {
2399        this.outputFormatPhraseList = outputFormatPhraseList;
2400    }
2401
2402    /**
2403     * teradata:
2404     * <p>column_expr (named alias_name)
2405     * @return (named alias_name) in column_expr
2406     */
2407    public TOutputFormatPhraseList getOutputFormatPhraseList() {
2408
2409        return outputFormatPhraseList;
2410    }
2411
2412    public TExpressionList getExprList() {
2413        return exprList;
2414    }
2415
2416    private TIntervalExpression intervalExpr = null;
2417
2418    public void setIntervalExpr(TIntervalExpression intervalExpr) {
2419        this.intervalExpr = intervalExpr;
2420    }
2421
2422    public TIntervalExpression getIntervalExpr() {
2423
2424        return intervalExpr;
2425    }
2426
2427    private TExpressionList exprList = null;
2428
2429    private TExceptReplaceClause exceptReplaceClause;
2430
2431    public TExceptReplaceClause getExceptReplaceClause() {
2432        if (exceptReplaceClause == null) {
2433            if (this.getObjectOperand()!=null) {
2434                if (this.getObjectOperand().getExceptReplaceClause()!=null) {
2435                    exceptReplaceClause = this.getObjectOperand().getExceptReplaceClause();
2436                }else if (this.getIndirection()!=null) {
2437                    if (this.getIndirection().getIndices()!=null) {
2438                        if (this.getIndirection().getIndices().size()>0) {
2439                            exceptReplaceClause = this.getIndirection().getIndices().getElement(0).getAttributeName().getExceptReplaceClause();
2440                        }
2441                    }
2442                }
2443            }
2444        }
2445        return exceptReplaceClause;
2446    }
2447
2448    public void setExceptReplaceClause(TExceptReplaceClause exceptReplaceClause) {
2449        this.exceptReplaceClause = exceptReplaceClause;
2450    }
2451
2452    private TObjectNameList fieldList;
2453
2454    public void setFieldList(TObjectNameList fieldList) {
2455        this.fieldList = fieldList;
2456    }
2457
2458    public TObjectNameList getFieldList() {
2459
2460        return fieldList;
2461    }
2462
2463    private TInExpr inExpr = null;
2464
2465    public void setInExpr(TInExpr inExpr) {
2466        this.inExpr = inExpr;
2467    }
2468
2469    /**
2470     * @deprecated As of v1.4.3.3, replaced by {@link #getRightOperand()}
2471     */
2472    public TInExpr getInExpr() {
2473        return inExpr;
2474    }
2475
2476
2477    public void setExprList(TExpressionList exprList) {
2478        this.exprList = exprList;
2479    }
2480
2481    public void setOracleOuterJoin(boolean oracleOuterJoin) {
2482        isOracleOuterJoin = oracleOuterJoin;
2483    }
2484
2485    public boolean isOracleOuterJoin() {
2486        return isOracleOuterJoin;
2487    }
2488
2489    /**
2490     *  Proprietary jion syntax of oracle: column(+)
2491     */
2492    private boolean isOracleOuterJoin = false;
2493
2494    /**
2495     * ClickHouse GLOBAL IN / GLOBAL NOT IN modifier.
2496     * When true, indicates the IN operator uses the GLOBAL keyword for distributed query execution.
2497     */
2498    private boolean globalIn = false;
2499
2500    public boolean isGlobalIn() {
2501        return globalIn;
2502    }
2503
2504    public void setGlobalIn(boolean globalIn) {
2505        this.globalIn = globalIn;
2506    }
2507
2508    private TExpression parentExpr;
2509
2510    public TExpression getParentExpr() {
2511        return parentExpr;
2512    }
2513
2514    public void setParentExpr(TExpression parentExpr) {
2515        this.parentExpr = parentExpr;
2516    }
2517
2518    public boolean isLeftOperandOfParent(){
2519        if (this.getParentExpr() == null) return false;
2520        return  (this == this.getParentExpr().getLeftOperand());
2521    }
2522
2523    public boolean isRightOperandOfParent(){
2524        if (this.getParentExpr() == null) return false;
2525        return  (this == this.getParentExpr().getRightOperand());
2526    }
2527
2528    public void setLeftOperand(TExpression leftOperand) {
2529        this.leftOperand = leftOperand;
2530        if (leftOperand != null){
2531            leftOperand.setParentExpr(this);
2532        }
2533
2534//        if (leftOperand == null){
2535//            TParseTreeNode.removeTokensBetweenNodes(this.leftOperand,this.rightOperand);
2536//        }
2537//
2538//        this.setNewSubNode(this.leftOperand,leftOperand,null);
2539//        this.leftOperand = leftOperand;
2540//        if (this.getNodeStatus() == ENodeStatus.nsRemoved){
2541//            // remove this expr cascade due to the left operand was removed
2542//            if (this.getParentExpr() != null){
2543//                if (this == this.getParentExpr().getLeftOperand()){
2544//                    if ((this.getParentExpr().getRightOperand() != null)&&(this.getParentExpr().getRightOperand().getNodeStatus() != ENodeStatus.nsRemoved)){
2545//                        this.getParentExpr().refreshAllNodesTokenCount();
2546//                        this.getParentExpr().removeTokensBetweenToken(this.getParentExpr().getStartToken(),this.getParentExpr().getRightOperand().getStartToken().getPrevTokenInChain());
2547//                        this.getParentExpr().updateNodeWithTheSameStartToken(TParseTreeNode.nodeChangeStartToken ,this.getParentExpr().getRightOperand().getStartToken());
2548//                    }
2549//                }else{
2550//                    if ((this.getParentExpr().getLeftOperand() != null)&&(this.getParentExpr().getLeftOperand().getNodeStatus() != ENodeStatus.nsRemoved)){
2551//                        this.getParentExpr().refreshAllNodesTokenCount();
2552//                        this.getParentExpr().removeTokensBetweenToken(this.getParentExpr().getLeftOperand().getEndToken().getNextTokenInChain(),this.getParentExpr().getEndToken());
2553//                        this.getParentExpr().updateMeNodeWithTheSameEndToken(TParseTreeNode.nodeChangeEndToken ,this.getParentExpr().getLeftOperand().getEndToken());
2554//                    }
2555//                }
2556//            }
2557//            this.setStartTokenDirectly(null);
2558//            this.setEndTokenDirectly(null);
2559//        }
2560//
2561    }
2562
2563    public void setRightOperand(TExpression rightOperand) {
2564
2565        this.rightOperand = rightOperand;
2566        if (rightOperand != null){
2567            rightOperand.setParentExpr(this);
2568        }
2569
2570//        if (rightOperand == null){
2571//            TParseTreeNode.removeTokensBetweenNodes(this.leftOperand,this.rightOperand);
2572//        }
2573//
2574//        this.setNewSubNode(this.rightOperand,rightOperand,null);
2575//        this.rightOperand = rightOperand;
2576//
2577//        if (this.getNodeStatus() == ENodeStatus.nsRemoved){
2578//            // remove this expr cascade due to the left operand was removed
2579//            if (this.getParentExpr() != null){
2580//                if (this == this.getParentExpr().getLeftOperand()){
2581//                    if ((this.getParentExpr().getRightOperand() != null)&&(this.getParentExpr().getRightOperand().getNodeStatus() != ENodeStatus.nsRemoved)){
2582//                        this.getParentExpr().refreshAllNodesTokenCount();
2583//                        this.getParentExpr().removeTokensBetweenToken(this.getParentExpr().getStartToken(),this.getParentExpr().getRightOperand().getStartToken().getPrevTokenInChain());
2584//                        this.getParentExpr().updateNodeWithTheSameStartToken(TParseTreeNode.nodeChangeStartToken ,this.getParentExpr().getRightOperand().getStartToken());
2585//                    }
2586//                }else{
2587//                    if ((this.getParentExpr().getLeftOperand() != null)&&(this.getParentExpr().getLeftOperand().getNodeStatus() != ENodeStatus.nsRemoved)){
2588//                        this.getParentExpr().refreshAllNodesTokenCount();
2589//                        this.getParentExpr().removeTokensBetweenToken(this.getParentExpr().getLeftOperand().getEndToken().getNextTokenInChain(),this.getParentExpr().getEndToken());
2590//                        this.getParentExpr().updateMeNodeWithTheSameEndToken(TParseTreeNode.nodeChangeEndToken ,this.getParentExpr().getLeftOperand().getEndToken());
2591//                    }
2592//                }
2593//            }
2594//            this.setStartTokenDirectly(null);
2595//            this.setEndTokenDirectly(null);
2596//        }
2597//
2598//        if (rightOperand != null){
2599//            rightOperand.setParentExpr(this);
2600//        }
2601    }
2602
2603    private TExpression leftOperand;
2604    private TExpression rightOperand;
2605
2606    private TArrayAccess arrayAccess = null;
2607
2608
2609    /*
2610     *
2611     * @return if leftOperand is not null, then return leftOperand,
2612     * otherwise, check other possible parse tree node that might be in left side of this expression.
2613     * <p>This function was called in preOrderTraverse, inOrderTraverse and postOrderTraverse
2614     * <p>This function is only valid when {@link gudusoft.gsqlparser.nodes.TExpression#isLeaf()} is not true.
2615     *
2616     * <p>take this expression for example:
2617     * <p>f in (1,2,3)
2618     * <p> rightOperand is null, but getRightNode() should return (1,2,3) which is {@link TExpression#exprList}
2619     *
2620    public TParseTreeNode getLeftNode() {
2621        TParseTreeNode ret = this.leftOperand;
2622        if ( ret == null) {
2623            ret = this.leftNode;
2624        }
2625        return ret;
2626    }
2627     */
2628
2629    /*
2630     *
2631     * @return if rightOperand is not null, then return rightOperand,
2632     * otherwise, check other possible parse tree node that might be in right side of this expression.
2633     * <p>This function was called in preOrderTraverse, inOrderTraverse and postOrderTraverse
2634     * <p>This function is only valid when {@link gudusoft.gsqlparser.nodes.TExpression#isLeaf()} is not true.
2635
2636     * <p>take this expression for example:
2637     * <p>f in (1,2,3)
2638     * <p> rightOperand is null, but getRightNode() should return (1,2,3) which is {@link TExpression#exprList}
2639    public TParseTreeNode getRightNode(){
2640        TParseTreeNode ret = this.rightOperand;
2641        if ( ret == null) {
2642            ret = this.rightNode;
2643        }
2644        return ret;
2645    }
2646     */
2647
2648    /**
2649     *
2650     * @return right operand of this expression which should be type of TExpression
2651     */
2652    public TExpression getRightOperand() {
2653        return rightOperand;
2654    }
2655
2656    /**
2657     *
2658     * @return left operand of this expression which should be type of TExpression
2659     */
2660    public TExpression getLeftOperand() {
2661
2662        return leftOperand;
2663    }
2664
2665    public TExpression getLikeEscapeOperand() {
2666        return likeEscapeOperand;
2667    }
2668
2669    public TExpression getBetweenOperand() {
2670        return betweenOperand;
2671    }
2672
2673    public TArrayAccess getArrayAccess() {
2674        return arrayAccess;
2675    }
2676
2677    private EExpressionType expressionType = EExpressionType.not_initialized_yet_t;
2678
2679    /**
2680     * change return type from int to EExpressionType since 1.4.3.0
2681     * @return a value of {@link EExpressionType}
2682     */
2683    public EExpressionType getExpressionType() {
2684        return expressionType;
2685    }
2686
2687    /**
2688     *
2689     * @param exprType type to distinguish expression, change type from int to
2690     * EExpressionType since 1.4.3.0
2691     */
2692    public void setExpressionType(EExpressionType exprType) {
2693        this.expressionType = exprType;
2694    }
2695
2696    //private int expressionType = unknown;
2697
2698    public void setObjectOperand(TObjectName objectOperand) {
2699        this.objectOperand = objectOperand;
2700    }
2701
2702    public TObjectName getObjectOperand() {
2703        return objectOperand;
2704    }
2705
2706    private TObjectName objectOperand;
2707
2708    public void setConstantOperand(TConstant constantOperand) {
2709        this.constantOperand = constantOperand;
2710    }
2711
2712    private TConstant constantOperand;
2713
2714    public TSourceToken getSourcetokenOperand() {
2715        return sourcetokenOperand;
2716    }
2717
2718    public void setSourcetokenOperand(TSourceToken sourcetokenOperand) {
2719        this.sourcetokenOperand = sourcetokenOperand;
2720    }
2721
2722    private TSourceToken sourcetokenOperand;
2723
2724    public void setCaseExpression(TCaseExpression caseExpression) {
2725        this.caseExpression = caseExpression;
2726    }
2727
2728    public TCaseExpression getCaseExpression() {
2729        return caseExpression;
2730    }
2731
2732    private TCaseExpression caseExpression;
2733
2734    /**
2735     * @deprecated As of v1.4.3.3
2736     */
2737    public void setArrayAccess(TArrayAccess arrayAccess) {
2738        this.arrayAccess = arrayAccess;
2739    }
2740
2741    private TExecuteSqlNode executeSqlNode;
2742
2743    public TExecuteSqlNode getExecuteSqlNode() {
2744        return executeSqlNode;
2745    }
2746
2747    private TCallSqlNode callSqlNode;
2748
2749    public TCallSqlNode getCallSqlNode() {
2750        return callSqlNode;
2751    }
2752
2753    public void setCallSqlNode(TCallSqlNode callSqlNode) {
2754        this.callSqlNode = callSqlNode;
2755    }
2756
2757    public void setSubQueryNode(TSelectSqlNode subQueryNode) {
2758        this.subQueryNode = subQueryNode;
2759    }
2760
2761    private TSelectSqlNode subQueryNode = null;
2762
2763    public void setSubQuery(TSelectSqlStatement subQuery) {
2764        this.subQuery = subQuery;
2765    }
2766
2767    public TSelectSqlStatement getSubQuery() {
2768        return subQuery;
2769    }
2770
2771    private TSelectSqlStatement subQuery = null;
2772
2773    public void setSubQueryInStmt(boolean subQueryInStmt) {
2774        isSubQueryInStmt = subQueryInStmt;
2775    }
2776
2777    private boolean isSubQueryInStmt = false;   // plsql, subQuery already was set to TSelectSqlStatement, but not parsed
2778
2779    private TFunctionCall functionCall;
2780
2781    public TFunctionCall getFunctionCall() {
2782        return functionCall;
2783    }
2784
2785    public void setFunctionCall(TFunctionCall functionCall) {
2786        this.functionCall = functionCall;
2787    }
2788
2789    private TDatetimeExpression datetimeExpression;
2790
2791    public void setDatetimeExpression(TDatetimeExpression datetimeExpression) {
2792        this.datetimeExpression = datetimeExpression;
2793    }
2794
2795    private TIntervalExpression intervalExpression;
2796
2797    public void setIntervalExpression(TIntervalExpression intervalExpression) {
2798        this.intervalExpression = intervalExpression;
2799    }
2800
2801    private TExpression betweenOperand;
2802
2803    public void setBetweenOperand(TExpression betweenOperand) {
2804        this.betweenOperand = betweenOperand;
2805    }
2806
2807    private TExpression likeEscapeOperand;
2808
2809    public void setLikeEscapeOperand(TExpression likeEscapeOperand) {
2810        this.likeEscapeOperand = likeEscapeOperand;
2811    }
2812
2813
2814    public void doParse(TCustomSqlStatement psql, ESqlClause plocation){
2815
2816        setLocation(plocation);
2817
2818        switch(expressionType){
2819            case simple_constant_t:
2820                if (this.constantOperand.getStartToken() != null){
2821                    this.constantOperand.getStartToken().location = plocation;
2822                }
2823                break;
2824            case simple_object_name_t:
2825                // target_el_expr -> basic3_expr -> simple_expression
2826                psql.linkColumnReferenceToTable(objectOperand,plocation);
2827                psql.linkColumnToTable(objectOperand,plocation);
2828
2829//                if (plocation == ESqlClause.selectInto){
2830//                    if (this.objectOperand.toString().startsWith("#")){
2831//                        TTable table = new TTable();
2832//                        this.objectOperand.setObjectType(TObjectName.ttobjTable);
2833//                        table.setTableName(this.objectOperand);
2834//                        table.setTableType(ETableSource.objectname);
2835//                        table.setEffectType(ETableEffectType.tetSelectInto);
2836//                        psql.addToTables(table);
2837//                    }else{
2838//                        this.objectOperand.setObjectType(TObjectName.ttobjVariable);
2839//                    }
2840//                }else{
2841//                    psql.linkColumnReferenceToTable(objectOperand,plocation);
2842//                    psql.linkColumnToTable(objectOperand,plocation);
2843//                }
2844                break;
2845            case group_t:
2846                inExpr.doParse(psql,plocation);
2847                break;
2848            case list_t:
2849            case collection_constructor_list_t:
2850            case collection_constructor_multiset_t:
2851            case collection_constructor_set_t:
2852            case new_structured_type_t:
2853                if (exprList != null){
2854                    exprList.doParse(psql,plocation);
2855                }
2856                break;
2857            case function_t:
2858                if (functionCall.getArgs() != null){
2859                    for(int i=0;i<functionCall.getArgs().size();i++){
2860                        functionCall.getArgs().getExpression(i).setParentExpr(this);
2861                    }
2862                }
2863                functionCall.doParse(psql,plocation);
2864                break;
2865
2866            case type_constructor_t:
2867                if (getExprList() != null){
2868                    getExprList().doParse(psql,plocation);
2869                }
2870
2871                break;
2872            case cursor_t:
2873            case subquery_t:
2874            case multiset_t:
2875                if (subQuery == null){
2876                    subQuery = new TSelectSqlStatement(psql.dbvendor);
2877                    subQuery.rootNode = subQueryNode;
2878                }
2879                subQuery.setLocation(plocation);
2880
2881                if (!isSubQueryInStmt){
2882                    subQuery.doParseStatement(psql);
2883                }else{
2884                    // subQuery in plsql
2885                 subQuery.parsestatement(psql,false);
2886                }
2887                break;
2888            case case_t:
2889                caseExpression.doParse(psql,plocation);
2890                break;
2891            case pattern_matching_t:
2892                // leftOperand may be null for dangling predicates in CASE expressions
2893                if (leftOperand != null) {
2894                    leftOperand.doParse(psql,plocation);
2895                }
2896                rightOperand.doParse(psql,plocation);
2897                if (likeEscapeOperand != null){
2898                    likeEscapeOperand.doParse(psql,plocation);
2899                }
2900                break;
2901            case exists_t:
2902                if (subQueryNode != null){
2903                    if (subQuery == null){
2904                        subQuery = new TSelectSqlStatement(psql.dbvendor);
2905                        subQuery.rootNode = subQueryNode;
2906                    }
2907                    if (!isSubQueryInStmt){
2908                        subQuery.doParseStatement(psql);
2909                    }else{
2910                        // subQuery in plsql
2911                        subQuery.parsestatement(psql,false);
2912                    }
2913                }else if (this.leftOperand != null){
2914                    // databricks, exists(expr, func)
2915                }
2916                break;
2917            case new_variant_type_t:
2918                this.newVariantTypeArgumentList.doParse(psql,plocation);
2919                break;
2920            case unary_plus_t:
2921            case unary_minus_t:
2922            case unary_prior_t:
2923                rightOperand.doParse(psql,plocation);
2924                break;
2925            case arithmetic_plus_t:
2926            case arithmetic_minus_t:
2927            case arithmetic_times_t:
2928            case arithmetic_divide_t:
2929            case power_t:
2930            case range_t:
2931            case concatenate_t:
2932            case period_ldiff_t:
2933            case period_rdiff_t:
2934            case period_p_intersect_t:
2935            case period_p_normalize_t:
2936            case contains_t:
2937                doParseLeftChainIterative(psql,plocation);
2938                break;
2939            case assignment_t:
2940                doParseLeftChainIterative(psql,plocation);
2941                break;
2942            case sqlserver_proprietary_column_alias_t:
2943                rightOperand.doParse(psql,plocation);
2944                break;
2945            case arithmetic_modulo_t:
2946            case bitwise_exclusive_or_t:
2947            case bitwise_or_t:
2948            case bitwise_and_t:
2949            case bitwise_xor_t:
2950            case exponentiate_t:
2951            case scope_resolution_t:
2952            case at_time_zone_t:
2953            case member_of_t:
2954            case arithmetic_exponentiation_t:
2955                doParseLeftChainIterative(psql,plocation);
2956                break;
2957            case at_local_t:
2958            case day_to_second_t:
2959            case year_to_month_t:
2960                leftOperand.doParse(psql,plocation);
2961                break;
2962            case teradata_at_t:
2963                doParseLeftChainIterative(psql,plocation);
2964                break;
2965            case parenthesis_t:
2966                leftOperand.doParse(psql,plocation);
2967                break;
2968            case simple_comparison_t:
2969                // leftOperand may be null for dangling predicates in CASE expressions
2970                if (leftOperand != null) {
2971                    leftOperand.doParse(psql,plocation);
2972                }
2973                rightOperand.doParse(psql,plocation);
2974                break;
2975            case is_distinct_from_t:
2976                // a IS [NOT] DISTINCT FROM b; leftOperand may be null in the
2977                // predicate-only form (IS DISTINCT FROM b) inside CASE
2978                if (leftOperand != null) {
2979                    leftOperand.doParse(psql,plocation);
2980                }
2981                if (rightOperand != null) {
2982                    rightOperand.doParse(psql,plocation);
2983                }
2984                break;
2985            case group_comparison_t:
2986                doParseLeftChainIterative(psql,plocation);
2987                break;
2988            case in_t:
2989                // leftOperand may be null for dangling predicates in CASE expressions
2990                if (leftOperand != null) {
2991                    leftOperand.doParse(psql,plocation);
2992                }
2993                rightOperand.doParse(psql,plocation);
2994                break;
2995            case floating_point_t:
2996                leftOperand.doParse(psql,plocation);
2997                break;
2998            case logical_xor_t:
2999            case is_t:
3000                doParseLeftChainIterative(psql,plocation);
3001                break;
3002            case logical_not_t:
3003                rightOperand.doParse(psql,plocation);
3004                break;
3005            case null_t:
3006                if (leftOperand != null) {
3007                    leftOperand.doParse(psql,plocation);
3008                }
3009                break;
3010            case is_not_null_t:
3011            case is_true_t:
3012            case is_false_t:
3013            case is_not_true_t:
3014            case is_not_false_t:
3015                leftOperand.doParse(psql,plocation);
3016                break;
3017            case between_t:
3018                // betweenOperand may be null for dangling predicates in CASE expressions
3019                if (betweenOperand != null) {
3020                    betweenOperand.doParse(psql,plocation);
3021                }
3022                leftOperand.doParse(psql,plocation);
3023                rightOperand.doParse(psql,plocation);
3024                break;
3025            case is_of_type_t:
3026                leftOperand.doParse(psql,plocation);
3027                break;
3028            case collate_t: //sql server,postgresql
3029                doParseLeftChainIterative(psql,plocation);
3030                break;
3031            case left_join_t:
3032            case right_join_t:
3033                doParseLeftChainIterative(psql,plocation);
3034                break;
3035            case ref_arrow_t:
3036                if (leftOperand.getExpressionType() == EExpressionType.simple_object_name_t){
3037                    leftOperand.getObjectOperand().setDbObjectType(EDbObjectType.variable);
3038                }
3039                leftOperand.doParse(psql,plocation);
3040                rightOperand.doParse(psql,plocation);
3041                break;
3042            case typecast_t:
3043                leftOperand.doParse(psql,plocation);
3044                break;
3045            case arrayaccess_t:
3046                arrayAccess.doParse(psql,plocation);
3047                break;
3048            case unary_connect_by_root_t:
3049                rightOperand.doParse(psql,plocation);
3050                break;
3051            case interval_t:
3052                intervalExpr.doParse(psql,plocation);
3053                break;
3054            case unary_binary_operator_t:
3055                rightOperand.doParse(psql,plocation);
3056                break;
3057            case left_shift_t:
3058            case right_shift_t:
3059                 doParseLeftChainIterative(psql,plocation);
3060                 break;
3061            case array_constructor_t:
3062                if ((this.subQueryNode != null)&&(subQuery == null)){
3063                    subQuery = new TSelectSqlStatement(psql.dbvendor);
3064                    subQuery.rootNode = subQueryNode;
3065                    subQuery.doParseStatement(psql);
3066                }else if (exprList != null){
3067                    exprList.doParse(psql,plocation);
3068                }else if (arrayConstruct !=null){
3069                    arrayConstruct.doParse(psql,plocation);
3070                }
3071                break;
3072            case objectConstruct_t:
3073                objectConstruct.doParse(psql,plocation);
3074                break;
3075            case row_constructor_t:
3076                if (exprList != null){
3077                    exprList.doParse(psql,plocation);
3078                }
3079                break;
3080            case namedParameter_t:
3081                namedParameter.doParse(psql,plocation);
3082                break;
3083            case positionalParameter_t:
3084                positionalParameter.doParse(psql,plocation);
3085                break;
3086            case collectionArray_t:
3087                collectionArray.doParse(psql,plocation);
3088                break;
3089            case collectionCondition_t:
3090                collectionCondition.doParse(psql,plocation);
3091                break;
3092            case unary_squareroot_t:
3093            case unary_cuberoot_t:
3094            case unary_factorialprefix_t:
3095            case unary_absolutevalue_t:
3096            case unary_bitwise_not_t:
3097                getRightOperand().doParse(psql,plocation);
3098                break;
3099            case unary_factorial_t:
3100                getLeftOperand().doParse(psql,plocation);
3101                break;
3102            case bitwise_shift_left_t:
3103            case bitwise_shift_right_t:
3104                doParseLeftChainIterative(psql,plocation);
3105                break;
3106            case multiset_union_t:
3107            case multiset_union_distinct_t:
3108            case multiset_intersect_t:
3109            case multiset_intersect_distinct_t:
3110            case multiset_except_t:
3111            case multiset_except_distinct_t:
3112                doParseLeftChainIterative(psql,plocation);
3113                break;
3114            case json_get_text:
3115            case json_get_text_at_path:
3116            case json_get_object:
3117            case json_get_object_at_path:
3118            case json_left_contain:
3119            case json_right_contain:
3120            case json_exist:
3121            case json_any_exist:
3122            case json_all_exist:
3123                doParseLeftChainIterative(psql,plocation);
3124                break;
3125            case interpolate_previous_value_t:
3126                doParseLeftChainIterative(psql,plocation);
3127                break;
3128            case text_search_t:
3129            case geo_t:
3130            case network_t:
3131            case json_delete_path:
3132            case json_path_exists:
3133            case json_path_match:
3134                doParseLeftChainIterative(psql,plocation);
3135                break;
3136            case logical_and_t:
3137            case logical_or_t:
3138                doParseLeftChainIterative(psql,plocation);
3139                break;
3140            case submultiset_t:
3141                doParseLeftChainIterative(psql,plocation);
3142                break;
3143            case overlaps_t:
3144                doParseLeftChainIterative(psql,plocation);
3145                break;
3146            case is_a_set_t:
3147                leftOperand.doParse(psql,plocation);
3148                break;
3149            case unnest_t:
3150                leftOperand.doParse(psql,plocation);
3151                break;
3152            case array_t:
3153                if (objectOperand != null){
3154                    psql.linkColumnToTable(objectOperand,plocation);
3155                }
3156
3157                if (getExprList() != null){
3158                    getExprList().doParse(psql,plocation);
3159                }
3160                break;
3161            case fieldselection_t:
3162                if (getLeftOperand() != null){
3163                    getLeftOperand().doParse(psql,plocation);
3164                }else if (getFunctionCall() != null){
3165                    getFunctionCall().doParse(psql,plocation);
3166                }
3167                break;
3168            case lambda_t:
3169                //getLeftOperand().doParse(psql,plocation);
3170                //getRightOperand().doParse(psql,plocation);
3171                break;
3172            case array_access_expr_t:
3173                doParseLeftChainIterative(psql,plocation);
3174                break;
3175            default:;
3176        }
3177    }
3178
3179    /**
3180     * Check if the expression type is a pure binary type where doParse() only
3181     * calls leftOperand.doParse() + rightOperand.doParse() with no additional logic.
3182     */
3183    public static boolean isPureBinaryForDoParse(EExpressionType type) {
3184        switch (type) {
3185            case arithmetic_plus_t:
3186            case arithmetic_minus_t:
3187            case arithmetic_times_t:
3188            case arithmetic_divide_t:
3189            case power_t:
3190            case range_t:
3191            case concatenate_t:
3192            case period_ldiff_t:
3193            case period_rdiff_t:
3194            case period_p_intersect_t:
3195            case period_p_normalize_t:
3196            case contains_t:
3197            case assignment_t:
3198            case arithmetic_modulo_t:
3199            case bitwise_exclusive_or_t:
3200            case bitwise_or_t:
3201            case bitwise_and_t:
3202            case bitwise_xor_t:
3203            case exponentiate_t:
3204            case scope_resolution_t:
3205            case at_time_zone_t:
3206            case member_of_t:
3207            case arithmetic_exponentiation_t:
3208            case teradata_at_t:
3209            case group_comparison_t:
3210            case logical_and_t:
3211            case logical_or_t:
3212            case logical_xor_t:
3213            case is_t:
3214            case collate_t:
3215            case left_join_t:
3216            case right_join_t:
3217            case left_shift_t:
3218            case right_shift_t:
3219            case bitwise_shift_left_t:
3220            case bitwise_shift_right_t:
3221            case multiset_union_t:
3222            case multiset_union_distinct_t:
3223            case multiset_intersect_t:
3224            case multiset_intersect_distinct_t:
3225            case multiset_except_t:
3226            case multiset_except_distinct_t:
3227            case json_get_text:
3228            case json_get_text_at_path:
3229            case json_get_object:
3230            case json_get_object_at_path:
3231            case json_left_contain:
3232            case json_right_contain:
3233            case json_exist:
3234            case json_any_exist:
3235            case json_all_exist:
3236            case interpolate_previous_value_t:
3237            case submultiset_t:
3238            case overlaps_t:
3239            case array_access_expr_t:
3240            case text_search_t:
3241            case geo_t:
3242            case network_t:
3243            case json_delete_path:
3244            case json_path_exists:
3245            case json_path_match:
3246                return true;
3247            default:
3248                return false;
3249        }
3250    }
3251
3252    /**
3253     * Iteratively processes a left-recursive chain of pure binary expressions,
3254     * avoiding deep recursion that would cause StackOverflowError for chains
3255     * with 2000+ operators (e.g., WHERE clauses with 2000+ AND conditions).
3256     *
3257     * Walks the left chain collecting right operands, then processes
3258     * the leftmost leaf and all right operands in left-to-right order.
3259     */
3260    private void doParseLeftChainIterative(TCustomSqlStatement psql, ESqlClause plocation) {
3261        Deque<TExpression> rightChildren = new ArrayDeque<>();
3262        TExpression current = this;
3263        // Descend the left chain while the current node is a pure binary expression
3264        while (current != null && isPureBinaryForDoParse(current.expressionType)) {
3265            current.setLocation(plocation);
3266            if (current.rightOperand != null) {
3267                rightChildren.push(current.rightOperand);
3268            }
3269            current = current.leftOperand;
3270        }
3271        // Process the leftmost non-binary leaf
3272        if (current != null) {
3273            current.doParse(psql, plocation);
3274        }
3275        // Process right children bottom-up (preserves left-to-right order)
3276        while (!rightChildren.isEmpty()) {
3277            rightChildren.pop().doParse(psql, plocation);
3278        }
3279    }
3280
3281    /**
3282     * Iteratively processes a left-recursive chain of pure binary expressions
3283     * for the visitor pattern (acceptChildren), avoiding StackOverflowError.
3284     *
3285     * Preserves the exact preVisit/postVisit ordering of the recursive version:
3286     * preVisit all chain nodes top-down, process leftmost leaf, then bottom-up
3287     * process each right child and call postVisit on the chain node.
3288     *
3289     * Note: preVisit(this) is called by the caller before the switch statement,
3290     * and postVisit(this) is called by the caller after the switch statement.
3291     */
3292    private void acceptChildrenIterativeBinaryChain(TParseTreeVisitor v) {
3293        // Collect the left-recursive chain of pure binary expression nodes
3294        ArrayList<TExpression> chain = new ArrayList<>();
3295        chain.add(this);
3296
3297        TExpression current = this.leftOperand;
3298        while (current != null && isPureBinaryForDoParse(current.expressionType)) {
3299            chain.add(current);
3300            current = current.leftOperand;
3301        }
3302        // `current` is the leftmost non-binary leaf (or null)
3303
3304        // Call preVisit on inner chain nodes top-down (index 0 = this, already preVisited)
3305        for (int i = 1; i < chain.size(); i++) {
3306            v.preVisit(chain.get(i));
3307        }
3308
3309        // Process the leftmost leaf
3310        if (current != null) {
3311            current.acceptChildren(v);
3312        }
3313
3314        // Bottom-up: for each chain node from deepest to shallowest,
3315        // process its right child and call postVisit
3316        for (int i = chain.size() - 1; i >= 1; i--) {
3317            TExpression node = chain.get(i);
3318            if (node.rightOperand != null) {
3319                node.rightOperand.acceptChildren(v);
3320            }
3321            v.postVisit(node);
3322        }
3323
3324        // Process this node's right child
3325        // (postVisit(this) is handled by the caller after the switch)
3326        if (this.rightOperand != null) {
3327            this.rightOperand.acceptChildren(v);
3328        }
3329    }
3330
3331    private EComparisonType comparisonType = EComparisonType.unknown;
3332    private TSourceToken comparisonOperator = null;
3333    private TSourceToken quantifier = null;
3334
3335    public void setQuantifierType(EQuantifierType quantifierType) {
3336        this.quantifierType = quantifierType;
3337    }
3338
3339    public EQuantifierType getQuantifierType() {
3340
3341        return quantifierType;
3342    }
3343
3344    private EQuantifierType quantifierType = EQuantifierType.none;
3345
3346    public EComparisonType getComparisonType() {
3347        return comparisonType;
3348    }
3349
3350    /**
3351     *  one of the following quantifier keywords: SOME, ANY, ALL
3352     * @return SOME, ANY, ALL in group comparison condition.
3353     */
3354    public TSourceToken getQuantifier() {
3355        return quantifier;
3356    }
3357
3358    /**
3359     *
3360     * @return operator used in comparison condition.
3361     */
3362    public TSourceToken getComparisonOperator() {
3363
3364        return comparisonOperator;
3365    }
3366
3367    public void setComparisonOperator(TDummy comparisonOperator) {
3368        if (comparisonOperator == null) return;
3369        for(TSourceToken st : comparisonOperator.tokens){
3370            this.getOperatorTokens().add(st);
3371        }
3372    }
3373
3374    public void setComparisonOperator(TSourceToken comparisonOperator) {
3375        if (comparisonOperator == null) return;
3376        this.comparisonOperator = comparisonOperator;
3377        this.operatorToken = comparisonOperator;
3378        comparisonType = getComparisonType(comparisonOperator);
3379        if ((comparisonOperator.toString().equalsIgnoreCase("="))
3380                && (expressionType == EExpressionType.simple_comparison_t)){
3381            // leftOperand may be null for dangling predicates in CASE expressions
3382            if (leftOperand != null && leftOperand.toString().startsWith("@")){
3383                expressionType = EExpressionType.assignment_t;
3384            }
3385        }
3386    }
3387
3388    public void setQuantifier(TSourceToken quantifier) {
3389        if (quantifier == null) return;
3390        this.quantifier = quantifier;
3391        switch (this.quantifier.tokencode){
3392            case TBaseType.rrw_all:
3393                quantifierType = EQuantifierType.all;
3394                break;
3395            default:
3396                if (this.quantifier.toString().equalsIgnoreCase("any")){
3397                    quantifierType = EQuantifierType.any;
3398                }else if (this.quantifier.toString().equalsIgnoreCase("some")){
3399                    quantifierType = EQuantifierType.some;
3400                }
3401                break;
3402        }
3403    }
3404
3405    public void accept(TParseTreeVisitor v){
3406        v.preVisit(this);
3407        v.postVisit(this);
3408    }
3409
3410    public void acceptChildren(TParseTreeVisitor v){
3411        v.preVisit(this);
3412        switch(expressionType){
3413            case simple_object_name_t:
3414                objectOperand.acceptChildren(v);
3415                break;
3416            case simple_constant_t:
3417                constantOperand.acceptChildren(v);
3418                break;
3419            case list_t:
3420            case collection_constructor_list_t:
3421            case collection_constructor_multiset_t:
3422            case collection_constructor_set_t:
3423            case new_structured_type_t:
3424                if (exprList != null){
3425                    for(int i=0;i<exprList.size();i++){
3426                        exprList.getExpression(i).acceptChildren(v);
3427                    }
3428                }
3429                break;
3430            case function_t:
3431                functionCall.acceptChildren(v);
3432                break;
3433            case type_constructor_t:
3434                if (getExprList() != null){
3435                    getExprList().acceptChildren(v);
3436                }
3437                break;
3438            case cursor_t:
3439            case subquery_t:
3440            case multiset_t:
3441                subQuery.acceptChildren(v);
3442                break;
3443            case case_t:
3444                caseExpression.acceptChildren(v);
3445                break;
3446            case pattern_matching_t:
3447                // leftOperand may be null for dangling predicates in CASE expressions
3448                if (leftOperand != null) {
3449                    leftOperand.acceptChildren(v);
3450                }
3451                rightOperand.acceptChildren(v);
3452                if (likeEscapeOperand != null){
3453                    likeEscapeOperand.acceptChildren(v);
3454                }
3455                break;
3456            case exists_t:
3457                if (subQuery!=null){
3458                    subQuery.acceptChildren(v);
3459                }else{
3460                    // databricks, exists(expr, func)
3461                }
3462
3463                break;
3464            case new_variant_type_t:
3465                newVariantTypeArgumentList.acceptChildren(v);
3466                break;
3467            case unary_plus_t:
3468            case unary_minus_t:
3469            case unary_prior_t:
3470                rightOperand.acceptChildren(v);
3471                break;
3472            case arithmetic_plus_t:
3473            case arithmetic_minus_t:
3474            case arithmetic_times_t:
3475            case arithmetic_divide_t:
3476            case power_t:
3477            case range_t:
3478            case concatenate_t:
3479            case period_ldiff_t:
3480            case period_rdiff_t:
3481            case period_p_intersect_t:
3482            case period_p_normalize_t:
3483            case contains_t:
3484                acceptChildrenIterativeBinaryChain(v);
3485                break;
3486            case assignment_t:
3487                acceptChildrenIterativeBinaryChain(v);
3488                break;
3489            case sqlserver_proprietary_column_alias_t:
3490                rightOperand.acceptChildren(v);
3491                break;
3492            case arithmetic_modulo_t:
3493            case bitwise_exclusive_or_t:
3494            case bitwise_or_t:
3495            case bitwise_and_t:
3496            case bitwise_xor_t:
3497            case exponentiate_t:
3498            case scope_resolution_t:
3499            case at_time_zone_t:
3500            case member_of_t:
3501            case arithmetic_exponentiation_t:
3502                acceptChildrenIterativeBinaryChain(v);
3503                break;
3504            case at_local_t:
3505            case day_to_second_t:
3506            case year_to_month_t:
3507                leftOperand.acceptChildren(v);
3508                break;
3509            case teradata_at_t:
3510                acceptChildrenIterativeBinaryChain(v);
3511                break;
3512            case parenthesis_t:
3513                leftOperand.acceptChildren(v);
3514                break;
3515            case simple_comparison_t:
3516                // leftOperand may be null for dangling predicates in CASE expressions
3517                if (leftOperand != null) {
3518                    leftOperand.acceptChildren(v);
3519                }
3520                rightOperand.acceptChildren(v);
3521                break;
3522            case is_distinct_from_t:
3523                // a IS [NOT] DISTINCT FROM b; leftOperand may be null in the
3524                // predicate-only form (IS DISTINCT FROM b) inside CASE
3525                if (leftOperand != null) {
3526                    leftOperand.acceptChildren(v);
3527                }
3528                if (rightOperand != null) {
3529                    rightOperand.acceptChildren(v);
3530                }
3531                break;
3532            case group_comparison_t:
3533                acceptChildrenIterativeBinaryChain(v);
3534                break;
3535            case in_t:
3536                // leftOperand may be null for dangling predicates in CASE expressions
3537                if (leftOperand != null) {
3538                    leftOperand.acceptChildren(v);
3539                }
3540                rightOperand.acceptChildren(v);
3541                break;
3542            case floating_point_t:
3543                leftOperand.acceptChildren(v);
3544                break;
3545            case logical_and_t:
3546            case logical_or_t:
3547            case logical_xor_t:
3548            case is_t:
3549                acceptChildrenIterativeBinaryChain(v);
3550                break;
3551            case logical_not_t:
3552                rightOperand.acceptChildren(v);
3553                break;
3554            case null_t:
3555            case is_not_null_t:
3556            case is_true_t:
3557            case is_false_t:
3558            case is_not_true_t:
3559            case is_not_false_t:
3560                leftOperand.acceptChildren(v);
3561                break;
3562            case between_t:
3563                if (betweenOperand != null){
3564                    betweenOperand.acceptChildren(v);
3565                }
3566                leftOperand.acceptChildren(v);
3567                rightOperand.acceptChildren(v);
3568                break;
3569            case is_of_type_t:
3570                leftOperand.acceptChildren(v);
3571                break;
3572            case collate_t: //sql server,postgresql
3573                acceptChildrenIterativeBinaryChain(v);
3574                break;
3575            case left_join_t:
3576            case right_join_t:
3577                acceptChildrenIterativeBinaryChain(v);
3578                break;
3579            case ref_arrow_t:
3580                leftOperand.acceptChildren(v);
3581                rightOperand.acceptChildren(v);
3582                break;
3583            case typecast_t:
3584                leftOperand.acceptChildren(v);
3585                break;
3586            case arrayaccess_t:
3587                arrayAccess.acceptChildren(v);
3588                break;
3589            case unary_connect_by_root_t:
3590                rightOperand.acceptChildren(v);
3591                break;
3592            case interval_t:
3593                intervalExpr.acceptChildren(v);
3594                break;
3595            case unary_binary_operator_t:
3596                rightOperand.acceptChildren(v);
3597                break;
3598            case left_shift_t:
3599            case right_shift_t:
3600                acceptChildrenIterativeBinaryChain(v);
3601                break;
3602            case array_constructor_t:
3603                if (subQuery != null){
3604                    subQuery.acceptChildren(v);
3605                }else if (exprList != null){
3606                    exprList.acceptChildren(v);
3607                }else if (arrayConstruct != null){
3608                    arrayConstruct.acceptChildren(v);
3609                }
3610                break;
3611            case row_constructor_t:
3612                if (exprList != null){
3613                    exprList.acceptChildren(v);
3614                }
3615                break;
3616            case unary_squareroot_t:
3617            case unary_cuberoot_t:
3618            case unary_factorialprefix_t:
3619            case unary_absolutevalue_t:
3620            case unary_bitwise_not_t:
3621                getRightOperand().acceptChildren(v);
3622                break;
3623            case unary_factorial_t:
3624                getLeftOperand().acceptChildren(v);
3625                break;
3626            case bitwise_shift_left_t:
3627            case bitwise_shift_right_t:
3628                acceptChildrenIterativeBinaryChain(v);
3629                break;
3630            case multiset_union_t:
3631            case multiset_union_distinct_t:
3632            case multiset_intersect_t:
3633            case multiset_intersect_distinct_t:
3634            case multiset_except_t:
3635            case multiset_except_distinct_t:
3636                acceptChildrenIterativeBinaryChain(v);
3637                break;
3638            case json_get_text:
3639            case json_get_text_at_path:
3640            case json_get_object:
3641            case json_get_object_at_path:
3642            case json_left_contain:
3643            case json_right_contain:
3644            case json_exist:
3645            case json_any_exist:
3646            case json_all_exist:
3647                acceptChildrenIterativeBinaryChain(v);
3648                break;
3649            case interpolate_previous_value_t:
3650                acceptChildrenIterativeBinaryChain(v);
3651                break;
3652            case text_search_t:
3653            case geo_t:
3654            case network_t:
3655            case json_delete_path:
3656            case json_path_exists:
3657            case json_path_match:
3658                acceptChildrenIterativeBinaryChain(v);
3659                break;
3660            case submultiset_t:
3661                acceptChildrenIterativeBinaryChain(v);
3662                break;
3663            case overlaps_t:
3664                acceptChildrenIterativeBinaryChain(v);
3665                break;
3666            case is_a_set_t:
3667                leftOperand.acceptChildren(v);
3668                break;
3669            case array_t:
3670                if (getExprList() != null){
3671                    getExprList().acceptChildren(v);
3672                }
3673                break;
3674            case lambda_t:
3675                getLeftOperand().acceptChildren(v);
3676                getRightOperand().acceptChildren(v);
3677                break;
3678            default:;
3679        }
3680
3681        v.postVisit(this);
3682    }
3683
3684    /**
3685     * expression type such as column reference is a leaf expression while subtract expression
3686     * is not a leaf expression. Usually, non-leaf expression should including both {@link #getLeftOperand()}
3687     * and {@link #getRightOperand()}.
3688     * @return leaf expression or not.
3689     */
3690    public boolean isLeaf(){
3691        return isLeafExpr(this);
3692    }
3693
3694
3695    public boolean isLeafExpr(TParseTreeNode pnode){
3696        boolean ret = true;
3697        if (pnode == null) return ret;
3698        if (!(pnode instanceof TExpression)) return ret;
3699        TExpression e = (TExpression)pnode;
3700
3701        if ((onlyAndOrIsNonLeaf) &&(!((e.getExpressionType()==EExpressionType.logical_and_t)||(e.getExpressionType()==EExpressionType.logical_or_t)))) return ret;
3702
3703        switch (e.getExpressionType()){
3704            case case_t:
3705            case simple_object_name_t:
3706            case simple_constant_t:
3707            case simple_source_token_t:
3708            case group_t:
3709            case list_t:
3710            case collection_constructor_list_t:
3711            case collection_constructor_multiset_t:
3712            case collection_constructor_set_t:
3713            case cursor_t:
3714            case function_t:
3715            case type_constructor_t:
3716            case subquery_t:
3717            case multiset_t:
3718            case object_access_t:
3719            case place_holder_t:
3720            case is_of_type_t:
3721            case exists_t:
3722            case arrayaccess_t:
3723            case interval_t:
3724            case new_structured_type_t:
3725            case new_variant_type_t:
3726            case member_of_t:
3727            case submultiset_t:
3728            case execute_stmt_t:
3729            case cursor_attribute_t:
3730                return ret;
3731            default:
3732        }
3733        //if(e.getExpressionType() == TExpression.datetimeExprOperator) return ret;
3734        //if(e.getExpressionType() == TExpression.intervalExprOperator) return ret;
3735        //if(e.getExpressionType() == TExpression.modelExprOperator) return ret;
3736        //if(e.getExpressionType() == TExpression.typeconstructorExprOperator) return ret;
3737        //if(e.getExpressionType() == TExpression.patternMatchingExprOperator) return ret;
3738
3739        if (e.getLeftOperand() != null){
3740            ret = !(e.getLeftOperand() instanceof TExpression);
3741        }
3742        if (e.getRightOperand() != null){
3743            ret = !(e.getRightOperand() instanceof TExpression);
3744        }
3745
3746        return ret;
3747    }
3748
3749    private Stack exprStack = null;
3750
3751    private Stack getExprStack() {
3752        if (exprStack == null){
3753            exprStack = new Stack();
3754        }
3755        return exprStack;
3756    }
3757
3758    // used in  PreOrderTraverse only,  InOrderTraverse  and PostOrderTraverse has already visit subtree.
3759    private boolean visitSubTree = true;
3760
3761
3762    public void setVisitSubTree(boolean visitSubTree) {
3763        this.visitSubTree = visitSubTree;
3764    }
3765
3766    public boolean isVisitSubTree() {
3767
3768        return visitSubTree;
3769    }
3770
3771    private boolean checkIsVisitSubTree(TParseTreeNode node){
3772        boolean ret = !this.isLeafExpr(node);
3773        if (ret){
3774            ret = ((TExpression)node).isVisitSubTree();
3775        }
3776        return ret;
3777    }
3778
3779
3780    public void setWindowSpecification(TWindowDef windowSpecification){
3781        if (this.getExpressionType() != EExpressionType.function_t) return;
3782        this.getFunctionCall().setWindowDef(windowSpecification);
3783
3784    }
3785
3786    /**
3787     * Traverse expression in pre Order.
3788     * @param ev user defined visitor
3789     */
3790    public void preOrderTraverse(IExpressionVisitor ev){
3791
3792
3793        if (this.isLeaf()){
3794            ev.exprVisit(this,true);
3795        }else{
3796            getExprStack().push(this);
3797        }
3798
3799        TParseTreeNode node = null;
3800        while(getExprStack().size() > 0){
3801            node = (TParseTreeNode)getExprStack().peek();
3802
3803            while(node != null){
3804                if (!ev.exprVisit(node,this.isLeafExpr(node))) {
3805                    return;
3806                }
3807
3808                if (this.isLeafExpr(node)) {
3809                    this.getExprStack().push(null);
3810                }else if (!this.checkIsVisitSubTree(node)){
3811                    this.getExprStack().push(null);
3812                }else{
3813                    this.getExprStack().push(((TExpression)node).getLeftOperand());
3814                }
3815                node = (TParseTreeNode)this.getExprStack().peek();
3816            }
3817
3818            // pop up the dummyOperator expression node
3819            this.getExprStack().pop();
3820
3821            if (this.getExprStack().size() > 0){
3822                node = (TParseTreeNode)this.getExprStack().pop();
3823                
3824                if (this.isLeafExpr(node)) {
3825                    this.getExprStack().push(null);
3826                }else if (!this.checkIsVisitSubTree(node)){
3827                    this.getExprStack().push(null);
3828                }else{
3829                    this.getExprStack().push(((TExpression)node).getRightOperand());
3830                }
3831
3832            }
3833
3834        } //while
3835
3836
3837    }
3838
3839    /**
3840     * Traverse expression in In Order.
3841     * @param ev user defined visitor
3842     */
3843    public void inOrderTraverse(IExpressionVisitor ev){
3844
3845        if (this.isLeaf()){
3846            ev.exprVisit(this,true);
3847        }else{
3848            getExprStack().push(this);
3849        }
3850
3851        TParseTreeNode node = null;
3852        while(getExprStack().size() > 0){
3853            node = (TParseTreeNode)getExprStack().peek();
3854
3855            while(node != null){
3856
3857                if (this.isLeafExpr(node)) {
3858                    this.getExprStack().push(null);
3859                }else{
3860                    this.getExprStack().push(((TExpression)node).getLeftOperand());
3861                }
3862                node = (TParseTreeNode)this.getExprStack().peek();
3863            }
3864
3865            // pop up the dummyOperator expression node
3866            this.getExprStack().pop();
3867
3868            if (this.getExprStack().size() > 0){
3869                node = (TParseTreeNode)this.getExprStack().pop();
3870
3871                if (!ev.exprVisit(node,this.isLeafExpr(node))) {
3872                    return;
3873                }
3874
3875                if (this.isLeafExpr(node)) {
3876                    this.getExprStack().push(null);
3877                }else{
3878                    this.getExprStack().push(((TExpression)node).getRightOperand());
3879                }
3880
3881            }
3882
3883        } //while
3884
3885    }
3886
3887    /**
3888     * Traverse expression in post order.
3889     * @param ev user defined visitor
3890     */
3891    public void postOrderTraverse(IExpressionVisitor ev){
3892
3893        final int ctNone = 0;
3894        final int ctL = 1;
3895        final int ctR = 2;
3896
3897        if (this.isLeaf()){
3898            ev.exprVisit(this,true);
3899        }else{
3900            getExprStack().push(this);
3901        }
3902
3903        TParseTreeNode node = null;
3904
3905        while(getExprStack().size() > 0){
3906            node = (TParseTreeNode)getExprStack().peek();
3907
3908            while(node != null){
3909
3910                if (this.isLeafExpr(node)) {
3911                    this.getExprStack().push(null);
3912                }else{
3913                    this.getExprStack().push(((TExpression)node).getLeftOperand());
3914                }
3915                node = (TParseTreeNode)this.getExprStack().peek();
3916                if (node != null){
3917                    node.setDummyTag(ctL);
3918                }
3919            }
3920
3921            // pop up the dummyOperator expression node
3922            this.getExprStack().pop();
3923            node = (TParseTreeNode)this.getExprStack().peek();
3924
3925            while((this.getExprStack().size() > 0) &&(node.getDummyTag() == ctR)){
3926                node = (TParseTreeNode)this.getExprStack().pop();
3927                node.setDummyTag(ctNone); //restore tag so next this expression will be traversed correctly
3928                if (!ev.exprVisit(node,this.isLeafExpr(node))) {
3929                    return;
3930                }
3931
3932                if (this.getExprStack().size() > 0){
3933                    node = (TParseTreeNode)this.getExprStack().peek();
3934                }else{
3935                    break;
3936                }
3937            }
3938
3939            if (this.getExprStack().size() > 0){
3940                node = (TParseTreeNode)this.getExprStack().peek();
3941                node.setDummyTag(ctR);
3942                if (this.isLeafExpr(node)){
3943                    this.getExprStack().push(null);
3944                }else{
3945                 this.getExprStack().push(((TExpression)node).getRightOperand());
3946                }
3947            }
3948
3949        }//while
3950
3951    }
3952
3953    /**
3954     * if original expr is f &gt; 1, and call addANDCondition("f2 &gt; 2")
3955     * expression will be: f &gt; 1 and f2&gt; 2
3956     * @param condition
3957     */
3958    public void addANDCondition(String condition){
3959        //appendString(" and "+condition);
3960        setString("("+this.toString()+") and "+condition);
3961    }
3962
3963    /**
3964     * if original expr is f &gt; 1, and call addORCondition("f2 &gt; 2")
3965     * expression will be: f &gt; 1 or f2 &gt;2
3966     *
3967     * @param condition
3968     */
3969    public void addORCondition(String condition){
3970        //appendString(" or "+condition);
3971        setString("("+this.toString()+") or "+condition);
3972    }
3973
3974
3975    /**
3976     * remove this expression from it's parent expr.
3977     * if itself is the top level expression, then remove it from parse tree
3978     * <p>f1 &gt; 1 and f2 &gt; 2, after remove f2 &gt; 2, parent expression will be changed to: f1 &gt; 1
3979     * <p> If we need to remove condition f &gt; 1 from where clause: where f &gt; 1,
3980     * Here f &gt; 1 is the top level expression, after remove it from where clause, only  WHERE keyword left in where clause.
3981     */
3982
3983    public void removeMe(){
3984        if (this.getExpressionType() == EExpressionType.removed_t) return;
3985        this.setExpressionType(EExpressionType.removed_t);
3986
3987        TExpression parentExpr = this.getParentExpr();
3988        if (parentExpr == null){
3989            this.removeTokens();
3990            return;
3991        }
3992
3993        switch (parentExpr.getExpressionType()){
3994            case list_t: // (1,2,3) in (column1,column2,column3)
3995                // remove column1 will break this expr, so need to remove parent expr of list_t as well.
3996                //if (parentExpr.getParentExpr() != null) removeExpr(parentExpr.getParentExpr());
3997                parentExpr.removeMe();
3998                break;
3999            case parenthesis_t:
4000                parentExpr.removeMe();
4001                break;
4002            case arithmetic_plus_t:
4003            case arithmetic_minus_t:
4004            case arithmetic_times_t:
4005            case arithmetic_divide_t:
4006            case arithmetic_modulo_t:
4007            case bitwise_exclusive_or_t:
4008            case bitwise_or_t:
4009            case bitwise_and_t:
4010            case bitwise_xor_t:
4011            case logical_xor_t:
4012            case concatenate_t:
4013            case logical_and_t:
4014            case logical_or_t:
4015                if (this.getNodeStatus() == ENodeStatus.nsRemoved){
4016                    // this node is removed cascade
4017                    if (this.isLeftOperandOfParent()){
4018                        if ((this.getParentExpr().getRightOperand() != null)&&(this.getParentExpr().getRightOperand().getNodeStatus() != ENodeStatus.nsRemoved)){
4019                            this.getParentExpr().refreshAllNodesTokenCount();
4020                            this.getParentExpr().removeTokensBetweenToken(this.getParentExpr().getStartToken(),this.getParentExpr().getRightOperand().getStartToken().getPrevTokenInChain());
4021                            this.getParentExpr().updateNodeWithTheSameStartToken(TParseTreeNode.nodeChangeStartToken ,this.getParentExpr().getRightOperand().getStartToken());
4022                        }
4023                    }else if (this.isRightOperandOfParent()){
4024                        if ((this.getParentExpr().getLeftOperand() != null)&&(this.getParentExpr().getLeftOperand().getNodeStatus() != ENodeStatus.nsRemoved)){
4025                            this.getParentExpr().refreshAllNodesTokenCount();
4026                            this.getParentExpr().removeTokensBetweenToken(this.getParentExpr().getLeftOperand().getEndToken().getNextTokenInChain(),this.getParentExpr().getEndToken());
4027                            this.getParentExpr().updateMeNodeWithTheSameEndToken(TParseTreeNode.nodeChangeEndToken ,this.getParentExpr().getLeftOperand().getEndToken());
4028                        }
4029                    }
4030                }else{
4031                    TParseTreeNode.removeTokensBetweenNodes(parentExpr.leftOperand,parentExpr.rightOperand);
4032                }
4033
4034                this.removeTokens();
4035                if (parentExpr.getNodeStatus() == ENodeStatus.nsRemoved){
4036                    parentExpr.removeMe();
4037                }
4038                break;
4039            case simple_comparison_t:
4040            case is_distinct_from_t:
4041            case group_comparison_t:
4042            case in_t:
4043                parentExpr.removeMe();
4044                break;
4045            case between_t:
4046                parentExpr.removeMe();
4047                break;
4048            case unary_plus_t:
4049            case unary_minus_t:
4050            case unary_prior_t:
4051            case pattern_matching_t:
4052            case power_t:
4053            case range_t:
4054            case period_ldiff_t:
4055            case period_rdiff_t:
4056            case period_p_intersect_t:
4057            case period_p_normalize_t:
4058            case contains_t:
4059            case assignment_t:
4060            case sqlserver_proprietary_column_alias_t:
4061            case scope_resolution_t:
4062            case at_time_zone_t:
4063            case member_of_t:
4064            case arithmetic_exponentiation_t:
4065            case submultiset_t:
4066            case overlaps_t:
4067            case at_local_t:
4068            case day_to_second_t:
4069            case year_to_month_t:
4070            case exponentiate_t:
4071            case floating_point_t:
4072            case is_t:
4073            case logical_not_t:
4074            case null_t:
4075            case is_not_null_t:
4076            case is_true_t:
4077            case is_false_t:
4078            case is_not_true_t:
4079            case is_not_false_t:
4080            case is_of_type_t:
4081            case collate_t: //sql server,postgresql
4082            case left_join_t:
4083            case right_join_t:
4084            case ref_arrow_t:
4085            case typecast_t:
4086            case arrayaccess_t:
4087            case unary_connect_by_root_t:
4088            case interval_t:
4089            case unary_binary_operator_t:
4090            case left_shift_t:
4091            case right_shift_t:
4092            case array_constructor_t:
4093            case objectConstruct_t:
4094            case row_constructor_t:
4095            case namedParameter_t:
4096            case positionalParameter_t:
4097            case collectionArray_t:
4098            case collectionCondition_t:
4099            case unary_squareroot_t:
4100            case unary_cuberoot_t:
4101            case unary_factorialprefix_t:
4102            case unary_absolutevalue_t:
4103            case unary_bitwise_not_t:
4104            case unary_factorial_t:
4105            case bitwise_shift_left_t:
4106            case bitwise_shift_right_t:
4107            case multiset_union_t:
4108            case multiset_union_distinct_t:
4109            case multiset_intersect_t:
4110            case multiset_intersect_distinct_t:
4111            case multiset_except_t:
4112            case multiset_except_distinct_t:
4113            case json_get_text:
4114            case json_get_text_at_path:
4115            case json_get_object:
4116            case json_get_object_at_path:
4117            case json_left_contain:
4118            case json_right_contain:
4119            case json_exist:
4120            case json_any_exist:
4121            case json_all_exist:
4122            case interpolate_previous_value_t:
4123            case unnest_t:
4124                if (leftOperand != null){
4125                    leftOperand.removeMe();
4126                }else if (rightOperand != null){
4127                    rightOperand.removeMe();
4128                }
4129
4130                break;
4131            case lambda_t:
4132                leftOperand.removeMe();
4133                rightOperand.removeMe();
4134                break;
4135            case teradata_at_t:
4136                leftOperand.removeMe();
4137                rightOperand.removeMe();
4138                break;
4139            default:
4140                parentExpr.removeMe();
4141                break;
4142        }
4143    }
4144
4145public void remove2(){
4146    if (TParseTreeNode.doubleLinkedTokenListToString){
4147        removeMe();
4148    }else{
4149        if (parentExpr == null){
4150            removeAllMyTokensFromTokenList(null);
4151        }else if ((parentExpr.getExpressionType() == EExpressionType.logical_and_t)
4152                ||(parentExpr.getExpressionType() == EExpressionType.logical_or_t))
4153        {
4154            removeAllMyTokensFromTokenList(parentExpr.getOperatorToken());
4155            if ((parentExpr.getLeftOperand().getStartToken() == null)&&(parentExpr.getRightOperand().getStartToken() == null)){
4156                parentExpr.remove2();
4157            }
4158        }else if (parentExpr.getExpressionType() == EExpressionType.parenthesis_t){
4159            removeAllMyTokensFromTokenList(null);
4160            parentExpr.remove2();
4161        }else{
4162            removeAllMyTokensFromTokenList(null);
4163        }
4164    }
4165}
4166
4167    public void remove(){
4168
4169        if (this.getExpressionType() == EExpressionType.removed_t) return;
4170
4171        this.setExpressionType(EExpressionType.removed_t);
4172        TExpression parentExpr = this.getParentExpr();
4173
4174        if (parentExpr == null) return;
4175
4176        switch (parentExpr.getExpressionType()){
4177            case list_t: // (1,2,3) in (column1,column2,column3)
4178                // remove column1 will break this expr, so need to remove parent expr of list_t as well.
4179                //if (parentExpr.getParentExpr() != null) removeExpr(parentExpr.getParentExpr());
4180                parentExpr.remove();
4181                break;
4182            case pattern_matching_t:
4183                parentExpr.remove();
4184                break;
4185            case unary_plus_t:
4186            case unary_minus_t:
4187            case unary_prior_t:
4188                parentExpr.remove();
4189                break;
4190            case arithmetic_plus_t:
4191            case arithmetic_minus_t:
4192            case arithmetic_times_t:
4193            case arithmetic_divide_t:
4194            case power_t:
4195            case range_t:
4196            case period_ldiff_t:
4197            case period_rdiff_t:
4198            case period_p_intersect_t:
4199            case period_p_normalize_t:
4200            case contains_t:
4201                parentExpr.remove();
4202                break;
4203            case assignment_t:
4204                parentExpr.remove();
4205                break;
4206            case sqlserver_proprietary_column_alias_t:
4207                parentExpr.remove();
4208                break;
4209            case arithmetic_modulo_t:
4210            case bitwise_exclusive_or_t:
4211            case bitwise_or_t:
4212            case bitwise_and_t:
4213            case bitwise_xor_t:
4214            case exponentiate_t:
4215            case scope_resolution_t:
4216            case at_time_zone_t:
4217            case member_of_t:
4218            case arithmetic_exponentiation_t:
4219            case submultiset_t:
4220            case overlaps_t:
4221                parentExpr.remove();
4222                break;
4223            case at_local_t:
4224            case day_to_second_t:
4225            case year_to_month_t:
4226                parentExpr.remove();
4227                break;
4228            case parenthesis_t:
4229                parentExpr.remove();
4230                break;
4231            case simple_comparison_t:
4232            case is_distinct_from_t:
4233                parentExpr.remove();
4234                break;
4235            case group_comparison_t:
4236                parentExpr.remove();
4237                break;
4238            case in_t:
4239                parentExpr.remove();
4240                break;
4241            case floating_point_t:
4242                parentExpr.remove();
4243                break;
4244            case logical_xor_t:
4245            case is_t:
4246                parentExpr.remove();
4247                break;
4248            case logical_not_t:
4249                parentExpr.remove();
4250                break;
4251            case null_t:
4252            case is_not_null_t:
4253            case is_true_t:
4254            case is_false_t:
4255            case is_not_true_t:
4256            case is_not_false_t:
4257                parentExpr.remove();
4258                break;
4259            case between_t:
4260                parentExpr.remove();
4261                break;
4262            case is_of_type_t:
4263                parentExpr.remove();
4264                break;
4265            case collate_t: //sql server,postgresql
4266                parentExpr.remove();
4267                break;
4268            case left_join_t:
4269            case right_join_t:
4270                parentExpr.remove();
4271                break;
4272            case ref_arrow_t:
4273                parentExpr.remove();
4274                break;
4275            case typecast_t:
4276                parentExpr.remove();
4277                break;
4278            case arrayaccess_t:
4279                parentExpr.remove();
4280                break;
4281            case unary_connect_by_root_t:
4282                parentExpr.remove();
4283                break;
4284            case interval_t:
4285                parentExpr.remove();
4286                break;
4287            case unary_binary_operator_t:
4288                parentExpr.remove();
4289                break;
4290            case left_shift_t:
4291            case right_shift_t:
4292                parentExpr.remove();
4293                break;
4294            case array_constructor_t:
4295                parentExpr.remove();
4296                break;
4297            case objectConstruct_t:
4298                parentExpr.remove();
4299                break;
4300            case row_constructor_t:
4301                parentExpr.remove();
4302                break;
4303            case namedParameter_t:
4304                parentExpr.remove();
4305                break;
4306            case positionalParameter_t:
4307                parentExpr.remove();
4308                break;
4309            case collectionArray_t:
4310                parentExpr.remove();
4311                break;
4312            case collectionCondition_t:
4313                parentExpr.remove();
4314                break;
4315            case unary_squareroot_t:
4316            case unary_cuberoot_t:
4317            case unary_factorialprefix_t:
4318            case unary_absolutevalue_t:
4319            case unary_bitwise_not_t:
4320                parentExpr.remove();
4321                break;
4322            case unary_factorial_t:
4323                parentExpr.remove();
4324                break;
4325            case bitwise_shift_left_t:
4326            case bitwise_shift_right_t:
4327                parentExpr.remove();
4328                break;
4329            case multiset_union_t:
4330            case multiset_union_distinct_t:
4331            case multiset_intersect_t:
4332            case multiset_intersect_distinct_t:
4333            case multiset_except_t:
4334            case multiset_except_distinct_t:
4335                parentExpr.remove();
4336                break;
4337            case json_get_text:
4338            case json_get_text_at_path:
4339            case json_get_object:
4340            case json_get_object_at_path:
4341            case json_left_contain:
4342            case json_right_contain:
4343            case json_exist:
4344            case json_any_exist:
4345            case json_all_exist:
4346            case lambda_t:
4347                parentExpr.remove();
4348                break;
4349            case interpolate_previous_value_t:
4350                parentExpr.remove();
4351                break;
4352            case concatenate_t:
4353            case logical_and_t:
4354            case logical_or_t:
4355                if (this == parentExpr.getLeftOperand()){
4356                    parentExpr.getRightOperand().copyTo(parentExpr);
4357                }else if (this == parentExpr.getRightOperand()){
4358                    parentExpr.getLeftOperand().copyTo(parentExpr);
4359                }
4360
4361                break;
4362            case unnest_t:
4363                leftOperand.remove();
4364                break;
4365            default:
4366                parentExpr.remove();
4367                break;
4368        }
4369
4370    }
4371
4372    public void copyTo(TExpression target){
4373        target.setExpressionType(this.getExpressionType());
4374        target.setLeftOperand(this.getLeftOperand());
4375        target.setRightOperand(this.getRightOperand());
4376        target.setObjectOperand(this.getObjectOperand());
4377        target.setFunctionCall(this.getFunctionCall());
4378        target.setSubQuery(this.getSubQuery());
4379        target.setConstantOperand(this.getConstantOperand());
4380        target.setExprList(this.getExprList());
4381        target.setOperatorToken(this.getOperatorToken());
4382        target.setComparisonOperator(this.getComparisonOperator());
4383        target.setBetweenOperand(this.getBetweenOperand());
4384        target.setCaseExpression(this.getCaseExpression());
4385
4386        target.setLikeEscapeOperand(this.getLikeEscapeOperand());
4387        target.setNotToken(this.getNotToken());
4388        target.setQuantifier(this.getQuantifier());
4389        target.setQuantifierType(this.getQuantifierType());
4390
4391    }
4392
4393    public static TExpression mergeObjectNameList(TExpression expr, TObjectNameList objectNameList){
4394        TExpression ret = null;
4395        if (expr.expressionType == EExpressionType.simple_object_name_t){
4396            TObjectName objectName = expr.getObjectOperand();
4397            objectName.appendObjectName(objectNameList.getObjectName(0));
4398            ret = expr;
4399        }
4400        return ret;
4401    }
4402
4403
4404    private TColumnDefinitionList colDefList = null;
4405    public TColumnDefinitionList getcolDefList() {
4406                return colDefList;
4407        }
4408
4409    public final static int  BigAndOrNestLevel = 100;
4410    /**
4411     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#not_initialized_yet_t}
4412     */
4413    public final static int unknown = 0;
4414
4415    /**
4416     * Addition: expr + expr
4417     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4418     */
4419    /**
4420     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#arithmetic_plus_t}
4421     */
4422    public final static int PLUS        = 1;
4423
4424    /**
4425     * syntax: expr - expr
4426     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4427     */
4428    /**
4429     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#arithmetic_minus_t}
4430     */
4431    public final static int MINUS       = 2;
4432
4433    /**
4434     * syntax: expr * expr
4435     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4436     */
4437    /**
4438     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#arithmetic_times_t}
4439     */
4440    public final static int TIMES       = 3;
4441
4442    /**
4443     * syntax: expr / expr
4444     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4445     */
4446    /**
4447     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#arithmetic_divide_t}
4448     */
4449    public final static int DIVIDE      = 4;
4450
4451    /**
4452     * Links two string operands to form a string expression.
4453     * <p>syntax: expr || expr,
4454     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4455     */
4456    /**
4457     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#concatenate_t}
4458     */
4459    public final static int CONCATENATE = 5;
4460
4461    /**
4462     * SQL SERVER,TERADATE(mod)
4463     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4464     */
4465    /**
4466     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#arithmetic_modulo_t}
4467     */
4468    public final static int MODULO = 6; //
4469
4470    /**
4471     * Used in set clause of update statement.
4472     * <p> Or, assign argument in postgresql function argument like this:
4473     * <p> param_name ASSIGN_SIGN basic_expr
4474     * <P> expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4475     */
4476    /**
4477     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#assignment_t}
4478     */
4479    public final static int ASSIGNMENT = 7; //
4480
4481    /**
4482     * SQL SERVER, postgresql
4483     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4484     */
4485    /**
4486     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#bitwise_and_t}
4487     */
4488    public final static int BITWISE_AND = 8;
4489
4490    /**
4491     * SQL SERVER, postgresql
4492     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4493     */
4494    /**
4495     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#bitwise_or_t}
4496     */
4497    public final static int BITWISE_OR = 9;
4498
4499    /**
4500     * MySQL, postgresql
4501     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4502     */
4503    /**
4504     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#bitwise_xor_t}
4505     */
4506    public final static int BITWISE_XOR = 10; //
4507
4508    /**
4509     * SQL SERVER
4510     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4511     */
4512    /**
4513     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#bitwise_exclusive_or_t}
4514     */
4515    public final static int BITWISE_EXCLUSIVE_OR = 11;
4516
4517    /**
4518     * SQL SERVER
4519     * <p>The scope resolution operator :: provides access to static members of a compound data type,
4520     * SELECT @hid = hierarchyid::GetRoot();
4521     * <p>Not implemented yet,
4522     */
4523    /**
4524     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#scope_resolution_t}
4525     */
4526    public final static int SCOPE_RESOLUTION = 12; //
4527
4528    /**
4529     * teradata ** , Postgresql ^
4530     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4531     */
4532    /**
4533     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#exponentiate_t}
4534     */
4535    public final static int  EXPONENTIATE = 13; //
4536
4537    /**
4538     * sql server 2008 +=,-=,*=,/=,%=
4539     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4540     */
4541    /**
4542     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#arithmetic_compound_operator_t}
4543     */
4544    public final static int  compoundAssignment = 14;
4545
4546    /**
4547     * specifies a column, pseudocolumn, sequence number,
4548     * value can be get via {@link #getObjectOperand()} which is type of {@link TObjectName}.
4549     */
4550    /**
4551     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#simple_object_name_t}
4552     */
4553    public final static int simpleObjectname = 15;
4554
4555    /**
4556     * specifies a constant,
4557     * value can be get via {@link #getConstantOperand()}
4558     */
4559    /**
4560     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#simple_constant_t}
4561     */
4562    public final static int simpleConstant = 16;
4563
4564    /**
4565     * specifies a null,
4566     * value can be get via {@link #getSourcetokenOperand()} which is type of {@link TSourceToken}.
4567     */
4568    /**
4569     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#simple_source_token_t}
4570     */
4571    public final static int simpleSourcetoken = 17;
4572
4573    /**
4574     * expression with parenthesis,
4575     * expr can be get via {@link #getLeftOperand()} which is type of {@link TExpression}.
4576     */
4577    /**
4578     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#parenthesis_t}
4579     */
4580    public final static int compoundParenthesis = 18;
4581
4582    /**
4583     * unary plus expression,
4584     * <p>syntax: + expression
4585     * <p>expr can be accessed via {@link #getRightOperand()}
4586     */
4587    /**
4588     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#unary_plus_t}
4589     */
4590    public final static int compoundUnaryPlus = 19;
4591
4592    /**
4593     * unary minus expression,
4594     * <p>syntax: - expression
4595     * <p>expr can be accessed via {@link #getRightOperand()}
4596     */
4597    /**
4598     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#unary_minus_t}
4599     */
4600    public final static int compoundUnaryMinus = 20;
4601
4602    /**
4603     * Oracle prior expression, syntax: PRIOR expr
4604     * value can be accessed via {@link #getRightOperand()} which is type of {@link TExpression}
4605     */
4606    /**
4607     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#unary_prior_t}
4608     */
4609    public final static int compoundPrior = 21;
4610
4611    /**
4612     * CASE expressions let you use IF ... THEN ... ELSE logic in SQL statements without
4613     * having to invoke procedures.
4614     * value can be accessed via {@link #getCaseExpression()} which is type of {@link TCaseExpression}.
4615     */
4616    /**
4617     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#case_t}
4618     */
4619    public final static int caseExprOperator = 22;
4620
4621    /**
4622     * A CURSOR expression returns a nested cursor.
4623     * <p>syntax: CURSOR(subquery ),
4624     * <p>subquery can be accessed via {@link #getSubQuery()} which is type of {@link TSelectSqlStatement}.
4625     */
4626    /**
4627     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#cursor_t}
4628     */
4629    public final static int cursorExprOperator = 23;
4630
4631    /**
4632     * funcation expression,
4633     * <p>value can be get via {@link #getFunctionCall()}
4634    */
4635    /**
4636     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#function_t}
4637     */
4638    public final static int funcationCallOperator = 24;
4639
4640
4641    /**
4642     * datetime expression
4643     * <p>N/A
4644     */
4645    /**
4646     * @deprecated As of v1.4.3.0
4647     */
4648    public final static int datetimeExprOperator = 25;
4649
4650    /**
4651     * interval expression
4652     * <p>N/A
4653     */
4654    /**
4655     * @deprecated As of v1.4.3.0
4656     */
4657    public final static int intervalExprOperator = 26;
4658
4659
4660    /**
4661     * model expression, not implemented yet
4662     * <p>N/A
4663     */
4664    /**
4665     * @deprecated As of v1.4.3.0
4666     */
4667    public final static int modelExprOperator = 27;
4668
4669    /**
4670     * A scalar subquery expression is a subquery that returns exactly one column value
4671     * from one row.
4672     * <br>value can be get via {@link #getSubQuery()} which is type of {@link TSelectSqlStatement}.
4673     */
4674    /**
4675     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#subquery_t}
4676     */
4677    public final static int subqueryExprOperator = 28;
4678
4679    //
4680    /**
4681     * type constructor expression,
4682     * <p>not implemented yet
4683     */
4684    /**
4685     * @deprecated As of v1.4.3.0
4686     */
4687    public final static int typeconstructorExprOperator = 29;
4688
4689
4690    /**
4691     * object access expression, some of those was represented by simpleObjectname expression.
4692     * <p>N/A
4693     */
4694    /**
4695     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#object_access_t}
4696     */
4697    public final static int objectaccessExprOperator = 30;
4698
4699    // model conditions is not implemented yet
4700    // multiset conditions is not implemented yet
4701
4702    /**
4703     * pattern matching conditon support like only, regexp_like was treat as a function
4704     * <p>N/A
4705     */
4706    //public final static int patternMatchingExprOperator = 31;
4707    //xml conditon not implemented here, treat as a function
4708
4709
4710    /**
4711     * place holder expression
4712     */
4713    /**
4714     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#place_holder_t}
4715     */
4716    public final static int placeholderExprOperator = 32;
4717
4718    /**
4719     * IN expr, values can be get via {@link #getInExpr()}
4720     */
4721    /**
4722     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#group_t}
4723     */
4724    public final static int in_expr = 34;
4725
4726    /**
4727     * row descriptor, values can be get via {@link #getExprList()}
4728     */
4729    /**
4730     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#list_t}
4731     */
4732    public final static int expr_list = 35;
4733
4734    // dummy expression operator, used in preOrderTraverse,inOrderTraverse, postOrderTraverse function only.
4735    /**
4736     * @deprecated As of v1.4.3.0
4737     */
4738    public final static int dummyOperator = 37;
4739
4740    /**
4741     * Comparison conditions compare one expression with another.
4742     * The result of such a comparison can be TRUE, FALSE, or NULL.
4743     *
4744     * A simple comparison condition specifies a comparison with expressions or subquery results.
4745     * <p>Syntax: expr EQUAL|NOT_EQUAL|LESS_THAN|GRREAT_THAN|LESS_EQUAL_THAN|GREATE_EQUAL_THAN expr,
4746     * or, (expr_list) EQUAL|NOT_EQUAL (subquery)
4747     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4748     */
4749    /**
4750     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#simple_comparison_t}
4751     */
4752    public final static int simple_comparison_conditions = 40;
4753
4754    /**
4755     * Comparison conditions compare one expression with another.
4756     * The result of such a comparison can be TRUE, FALSE, or NULL.
4757     *
4758     * <p>A group comparison condition specifies a comparison with any or all members
4759     * in a list or subquery.
4760     * <p>Syntax: expr EQUAL|NOT_EQUAL|LESS_THAN|GRREAT_THAN|LESS_EQUAL_THAN|GREATE_EQUAL_THAN ANY|SOME|ALL (expr_list|subquery),
4761     * or, (expr_list) EQUAL|NOT_EQUAL ANY|SOME|ALL (expr_list|subquery)
4762     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4763     */
4764    /**
4765     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#group_comparison_t}
4766     */
4767    public final static int group_comparison_conditions = 41;
4768
4769    /**
4770     * An in_condition is a membership condition. It tests a value for membership in a list of values or subquery.
4771     * <p>Syntax: (expr|expr_list) IN|NOT IN (expr_list|subquery).
4772     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4773     * <p>Use {@link #getOperatorToken()} to distinguish in or not in.
4774     */
4775    /**
4776     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#in_t}
4777     */
4778    public final static int in_conditions = 42;
4779
4780    /**
4781     * The ORACLE floating-point conditions let you determine whether an expression is infinite or is the undefined result of an operation (is not a number or NaN).
4782     * <p>Syntax: expr IS|IS NOT (NAM|INFINITE).
4783     * <p>Value can be get via  {@link #getLeftOperand()}
4784     */
4785    /**
4786     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#floating_point_t}
4787     */
4788    public final static int floating_point_conditions = 43;
4789
4790    /**
4791     * The pattern-matching conditions compare character data.
4792     * <p>The LIKE conditions specify a test involving pattern matching.
4793     * <p>Syntax: expr1 LIKE|NOT_LIKE expr1 [ESCAPE expr3],
4794     * <p>expr1 can be get via {@link #getLeftOperand()},
4795     * <p>expr2 can be get via  {@link #getRightOperand()},
4796     * <p>expr3 can be get via  {@link #getLikeEscapeOperand()},
4797     * <p>Use {@link #getOperatorToken()} to distinguish is like or is not like
4798     */
4799    /**
4800     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#pattern_matching_t}
4801     */
4802    public final static int pattern_matching_conditions = 45;
4803
4804    /**
4805     * A NULL condition tests for nulls. This is the only condition that you should use to test for nulls.
4806     * <p>Syntax: expr IS [NOT] null
4807     * <p>expr can be accessed via {@link #getLeftOperand()}
4808     * <p>Use {@link #getOperatorToken()} to distinguish is null or is not null
4809     */
4810    /**
4811     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#null_t}
4812     */
4813    public final static int null_conditions = 46;
4814
4815    /**
4816     * A BETWEEN condition determines whether the value of one expression is in an interval defined by two other expressions.
4817     * <p>Syntax: expr1 [NOT] BETWEEN expr2 AND expr3
4818     * <p>expr1 can be get via {@link #betweenOperand},
4819     * <p>expr2 can be get via {@link #getLeftOperand()}, and expr3 can be get via {@link #getRightOperand()},
4820     * <p>Use {@link #getOperatorToken()} to distinguish is between or is not between
4821     */
4822    /**
4823     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#between_t}
4824     */
4825    public final static int between_conditions = 47;
4826
4827    /**
4828     * An EXISTS condition tests for existence of rows in a subquery.
4829     * <p>Syntax: EXISTS (subquery).
4830     * <p>value of subquery can be get via {@link #getSubQuery()}
4831     */
4832    /**
4833     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#exists_t}
4834     */
4835    public final static int exists_condition = 48;
4836
4837    /**
4838     * <p>expr can be accessed via {@link #getLeftOperand()}
4839     */
4840    /**
4841     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#is_of_type_t}
4842     */
4843    public final static int isoftype_condition = 49;
4844
4845    /**
4846     * A logical condition combines the results of two component conditions to produce a single result based on them or to invert the result of a single condition.
4847     *<p> Syntax: expr AND expr.
4848     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4849     */
4850    /**
4851     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#logical_and_t}
4852     */
4853    public final static int logical_conditions_and = 50;
4854
4855    /**
4856     * A logical condition combines the results of two component conditions to produce a single result based on them or to invert the result of a single condition.
4857     * <p>Syntax: expr OR expr.
4858     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4859     */
4860    /**
4861     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#logical_or_t}
4862     */
4863    public final static int logical_conditions_or = 51;
4864
4865    /**
4866     * A logical condition combines the results of two component conditions to produce a single result based on them or to invert the result of a single condition.
4867     * <p>Syntax: expr XOR expr.
4868     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4869     */
4870    /**
4871     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#logical_xor_t}
4872     */
4873    public final static int logical_conditions_xor = 52;
4874
4875    /**
4876     * A logical condition combines the results of two component conditions to produce a single result based on them or to invert the result of a single condition.
4877     * <p>Syntax: NOT expr.
4878     * <p>value can be get via {@link #rightOperand},
4879     */
4880    /**
4881     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#logical_not_t}
4882     */
4883    public final static int logical_conditions_not = 53;
4884
4885    /**
4886     * Mdx is logical condition
4887     */
4888    /**
4889     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#is_t}
4890     */
4891    public final static int logical_conditions_is = 54;
4892
4893
4894    /**
4895     * Mdx range operator :
4896     */
4897    /**
4898     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#range_t}
4899     */
4900    public final static int RANGE = 55;
4901
4902    /**
4903     *   mdx power operator ^
4904     */
4905    /**
4906     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#power_t}
4907     */
4908    public final static int POWER = 56; //
4909
4910    /**
4911     * ORACLE,teradata date time expression, at time zone.
4912     * <p>Syntax: expr1 AT TIME ZONE expr2
4913     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4914     */
4915    /**
4916     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#at_time_zone_t}
4917     */
4918    public final static int at_time_zone = 100;
4919
4920
4921    /**
4922     * ORACLE,teradata date time expression, at local.
4923     * <p>Syntax: expr AT LOCAL.
4924     * <p>expr can be accessed via {@link #getLeftOperand()}
4925     */
4926    /**
4927     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#at_local_t}
4928     */
4929    public final static int at_local = 101;
4930
4931    /**
4932     * ORACLE date time expression, day to second.
4933     * <p>Syntax: expr DAY [( integer )] TO SECOND [( integer )].
4934     * <p>expr cam be get via {@link #getLeftOperand()}.
4935     * <p>The type of this operand is {@link TExpression}.
4936     */
4937    /**
4938     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#day_to_second_t}
4939     */
4940    public final static int day_to_second = 102;
4941
4942    /**
4943     * ORACLE date time expression, year to month.
4944     *<p> Syntax: expr YEAR [( integer )] TO MONTH.
4945     * <p>expr can be accessed via {@link #getLeftOperand()}
4946     */
4947    /**
4948     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#year_to_month_t}
4949     */
4950    public final static int year_to_month = 103;
4951
4952    /**
4953     * teradata interval expression:
4954     * <p>( date_time_expression date_time_term ) start TO end
4955     * <p>{@link #getIntervalExpr()}
4956     */
4957    /**
4958     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#interval_t}
4959     */
4960    public final static int interval_expression = 104;
4961
4962    /**
4963     * teradata
4964     * Constructs a new instance of a structured type
4965     * and initializes it using the specified constructor method or function.
4966     *<p> object reference {@link TExpression#getFunctionCall()}
4967     */
4968    /**
4969     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#new_structured_type_t}
4970     */
4971    public final static int new_structured_type = 110;
4972
4973    /**
4974     * teradata
4975     * Constructs a new instance of a dynamic or VARIANT_TYPE UDT
4976     * and defines the run time composition of the UDT.
4977     * object reference {@link #getNewVariantTypeArgumentList()}
4978     */
4979    /**
4980     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#new_variant_type_t}
4981     */
4982    public final static int new_variant_type = 111;
4983
4984    /**
4985     * teradata period expression: ldiff
4986     * <p> expression can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4987     */
4988    /**
4989     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#period_ldiff_t}
4990     */
4991    public final static int period_ldiff = 115;
4992
4993    /**
4994     * teradata period expression: rdiff
4995     * <p> expression can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
4996     */
4997    /**
4998     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#period_rdiff_t}
4999     */
5000    public final static int period_rdiff = 117;
5001
5002    /**
5003     * teradata period expression: p_intersect
5004     * <p> expression can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
5005     */
5006    /**
5007     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#period_p_intersect_t}
5008     */
5009    public final static int period_p_intersect = 119;
5010
5011    /**
5012     * teradata period expression: p_normalize
5013     * <p> expression can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
5014     */
5015    /**
5016     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#period_p_normalize_t}
5017     */
5018    public final static int period_p_normalize = 121;
5019
5020    /**
5021     * teradata until changed condition
5022     * <p> syntax: END(period_value_expression) IS[NOT] UNTIL_CHANGED
5023     * <p> ending bound of a Period value expression can be accessed via {@link #getLeftOperand()}
5024     */
5025    /**
5026     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#until_changed_t}
5027     */
5028    public final static int until_changed = 123;
5029
5030    /**
5031     * Postgresql, is document condition
5032     * <p>expr is [not] document
5033     * <p> expr was set in {@link #leftOperand}.
5034     * <p> {@link #getOperatorToken()} can be used to check whether NOT keyword was used or not.
5035     */
5036    /**
5037     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#is_document_t}
5038     */
5039    public final static int is_document = 133;
5040
5041
5042    /**
5043     * Postgresql,
5044     * <p>expr is [not] distinct from expr
5045     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
5046     * <p> {@link #getOperatorToken()} can be used to check whether NOT keyword was used or not.
5047     */
5048    /**
5049     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#is_distinct_from_t}
5050     */
5051    public final static int is_distinct_from = 135;
5052
5053    /**
5054     * Postgresql
5055     * <p> true, false, unknown condition
5056     * <p> expr is [not] true
5057     * <p> expr is [not] false
5058     * <p> expr is [not] unknown
5059     * <p> expr can be accessed via {@link #getLeftOperand()}
5060     * <p> {@link #getOperatorToken()} can be used to check whether NOT keyword was used or not.
5061     */
5062    /**
5063     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#is_true_t},
5064     * {@link EExpressionType#is_false_t},{@link EExpressionType#is_unknown_t}
5065     */
5066    public final static int true_false_unknown = 137;
5067
5068
5069
5070    /**
5071     *  sql server, Is a clause that can be applied to a database definition or a column definition
5072     *  to define the collation, or to a character string expression to apply a collation cast.
5073     *
5074     * postgresql
5075     *
5076     *<p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
5077     */
5078    /**
5079     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#collate_t}
5080     */
5081    public final static int COLLATE = 200+23;
5082
5083    /**
5084     * sql server, LEFTJOIN_OP *=
5085     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
5086     */
5087    /**
5088     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#left_join_t}
5089     */
5090    public final static int LEFTJOIN_OP = 200+24; //
5091
5092    /**
5093     * sql server, RIGHTJOIN_OP =*
5094     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
5095     */
5096    /**
5097     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#right_join_t}
5098     */
5099    public final static int RIGHTJOIN_OP = 200+25; //
5100
5101    /**
5102     * plsql RAISE_APPLICATION_ERROR (num=> -20107,    msg=> 'Duplicate customer or order ID');
5103     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
5104     */
5105    /**
5106     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#ref_arrow_t}
5107     */
5108    public final static int ref_arrow = 200+26;//
5109
5110
5111    /**
5112     * plsql
5113     * <p>expr can be accessed via {@link #getLeftOperand()}
5114     */
5115    /**
5116     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#typecast_t}
5117     */
5118    public final static int typecast = 200+27;//
5119    /**
5120     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#arrayaccess_t}
5121     */
5122    public final static int arrayaccess = 200+28;//plsql array access
5123
5124    /**
5125     * oracle unary operator connect_by_root is only valid in hierarchical queries
5126     * <p>expr can be accessed via {@link #getRightOperand()}
5127     */
5128    /**
5129     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#unary_connect_by_root_t}
5130     */
5131    public final static int connect_by_root = 200+29; //
5132
5133    /**
5134     * SQL SERVER Proprietary syntax, set alias of a column in select list,
5135     * column expr in rightOperand.
5136     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
5137     */
5138    /**
5139     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#sqlserver_proprietary_column_alias_t}
5140     */
5141    public final static int sqlserver_proprietary_column_alias = 200+30; //
5142
5143
5144    /**
5145      MySQL binary operator, select binary 'a' = 'A'
5146     * <p>syntax: binary expr
5147     * <p>expr can be accessed via {@link #getRightOperand()}
5148     */
5149    /**
5150     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#unary_binary_operator_t}
5151     */
5152    public final static int mysql_binary_operator = 300;
5153
5154    /**
5155     * MySQL left shift
5156     * <p>Syntax: expr << expr.
5157     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
5158     */
5159    /**
5160     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#left_shift_t}
5161     */
5162    public final static int left_shift = 301;
5163
5164    /**
5165     * MySQL rigth shift
5166     * <p>Syntax: expr >> expr.
5167     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
5168     */
5169    /**
5170     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#right_shift_t}
5171     */
5172    public final static int right_shift = 302;
5173
5174    /**
5175     * Oracle MULTISET operator
5176     * <p>Syntax MULTISET (subquery)
5177     * <p> subquery can be get via {@link #getSubQuery()}
5178     */
5179    /**
5180     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#multiset_t}
5181     */
5182    public final static int multisetExprOperator = 310;
5183
5184    /**
5185     * If an expression yields a value of a composite type (row type), then a specific field of the row can be extracted by writing
5186     * <p> expression.fieldname
5187     * <p> In general the row expression must be parenthesized, but the parentheses can be omitted
5188     * <p> when the expression to be selected from is just a table reference or positional parameter.
5189     * <p> For example:
5190     * <p> mytable.mycolumn
5191     * <p> $1.somecolumn
5192     * <p> (rowfunction(a,b)).col3
5193     * <p>
5194     * <p> (Thus, a qualified column reference is actually just a special case of the field selection syntax.) An important special case is extracting a field from a table column that is of a composite type:
5195     * <p> (compositecol).somefield
5196     * <p> (mytable.compositecol).somefield
5197     * <p> The parentheses are required here to show that compositecol is a column name not a table name,
5198     * <p> or that mytable is a table name not a schema name in the second case.
5199     * <p>
5200     * <p> n a select list, you can ask for all fields of a composite value by writing .*:
5201     * <p> (compositecol).*
5202     * <p>
5203     * <p>
5204     * <p> When expression in following syntax, it will be marked as {@link #fieldSelection}, and check {@link #getFieldName()}
5205     * <p> (rowfunction(a,b)).col3
5206     * <p> (compositecol).somefield
5207     * <p> (mytable.compositecol).somefield
5208     * <p> (compositecol).*
5209     * <p>
5210     * <p> Otherwise, it will be marked as {@link #simpleObjectname}:
5211     * <p> mytable.mycolumn
5212     * <p> $1.somecolumn
5213     */
5214    /**
5215     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#fieldselection_t}
5216     */
5217    public final static int fieldSelection = 501;
5218
5219    /**
5220     * An array constructor is an expression that builds an array value using values for its member elements.
5221     * <p> like this: ARRAY[1,2,3+4]
5222     * <p> array element values can be accessed via {@link #getExprList()},
5223     * <p> or {@link #getExprList()} can be null when it is: array[]
5224     * <p>
5225     * <p> It is also possible to construct an array from the results of a subquery like this:
5226     * <p> SELECT ARRAY(SELECT oid FROM pg_proc WHERE proname LIKE 'bytea%');
5227     * <p> thus, subquery can be access via {@link #getSubQuery()}
5228     */
5229    /**
5230     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#array_constructor_t}
5231     */
5232    public final static int arrayConstructor = 505;     //postgresql
5233
5234    /**
5235     * A row constructor is an expression that builds a row value (also called a composite value) using values for its member fields.
5236     * <p> like this: ROW(1,2.5,'this is a test')
5237     * <p> element values can be accessed via {@link #getExprList()},
5238     * <p> or {@link #getExprList()} can be null when it is: row()
5239     */
5240    /**
5241     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#row_constructor_t}
5242     */
5243    public final static int rowConstructor = 509;
5244
5245    /**
5246     * Postgresql factorial:
5247     * <p> expr !
5248     * <p> expr can be accessed via {@link #getLeftOperand()}
5249     */
5250    /**
5251     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#unary_factorial_t}
5252     */
5253    public final static int factorial = 515;
5254
5255    /**
5256     * Postgresql square root
5257     * <p> |/ 25.0
5258     * <p> expr can be accessed via {@link #getRightOperand()}
5259     */
5260    /**
5261     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#unary_squareroot_t}
5262     */
5263    public final static int squareRoot = 517;
5264
5265    /**
5266     * Postgresql cube root
5267     * <p> ||/ 27.0
5268     * <p> expr can be accessed via {@link #getRightOperand()}
5269     */
5270    /**
5271     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#unary_cuberoot_t}
5272     */
5273    public final static int cubeRoot = 519;
5274
5275    /**
5276     * Postgresql factorial (prefix operator):
5277     * <p> !! 5
5278     * <p> expr can be accessed via {@link #getRightOperand()}
5279     */
5280    /**
5281     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#unary_factorialprefix_t}
5282     */
5283    public final static int factorialPrefix = 521;
5284
5285    /**
5286     * Postgresql absolute value
5287     * <p> @ -5.0
5288     * <p> expr can be accessed via {@link #getRightOperand()}
5289     */
5290    /**
5291     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#unary_absolutevalue_t}
5292     */
5293    public final static int absoluteValue = 523;
5294
5295    /**
5296     * Postgresql bitwise shit left
5297     * <p> expr << expr
5298     * <p> expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
5299     */
5300    /**
5301     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#bitwise_shift_left_t}
5302     */
5303    public final static int BITWISE_SHIFT_LEFT = 525; //postgresql
5304
5305    /**
5306     * Postgresql bitwise shit right
5307     * <p> expr >> expr
5308     * <p> expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
5309     */
5310    /**
5311     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#bitwise_shift_right_t}
5312     */
5313    public final static int BITWISE_SHIFT_RIGHT = 527; //postgresql
5314
5315    /**
5316     * Postgresql bitwise not
5317     * <p> ~expr
5318     * <p> expr can be accessed via {@link #getRightOperand()}
5319     */
5320    /**
5321     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#unary_bitwise_not_t}
5322     */
5323    public final static int BITWISE_NOT = 529; //postgresql
5324
5325    /**
5326     * sql server
5327     * <p>expr can be accessed via {@link #getRightOperand()}
5328     */
5329
5330    /**
5331     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#unary_bitwise_not_t}
5332     */
5333    public final static int compoundUnaryBitwiseNot = 200+22; //
5334
5335    //
5336
5337    /**
5338     * ORACLE
5339     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
5340     */
5341    /**
5342     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#member_of_t}
5343     */
5344    public final static int member_of = 541;
5345
5346    /**
5347     * Netezza
5348     * <p>NEXT VALUE FOR <sequence name>
5349     * <p>NEXT <integer expression> VALUE FOR <sequence name>
5350     * <p> integer expression can be accessed via {@link #getLeftOperand()} if any.
5351     * <p> sequence name name can be accessed via {@link #getRightOperand()}
5352     */
5353
5354    /**
5355     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#next_value_for_t}
5356     */
5357    public final static int nextValueOf = 601;
5358
5359    /**
5360     * This UnknownOperator means this expression was not recognized by SQL parser yet.
5361     * <p>In syntax like this:
5362     * <p> expr OPERATOR expr
5363     * <p>expr can be accessed via {@link #getLeftOperand()} and {@link #getRightOperand()}
5364     */
5365    /**
5366     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#unknown_t}
5367     */
5368    public final static int UnknownOperator = 901;
5369
5370
5371    /**
5372     * This UnknownLeftUnaryOperator means this expression was not recognized by SQL parser yet.
5373     * <p>In syntax like this:
5374     * <p> OPERATOR expr
5375     * <p>expr can be accessed via {@link #getRightOperand()}
5376     */
5377    /**
5378     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#unary_left_unknown_t}
5379     */
5380    public final static int UnknownUnaryOperator = 905;
5381
5382    /**
5383     * This UnknownLeftUnaryOperator means this expression was not recognized by SQL parser yet.
5384     * <p>In syntax like this:
5385     * <p> expr OPERATOR
5386     * <p>expr can be accessed via {@link #getLeftOperand()}
5387     */
5388    /**
5389     * @deprecated As of v1.4.3.0, replaced by {@link EExpressionType#unary_right_unknown_t}
5390     */
5391    public final static int UnknownUnaryOperatorRight = 909;
5392
5393
5394}