Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.2 e3dc78fe8 -> 9b839b56f
PHOENIX-3923 TimezoneOffsetFunctionIT failing after PHOENIX-3913 Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/50f6297d Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/50f6297d Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/50f6297d Branch: refs/heads/4.x-HBase-1.2 Commit: 50f6297d684c2f4345feee4d0fb3d137b29085ce Parents: e3dc78f Author: James Taylor <jamestay...@apache.org> Authored: Thu Jun 8 11:21:00 2017 -0700 Committer: James Taylor <jamestay...@apache.org> Committed: Thu Jun 8 13:26:27 2017 -0700 ---------------------------------------------------------------------- .../expression/function/TimezoneOffsetFunction.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/50f6297d/phoenix-core/src/main/java/org/apache/phoenix/expression/function/TimezoneOffsetFunction.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/TimezoneOffsetFunction.java b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/TimezoneOffsetFunction.java index 8c70346..c61f838 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/TimezoneOffsetFunction.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/TimezoneOffsetFunction.java @@ -20,15 +20,16 @@ package org.apache.phoenix.expression.function; import java.sql.SQLException; import java.util.List; + import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.phoenix.cache.JodaTimezoneCache; import org.apache.phoenix.expression.Expression; import org.apache.phoenix.parse.FunctionParseNode; +import org.apache.phoenix.schema.tuple.Tuple; +import org.apache.phoenix.schema.types.PDataType; import org.apache.phoenix.schema.types.PDate; import org.apache.phoenix.schema.types.PInteger; -import org.apache.phoenix.schema.types.PDataType; import org.apache.phoenix.schema.types.PVarchar; -import org.apache.phoenix.schema.tuple.Tuple; import org.joda.time.DateTimeZone; /** @@ -59,11 +60,17 @@ public class TimezoneOffsetFunction extends ScalarFunction { if (!children.get(0).evaluate(tuple, ptr)) { return false; } + if (ptr.getLength() == 0) { + return true; + } DateTimeZone timezoneInstance = JodaTimezoneCache.getInstance(ptr); if (!children.get(1).evaluate(tuple, ptr)) { return false; } + if (ptr.getLength() == 0) { + return true; + } long date = PDate.INSTANCE.getCodec().decodeLong(ptr, children.get(1).getSortOrder()); int offset = timezoneInstance.getOffset(date);