Package com.foundationdb.server.error

Examples of com.foundationdb.server.error.UnsupportedSQLException


                for (FullTextQuery operand : operands) {
                    queries.add(assembleFullTextQuery(operand, builder));
                }
                return builder.booleanQuery(queries, bquery.getTypes());
            }
            throw new UnsupportedSQLException("Full text query " + query, null);
        }
View Full Code Here


            else if (sexpr instanceof SubqueryResultSetExpression)
                return resultSetSubqueryExpression(operator, sexpr.getPreptimeValue(),
                                                   outerRowType, innerRowType,
                                                   bindingPosition);
            else
                throw new UnsupportedSQLException("Unknown subquery", sexpr.getSQLsource());
        }
View Full Code Here

                query = toAggregateSource(query, selectNode.getGroupByList(), projects);
                query = new Select(query, toConditions(selectNode.getHavingClause(), projects));
            }

            if (selectNode.hasWindows())
                throw new UnsupportedSQLException("WINDOW", selectNode);
       
            do_distinct:
            {
                // Distinct puts the Project before any Sort so as to only do one sort.
                if (selectNode.isDistinct()) {
View Full Code Here

                // No FROM list means one row with presumably constant Projects.
                input = new ExpressionsSource(Collections.singletonList(Collections.<ExpressionNode>emptyList()));
            }
            ConditionList conditions = toConditions(selectNode.getWhereClause());
            if (hasAggregateFunction(conditions))
                throw new UnsupportedSQLException("Aggregate not allowed in WHERE",
                                                  selectNode.getWhereClause());
            return new Select(input, conditions);
        }
View Full Code Here

                throws StandardException {
            Joinable result;
            if (fromTable instanceof FromBaseTable) {
                TableBinding tb = (TableBinding)fromTable.getUserData();
                if (tb == null)
                    throw new UnsupportedSQLException("FROM table",
                                                      fromTable);
                Table aisTable = (Table)tb.getTable();
                TableNode table = getTableNode(aisTable);
                String name = fromTable.getCorrelationName();
                if (name == null) {
                    if (aisTable.getName().getSchemaName().equals(rulesContext.getDefaultSchemaName()))
                        name = aisTable.getName().getTableName();
                    else
                        name = aisTable.getName().toString();
                }
                result = new TableSource(table, required, name);
            }
            else if (fromTable instanceof com.foundationdb.sql.parser.JoinNode) {
                com.foundationdb.sql.parser.JoinNode joinNode =
                    (com.foundationdb.sql.parser.JoinNode)fromTable;
                JoinType joinType;
                switch (joinNode.getNodeType()) {
                case NodeTypes.JOIN_NODE:
                    joinType = JoinType.INNER;
                    break;
                case NodeTypes.HALF_OUTER_JOIN_NODE:
                    if (((HalfOuterJoinNode)joinNode).isRightOuterJoin())
                        joinType = JoinType.RIGHT;
                    else
                        joinType = JoinType.LEFT;
                    break;
                default:
                    throw new UnsupportedSQLException("Unsupported join type", joinNode);
                }
                JoinNode join = joinNodes(toJoinNode((FromTable)joinNode.getLeftResultSet(),
                                                     required && (joinType != JoinType.RIGHT)),
                                          toJoinNode((FromTable)joinNode.getRightResultSet(),
                                                     required && (joinType != JoinType.LEFT)),
                                          joinType);
                join.setJoinConditions(toConditions(joinNode.getJoinClause()));
                result = join;
            }
            else if (fromTable instanceof FromSubquery) {
                FromSubquery fromSubquery = (FromSubquery)fromTable;
                PlanNode subquery = toQueryForSelect(fromSubquery.getSubquery(),
                                                     fromSubquery.getOrderByList(),
                                                     fromSubquery.getOffset(),
                                                     fromSubquery.getFetchFirst(),
                                                     false);
                result = new SubquerySource(new Subquery(subquery, peekEquivalenceFinder()),
                                            fromSubquery.getExposedName());
            }
            else
                throw new UnsupportedSQLException("Unsupported FROM non-table", fromTable);
            joinNodes.put(fromTable, result);
            return result;
        }
View Full Code Here

                throws StandardException {
            ConditionList conditions = new ConditionList();
            while (cnfClause != null) {
                if (cnfClause.isBooleanTrue()) break;
                if (!(cnfClause instanceof AndNode))
                    throw new UnsupportedSQLException("Unsupported complex WHERE",
                                                      cnfClause);
                AndNode andNode = (AndNode)cnfClause;
                cnfClause = andNode.getRightOperand();
                ValueNode condition = andNode.getLeftOperand();
                addCondition(conditions, condition, projects);
View Full Code Here

                    if (plan instanceof Project) {
                        Project project = (Project)plan;
                        if (needOperand) {
                            operands = project.getFields();
                            if (!multipleOperands && (operands.size() != 1))
                                throw new UnsupportedSQLException("Subquery must have exactly one column", subqueryNode);
                            operand = project.getFields().get(0);
                        }
                        // Don't need project any more.
                        if (prev != null)
                            prev.replaceInput(plan, next);
                        else
                            subquery = next;
                        break;
                    }
                    if (plan instanceof Distinct) {
                        distinct = true;
                    }
                    else {
                        prev = (PlanWithInput)plan;
                    }
                    plan = next;
                }
            }
            if ((operands == null) &&
                (subquery instanceof ColumnSource) &&
                (subquery instanceof TypedPlan)) {
                int nfields = ((TypedPlan)subquery).nFields();
                if (!multipleOperands && (nfields != 1))
                    throw new UnsupportedSQLException("Subquery must have exactly one column", subqueryNode);
                operands = new ArrayList<>(nfields);
                for (int i = 0; i < nfields; i++) {
                    operands.add(new ColumnExpression(((ColumnSource)subquery), i, null, null, null));
                }
                if (nfields > 0)
                    operand = operands.get(0);
            }
            if ((operands == null) &&
                (subquery instanceof ColumnSource) &&
                (subquery instanceof TypedPlan)) {
                int nfields = ((TypedPlan)subquery).nFields();
                if (!multipleOperands && (nfields != 1))
                    throw new UnsupportedSQLException("Subquery must have exactly one column", subqueryNode);
                operands = new ArrayList<>(nfields);
                for (int i = 0; i < nfields; i++) {
                    operands.add(new ColumnExpression(((ColumnSource)subquery), i, null, null, null));
                }
                if (nfields > 0)
View Full Code Here

                switch (condition.getNodeType()) {
                case NodeTypes.NOT_NODE:
                    functionName = "not";
                    break;
                default:
                    throw new UnsupportedSQLException("Unsuported condition", condition);
                }
                operands = new ArrayList<>(1);
                operands.add(toCondition(((UnaryLogicalOperatorNode)condition).getOperand(),
                                         projects));
            }
            else if (condition instanceof BinaryLogicalOperatorNode) {
                ValueNode leftOperand = ((BinaryLogicalOperatorNode)
                                         condition).getLeftOperand();
                ValueNode rightOperand = ((BinaryLogicalOperatorNode)
                                          condition).getRightOperand();
                switch (condition.getNodeType()) {
                case NodeTypes.AND_NODE:
                    // Can just fold straight into conjunction.
                    addCondition(conditions, leftOperand, projects);
                    if (!rightOperand.isBooleanTrue())
                        addCondition(conditions, rightOperand, projects);
                    return;
                case NodeTypes.OR_NODE:
                    if (rightOperand.isBooleanFalse()) {
                        addCondition(conditions, leftOperand, projects);
                        return;
                    }
                    functionName = "or";
                    break;
                default:
                    throw new UnsupportedSQLException("Unsuported condition", condition);
                }
                operands = new ArrayList<>(2);
                operands.add(toCondition(leftOperand, projects));
                operands.add(toCondition(rightOperand, projects));
            }
            else
                throw new UnsupportedSQLException("Unsuported condition", condition);
            TInstance type = typesTranslator.typeForSQLType(condition.getType());
            conditions.add(new LogicalFunctionCondition(functionName, operands,
                                                        condition.getType(), condition, type));
        }
View Full Code Here

                ExpressionNode expr = orderBy.getExpression();
                int idx = exprs.indexOf(expr);
                if (idx < 0) {
                    if (isDistinctSortNotSelectGroupBy())
                        return false;
                    throw new UnsupportedSQLException("SELECT DISTINCT requires that ORDER BY expressions be in the select list",
                                                      expr.getSQLsource());
                }
                adjustedOrderBys[i] = new ColumnExpression(project, idx,
                                                           expr.getSQLtype(),
                                                           expr.getSQLsource(),
View Full Code Here

            if (copyStmt.isHeader()) {
                csvFormat.setHeadings(getColumnNames());
            }
            break;
        default:
            throw new UnsupportedSQLException("COPY FORMAT " + format);
        }
        return this;
    }
View Full Code Here

TOP

Related Classes of com.foundationdb.server.error.UnsupportedSQLException

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.