@Override public String getExprString() { return desc.getExprString() + "." + fieldName; }
public String getExprString(boolean sortChildren) { return getExprString(); }
@Override public String getExprString() { return desc.getExprString() + "." + fieldName; }
public List<String> getKeyColumnNames() { List<String> ret = new ArrayList<>(); for (ExprNodeDesc keyColumn : keyColumns) { ret.add(keyColumn.getExprString()); } return ret; }
@Override public String getExprString() { // Get the children expr strings String[] childrenExprStrings = new String[chidren.size()]; for (int i = 0; i < childrenExprStrings.length; i++) { childrenExprStrings[i] = chidren.get(i).getExprString(); } return genericUDF.getDisplayString(childrenExprStrings); }
@Explain(displayName = "columnExprMap", jsonOnly = true) public Map<String, String> getColumnExprMapForExplain() { Map<String, String> colExprMapForExplain = new HashMap<>(); for(String col:this.colExprMap.keySet()) { colExprMapForExplain.put(col, this.colExprMap.get(col).getExprString()); } return colExprMapForExplain; }
public static void addExprToStringBuffer(ExprNodeDesc expr, Appendable sb, boolean userLevelExplain, boolean sortExpressions) { try { sb.append(expr.getExprString(sortExpressions)); if (!userLevelExplain) { sb.append(" (type: "); sb.append(expr.getTypeString()); sb.append(")"); } } catch (IOException e) { throw new RuntimeException(e); } }
@Explain(displayName = "expr", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED }) public String getExprNodeExplain() { return exprNode == null ? null : exprNode.getExprString(); }
@Explain(displayName = "partition key expr") public String getPartKeyString() { return partKey.getExprString(); } }
public static void addExprToStringBuffer(ExprNodeDesc expr, Appendable sb, boolean userLevelExplain) { try { sb.append(expr.getExprString()); if (!userLevelExplain) { sb.append(" (type: "); sb.append(expr.getTypeString()); sb.append(")"); } } catch (IOException e) { throw new RuntimeException(e); } }
@Override public String getExprString() { // Get the children expr strings String[] childrenExprStrings = new String[chidren.size()]; for (int i = 0; i < childrenExprStrings.length; i++) { childrenExprStrings[i] = chidren.get(i).getExprString(); } return genericUDF.getDisplayString(childrenExprStrings); }
@Explain(displayName = "expr", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED }) public String getExprNodeExplain() { return exprNode == null ? null : exprNode.getExprString(); }
@Explain(displayName = "Partition key expr") public String getPartKeyString() { return this.partKey.getExprString(); }
@Explain(displayName = "arguments") public String getArgsExplain() { if (args == null) { return null; } StringBuilder builder = new StringBuilder(); for (PTFExpressionDef expression : args) { if (builder.length() > 0) { builder.append(", "); } builder.append(expression.getExprNode().getExprString()); } return builder.toString(); }
@Explain(displayName = "arguments") public String getArgsExplain() { if (args == null) { return null; } StringBuilder builder = new StringBuilder(); for (PTFExpressionDef expression : args) { if (builder.length() > 0) { builder.append(", "); } builder.append(expression.getExprNode().getExprString()); } return builder.toString(); }
@Override @Explain(displayName = "columnExprMap", jsonOnly = true) public Map<String, String> getColumnExprMapForExplain() { if(this.reversedExprs == null) { return super.getColumnExprMapForExplain(); } Map<String, String> explainColMap = new HashMap<>(); for(String col:this.colExprMap.keySet()){ String taggedCol = this.reversedExprs.get(col) + ":" + this.colExprMap.get(col).getExprString(); explainColMap.put(col, taggedCol); } return explainColMap; }
@Explain(displayName = "Partition key expr") @Signature public String getPartKeyString() { return this.partKey.getExprString(); }
@Explain(displayName = "partition by", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED }) public String getPartitionExplain() { if (partition == null || partition.getExpressions() == null) { return null; } StringBuilder builder = new StringBuilder(); for (PTFExpressionDef expression : partition.getExpressions()) { if (builder.length() > 0) { builder.append(", "); } builder.append(expression.getExprNode().getExprString()); } return builder.toString(); }
@Override public String getExprString(boolean sortChildren) { if (sortChildren) { UDFType udfType = genericUDF.getClass().getAnnotation(UDFType.class); if (udfType.commutative()) { // Get the sorted children expr strings String[] childrenExprStrings = new String[chidren.size()]; for (int i = 0; i < childrenExprStrings.length; i++) { childrenExprStrings[i] = chidren.get(i).getExprString(); } return genericUDF.getDisplayString( ImmutableSortedMultiset.copyOf(childrenExprStrings).toArray(new String[childrenExprStrings.length])); } } return getExprString(); }
@Test public void testCompactExpr() { ExprNodeDesc actual = PartitionPruner.compactExpr(expression); if (expected == null) { assertNull(actual); } else { assertNotNull("Expected not NULL expression", actual); assertNotNull("Expected not NULL expression string", actual.getExprString()); assertEquals(expected, actual.getExprString()); } }