hive icon indicating copy to clipboard operation
hive copied to clipboard

HIVE-27987: Implement YESTERDAY UDF in Hive

Open MRKKmrkk opened this issue 2 years ago • 5 comments

What changes were proposed in this pull request?

Implement YESTERDAY UDF in Hive

Why are the changes needed?

In my daily work, I frequently need to examine data from the previous day. Currently, in Hive, the only available method to obtain the date of yesterday is by using calculations like date_sub(current_date, 1). It would be convenient if Hive could introduce a method named 'yesterday' to facilitate the quick and easy retrieval of the date corresponding to the previous day.

Does this PR introduce any user-facing change?

No

Is the change a dependency upgrade?

No

How was this patch tested?

Created qtests as part of this change

MRKKmrkk avatar Jan 08 '24 10:01 MRKKmrkk

Googling some database systems, I didn't find ones with YESTERDAY or a similar UDF. But I imagine this UDF would be helpful at this point. I'm not confident though.

okumin avatar Jan 10 '24 03:01 okumin

Googling some database systems, I didn't find ones with YESTERDAY or a similar UDF. But I imagine this UDF would be helpful at this point. I'm not confident though.

Thank you for your review! I understand your confusion, actually clickhouse has similar UDF: https://clickhouse.com/docs/en/sql-reference/functions/date-time-functions#yesterday, and this function is widely used by both me and my colleagues in our daily work.

MRKKmrkk avatar Jan 10 '24 05:01 MRKKmrkk

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

7 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Jan 10 '24 14:01 sonarqubecloud[bot]

@okumin Could you please check if this fix is ok? Thanks.

MRKKmrkk avatar Jan 12 '24 05:01 MRKKmrkk

@MRKKmrkk Thanks for sharing the use case. I'm putting some thoughts here.

  1. CI is failing. Could you please check this and this? I guess you need to generate the result using TestMiniLlapLocalCliDriver
  2. I put some minor comments
  3. I can personally give +1 if we resolve the above two points. But note that I am not a committer and you would need to find another person to take another look

okumin avatar Jan 15 '24 13:01 okumin

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Feel free to reach out on the [email protected] list if the patch is in need of reviews.

github-actions[bot] avatar Mar 26 '24 00:03 github-actions[bot]