[ 
https://issues.apache.org/jira/browse/HIVE-30228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Indhumathi Muthumurugesh reassigned HIVE-30228:
-----------------------------------------------

    Assignee: Indhumathi Muthumurugesh

>  Vectorized LEAD/LAG returns wrong default value when the default literal's 
> type differs from the window column's type (e.g. DATE column, string-literal 
> default)
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-30228
>                 URL: https://issues.apache.org/jira/browse/HIVE-30228
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Indhumathi Muthumurugesh
>            Assignee: Indhumathi Muthumurugesh
>            Priority: Major
>
> When LEAD/LAG is used over a window with a literal default value whose SQL 
> type differs from the value column's type — e.g. LEAD(date_col, 1, 
> '9999-01-01') where the default is a STRING literal implicitly convertible to 
> the column's DATE type — vectorized execution silently returns the wrong 
> default (epoch 1970-01-01) instead of the specified value, while 
> non-vectorized (row-mode) execution returns the correct value.
>  
> Repro:
> CREATE TABLE t1 (id INT, cat STRING, app_date DATE, active STRING);
> INSERT INTO t1 VALUES (1,'A',DATE'2024-03-01','Y');
> SELECT id, cat, app_date,
>   LEAD(date_add(app_date,-1), 1, ('9999-01-01'))
>     OVER (PARTITION BY id, cat ORDER BY id, cat, app_date) AS app_end_date
> FROM t1;
> -- vectorized: returns 1970-01-01 for the last row in each partition (WRONG)
> SET hive.vectorized.execution.reduce.enabled=false;
> -- same query now correctly returns 9999-01-01



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to