timestamptimezoneupsertapache-phoenix

Is there a way to UPSERT a TIMESTAMP with TIME ZONE information in Apache Phoenix?


I am trying to UPSERT into a Phoenix table from Nifi using the PutSQL processor.

Let's say my table name is X and its schema looks like this: id [INT], ts [TIMESTAMP]

Statement looks like:

UPSERT INTO X (id, ts) VALUES (1 , '2021-07-01 10:00:00.000')

Problem: When I look at the Phoenix Table I see:

id ts
1 2021-07-01 08:00:00.000

Apparently, because my Apache Nifi or Phoenix server time is set to GMT+02:00, the TIMESTAMP gets offset during the UPSERT because Phoenix thinks it must correct this offset to arrive at GMT. But my timestamp is already a GMT timestamp, so I do not want this correction.

Is there a way to append the time zone information to the TIMESTAMP string so that Phoenix understands it? I cannot find anything in the documentation.

I have already tried upserting without success:

'2021-07-01 10:00:00.000Z'
'2021-07-01 10:00:00.000+0000'

Constraint: I cannot change my server time zones to GMT/UTC (which would probably be a simple solution) because I am not the admin.

Could someone please advise?


Solution

  • I found a solution: If I UPSERT the epoch millis instead of a timestamp string, it works.

    So the solution is now:

    UPSERT INTO X (id, ts) VALUES (1, 1625133600000)