soumyakanti3578 commented on code in PR #5721:
URL: https://github.com/apache/hive/pull/5721#discussion_r2034079502


##########
ql/src/test/queries/clientpositive/drop_stats_for_columns.q:
##########
@@ -0,0 +1,36 @@
+create table t1(i int, j int, k int);
+
+alter table t1 update statistics set('numRows'='10000', 'rawDataSize'='18000');
+alter table t1 update statistics for column i 
set('numDVs'='2500','numNulls'='50','highValue'='1000','lowValue'='0');

Review Comment:
   > How does this update works?
   
   This is handled by 
[AlterTableUpdateColumnStatistictAnalyzer](https://github.com/apache/hive/blob/b9ada6d8b30b325c91e6ab88a9deb7bb98b8a738/ql/src/java/org/apache/hadoop/hive/ql/ddl/table/misc/columnstats/AlterTableUpdateColumnStatistictAnalyzer.java).
 Also checkout 
[ColumnStatsUpdateTask](https://github.com/apache/hive/blob/b9ada6d8b30b325c91e6ab88a9deb7bb98b8a738/ql/src/java/org/apache/hadoop/hive/ql/exec/ColumnStatsUpdateTask.java),
 where we construct column stats in `constructColumnStatsFromInput()` and then 
build a `SetPartitionsStatsRequest` to persist the stats in HMS.
   
   > alter table t1 update statistics for column i set();
   
   This throws a `ParseException`:
   ```
   org.apache.hadoop.hive.ql.parse.ParseException: line 2:50 cannot recognize 
input near ')' '<EOF>' '<EOF>' in table properties list
   ```
   `set()` cannot be empty as it expects `tableProperties` 
([AlterClauseParser.g](https://github.com/apache/hive/blob/b9ada6d8b30b325c91e6ab88a9deb7bb98b8a738/parser/src/java/org/apache/hadoop/hive/ql/parse/AlterClauseParser.g#L258))
   ```
   alterStatementSuffixUpdateStatsCol[boolean partition]
   @init { gParent.pushMsg("update column statistics", state); }
   @after { gParent.popMsg(state); }
       : KW_UPDATE KW_STATISTICS KW_FOR KW_COLUMN? colName=identifier KW_SET 
tableProperties (KW_COMMENT comment=StringLiteral)?
       -> {partition}? ^(TOK_ALTERPARTITION_UPDATECOLSTATS $colName 
tableProperties $comment?)
       ->              ^(TOK_ALTERTABLE_UPDATECOLSTATS $colName tableProperties 
$comment?)
       ;
   ```



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to