/** * Creates a key for {@link RexNode} which is the same as another key of another RexNode only if * the two have both the same type and textual representation. For example, "10" integer and "10" * bigint result in different keys. */ public static String makeKey(RexNode expr) { String type = expr.getType().getFullTypeString(); String separator = ";"; String node = expr.toString(); StringBuilder keyBuilder = new StringBuilder(type.length() + separator.length() + node.length()); keyBuilder.append(type).append(separator).append(node); return keyBuilder.toString(); }
/** * Computes a string describing this rule match. Two rule matches are equivalent if and only if * their digests are the same. * * @return description of this rule match */ private String computeDigest() { StringBuilder buf = new StringBuilder("rule [" + getRule() + "] rels ["); for (int i = 0; i < rels.length; i++) { if (i > 0) { buf.append(", "); } buf.append(rels[i].toString()); } buf.append("]"); return buf.toString(); }