Skip to content

Commit

Permalink
PHOENIX-6894 Set up PQS to run tests with TZ displacement enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
stoty committed Jul 18, 2024
1 parent d60e643 commit 18db2ba
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ public void testParameterizedLikeExpression() throws Exception {
assertFalse(rs.next());
}

@Ignore("PHOENIX-4664")
@Test
//This is the java reproducer for PHOENIX-4664
//This test only works as intended when the system timezone is NOT GMT
Expand All @@ -370,6 +369,8 @@ public void testTimezoneLess() throws Exception {
conn.commit();

LocalDateTime now = LocalDateTime.now();
//Avatica has only millisecond timestamps
now = now.withNano((now.getNano()/1000000)*1000000);
try(PreparedStatement upsert = conn.prepareStatement(
"UPSERT INTO " + tableName + " VALUES (?, ?)")
) {
Expand All @@ -380,7 +381,7 @@ public void testTimezoneLess() throws Exception {
ResultSet rs = stmt.executeQuery("select * from " + tableName);
assertTrue(rs.next());
LocalDateTime fromDB = rs.getTimestamp("i").toLocalDateTime();
assertTrue("Timestamps do not match. inserted:" + now.toString() + "returned:" + fromDB.toString(), fromDB.compareTo(now) == 0);
assertTrue("Timestamps do not match. inserted:" + now.toString() + " returned:" + fromDB.toString(), fromDB.compareTo(now) == 0);
}
}
}
Expand Down
31 changes: 31 additions & 0 deletions phoenix-queryserver-it/src/it/resources/hbase-site.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<configuration>
<property>
<name>hbase.regionserver.wal.codec</name>
<value>org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec</value>
</property>
<property>
<name>phoenix.query.applyTimeZoneDisplacement</name>
<value>true</value>
</property>
</configuration>

0 comments on commit 18db2ba

Please sign in to comment.