/** * Get Map of ExprNodeColumnDesc HashCode to ExprNodeColumnDesc. * * @param exprDesc * @param hashCodeToColumnDescMap Assumption: If two ExprNodeColumnDesc have same hash code then * they are logically referring to same projection */ public static void getExprNodeColumnDesc( ExprNodeDesc exprDesc, Map<Integer, ExprNodeDesc> hashCodeToColumnDescMap) { if (exprDesc instanceof ExprNodeColumnDesc) { hashCodeToColumnDescMap.put(exprDesc.hashCode(), exprDesc); } else if (exprDesc instanceof ExprNodeColumnListDesc) { for (ExprNodeDesc child : exprDesc.getChildren()) { getExprNodeColumnDesc(child, hashCodeToColumnDescMap); } } else if (exprDesc instanceof ExprNodeGenericFuncDesc) { for (ExprNodeDesc child : exprDesc.getChildren()) { getExprNodeColumnDesc(child, hashCodeToColumnDescMap); } } else if (exprDesc instanceof ExprNodeFieldDesc) { getExprNodeColumnDesc(((ExprNodeFieldDesc) exprDesc).getDesc(), hashCodeToColumnDescMap); } }
public static void getExprNodeColumnDesc( List<ExprNodeDesc> exprDescList, Map<Integer, ExprNodeDesc> hashCodeTocolumnDescMap) { for (ExprNodeDesc exprNodeDesc : exprDescList) { getExprNodeColumnDesc(exprNodeDesc, hashCodeTocolumnDescMap); } }