You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by hy...@apache.org on 2014/05/27 20:49:06 UTC
git commit: TAJO-851: Timestamp type test of
TestSQLExpression::testCastFromTable fails in jenkins CI test. (Hyoungjun Kim
via hyunsik)
Repository: tajo
Updated Branches:
refs/heads/master a191b1dc7 -> c2477f416
TAJO-851: Timestamp type test of TestSQLExpression::testCastFromTable fails in jenkins CI test. (Hyoungjun Kim via hyunsik)
Closes #23
Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/c2477f41
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/c2477f41
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/c2477f41
Branch: refs/heads/master
Commit: c2477f4167e48f5ded935d5c1a213cf22d06d9eb
Parents: a191b1d
Author: Hyunsik Choi <hy...@apache.org>
Authored: Wed May 28 03:41:44 2014 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Tue May 27 15:48:38 2014 -0300
----------------------------------------------------------------------
CHANGES | 3 ++
.../tajo/engine/eval/TestSQLExpression.java | 44 ++++++++++++--------
2 files changed, 30 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tajo/blob/c2477f41/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 66b5641..93ed43e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -45,6 +45,9 @@ Release 0.9.0 - unreleased
BUG FIXES
+ TAJO-851: Timestamp type test of TestSQLExpression::testCastFromTable fails
+ in jenkins CI test. (Hyoungjun Kim via hyunsik)
+
TAJO-830: Some filter conditions with a SUBQUERY are removed by optimizer.
(Hyoungjun Kim via hyunsik)
http://git-wip-us.apache.org/repos/asf/tajo/blob/c2477f41/tajo-core/src/test/java/org/apache/tajo/engine/eval/TestSQLExpression.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/eval/TestSQLExpression.java b/tajo-core/src/test/java/org/apache/tajo/engine/eval/TestSQLExpression.java
index 9bd26b8..af084d9 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/eval/TestSQLExpression.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/eval/TestSQLExpression.java
@@ -25,9 +25,11 @@ import org.apache.tajo.common.TajoDataTypes;
import org.apache.tajo.conf.TajoConf;
import org.apache.tajo.datum.DatumFactory;
import org.apache.tajo.datum.TimestampDatum;
+import org.apache.tajo.util.datetime.DateTimeUtil;
import org.junit.Test;
import java.io.IOException;
+import java.util.TimeZone;
import static org.apache.tajo.common.TajoDataTypes.Type.TEXT;
import static org.junit.Assert.fail;
@@ -859,23 +861,31 @@ public class TestSQLExpression extends ExprTestBase {
@Test
public void testCastFromTable() throws IOException {
- Schema schema = new Schema();
- schema.addColumn("col1", TEXT);
- schema.addColumn("col2", TEXT);
- testEval(schema, "table1", "123,234", "select cast(col1 as float) as b, cast(col2 as float) as a from table1",
- new String[]{"123.0", "234.0"});
- testEval(schema, "table1", "123,234", "select col1::float, col2::float from table1",
- new String[]{"123.0", "234.0"});
-
- TimestampDatum timestamp = DatumFactory.createTimestamp("1980-04-01 01:50:01+09");
- testEval(schema, "table1", "1980-04-01 01:50:01,234", "select col1::timestamp as t1, col2::float from table1 " +
- "where t1 = '1980-04-01 01:50:01'::timestamp",
- new String[]{timestamp.asChars(TajoConf.getCurrentTimeZone(), true), "234.0"});
-
- testSimpleEval("select '1980-04-01 01:50:01'::timestamp;", new String [] {timestamp.asChars(TajoConf.getCurrentTimeZone(), true)});
- testSimpleEval("select '1980-04-01 01:50:01'::timestamp::text", new String [] {"1980-04-01 01:50:01"});
-
- testSimpleEval("select (cast ('99999'::int8 as text))::int4 + 1", new String [] {"100000"});
+ TimeZone originTimeZone = TajoConf.setCurrentTimeZone(TimeZone.getTimeZone("GMT-6"));
+ try {
+ Schema schema = new Schema();
+ schema.addColumn("col1", TEXT);
+ schema.addColumn("col2", TEXT);
+ testEval(schema, "table1", "123,234", "select cast(col1 as float) as b, cast(col2 as float) as a from table1",
+ new String[]{"123.0", "234.0"});
+ testEval(schema, "table1", "123,234", "select col1::float, col2::float from table1",
+ new String[]{"123.0", "234.0"});
+
+ TimestampDatum timestamp = DatumFactory.createTimestamp("1980-04-01 01:50:01" +
+ DateTimeUtil.getTimeZoneDisplayTime(TajoConf.getCurrentTimeZone()));
+
+ testEval(schema, "table1", "1980-04-01 01:50:01,234", "select col1::timestamp as t1, col2::float from table1 " +
+ "where t1 = '1980-04-01 01:50:01'::timestamp",
+ new String[]{timestamp.asChars(TajoConf.getCurrentTimeZone(), true), "234.0"}
+ );
+
+ testSimpleEval("select '1980-04-01 01:50:01'::timestamp;", new String[]{timestamp.asChars(TajoConf.getCurrentTimeZone(), true)});
+ testSimpleEval("select '1980-04-01 01:50:01'::timestamp::text", new String[]{"1980-04-01 01:50:01"});
+
+ testSimpleEval("select (cast ('99999'::int8 as text))::int4 + 1", new String[]{"100000"});
+ } finally {
+ TajoConf.setCurrentTimeZone(originTimeZone);
+ }
}
@Test