yijiuqi created HIVE-28637:
------------------------------

             Summary: The execution plan encounters a "width < 0" issue when 
there are multiple windowing functions and the source table contains a large 
amount of data.
                 Key: HIVE-28637
                 URL: https://issues.apache.org/jira/browse/HIVE-28637
             Project: Hive
          Issue Type: Bug
      Security Level: Public (Viewable by anyone)
    Affects Versions: 4.0.1
            Reporter: yijiuqi
            Assignee: yijiuqi
             Fix For: 4.1.0


I encountered an issue in production where, with a large amount of data and 
more than four windowing functions, the execution plan shows a negative 
{{width}} value for windowing functions beyond the fourth. Additionally, during 
execution on the Tez engine, the number of reducers for that stage is set to 2. 
Upon reviewing the Hive {{Statistics}} code, I found that when {{datasize}} 
exceeds the maximum value of a {{{}long{}}}, it wraps around and becomes 
negative.

```
public void addBasicStats(Statistics stats) {
dataSize += stats.dataSize;
numRows += stats.numRows;
basicStatsState = inferColumnStatsState(basicStatsState, stats.basicStatsState);
}

@Deprecated
public void addToDataSize(long rds) {
dataSize += rds;
}
```



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to