dengzhhu653 commented on code in PR #6602:
URL: https://github.com/apache/hive/pull/6602#discussion_r3869734215
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/directsql/DirectSqlAggrStats.java:
##########
@@ -380,6 +358,61 @@ private List<ColumnStatisticsObj> aggrStatsUseDB(
return colStats;
}
+ private String createQueryString(List<Integer> minMaxStatIndices) {
+ StringBuilder selectClause = new StringBuilder("\"PART_NAME\"");
+ for (int colStatIndex : minMaxStatIndices) {
+ String colStatName = IExtrapolatePartStatus.colStatNames[colStatIndex];
+ selectClause.append(", ");
+ if (IExtrapolatePartStatus.colStatTypes[colStatIndex]
+ == IExtrapolatePartStatus.ColStatType.Decimal) {
+ selectClause.append("cast(\"").append(colStatName).append("\" as
decimal)");
+ } else {
+ selectClause.append("\"").append(colStatName).append("\"");
+ }
+ }
+ return "select " + selectClause + " from " + PART_COL_STATS
Review Comment:
Instead of fetching all rows, we can just fetch the partition name which
has the min/max value, as the partitionStatRows have already contains the
min/max for this column.
if `row[2 + colStatIndex]` is null, stop extrapolating this field, otherwise
add the filter `"cast(\"").append(colStatName).append("\" as decimal) - " +
row[2 + colStatIndex] + " < 0.01 ` for min and ` row[2 + colStatIndex] + " -
cast(\"").append(colStatName).append("\" as decimal) < 0.01"` for max to the
`select` query.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]