Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Presto use hive data source, time will change? #8713

Closed
annisun opened this issue Aug 10, 2017 · 3 comments
Closed

Presto use hive data source, time will change? #8713

annisun opened this issue Aug 10, 2017 · 3 comments

Comments

@annisun
Copy link

annisun commented Aug 10, 2017

Presto use hive data source, time will change?
In hive,the time is '2017-08-10 00:00:00.000',
but in presto, the time changes like this : '2017-08-10 08:00:00.000'.

Where can I configure it?

@fiedukow
Copy link
Member

The way TIMESTAMP from Hive is displayed in presto currently can be determined by two factors.

  1. CLI timezone - the value is adjusted by Presto to timezone demanded by user. Timezone can be chosen by passing -Duser.timezone=<YourTZ>[1] to jvm while starting cli executable. By default it's of course determined by client operating system settings.
    Example CLI start: java -jar -Duser.timezone=Asia/Kathmandu presto-cli-0.183-SNAPSHOT-executable.jar
  2. Presto Server timezone - it's recommended to align TZ in which Presto Server JVM works with timezone used by Hive. You can do that by applying same flag as to CLI but to the server (-Duser.timezone may be added to jvm.config). If for some reason you cannot do that, you can preserve some functionality by setting hive.time-zone connector property to timezone of Hive. In that setup you will not be able to do inserts into hive though. Please note that if you will not follow one of those steps Presto configuration is considered invalid, and for that reason the behaviour is undefined and untested - you are basically lying to Presto about what timezone does hive operate in.

To summarise:
Make sure that presto server is configured properly. If you are sure that the configuration is correct, you can adjust timezone in which TIMESTAMP is displayed(!) by setting CLI timezone.

Note that current TIMESTAMP behaviour may change in the future (#7480).

[1] List of possible timezones for JVM: https://garygregory.wordpress.com/2013/06/18/what-are-the-java-timezone-ids/

@annisun
Copy link
Author

annisun commented Aug 11, 2017

thanks !
I will try it

@fiedukow
Copy link
Member

Closing for now. Feel free to reopen if required.

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

No branches or pull requests

2 participants