[ 
https://issues.apache.org/jira/browse/HIVE-19247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16451244#comment-16451244
 ] 

Ashutosh Chauhan commented on HIVE-19247:
-----------------------------------------

+1

> StatsOptimizer: Missing stats fast-path for Date
> ------------------------------------------------
>
>                 Key: HIVE-19247
>                 URL: https://issues.apache.org/jira/browse/HIVE-19247
>             Project: Hive
>          Issue Type: Bug
>          Components: Statistics
>    Affects Versions: 2.2.0, 3.0.0, 2.3.2
>            Reporter: Gopal V
>            Assignee: Gopal V
>            Priority: Major
>         Attachments: HIVE-19247.1.patch
>
>
> {code}
> 2018-04-19T18:57:24,268 DEBUG [67259108-c184-4c92-9e18-9e2969244442 
> HiveServer2-Handler-Pool: Thread-73]: optimizer.StatsOptimizer 
> (StatsOptimizer.java:process(614)) - Unsupported type: date encountered in 
> metadata optimizer for column : jour
> {code}
> {code}
> if (udaf instanceof GenericUDAFMin) {
>             ExprNodeColumnDesc colDesc = 
> (ExprNodeColumnDesc)exprMap.get(((ExprNodeColumnDesc)aggr.getParameters().get(0)).getColumn());
>             String colName = colDesc.getColumn();
>             StatType type = getType(colDesc.getTypeString());
>             if (!tbl.isPartitioned()) {
>               if 
> (!StatsSetupConst.areColumnStatsUptoDate(tbl.getParameters(), colName)) {
>                 Logger.debug("Stats for table : " + tbl.getTableName() + " 
> column " + colName
>                     + " are not up to date.");
>                 return null;
>               }
>               ColumnStatisticsData statData = 
> hive.getMSC().getTableColumnStatistics(
>                   tbl.getDbName(), tbl.getTableName(), 
> Lists.newArrayList(colName))
>                   .get(0).getStatsData();
>               String name = colDesc.getTypeString().toUpperCase();
>               switch (type) {
>                 case Integeral: {
>                   LongSubType subType = LongSubType.valueOf(name);
>                   LongColumnStatsData lstats = statData.getLongStats();
>                   if (lstats.isSetLowValue()) {
>                     oneRow.add(subType.cast(lstats.getLowValue()));
>                   } else {
>                     oneRow.add(null);
>                   }
>                   break;
>                 }
>                 case Double: {
>                   DoubleSubType subType = DoubleSubType.valueOf(name);
>                   DoubleColumnStatsData dstats = statData.getDoubleStats();
>                   if (dstats.isSetLowValue()) {
>                     oneRow.add(subType.cast(dstats.getLowValue()));
>                   } else {
>                     oneRow.add(null);
>                   }
>                   break;
>                 }
>                 default: // unsupported type
>                   Logger.debug("Unsupported type: " + colDesc.getTypeString() 
> + " encountered in " +
>                       "metadata optimizer for column : " + colName);
>                   return null;
>               }
>             }
> {code}
> {code}
>     enum StatType{
>       Integeral,
>       Double,
>       String,
>       Boolean,
>       Binary,
>       Unsupported
>     }
>     enum LongSubType {
>       BIGINT { @Override
>       Object cast(long longValue) { return longValue; } },
>       INT { @Override
>       Object cast(long longValue) { return (int)longValue; } },
>       SMALLINT { @Override
>       Object cast(long longValue) { return (short)longValue; } },
>       TINYINT { @Override
>       Object cast(long longValue) { return (byte)longValue; } };
>       abstract Object cast(long longValue);
>     }
> {code}
> Date is stored in stats (& also the typo there).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to