Skip to content

Enable timestamp type for SHOW STATS command#21286

Merged
tdcmeehan merged 1 commit intoprestodb:masterfrom
gupteaj:timestamp_stats
Nov 3, 2023
Merged

Enable timestamp type for SHOW STATS command#21286
tdcmeehan merged 1 commit intoprestodb:masterfrom
gupteaj:timestamp_stats

Conversation

@gupteaj
Copy link
Contributor

@gupteaj gupteaj commented Oct 31, 2023

Description

Presto issue #20929

Motivation and Context

-Display min/max statistics for timestamp column in iceberg tables.
-SHOW STATS will use time zone from user session's property.
-Before fix, SHOW STATS would return error Unexpected type: timestamp

Note : Hive table will need additional support for min/max on timestamp column.

Impact

Fixed error "Unexpected type: timestamp"

Test Plan

  • New test case in IcebergDistributedSmokeTestBase.java
  • manual test
CREATE TABLE timestamp_test (  "t" timestamp  ) WITH (   format = 'PARQUET'  ) ;
INSERT INTO timestamp_test values(TIMESTAMP '2001-08-22 03:04:05.321’);
INSERT INTO timestamp_test values(TIMESTAMP '2023-08-22 09:14:25.456');

presto:test> SHOW STATS FOR timestamp_test;
 column_name | data_size | distinct_values_count | nulls_fraction | row_count |        low_value        |       high_value        
-------------+-----------+-----------------------+----------------+-----------+-------------------------+-------------------------
 t           |     112.0 | NULL                  |            0.0 | NULL      | 2001-08-22 03:04:05.321 | 2023-08-22 09:14:25.456 
 NULL        | NULL      | NULL                  | NULL           |       2.0 | NULL                    | NULL                    
(2 rows)

Contributor checklist

  • Please make sure your submission complies with our development, formatting, commit message, and attribution guidelines.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

Iceberg Changes
* SHOW STATS command will support timestamp column based on user session's time zone 


@gupteaj gupteaj marked this pull request as ready for review October 31, 2023 20:07
@gupteaj gupteaj requested a review from a team as a code owner October 31, 2023 20:07
@gupteaj gupteaj requested a review from presto-oss October 31, 2023 20:07
@tdcmeehan tdcmeehan self-assigned this Nov 1, 2023
Copy link
Contributor

@s-akhtar-baig s-akhtar-baig left a comment

Choose a reason for hiding this comment

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

Never mind my last comment, I checked the SqlTimestamp::toString and it uses time zone. These changes look good to me, thanks!

@tdcmeehan tdcmeehan merged commit 8b56666 into prestodb:master Nov 3, 2023
@wanglinsong wanglinsong mentioned this pull request Dec 8, 2023
26 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants