本文整理汇总了Java中org.voltdb.types.ExpressionType.INVALID属性的典型用法代码示例。如果您正苦于以下问题:Java ExpressionType.INVALID属性的具体用法?Java ExpressionType.INVALID怎么用?Java ExpressionType.INVALID使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.voltdb.types.ExpressionType
的用法示例。
在下文中一共展示了ExpressionType.INVALID属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
public void validate() throws Exception {
//
// Validate our children first
//
if (m_left != null) {
m_left.validate();
}
if (m_right != null) {
m_right.validate();
}
//
// Expression Type
//
if (m_type == null) {
throw new Exception("ERROR: The ExpressionType for '" + this + "' is NULL");
} else if (m_type == ExpressionType.INVALID) {
throw new Exception("ERROR: The ExpressionType for '" + this + "' is " + m_type);
//
// Output Type
//
} else if (m_valueType == null) {
throw new Exception("ERROR: The output VoltType for '" + this + "' is NULL");
} else if (m_valueType == VoltType.INVALID) {
throw new Exception("ERROR: The output VoltType for '" + this + "' is " + m_valueType);
}
//
// Since it is possible for an AbstractExpression to be stored with
// any ExpressionType, we do a simple check to make sure that it is the right class
//
Class<?> check_class = m_type.getExpressionClass();
if (!check_class.isInstance(this)) {
throw new Exception("ERROR: Expression '" + this + "' is class type '" + getClass().getSimpleName() + "' but needs to be '" + check_class.getSimpleName() + "'");
}
}
示例2: parseOperationExpression
/**
*
* @param exprNode
* @param attrs
* @param db
* @return
*/
AbstractExpression parseOperationExpression(Node exprNode, NamedNodeMap attrs, Database db) {
String type = attrs.getNamedItem("type").getNodeValue();
ExpressionType exprType = ExpressionType.get(type);
AbstractExpression expr = null;
if (exprType == ExpressionType.INVALID) {
throw new PlanningErrorException("Unsupported operation type '" + type + "'");
}
try {
expr = exprType.getExpressionClass().newInstance();
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
}
expr.setExpressionType(exprType);
// Allow expressions to read expression-specific data from exprNode.
// Looks like the design fully abstracts other volt classes from
// the XML serialization? Putting this here instead of in derived
// Expression implementations.
if (expr instanceof AggregateExpression) {
Node node;
if ((node = attrs.getNamedItem("distinct")) != null) {
AggregateExpression ae = (AggregateExpression)expr;
ae.m_distinct = Boolean.parseBoolean(node.getNodeValue());
}
}
// setup for children access
NodeList children = exprNode.getChildNodes();
int i = 0;
// get the first (left) node that is an element
Node leftExprNode = children.item(i++);
while ((leftExprNode != null) && (leftExprNode.getNodeType() != Node.ELEMENT_NODE))
leftExprNode = children.item(i++);
assert(leftExprNode != null);
// get the second (right) node that is an element (might be null)
Node rightExprNode = children.item(i++);
while ((rightExprNode != null) && (rightExprNode.getNodeType() != Node.ELEMENT_NODE))
rightExprNode = children.item(i++);
// recursively parse the left subtree (could be another operator or
// a constant/tuple/param value operand).
AbstractExpression leftExpr = parseExpressionTree(leftExprNode, db);
assert((leftExpr != null) || (exprType == ExpressionType.AGGREGATE_COUNT));
expr.setLeft(leftExpr);
if (ExpressionUtil.needsRightExpression(expr)) {
assert(rightExprNode != null);
// recursively parse the right subtree
AbstractExpression rightExpr = parseExpressionTree(rightExprNode, db);
assert(rightExpr != null);
expr.setRight(rightExpr);
}
return expr;
}