Skip to content

Conversation

@yashmayya
Copy link
Contributor

  • The NOW scalar function returns a value of LONG type representing milliseconds since epoch. It was added before the TIMESTAMP data type was introduced to Pinot.
  • The function can't currently be used wherever timestamps are expected in the v2 engine because of the strong typing. For instance, the standard SQL function TIMESTAMPADD takes a datetime type as its third parameter (ex - TIMESTAMPADD(day, 10, CAST('2024-12-01' AS TIMESTAMP)).
  • In the v1 engine, TIMESTAMPADD(day, 10, now()) (LONG / TIMESTAMP are interchangeable in v1 which is not strongly typed) works fine but it fails in the v2 engine with an error like - Cannot apply 'TIMESTAMPADD' to arguments of type 'TIMESTAMPADD(<INTERVAL DAY>, <INTEGER>, <BIGINT>)'. Supported form(s): 'TIMESTAMPADD(<ANY>, <INTEGER>, <DATETIME>)' .
  • Similar to FROM_DATE_TIME, we can add an override to the operator table to make sure that the return type for the NOW scalar function is defined as TIMESTAMP and it can be used as one (in terms of execution in the query engine, TIMESTAMP is represented as LONG internally so that isn't an issue here).

@yashmayya yashmayya added the multi-stage Related to the multi-stage query engine label Dec 6, 2024
@codecov-commenter
Copy link

codecov-commenter commented Dec 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.03%. Comparing base (59551e4) to head (18361f0).
Report is 1438 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #14614      +/-   ##
============================================
+ Coverage     61.75%   64.03%   +2.28%     
- Complexity      207     1573    +1366     
============================================
  Files          2436     2687     +251     
  Lines        133233   147785   +14552     
  Branches      20636    22648    +2012     
============================================
+ Hits          82274    94639   +12365     
- Misses        44911    46210    +1299     
- Partials       6048     6936     +888     
Flag Coverage Δ
custom-integration1 100.00% <ø> (+99.99%) ⬆️
integration 100.00% <ø> (+99.99%) ⬆️
integration1 100.00% <ø> (+99.99%) ⬆️
integration2 0.00% <ø> (ø)
java-11 63.99% <100.00%> (+2.28%) ⬆️
java-21 63.93% <100.00%> (+2.31%) ⬆️
skip-bytebuffers-false 64.03% <100.00%> (+2.28%) ⬆️
skip-bytebuffers-true 63.90% <100.00%> (+36.17%) ⬆️
temurin 64.03% <100.00%> (+2.28%) ⬆️
unittests 64.03% <100.00%> (+2.28%) ⬆️
unittests1 56.18% <100.00%> (+9.29%) ⬆️
unittests2 34.57% <0.00%> (+6.84%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yashmayya yashmayya marked this pull request as ready for review December 6, 2024 09:49
Copy link
Contributor

@Jackie-Jiang Jackie-Jiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In PostgreSQL, now() returns timestamp with time zone, so I believe this is the correct change

@yashmayya yashmayya merged commit e89ac94 into apache:master Dec 15, 2024
21 checks passed
zeronerdzerogeekzerocool pushed a commit to zeronerdzerogeekzerocool/pinot that referenced this pull request Feb 20, 2025
@yashmayya yashmayya added the backward-incompat Referenced by PRs that introduce or fix backward compat issues label Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backward-incompat Referenced by PRs that introduce or fix backward compat issues multi-stage Related to the multi-stage query engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants