Package com.foundationdb.server.types

Examples of com.foundationdb.server.types.TInstance


            ExpressionNode left = toExpression(between.getLeftOperand(), projects);
            ValueNodeList rightOperandList = between.getRightOperandList();
            ExpressionNode right1 = toExpression(rightOperandList.get(0), projects);
            ExpressionNode right2 = toExpression(rightOperandList.get(1), projects);
            DataTypeDescriptor sqlType = between.getType();
            TInstance type = typesTranslator.typeForSQLType(sqlType);
            conditions.add(new ComparisonCondition(Comparison.GE, left, right1, sqlType, null, type));
            conditions.add(new ComparisonCondition(Comparison.LE, left, right2, sqlType, null, type));
        }
View Full Code Here


                    combined = andConditions(combined, cond);
                }
                List<ExpressionNode> fields = new ArrayList<>(1);
                fields.add(combined);
                PlanNode subquery = new Project(source, fields);
                TInstance type = typesTranslator.typeForSQLType(in.getType());
                inCondition = new AnyCondition(new Subquery(subquery, peekEquivalenceFinder()), in.getType(), in, type);
            }
            if (in.isNegated()) {
                inCondition = negateCondition(inCondition, in);
            }
View Full Code Here

                    left = leftList.get(0);
                }
               
                ExpressionNode rightExp = toExpression(right, projects);
                ExpressionNode leftExp = toExpression(left, projects);
                TInstance type = typesTranslator.typeForSQLType(in.getType());
                return new ComparisonCondition(Comparison.EQ,
                                               leftExp, rightExp,
                                               in.getType(), in, type);
            }
        }
View Full Code Here

                    List<ConditionExpression> operands = new ArrayList<>(2);

                    operands.add(result);
                    operands.add(equalNode);

                    TInstance type = typesTranslator.typeForSQLType(in.getType());
                    result = new LogicalFunctionCondition("or", operands, in.getType(), in, type);
                }
            }
            return result;
        }
View Full Code Here

        }


        private void flattenAnyComparisons(List<ConditionExpression> conds, ValueNodeList leftOperandList, ExpressionsSource source,
                                           List<ExpressionNode> projects, DataTypeDescriptor sqlType) throws StandardException {
            TInstance type = typesTranslator.typeForSQLType(sqlType);
            for (ValueNode leftOperand : leftOperandList) {
                if (leftOperand instanceof RowConstructorNode) {
                    flattenAnyComparisons(conds, ((RowConstructorNode)leftOperand).getNodeList(), source,
                                          projects, sqlType);
                }
                else {
                    ExpressionNode left = toExpression(leftOperand, projects);
                    DataTypeDescriptor leftType = left.getSQLtype();
                    TInstance leftInst = typesTranslator.typeForSQLType(leftType);
                    ConditionExpression cond =
                        new ComparisonCondition(Comparison.EQ,
                                                left,
                                                new ColumnExpression(source, conds.size(), leftType, null, leftInst),
                                                sqlType, null, type);
View Full Code Here

                            throw new IllegalArgumentException("mismatched columns count in IN "
                                                               + "left : " + leftOperands.size() + ", right: " + operands.size());
                        for (int i = 0; i < leftOperands.size(); i++) {
                            ExpressionNode left = toExpression(leftOperands.get(i)
, projects);
                            TInstance type = typesTranslator.typeForSQLType(subqueryNode.getType());
                            ConditionExpression cond = new ComparisonCondition(comp, left, operands.get(i),
                                                                               subqueryNode.getType(), null, type);
                            inner = andConditions(inner, cond);
                        }
                    }
                    else {
                        if (operands.size() != 1)
                            throw new IllegalArgumentException("Subquery must have exactly one column");
                        multipleOperands = false;
                    }
                }
                if (!multipleOperands) {
                    ExpressionNode left = toExpression(leftOperand, projects);
                    TInstance type = typesTranslator.typeForSQLType(subqueryNode.getType());
                    inner = new ComparisonCondition(comp, left, operand,
                                                    subqueryNode.getType(),
                                                    subqueryNode,
                                                    type);
                }
                // We take this condition back off from the top of the
                // physical plan and move it to the expression, but it's
                // easier to think about the scoping as evaluated at the
                // end of the inner query.
                List<ExpressionNode> fields = new ArrayList<>(1);
                fields.add(inner);
                subquery = new Project(subquery, fields);
                if (distinct)
                    // See InConditionReverser#convert(Select,AnyCondition).
                    subquery = new Distinct(subquery);
                TInstance type = typesTranslator.typeForSQLType(subqueryNode.getType());
                condition = new AnyCondition(new Subquery(subquery, peekEquivalenceFinder()),
                                             subqueryNode.getType(), subqueryNode, type);
            }
            else if (subqueryNode.getSubqueryType() == SubqueryNode.SubqueryType.EXPRESSION) {
                ExpressionNode expression = toExpression(subqueryNode);
                condition = new BooleanCastExpression(expression, subqueryNode.getType(),
                        subqueryNode, expression.getType());
            }
            else {
                TInstance type = typesTranslator.typeForSQLType(subqueryNode.getType());
                condition = new ExistsCondition(new Subquery(subquery, peekEquivalenceFinder()),
                                                subqueryNode.getType(), subqueryNode, type);
            }
            if (negate) {
                condition = negateCondition(condition, subqueryNode);
View Full Code Here

                                            List<ExpressionNode> projects,
                                            UnaryOperatorNode unary)
                throws StandardException {
            List<ExpressionNode> operands = new ArrayList<>(1);
            operands.add(toExpression(unary.getOperand(), projects));
            TInstance type = typesTranslator.typeForSQLType(unary.getType());
            conditions.add(new FunctionCondition(unary.getMethodName(),
                                                 operands,
                                                 unary.getType(), unary, type));
        }
View Full Code Here

                                            BinaryOperatorNode binary)
                throws StandardException {
            List<ExpressionNode> operands = new ArrayList<>(2);
            operands.add(toExpression(binary.getLeftOperand(), projects));
            operands.add(toExpression(binary.getRightOperand(), projects));
            TInstance type = typesTranslator.typeForSQLType(binary.getType());
            conditions.add(new FunctionCondition(binary.getMethodName(),
                                                 operands,
                                                 binary.getType(), binary, type));
        }
View Full Code Here

           
            ValueNode third = ternary.getRightOperand();
            if (third != null)
                operands.add(toExpression(third, projects));

            TInstance type = typesTranslator.typeForSQLType(ternary.getType());
            conditions.add(new FunctionCondition(ternary.getMethodName(),
                                                 operands,
                                                 ternary.getType(), ternary, type));
        }
View Full Code Here

            boolean negated = false;
            if ("isNotNull".equals(function)) {
                function = "isNull";
                negated = true;
            }
            TInstance type = typesTranslator.typeForSQLType(isNull.getType());
            ConditionExpression cond = new FunctionCondition(function, operands,
                                                             isNull.getType(), isNull, type);
            if (negated) {
                cond = negateCondition(cond, isNull);
            }
View Full Code Here

TOP

Related Classes of com.foundationdb.server.types.TInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.