Package com.salesforce.phoenix.schema

Examples of com.salesforce.phoenix.schema.ArgumentTypeMismatchException


                            isCoercible = true;
                            break;
                        }
                    }
                    if (!isCoercible) {
                        throw new ArgumentTypeMismatchException(Arrays.toString(args[i].getAllowedTypes()),
                                child.getDataType().toString(), info.getName() + " argument " + (i + 1));
                    }
                    if (child instanceof LiteralExpression) {
                        LiteralExpression valueExp = (LiteralExpression) child;
                        LiteralExpression minValue = args[i].getMinValue();
                        LiteralExpression maxValue = args[i].getMaxValue();
                        if (minValue != null && minValue.getDataType().compareTo(minValue.getValue(), valueExp.getValue(), valueExp.getDataType()) > 0) {
                            throw new ValueRangeExcpetion(minValue, maxValue == null ? "" : maxValue, valueExp.getValue(), info.getName() + " argument " + (i + 1));
                        }
                        if (maxValue != null && maxValue.getDataType().compareTo(maxValue.getValue(), valueExp.getValue(), valueExp.getDataType()) < 0) {
                            throw new ValueRangeExcpetion(minValue == null ? "" : minValue, maxValue, valueExp.getValue(), info.getName() + " argument " + (i + 1));
                        }
                    }
                }
                if (args[i].isConstant() && ! (child instanceof LiteralExpression) ) {
                    throw new ArgumentTypeMismatchException("constant", child.toString(), info.getName() + " argument " + (i + 1));
                }
                if (!args[i].getAllowedValues().isEmpty()) {
                    Object value = ((LiteralExpression)child).getValue();
                    if (!args[i].getAllowedValues().contains(value.toString().toUpperCase())) {
                        throw new ArgumentTypeMismatchException(Arrays.toString(args[i].getAllowedValues().toArray(new String[0])),
                                value.toString(), info.getName() + " argument " + (i + 1));
                    }
                }
            }
        }
View Full Code Here


                        PDataType targetType = targetColumn.getDataType();
                        // Check if coerce allowed using more relaxed isCastableTo check, since we promote INTEGER to LONG
                        // during expression evaluation and then convert back to INTEGER on UPSERT SELECT (and we don't have
                        // (an actual value we can specifically check against).
                        if (expression.getDataType() != null && !expression.getDataType().isCastableTo(targetType)) {
                            throw new ArgumentTypeMismatchException(targetType, expression.getDataType(), "column: " + targetColumn);
                        }
                        expression = CoerceExpression.create(expression, targetType);
                    }
                }
                if (node instanceof BindParseNode) {
View Full Code Here

TOP

Related Classes of com.salesforce.phoenix.schema.ArgumentTypeMismatchException

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.