phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriel Reid <gabriel.r...@gmail.com>
Subject Re: Configuring phoenix.query.dateFormatTimeZone
Date Mon, 17 Aug 2015 17:49:08 GMT
If I'm understanding correctly, you're using DateTimeFormatter (from
joda-time) to convert a String to a long, and then instantiating a
java.sql.Timestamp from the long -- could you confirm that that is
correct? And could you also explain how you're checking what is stored
in Phoenix? Is that via sqlline or Squirrel or something similar, or
your own JDBC code?

Even better would be if you could write a little test class that
demonstrates the issue that you're running into. My gut feeling is
that things are working as intended and that it's timezone weirdness
in the JDBC spec that is causing the issue, but I need to nail down
your exact use case to verify this.

- Gabriel


On Sun, Aug 16, 2015 at 5:54 PM, Naor David <tron47@gmail.com> wrote:
> I'm upserting timestamps by setting a java.sql.TimeStamp object to it's
> proper index in my PreparedStatement object, so it,s something like this:
> ps.setObject(1,ts);
> By doing so I am not using the TO_DATE Phoenix function, nor am I parsing
> the time samp as a String, so I think that setting the parameter at
> hbase-site.xml wouldn't help..
>
> For example, if I insert the timestamp corresponding to 1-1-2015 10:00:00,
> the inserted timestamp column would be 1-1-2015 07:00:00 and so on.
> FYI, I use the DateTimeFormatter class for converting the date (which comes
> with GMT+3 suffix) to a TimeStamp object as above for inserting the date as
> a TimeStamp.
>
> - David
>
> בתאריך 14 באוג׳ 2015 16:31,‏ "Gabriel Reid" <gabriel.reid@gmail.com>
כתב:
>
>> Hi David,
>>
>> How are you upserting timestamps? The phoenix.query.dateFormatTimeZone
>> config property only affects string parsing or the TO_DATE function (docs on
>> this are at [1]). If you're using the TO_DATE function, it's also possible
>> to supply a custom time zone in the function call (docs on this are at [2]).
>>
>> Regardless, if you want to use this setting, you need to update the
>> hbase-site.xml on the client machine where you're connecting to
>> HBase/Phoenix. This configuration file will typically be in /etc/hbase/conf,
>> although if you're using Cloudera Manager (or probably some other cluster
>> management software) the hbase-site is automatically overwritten by CM, so
>> you'll need to configure this within Cloudera Manager itself (via
>> configuration settings called "Gateway safety-valve", or something along
>> those lines).
>>
>> In any case, there are often issues due to the odd way in which JDBC
>> itself handles (or doesn't handle) timezones, so the best way to resolve
>> this issue is probably for you to post some examples of the statements
>> you're running, what output you're getting, and what you would expect
>> instead of what you're getting.
>>
>> - Gabriel
>>
>> 1. http://phoenix.apache.org/tuning.html
>> 2. https://phoenix.apache.org/language/functions.html#to_date
>>
>> On Fri, Aug 14, 2015 at 1:59 PM Naor David <tron47@gmail.com> wrote:
>>>
>>> Hello,
>>> I recently installed Apache Pheonix 4.3 at a Cloudera cluster via parcel
>>> installation.
>>> My problem is that while inserting a java.sql.TimeStamp object via jdbc,
>>> the corresponding inserted timestamp column is converted to GMT+0 timezone.
>>> (While my local time is GMT+3).
>>> I understood that one can configure the Phoenix timezone by setting
>>> phoenix.query.dateFormatTimeZone to the desired timezone.
>>> My problem is that I don't know which hbase-site.xml should I edit (and
>>> where can I find it).
>>>
>>> Any help would be appreciated.
>>>
>>> Regards,
>>> David.

Mime
View raw message