You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by ji...@apache.org on 2016/03/31 03:21:33 UTC
tajo git commit: TAJO-2107: TIMESTAMP type equalsTo() problem.
Repository: tajo
Updated Branches:
refs/heads/master 4046310a1 -> 394ce580b
TAJO-2107: TIMESTAMP type equalsTo() problem.
Closes #991
Signed-off-by: Jihoon Son <ji...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/394ce580
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/394ce580
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/394ce580
Branch: refs/heads/master
Commit: 394ce580b42319ff7bd9727f3316315d5cd27b50
Parents: 4046310
Author: Jongyoung Park <em...@gmail.com>
Authored: Thu Mar 31 10:20:45 2016 +0900
Committer: Jihoon Son <ji...@apache.org>
Committed: Thu Mar 31 10:20:45 2016 +0900
----------------------------------------------------------------------
.../java/org/apache/tajo/datum/TimestampDatum.java | 2 +-
.../org/apache/tajo/datum/TestTimestampDatum.java | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tajo/blob/394ce580/tajo-common/src/main/java/org/apache/tajo/datum/TimestampDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/datum/TimestampDatum.java b/tajo-common/src/main/java/org/apache/tajo/datum/TimestampDatum.java
index f69e7da..ac30278 100644
--- a/tajo-common/src/main/java/org/apache/tajo/datum/TimestampDatum.java
+++ b/tajo-common/src/main/java/org/apache/tajo/datum/TimestampDatum.java
@@ -176,7 +176,7 @@ public class TimestampDatum extends Datum {
@Override
public Datum equalsTo(Datum datum) {
- if (datum.type() == TajoDataTypes.Type.TIME) {
+ if (datum.type() == TajoDataTypes.Type.TIMESTAMP) {
return timestamp == datum.asInt8() ? BooleanDatum.TRUE : BooleanDatum.FALSE;
} else if (datum.isNull()) {
return datum;
http://git-wip-us.apache.org/repos/asf/tajo/blob/394ce580/tajo-common/src/test/java/org/apache/tajo/datum/TestTimestampDatum.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/datum/TestTimestampDatum.java b/tajo-common/src/test/java/org/apache/tajo/datum/TestTimestampDatum.java
index dc8a881..f82f66d 100644
--- a/tajo-common/src/test/java/org/apache/tajo/datum/TestTimestampDatum.java
+++ b/tajo-common/src/test/java/org/apache/tajo/datum/TestTimestampDatum.java
@@ -19,6 +19,7 @@
package org.apache.tajo.datum;
import org.apache.tajo.common.TajoDataTypes.Type;
+import org.apache.tajo.exception.InvalidOperationException;
import org.apache.tajo.exception.TajoRuntimeException;
import org.apache.tajo.json.CommonGsonHelper;
import org.apache.tajo.util.datetime.DateTimeUtil;
@@ -199,4 +200,19 @@ public class TestTimestampDatum {
assertThat(theday.compareTo(date) > 0, is(true));
}
+
+ @Test
+ public void testEqualsTo() {
+ TimestampDatum theday = DatumFactory.createTimestamp("2014-11-12 15:00:00.68");
+
+ assertTrue(theday.equalsTo(theday).asBool());
+ assertEquals(NullDatum.get(), theday.equalsTo(NullDatum.get()));
+ }
+
+ @Test(expected = InvalidOperationException.class)
+ public void testEqualsToInvalidCase() {
+ TimestampDatum theday = DatumFactory.createTimestamp("2014-11-12 15:00:00.68");
+
+ theday.equalsTo(new Int4Datum(123));
+ }
}