countDistincts = numRows;
oi = encd.getWritableObjectInspector();
} else {
// clone the column stats and return
ColStatistics result = parentStats.getColumnStatisticsForColumn(tabAlias, colName);
if (result != null) {
try {
return result.clone();
} catch (CloneNotSupportedException e) {
return null;
}
}
return null;
}
} else if (end instanceof ExprNodeConstantDesc) {
// constant projection
ExprNodeConstantDesc encd = (ExprNodeConstantDesc) end;
// null projection
if (encd.getValue() == null) {
colName = encd.getName();
colType = "null";
numNulls = numRows;
} else {
colName = encd.getName();
colType = encd.getTypeString();
countDistincts = 1;
oi = encd.getWritableObjectInspector();
}
} else if (end instanceof ExprNodeGenericFuncDesc) {
// udf projection
ExprNodeGenericFuncDesc engfd = (ExprNodeGenericFuncDesc) end;
colName = engfd.getName();
colType = engfd.getTypeString();
countDistincts = numRows;
oi = engfd.getWritableObjectInspector();
} else if (end instanceof ExprNodeNullDesc) {
// null projection
ExprNodeNullDesc ennd = (ExprNodeNullDesc) end;
colName = ennd.getName();
colType = "null";
numNulls = numRows;
}
if (colType.equalsIgnoreCase(serdeConstants.STRING_TYPE_NAME)
|| colType.equalsIgnoreCase(serdeConstants.BINARY_TYPE_NAME)
|| colType.startsWith(serdeConstants.VARCHAR_TYPE_NAME)
|| colType.startsWith(serdeConstants.CHAR_TYPE_NAME)
|| colType.startsWith(serdeConstants.LIST_TYPE_NAME)
|| colType.startsWith(serdeConstants.MAP_TYPE_NAME)
|| colType.startsWith(serdeConstants.STRUCT_TYPE_NAME)
|| colType.startsWith(serdeConstants.UNION_TYPE_NAME)) {
avgColSize = getAvgColLenOfVariableLengthTypes(conf, oi, colType);
} else {
avgColSize = getAvgColLenOfFixedLengthTypes(colType);
}
ColStatistics colStats = new ColStatistics(tabAlias, colName, colType);
colStats.setAvgColLen(avgColSize);
colStats.setCountDistint(countDistincts);
colStats.setNumNulls(numNulls);
return colStats;
}