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