0

I am running queries using presto jdbc jars. There is a time difference noticed for the same query when run against presto-jdbc-0.238.jar and presto-jdbc-0.82.jar.

The simple query which shows this inconsistency is:

select now();

with presto-jdbc-0.238.jar, the query output is

2023-08-09 10:58:02.512

with presto-jdbc-0.82.jar, the query output is

2023-08-09 09:58:22.108

On same cluster, similar hive query returns the o/p that matches with o/p of presto-jdbc-0.82.jar

hive> select current_timestamp();
OK
2023-08-09 09:58:23.64

However there are other queries patterns where o/p from both the jars are same. For example, below queries are producing same output with both presto-jdbc jars

select cast(from_unixtime(1669255200) as timestamp);
2022-11-24 04:00:00.0

select date_parse('2022-12-01 11:00:00','%Y-%m-%d %H:%i:%s');
2022-12-01 11:00:00.0

Current system timezone is

hive> set system:user.timezone;
system:user.timezone=Africa/Cairo


presto:testuser> select current_timezone();
    _col0
--------------
Africa/Cairo

It would really help to understand what could be the root cause for presto-jdbc-0.238.jar to show time by 1 hour advance v/s time shown by presto-jdbc-0.82.jar and hive.

Also, what can be done to fix this issue with presto-jdbc-0.238.jar

Tried to compare the query output with multiple presto jdbc jars and hive. I was expecting all presto-jdbc jars and hive to give same output. But actually same output is not observed.

Using code below to run the query

String url = args[0]; Properties properties = new Properties(); Statement stmt = null; 
try  
{    
   Connection connection = DriverManager.getConnection(url, properties);    
   stmt = connection.createStatement();    
   ResultSet rs = stmt.executeQuery("select now()");                
   while (rs.next()) {
      Timestamp tstamp = rs.getTimestamp(1) ;
      System.out.println("tstamp -" + tstamp);
   } 
}  
catch (SQLException e )  
{ System.out.println("Error " + e) ;}  
finally { if (stmt != null) { stmt.close(); } }

Instructions to run the code :

java -cp ./presto238//presto-jdbc-0.238.jar:. TestPrestoQuery jdbc:presto://coordinator_hostname:8180/hive/schema user

java -cp ./presto82/presto-jdbc-0.82.jar:. TestPrestoQuery jdbc:presto://coordinator_hostname:8180/hive/schema user

RaviKumar
  • 1
  • 3

0 Answers0