我正在处理 Hbase 数据库,并使用 Apache Phoenix 使用普通 SQL 查询访问 Hbase。
我在表中有两列,分别用 varchar 和 Date 保存当前的 UTC 时间戳。加载一些数据后,当我查询回 Hbase 时,我得到了 Date 类型的事件时间戳列的奇怪结果。
Event UTC (Date) :2017-01-13 16:36:59.0
Event UTC (varchar):2017-01-13 21:36:59
以上两个值应该是相同的,但对于每条记录,当查询事件 UTC(日期)列时给我错误的结果,即正好晚了 5 小时。 我不知道这个问题是从哪里来的。我没有保存任何时区信息,我知道 Java Util 或 SQL 时间戳不存储任何时区信息,但在运行查询时确实与结果集数据混淆。请帮我解决这个问题
最佳答案
很可能是因为客户的本地时区。
时间戳类型:
the internal representation is based on a number of milliseconds since the epoch (which is based on a time in GMT), while java.sql.Timestamp will format timestamps based on the client's local time zone.
关于mysql - Phoenix JDBC 时间戳列问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41657636/