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/05/04 09:04:13 UTC
[7/8] tajo git commit: TAJO-2135: Invalid join result when join key
columns contain nulls.
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestHBaseTable.java
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestHBaseTable.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestHBaseTable.java
index bc4628f..69a0230 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestHBaseTable.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestHBaseTable.java
@@ -18,8 +18,6 @@
package org.apache.tajo.engine.query;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
@@ -43,13 +41,11 @@ import org.apache.tajo.exception.TajoException;
import org.apache.tajo.exception.UnavailableTableLocationException;
import org.apache.tajo.plan.expr.*;
import org.apache.tajo.plan.logical.ScanNode;
-import org.apache.tajo.storage.StorageConstants;
import org.apache.tajo.storage.Tablespace;
import org.apache.tajo.storage.TablespaceManager;
import org.apache.tajo.storage.fragment.Fragment;
import org.apache.tajo.storage.hbase.*;
import org.apache.tajo.util.Bytes;
-import org.apache.tajo.util.KeyValueSet;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -66,8 +62,6 @@ import static org.junit.Assert.*;
@Category(IntegrationTest.class)
public class TestHBaseTable extends QueryTestCaseBase {
- private static final Log LOG = LogFactory.getLog(TestHBaseTable.class);
-
private static String tableSpaceUri;
private static String hostName,zkPort;
@@ -814,10 +808,6 @@ public class TestHBaseTable extends QueryTestCaseBase {
TableDesc tableDesc = catalog.getTableDesc(getCurrentDatabase(), "hbase_mapped_table");
// create test table
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("id", Type.TEXT)
.add("name", Type.TEXT)
@@ -827,8 +817,8 @@ public class TestHBaseTable extends QueryTestCaseBase {
for (int i = 99; i >= 0; i--) {
datas.add(df.format(i) + "|value" + i);
}
- TajoTestingCluster.createTable(getCurrentDatabase() + ".base_table",
- schema, tableOptions, datas.toArray(new String[datas.size()]), 2);
+ TajoTestingCluster.createTable(conf, getCurrentDatabase() + ".base_table",
+ schema, datas.toArray(new String[datas.size()]), 2);
executeString("insert into hbase_mapped_table " +
"select id, name from base_table ").close();
@@ -871,10 +861,6 @@ public class TestHBaseTable extends QueryTestCaseBase {
TableDesc tableDesc = catalog.getTableDesc(getCurrentDatabase(), "hbase_mapped_table");
// create test table
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("id", Type.TEXT)
.add("name", Type.TEXT)
@@ -883,8 +869,8 @@ public class TestHBaseTable extends QueryTestCaseBase {
for (int i = 99; i >= 0; i--) {
datas.add(i + "|value" + i);
}
- TajoTestingCluster.createTable(getCurrentDatabase() + ".base_table",
- schema, tableOptions, datas.toArray(new String[datas.size()]), 2);
+ TajoTestingCluster.createTable(conf, getCurrentDatabase() + ".base_table",
+ schema, datas.toArray(new String[datas.size()]), 2);
executeString("insert into hbase_mapped_table " +
"select id, name from base_table ").close();
@@ -930,10 +916,6 @@ public class TestHBaseTable extends QueryTestCaseBase {
TableDesc tableDesc = catalog.getTableDesc(getCurrentDatabase(), "hbase_mapped_table");
// create test table
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("id", Type.TEXT)
.add("name", Type.TEXT)
@@ -943,8 +925,8 @@ public class TestHBaseTable extends QueryTestCaseBase {
for (int i = 99; i >= 0; i--) {
datas.add(df.format(i) + "|value" + i);
}
- TajoTestingCluster.createTable(getCurrentDatabase() + ".base_table",
- schema, tableOptions, datas.toArray(new String[datas.size()]), 2);
+ TajoTestingCluster.createTable(conf, getCurrentDatabase() + ".base_table",
+ schema, datas.toArray(new String[datas.size()]), 2);
executeString("insert into hbase_mapped_table " +
"select id, name from base_table ").close();
@@ -989,10 +971,6 @@ public class TestHBaseTable extends QueryTestCaseBase {
TableDesc tableDesc = catalog.getTableDesc(getCurrentDatabase(), "hbase_mapped_table");
// create test table
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("id1", Type.TEXT)
.add("id2", Type.TEXT)
@@ -1003,8 +981,8 @@ public class TestHBaseTable extends QueryTestCaseBase {
for (int i = 99; i >= 0; i--) {
datas.add(df.format(i) + "|" + (i + 100) + "|value" + i);
}
- TajoTestingCluster.createTable(getCurrentDatabase() + ".base_table",
- schema, tableOptions, datas.toArray(new String[datas.size()]), 2);
+ TajoTestingCluster.createTable(conf, getCurrentDatabase() + ".base_table",
+ schema, datas.toArray(new String[datas.size()]), 2);
executeString("insert into hbase_mapped_table " +
"select id1, id2, name from base_table ").close();
@@ -1047,10 +1025,6 @@ public class TestHBaseTable extends QueryTestCaseBase {
TableDesc tableDesc = catalog.getTableDesc(getCurrentDatabase(), "hbase_mapped_table");
// create test table
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("id", Type.INT4)
.add("name", Type.TEXT)
@@ -1059,8 +1033,8 @@ public class TestHBaseTable extends QueryTestCaseBase {
for (int i = 99; i >= 0; i--) {
datas.add(i + "|value" + i);
}
- TajoTestingCluster.createTable(getCurrentDatabase() + ".base_table",
- schema, tableOptions, datas.toArray(new String[datas.size()]), 2);
+ TajoTestingCluster.createTable(conf, getCurrentDatabase() + ".base_table",
+ schema, datas.toArray(new String[datas.size()]), 2);
executeString("insert into hbase_mapped_table " +
"select id, name from base_table ").close();
@@ -1104,10 +1078,6 @@ public class TestHBaseTable extends QueryTestCaseBase {
TableDesc tableDesc = catalog.getTableDesc(getCurrentDatabase(), "hbase_mapped_table");
// create test table
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("rk", Type.TEXT)
.add("col2_key", Type.TEXT)
@@ -1120,8 +1090,8 @@ public class TestHBaseTable extends QueryTestCaseBase {
datas.add(i + "|ck-" + j + "|value-" + j + "|col3-" + i);
}
}
- TajoTestingCluster.createTable(getCurrentDatabase() + ".base_table",
- schema, tableOptions, datas.toArray(new String[datas.size()]), 2);
+ TajoTestingCluster.createTable(conf, getCurrentDatabase() + ".base_table",
+ schema, datas.toArray(new String[datas.size()]), 2);
executeString("insert into hbase_mapped_table " +
"select rk, col2_key, col2_value, col3 from base_table ").close();
@@ -1194,10 +1164,6 @@ public class TestHBaseTable extends QueryTestCaseBase {
assertTableExists("hbase_mapped_table");
// create test table
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("id", Type.INT4)
.add("name", Type.TEXT)
@@ -1206,8 +1172,8 @@ public class TestHBaseTable extends QueryTestCaseBase {
for (int i = 99; i >= 0; i--) {
datas.add(i + "|value" + i);
}
- TajoTestingCluster.createTable(getCurrentDatabase() + ".base_table",
- schema, tableOptions, datas.toArray(new String[datas.size()]), 2);
+ TajoTestingCluster.createTable(conf, getCurrentDatabase() + ".base_table",
+ schema, datas.toArray(new String[datas.size()]), 2);
try {
executeString("insert into hbase_mapped_table " +
@@ -1267,10 +1233,6 @@ public class TestHBaseTable extends QueryTestCaseBase {
@Test
public void testCTAS() throws Exception {
// create test table
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("id", Type.TEXT)
.add("name", Type.TEXT)
@@ -1280,8 +1242,8 @@ public class TestHBaseTable extends QueryTestCaseBase {
for (int i = 99; i >= 0; i--) {
datas.add(df.format(i) + "|value" + i);
}
- TajoTestingCluster.createTable(getCurrentDatabase() + ".base_table",
- schema, tableOptions, datas.toArray(new String[datas.size()]), 2);
+ TajoTestingCluster.createTable(conf, getCurrentDatabase() + ".base_table",
+ schema, datas.toArray(new String[datas.size()]), 2);
executeString(
"CREATE TABLE hbase_mapped_table (rk text, col1 text) TABLESPACE cluster1 " +
@@ -1389,10 +1351,6 @@ public class TestHBaseTable extends QueryTestCaseBase {
try {
// create test table
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("id", Type.TEXT)
.add("name", Type.TEXT)
@@ -1403,8 +1361,8 @@ public class TestHBaseTable extends QueryTestCaseBase {
for (int i = 99; i >= 0; i--) {
datas.add(df.format(i) + "|value" + i + "|comment-" + i);
}
- TajoTestingCluster.createTable(getCurrentDatabase() + ".base_table",
- schema, tableOptions, datas.toArray(new String[datas.size()]), 2);
+ TajoTestingCluster.createTable(conf, getCurrentDatabase() + ".base_table",
+ schema, datas.toArray(new String[datas.size()]), 2);
executeString("insert into location '/tmp/hfile_test' " +
"select id, name, comment from base_table ").close();
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestInSubquery.java
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestInSubquery.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestInSubquery.java
index 3733d00..41c0bd5 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestInSubquery.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestInSubquery.java
@@ -98,35 +98,40 @@ public class TestInSubquery extends TestJoinQuery {
runSimpleTests();
}
- @Test
+ // TODO: enable after TAJO-2141
+// @Test
@Option(withExplain = false, withExplainGlobal = false, parameterized = true, sort = true)
@SimpleTest()
public final void testNotInSubQuery() throws Exception {
runSimpleTests();
}
- @Test
+ // TODO: enable after TAJO-2141
+// @Test
@Option(withExplain = false, withExplainGlobal = false, parameterized = true, sort = true)
@SimpleTest()
public final void testMultipleNotInSubQuery() throws Exception {
runSimpleTests();
}
- @Test
+ // TODO: enable after TAJO-2141
+// @Test
@Option(withExplain = false, withExplainGlobal = false, parameterized = true, sort = true)
@SimpleTest()
public final void testNestedNotInSubQuery() throws Exception {
runSimpleTests();
}
- @Test
+ // TODO: enable after TAJO-2141
+// @Test
@Option(withExplain = false, withExplainGlobal = false, parameterized = true, sort = true)
@SimpleTest()
public final void testInAndNotInSubQuery() throws Exception {
runSimpleTests();
}
- @Test
+ // TODO: enable after TAJO-2141
+// @Test
@Option(withExplain = false, withExplainGlobal = false, parameterized = true, sort = true)
@SimpleTest()
public final void testNestedInAndNotInSubQuery() throws Exception {
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java
index 05c30df..b87639f 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java
@@ -56,7 +56,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), "table1");
if (!testingCluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, desc.getStats().getNumRows().intValue());
+ assertEquals(8, desc.getStats().getNumRows().intValue());
}
executeString("DROP TABLE table1 PURGE");
@@ -76,7 +76,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), "table1");
if (!testingCluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, desc.getStats().getNumRows().intValue());
+ assertEquals(8, desc.getStats().getNumRows().intValue());
}
res = executeFile("testInsertInto.sql");
@@ -100,11 +100,17 @@ public class TestInsertQuery extends QueryTestCaseBase {
"2|2|38.0\n" +
"3|2|45.0\n" +
"3|3|49.0\n" +
+ "||\n" +
+ "||\n" +
+ "||\n" +
"1|1|17.0\n" +
"1|1|36.0\n" +
"2|2|38.0\n" +
"3|2|45.0\n" +
- "3|3|49.0\n";
+ "3|3|49.0\n" +
+ "||\n" +
+ "||\n" +
+ "||\n";
assertNotNull(tableDatas);
assertEquals(expected, tableDatas);
@@ -135,7 +141,10 @@ public class TestInsertQuery extends QueryTestCaseBase {
"1|1|2\n" +
"2|2|1\n" +
"3|2|1\n" +
- "3|3|2\n";
+ "3|3|2\n" +
+ "||\n" +
+ "||\n" +
+ "||\n";
assertEquals(expected, resultFileData);
@@ -156,7 +165,10 @@ public class TestInsertQuery extends QueryTestCaseBase {
"1|1|2\n" +
"2|2|1\n" +
"3|2|1\n" +
- "3|3|2\n";
+ "3|3|2\n" +
+ "||\n" +
+ "||\n" +
+ "||\n";
assertEquals(expected + expected, resultFileData);
@@ -212,7 +224,10 @@ public class TestInsertQuery extends QueryTestCaseBase {
"FRANCE,3,6\n" +
"GERMANY,3,7\n" +
"INDIA,2,8\n" +
- "INDONESIA,2,9\n";
+ "INDONESIA,2,9\n" +
+ "null,null,null\n" +
+ "null,null,null\n" +
+ "null,null,null\n";
assertEquals(expected, resultSetToString(res));
res.close();
@@ -270,7 +285,13 @@ public class TestInsertQuery extends QueryTestCaseBase {
"INDIA,2,8\n" +
"INDIA,2,8\n" +
"INDONESIA,2,9\n" +
- "INDONESIA,2,9\n";
+ "INDONESIA,2,9\n" +
+ "null,null,null\n" +
+ "null,null,null\n" +
+ "null,null,null\n" +
+ "null,null,null\n" +
+ "null,null,null\n" +
+ "null,null,null\n";
assertEquals(expected, resultSetToString(res));
@@ -282,7 +303,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
FileStatus[] files = fs.listStatus(path);
assertNotNull(files);
- assertEquals(25, files.length);
+ assertEquals(26, files.length);
for (FileStatus eachFileStatus: files) {
assertTrue(eachFileStatus.getPath().getName().indexOf("n_nationkey=") == 0);
@@ -311,7 +332,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
res.close();
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), "table1");
if (!testingCluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, desc.getStats().getNumRows().intValue());
+ assertEquals(8, desc.getStats().getNumRows().intValue());
}
assertEquals(originalDesc.getSchema(), desc.getSchema());
@@ -331,7 +352,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
res.close();
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), "table1");
if (!testingCluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, desc.getStats().getNumRows().intValue());
+ assertEquals(8, desc.getStats().getNumRows().intValue());
}
res = executeString("select * from " + CatalogUtil.denormalizeIdentifier(getCurrentDatabase()) + ".table1");
@@ -365,6 +386,21 @@ public class TestInsertQuery extends QueryTestCaseBase {
assertTrue(res.wasNull());
assertTrue(49.0 == res.getFloat(3));
+ assertTrue(res.next());
+ assertEquals(0, res.getLong(1));
+ assertEquals(0.0, 0.0, res.getFloat(2));
+ assertEquals(0.0, 0.0, res.getFloat(3));
+
+ assertTrue(res.next());
+ assertEquals(0, res.getLong(1));
+ assertEquals(0.0, 0.0, res.getFloat(2));
+ assertEquals(0.0, 0.0, res.getFloat(3));
+
+ assertTrue(res.next());
+ assertEquals(0, res.getLong(1));
+ assertEquals(0.0, 0.0, res.getFloat(2));
+ assertEquals(0.0, 0.0, res.getFloat(3));
+
assertFalse(res.next());
res.close();
@@ -402,7 +438,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
res.close();
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), "lineitem_year_month");
if (!testingCluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, desc.getStats().getNumRows().intValue());
+ assertEquals(8, desc.getStats().getNumRows().intValue());
}
res = executeQuery();
@@ -424,7 +460,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
assertTrue(catalog.existsTable(getCurrentDatabase(), tableName));
TableDesc orderKeys = catalog.getTableDesc(getCurrentDatabase(), tableName);
if (!testingCluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, orderKeys.getStats().getNumRows().intValue());
+ assertEquals(8, orderKeys.getStats().getNumRows().intValue());
}
// this query will result in the two rows.
@@ -554,7 +590,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), "parquet_table");
if (!testingCluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, desc.getStats().getNumRows().intValue());
+ assertEquals(8, desc.getStats().getNumRows().intValue());
}
ResultSet res = executeString("select l_orderkey, l_shipdate, l_shipdate_function " +
@@ -566,7 +602,10 @@ public class TestInsertQuery extends QueryTestCaseBase {
"1,1996-04-12,1996-04-12\n" +
"2,1997-01-28,1997-01-28\n" +
"3,1994-02-02,1994-02-02\n" +
- "3,1993-11-09,1993-11-09\n";
+ "3,1993-11-09,1993-11-09\n" +
+ "null,null,null\n" +
+ "null,null,null\n" +
+ "null,null,null\n";
assertEquals(expected, resultSetToString(res));
@@ -589,7 +628,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), "parquet_table");
if (!testingCluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, desc.getStats().getNumRows().intValue());
+ assertEquals(8, desc.getStats().getNumRows().intValue());
}
ResultSet res = executeString("select l_orderkey, l_shipdate, l_shipdate_function " +
@@ -601,7 +640,10 @@ public class TestInsertQuery extends QueryTestCaseBase {
"3,1994-02-02,1994-02-02\n" +
"1,1996-03-13,1996-03-13\n" +
"1,1996-04-12,1996-04-12\n" +
- "2,1997-01-28,1997-01-28\n";
+ "2,1997-01-28,1997-01-28\n" +
+ "null,null,null\n" +
+ "null,null,null\n" +
+ "null,null,null\n";
assertEquals(expected, resultSetToString(res));
@@ -622,7 +664,7 @@ public class TestInsertQuery extends QueryTestCaseBase {
TableDesc desc = catalog.getTableDesc(getCurrentDatabase(), "table1");
if (!testingCluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, desc.getStats().getNumRows().intValue());
+ assertEquals(8, desc.getStats().getNumRows().intValue());
}
executeString("DROP TABLE table1 PURGE");
}
@@ -758,9 +800,15 @@ public class TestInsertQuery extends QueryTestCaseBase {
"2|2|38.0\n" +
"3|2|45.0\n" +
"3|3|49.0\n" +
+ "||\n" +
+ "||\n" +
+ "||\n" +
"1|3|173665.47\n" +
"2|4|46929.18\n" +
- "3|2|193846.25\n";
+ "3|2|193846.25\n" +
+ "||\n" +
+ "||\n" +
+ "||\n";
assertNotNull(tableDatas);
assertEquals(expected, tableDatas);
@@ -786,9 +834,15 @@ public class TestInsertQuery extends QueryTestCaseBase {
"2|2|38.0\n" +
"3|2|45.0\n" +
"3|3|49.0\n" +
+ "||\n" +
+ "||\n" +
+ "||\n" +
"1|3|173665.47\n" +
"2|4|46929.18\n" +
- "3|2|193846.25\n";
+ "3|2|193846.25\n" +
+ "||\n" +
+ "||\n" +
+ "||\n";
assertNotNull(tableDatas);
assertEquals(expected, tableDatas);
@@ -808,9 +862,15 @@ public class TestInsertQuery extends QueryTestCaseBase {
"2|2|38.0\n" +
"3|2|45.0\n" +
"3|3|49.0\n" +
+ "||\n" +
+ "||\n" +
+ "||\n" +
"1|3|173665.47\n" +
"2|4|46929.18\n" +
- "3|2|193846.25\n";
+ "3|2|193846.25\n" +
+ "||\n" +
+ "||\n" +
+ "||\n";
assertNotNull(resultDatas);
assertEquals(expected, resultDatas);
@@ -828,9 +888,15 @@ public class TestInsertQuery extends QueryTestCaseBase {
"2|2|38.0\n" +
"3|2|45.0\n" +
"3|3|49.0\n" +
+ "||\n" +
+ "||\n" +
+ "||\n" +
"1|3|173665.47\n" +
"2|4|46929.18\n" +
- "3|2|193846.25\n";
+ "3|2|193846.25\n" +
+ "||\n" +
+ "||\n" +
+ "||\n";
assertNotNull(resultDatas);
assertEquals(expected, resultDatas);
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestJoinOnPartitionedTables.java
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestJoinOnPartitionedTables.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestJoinOnPartitionedTables.java
index 0d110d1..496d112 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestJoinOnPartitionedTables.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestJoinOnPartitionedTables.java
@@ -170,7 +170,7 @@ public class TestJoinOnPartitionedTables extends TestJoinQuery {
" select l_partkey, l_suppkey, l_linenumber, \n" +
" l_quantity, l_extendedprice, l_discount, l_tax, \n" +
" l_returnflag, l_linestatus, l_shipdate, l_commitdate, \n" +
- " l_receiptdate, l_shipinstruct, l_shipmode, l_comment, l_orderkey from lineitem");
+ " l_receiptdate, l_shipinstruct, l_shipmode, l_comment, l_orderkey from lineitem").close();
ResultSet res = executeString(
"select a.l_orderkey as key1, b.l_orderkey as key2 from lineitem as a " +
@@ -184,7 +184,10 @@ public class TestJoinOnPartitionedTables extends TestJoinQuery {
"1,null\n" +
"2,null\n" +
"3,null\n" +
- "3,null\n";
+ "3,null\n" +
+ "null,null\n" +
+ "null,null\n" +
+ "null,null\n";
assertEquals(expected, resultSetToString(res));
cleanupQuery(res);
} finally {
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
index 749aad1..125a2ec 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
@@ -31,6 +31,7 @@ import org.apache.tajo.common.TajoDataTypes;
import org.apache.tajo.conf.TajoConf.ConfVars;
import org.apache.tajo.datum.Datum;
import org.apache.tajo.datum.Int4Datum;
+import org.apache.tajo.datum.NullDatum;
import org.apache.tajo.datum.TextDatum;
import org.apache.tajo.exception.TajoException;
import org.apache.tajo.storage.*;
@@ -142,67 +143,63 @@ public class TestJoinQuery extends QueryTestCaseBase {
protected static void createCommonTables() throws Exception {
LOG.info("Create common tables for join tests");
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("id", TajoDataTypes.Type.INT4)
.add("name", TajoDataTypes.Type.TEXT)
.build();
String[] data = new String[]{"1|table11-1", "2|table11-2", "3|table11-3", "4|table11-4", "5|table11-5"};
- TajoTestingCluster.createTable("jointable11", schema, tableOptions, data, 2);
+ TajoTestingCluster.createTable(conf, "jointable11", schema, data, 2);
schema = SchemaBuilder.builder()
.add("id", TajoDataTypes.Type.INT4)
.add("name", TajoDataTypes.Type.TEXT)
.build();
data = new String[]{"1|table12-1", "2|table12-2"};
- TajoTestingCluster.createTable("jointable12", schema, tableOptions, data, 2);
+ TajoTestingCluster.createTable(conf, "jointable12", schema, data, 2);
schema = SchemaBuilder.builder()
.add("id", TajoDataTypes.Type.INT4)
.add("name", TajoDataTypes.Type.TEXT)
.build();
data = new String[]{"2|table13-2", "3|table13-3"};
- TajoTestingCluster.createTable("jointable13", schema, tableOptions, data);
+ TajoTestingCluster.createTable(conf, "jointable13", schema, data);
schema = SchemaBuilder.builder()
.add("id", TajoDataTypes.Type.INT4)
.add("name", TajoDataTypes.Type.TEXT)
.build();
data = new String[]{"1|table14-1", "2|table14-2", "3|table14-3", "4|table14-4"};
- TajoTestingCluster.createTable("jointable14", schema, tableOptions, data);
+ TajoTestingCluster.createTable(conf, "jointable14", schema, data);
schema = SchemaBuilder.builder()
.add("id", TajoDataTypes.Type.INT4)
.add("name", TajoDataTypes.Type.TEXT)
.build();
data = new String[]{};
- TajoTestingCluster.createTable("jointable15", schema, tableOptions, data);
+ TajoTestingCluster.createTable(conf, "jointable15", schema, data);
schema = SchemaBuilder.builder()
.add("id", TajoDataTypes.Type.INT4)
.add("name", TajoDataTypes.Type.TEXT)
.build();
data = new String[]{"1000000|a", "1000001|b", "2|c", "3|d", "4|e"};
- TajoTestingCluster.createTable("jointable1", schema, tableOptions, data, 1);
+ TajoTestingCluster.createTable(conf, "jointable1", schema, data, 1);
data = new String[10000];
for (int i = 0; i < data.length; i++) {
data[i] = i + "|" + "this is testLeftOuterJoinLeftSideSmallTabletestLeftOuterJoinLeftSideSmallTable" + i;
}
- TajoTestingCluster.createTable("jointable_large", schema, tableOptions, data, 2);
+ TajoTestingCluster.createTable(conf, "jointable_large", schema, data, 2);
// According to node type(leaf or non-leaf) Broadcast join is determined differently by Repartitioner.
// testMultipleBroadcastDataFileWithZeroLength testcase is for the leaf node
createMultiFile("nation", 2, new TupleCreator() {
public Tuple createTuple(String[] columnDatas) {
return new VTuple(new Datum[]{
- new Int4Datum(Integer.parseInt(columnDatas[0])),
- new TextDatum(columnDatas[1]),
- new Int4Datum(Integer.parseInt(columnDatas[2])),
- new TextDatum(columnDatas[3])
+ columnDatas[0].equals("") ? NullDatum.get() : new Int4Datum(Integer.parseInt(columnDatas[0])),
+ columnDatas[1].equals("") ? NullDatum.get() : new TextDatum(columnDatas[1]),
+ columnDatas[2].equals("") ? NullDatum.get() : new Int4Datum(Integer.parseInt(columnDatas[2])),
+ columnDatas[3].equals("") ? NullDatum.get() : new TextDatum(columnDatas[3])
});
}
});
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestNullValues.java
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestNullValues.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestNullValues.java
index 1966332..c457253 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestNullValues.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestNullValues.java
@@ -25,8 +25,6 @@ import org.apache.tajo.catalog.Schema;
import org.apache.tajo.catalog.SchemaBuilder;
import org.apache.tajo.client.TajoClient;
import org.apache.tajo.common.TajoDataTypes.Type;
-import org.apache.tajo.storage.StorageConstants;
-import org.apache.tajo.util.KeyValueSet;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -70,11 +68,9 @@ public class TestNullValues {
"2||",
"3|filled|0.2"
};
- KeyValueSet opts = new KeyValueSet();
- opts.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
try (ResultSet res = TajoTestingCluster
- .run(table, schemas, opts, new String[][]{data},
+ .run(table, schemas, new String[][]{data},
"select * from nulltable1 where col3 is null", client)) {
assertTrue(res.next());
assertEquals(2, res.getInt(1));
@@ -95,10 +91,8 @@ public class TestNullValues {
"||",
"3|filled|"
};
- KeyValueSet opts = new KeyValueSet();
- opts.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
try (ResultSet res = TajoTestingCluster
- .run(table, schemas, opts, new String[][]{data},
+ .run(table, schemas, new String[][]{data},
"select * from nulltable2 where col1 is not null", client)) {
assertTrue(res.next());
assertEquals(1, res.getInt(1));
@@ -125,13 +119,11 @@ public class TestNullValues {
.build();
Schema [] schemas = new Schema[] {schema};
String [] data = {
- ",,,,672287821,1301460,1,313895860387,126288907,1024",
- ",,,43578,19,13,6,3581,2557,1024"
+ "||||672287821|1301460|1|313895860387|126288907|1024",
+ "|||43578|19|13|6|3581|2557|1024"
};
- KeyValueSet opts = new KeyValueSet();
- opts.set(StorageConstants.TEXT_DELIMITER, ",");
try (ResultSet res = TajoTestingCluster
- .run(table, schemas, opts, new String[][]{data},
+ .run(table, schemas, new String[][]{data},
"select * from nulltable3 where col1 is null and col2 is null and col3 is null and col4 = 43578", client)) {
assertTrue(res.next());
assertEquals(43578, res.getLong(4));
@@ -156,14 +148,11 @@ public class TestNullValues {
.build();
Schema [] schemas = new Schema[] {schema};
String [] data = {
- "\\N,,,,672287821,",
- ",\\N,,43578"
+ "\\N||||672287821|",
+ "|\\N||43578"
};
- KeyValueSet opts = new KeyValueSet();
- opts.set(StorageConstants.TEXT_DELIMITER, ",");
- opts.set(StorageConstants.TEXT_NULL, "\\\\N");
try (ResultSet res = TajoTestingCluster
- .run(table, schemas, opts, new String[][]{data},
+ .run(table, schemas, new String[][]{data},
"select * from nulltable4 where col1 is null and col2 is null and col3 is null and col5 is null and col4 = 43578"
, client)) {
assertTrue(res.next());
@@ -269,14 +258,11 @@ public class TestNullValues {
"3|c|\\N|t",
"4|d|4.0|\\N"
};
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
if (client == null) {
- return TajoTestingCluster.run(table, schemas, tableOptions, new String[][]{data}, query);
+ return TajoTestingCluster.run(table, schemas, new String[][]{data}, query);
} else {
- return TajoTestingCluster.run(table, schemas, tableOptions, new String[][]{data}, query, client);
+ return TajoTestingCluster.run(table, schemas, new String[][]{data}, query, client);
}
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
index 7a88198..d3b646a 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
@@ -32,8 +32,6 @@ import org.apache.tajo.conf.TajoConf.ConfVars;
import org.apache.tajo.ipc.ClientProtos;
import org.apache.tajo.plan.rewrite.BaseLogicalPlanRewriteRuleProvider;
import org.apache.tajo.plan.rewrite.LogicalPlanRewriteRule;
-import org.apache.tajo.storage.StorageConstants;
-import org.apache.tajo.util.KeyValueSet;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -380,7 +378,7 @@ public class TestSelectQuery extends QueryTestCaseBase {
assertTrue(catalog.existsTable(DEFAULT_DATABASE_NAME, "orderkeys"));
TableDesc orderKeys = catalog.getTableDesc(DEFAULT_DATABASE_NAME, "orderkeys");
if (!cluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, orderKeys.getStats().getNumRows().intValue());
+ assertEquals(8, orderKeys.getStats().getNumRows().intValue());
}
}
@@ -495,16 +493,12 @@ public class TestSelectQuery extends QueryTestCaseBase {
@Test
public final void testNowInMultipleTasks() throws Exception {
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("id", Type.INT4)
.add("name", Type.TEXT)
.build();
String[] data = new String[]{ "1|table11-1", "2|table11-2", "3|table11-3", "4|table11-4", "5|table11-5" };
- TajoTestingCluster.createTable("testNowInMultipleTasks".toLowerCase(), schema, tableOptions, data, 2);
+ TajoTestingCluster.createTable(conf, "testNowInMultipleTasks".toLowerCase(), schema, data, 2);
try {
testingCluster.setAllTajoDaemonConfValue(ConfVars.$TEST_MIN_TASK_NUM.varname, "2");
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
index 3dc9d85..ec89420 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
@@ -23,8 +23,6 @@ import org.apache.tajo.catalog.Schema;
import org.apache.tajo.catalog.SchemaBuilder;
import org.apache.tajo.common.TajoDataTypes.Type;
import org.apache.tajo.conf.TajoConf.ConfVars;
-import org.apache.tajo.storage.StorageConstants;
-import org.apache.tajo.util.KeyValueSet;
import org.junit.AfterClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -129,9 +127,6 @@ public class TestSortQuery extends QueryTestCaseBase {
public final void testSortFirstDesc() throws Exception {
try {
testingCluster.setAllTajoDaemonConfValue(ConfVars.$TEST_MIN_TASK_NUM.varname, "2");
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
Schema schema = SchemaBuilder.builder()
.add("col1", Type.INT4)
@@ -147,7 +142,7 @@ public class TestSortQuery extends QueryTestCaseBase {
"3|dat",
"1|abe"
};
- TajoTestingCluster.createTable("sortfirstdesc", schema, tableOptions, data, 2);
+ TajoTestingCluster.createTable(conf, "sortfirstdesc", schema, data, 2);
ResultSet res = executeQuery();
assertResultSet(res);
@@ -226,7 +221,7 @@ public class TestSortQuery extends QueryTestCaseBase {
@Test
public final void testTopkWithJson() throws Exception {
- // select l_orderkey, l_linenumber from lineitem order by l_orderkey desc limit 3;
+ // select l_orderkey, l_linenumber from lineitem order by l_orderkey desc limit 5;
ResultSet res = executeJsonQuery();
assertResultSet(res);
cleanupQuery(res);
@@ -236,9 +231,6 @@ public class TestSortQuery extends QueryTestCaseBase {
public final void testSortOnNullColumn() throws Exception {
try {
testingCluster.setAllTajoDaemonConfValue(ConfVars.$TEST_MIN_TASK_NUM.varname, "2");
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
Schema schema = SchemaBuilder.builder()
.add("id", Type.INT4)
@@ -250,7 +242,7 @@ public class TestSortQuery extends QueryTestCaseBase {
"3|ARGENTINA",
"4|CANADA"
};
- TajoTestingCluster.createTable("nullsort", schema, tableOptions, data, 2);
+ TajoTestingCluster.createTable(conf, "nullsort", schema, data, 2);
ResultSet res = executeQuery();
assertResultSet(res);
@@ -263,16 +255,12 @@ public class TestSortQuery extends QueryTestCaseBase {
@Test
public final void testSortOnNullColumn2() throws Exception {
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("id", Type.INT4)
.add("name", Type.TEXT)
.build();
String[] data = new String[]{ "1|111", "2|\\N", "3|333" };
- TajoTestingCluster.createTable("testSortOnNullColumn2".toLowerCase(), schema, tableOptions, data, 1);
+ TajoTestingCluster.createTable(conf, "testSortOnNullColumn2".toLowerCase(), schema, data, 1);
try {
ResultSet res = executeString("select * from testSortOnNullColumn2 order by name asc");
@@ -301,16 +289,12 @@ public class TestSortQuery extends QueryTestCaseBase {
@Test
public final void testSortOnNullColumn3() throws Exception {
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("id", Type.INT4)
.add("name", Type.TEXT)
.build();
String[] data = new String[]{ "1|111", "2|\\N", "3|333" };
- TajoTestingCluster.createTable("testSortOnNullColumn3".toLowerCase(), schema, tableOptions, data, 1);
+ TajoTestingCluster.createTable(conf, "testSortOnNullColumn3".toLowerCase(), schema, data, 1);
try {
ResultSet res = executeString("select * from testSortOnNullColumn3 order by name nulls first");
@@ -330,16 +314,12 @@ public class TestSortQuery extends QueryTestCaseBase {
@Test
public final void testSortOnNullColumn4() throws Exception {
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("id", Type.INT4)
.add("name", Type.TEXT)
.build();
String[] data = new String[]{ "1|111", "2|\\N", "3|333" };
- TajoTestingCluster.createTable("testSortOnNullColumn4".toLowerCase(), schema, tableOptions, data, 1);
+ TajoTestingCluster.createTable(conf, "testSortOnNullColumn4".toLowerCase(), schema, data, 1);
try {
ResultSet res = executeString("select * from testSortOnNullColumn4 order by name desc nulls last");
@@ -359,16 +339,12 @@ public class TestSortQuery extends QueryTestCaseBase {
@Test
public final void testSortOnNullColumn5() throws Exception {
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("id", Type.INT4)
.add("name", Type.TEXT)
.build();
String[] data = new String[]{ "1|111", "2|\\N", "3|333" };
- TajoTestingCluster.createTable("testSortOnNullColumn5".toLowerCase(), schema, tableOptions, data, 1);
+ TajoTestingCluster.createTable(conf, "testSortOnNullColumn5".toLowerCase(), schema, data, 1);
try {
ResultSet res = executeString("select * from testSortOnNullColumn5 order by name asc nulls first");
@@ -390,10 +366,6 @@ public class TestSortQuery extends QueryTestCaseBase {
public final void testSortOnUnicodeTextAsc() throws Exception {
try {
testingCluster.setAllTajoDaemonConfValue(ConfVars.$TEST_MIN_TASK_NUM.varname, "2");
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("col1", Type.INT4)
.add("col2", Type.TEXT)
@@ -404,7 +376,7 @@ public class TestSortQuery extends QueryTestCaseBase {
"3|\uac00\uac00\uac00",
"4|\ub0d0\ud558\ud558"
};
- TajoTestingCluster.createTable("unicode_sort1", schema, tableOptions, data, 2);
+ TajoTestingCluster.createTable(conf, "unicode_sort1", schema, data, 2);
ResultSet res = executeQuery();
assertResultSet(res);
@@ -419,9 +391,6 @@ public class TestSortQuery extends QueryTestCaseBase {
public final void testSortOnUnicodeTextDesc() throws Exception {
try {
testingCluster.setAllTajoDaemonConfValue(ConfVars.$TEST_MIN_TASK_NUM.varname, "2");
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
Schema schema = SchemaBuilder.builder()
.add("col1", Type.INT4)
@@ -433,7 +402,7 @@ public class TestSortQuery extends QueryTestCaseBase {
"3|\uac00\uac00\uac00",
"4|\ub0d0\ud558\ud558"
};
- TajoTestingCluster.createTable("unicode_sort2", schema, tableOptions, data, 2);
+ TajoTestingCluster.createTable(conf, "unicode_sort2", schema, data, 2);
ResultSet res = executeQuery();
assertResultSet(res);
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
index 196f332..e74d722 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestTablePartitions.java
@@ -41,7 +41,6 @@ import org.apache.tajo.plan.logical.NodeType;
import org.apache.tajo.querymaster.QueryMasterTask;
import org.apache.tajo.storage.StorageConstants;
import org.apache.tajo.util.CommonTestingUtil;
-import org.apache.tajo.util.KeyValueSet;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -268,7 +267,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
assertTrue(fs.isDirectory(new Path(path.toUri() + "/key=45.0")));
assertTrue(fs.isDirectory(new Path(path.toUri() + "/key=49.0")));
if (!testingCluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, desc.getStats().getNumRows().intValue());
+ assertEquals(8, desc.getStats().getNumRows().intValue());
}
}
@@ -404,7 +403,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
assertTrue(fs.isDirectory(new Path(path.toUri() + "/col1=3/col2=2/col3=45.0")));
assertTrue(fs.isDirectory(new Path(path.toUri() + "/col1=3/col2=3/col3=49.0")));
if (!testingCluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, desc.getStats().getNumRows().intValue());
+ assertEquals(8, desc.getStats().getNumRows().intValue());
}
res = executeString("select * from " + tableName + " where col2 = 2");
@@ -468,7 +467,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
res = executeString("insert into " + tableName
+ " select l_returnflag, l_orderkey, l_partkey, l_quantity from lineitem");
} else {
- res = executeString( "create table " + tableName + " (col4 text) "
+ res = executeString( "create table " + tableName + " (col4 text)"
+ " partition by column(col1 int4, col2 int4, col3 float8) as select l_returnflag, l_orderkey, l_partkey, " +
"l_quantity from lineitem");
}
@@ -484,7 +483,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
FileSystem fs = FileSystem.get(conf);
verifyDirectoriesForThreeColumns(fs, path, 1);
if (!testingCluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, desc.getStats().getNumRows().intValue());
+ assertEquals(8, desc.getStats().getNumRows().intValue());
}
res = executeString("select * from " + tableName + " where col2 = 2");
@@ -529,7 +528,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
verifyDirectoriesForThreeColumns(fs, path, 2);
if (!testingCluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, desc.getStats().getNumRows().intValue());
+ assertEquals(8, desc.getStats().getNumRows().intValue());
}
String expected = "N\n" +
@@ -541,7 +540,13 @@ public class TestTablePartitions extends QueryTestCaseBase {
"R\n" +
"R\n" +
"R\n" +
- "R\n";
+ "R\n" +
+ "\\N\n" +
+ "\\N\n" +
+ "\\N\n" +
+ "\\N\n" +
+ "\\N\n" +
+ "\\N\n";
String tableData = getTableFileContents(new Path(desc.getUri()));
assertEquals(expected, tableData);
@@ -658,7 +663,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
if (!testingCluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, desc.getStats().getNumRows().intValue());
+ assertEquals(8, desc.getStats().getNumRows().intValue());
}
FileSystem fs = FileSystem.get(conf);
@@ -710,7 +715,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
if (!testingCluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, desc.getStats().getNumRows().intValue());
+ assertEquals(8, desc.getStats().getNumRows().intValue());
}
FileSystem fs = FileSystem.get(conf);
@@ -770,7 +775,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
if (!testingCluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, desc.getStats().getNumRows().intValue());
+ assertEquals(8, desc.getStats().getNumRows().intValue());
}
FileSystem fs = FileSystem.get(conf);
@@ -868,7 +873,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
TableDesc desc = catalog.getTableDesc(DEFAULT_DATABASE_NAME, tableName);
if (!testingCluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, desc.getStats().getNumRows().intValue());
+ assertEquals(8, desc.getStats().getNumRows().intValue());
}
FileSystem fs = FileSystem.get(conf);
@@ -1002,7 +1007,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
TableDesc desc = catalog.getTableDesc("testinsertquery1", "table1");
if (!testingCluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, desc.getStats().getNumRows().intValue());
+ assertEquals(8, desc.getStats().getNumRows().intValue());
}
if (nodeType == NodeType.INSERT) {
@@ -1016,7 +1021,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
}
desc = catalog.getTableDesc("testinsertquery2", "table1");
if (!testingCluster.isHiveCatalogStoreRunning()) {
- assertEquals(5, desc.getStats().getNumRows().intValue());
+ assertEquals(8, desc.getStats().getNumRows().intValue());
}
executeString("DROP TABLE testinsertquery1.table1 PURGE").close();
@@ -1091,10 +1096,6 @@ public class TestTablePartitions extends QueryTestCaseBase {
testingCluster.setAllTajoDaemonConfValue(TajoConf.ConfVars.$DIST_QUERY_TABLE_PARTITION_VOLUME.varname, "2");
testingCluster.setAllTajoDaemonConfValue(TajoConf.ConfVars.SHUFFLE_HASH_APPENDER_PAGE_VOLUME.varname, "1");
try {
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("col1", TajoDataTypes.Type.TEXT)
.add("col2", TajoDataTypes.Type.TEXT)
@@ -1121,7 +1122,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
index++;
}
- TajoTestingCluster.createTable("testscatteredhashshuffle", schema, tableOptions, data.toArray(new String[data.size()]), 3);
+ TajoTestingCluster.createTable(conf, "testscatteredhashshuffle", schema, data.toArray(new String[data.size()]), 3);
CatalogService catalog = testingCluster.getMaster().getCatalog();
assertTrue(catalog.existsTable("default", "testscatteredhashshuffle"));
@@ -1279,7 +1280,11 @@ public class TestTablePartitions extends QueryTestCaseBase {
if (i > 0) {
partitionName.append("/");
}
- partitionName.append(partitionColumn).append("=").append(res.getString(partitionColumn));
+ String partitionValue = res.getString(partitionColumn);
+ if (partitionValue == null) {
+ partitionValue = StorageConstants.DEFAULT_PARTITION_NAME;
+ }
+ partitionName.append(partitionColumn).append("=").append(partitionValue);
}
partitionDescProto = catalog.getPartition(databaseName, tableName, partitionName.toString());
assertNotNull(partitionDescProto);
@@ -1329,7 +1334,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
// partition. In previous Query and Stage, duplicated partitions were not deleted because they had been in List.
// If you want to verify duplicated partitions, you need to use List instead of Set with DerbyStore.
List<PartitionDescProto> partitions = catalog.getPartitionsOfTable(DEFAULT_DATABASE_NAME, tableName);
- assertEquals(2, partitions.size());
+ assertEquals(3, partitions.size());
PartitionDescProto firstPartition = catalog.getPartition(DEFAULT_DATABASE_NAME, tableName, "key=N");
assertNotNull(firstPartition);
@@ -1660,7 +1665,10 @@ public class TestTablePartitions extends QueryTestCaseBase {
"1,1,00:00:00\n" +
"1,1,11:20:40\n" +
"2,2,12:10:20\n" +
- "3,3,00:00:00\n";
+ "3,3,00:00:00\n" +
+ "null,null,00:00:00\n" +
+ "null,null,00:00:00\n" +
+ "null,null,00:00:00\n";
assertEquals(expectedResult, resultSetToString(res));
res.close();
@@ -1732,7 +1740,10 @@ public class TestTablePartitions extends QueryTestCaseBase {
"1,1,36.0\n" +
"2,2,38.0\n" +
"3,2,45.0\n" +
- "3,3,49.0\n";
+ "3,3,49.0\n" +
+ "null,null,null\n" +
+ "null,null,null\n" +
+ "null,null,null\n";
res.close();
assertEquals(expectedResult, result);
@@ -1775,7 +1786,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
String result = resultSetToString(res);
String expectedResult = "cnt\n" +
"-------------------------------\n" +
- "5\n";
+ "8\n";
res.close();
assertEquals(expectedResult, result);
@@ -1786,7 +1797,6 @@ public class TestTablePartitions extends QueryTestCaseBase {
fs.mkdirs(path);
path = new Path(tableDesc.getUri().getPath(), "col1=a");
fs.mkdirs(path);
- assertEquals(8, fs.listStatus(path.getParent()).length);
res = executeString("SELECT COUNT(*) AS cnt FROM " + externalTableName + " WHERE key > 40.0");
result = resultSetToString(res);
@@ -1807,7 +1817,10 @@ public class TestTablePartitions extends QueryTestCaseBase {
"1,1,17.0\n" +
"2,2,38.0\n" +
"3,2,45.0\n" +
- "3,3,49.0\n";
+ "3,3,49.0\n" +
+ "null,null,null\n" +
+ "null,null,null\n" +
+ "null,null,null\n";
res.close();
assertEquals(expectedResult, result);
@@ -1815,7 +1828,7 @@ public class TestTablePartitions extends QueryTestCaseBase {
result = resultSetToString(res);
expectedResult = "cnt\n" +
"-------------------------------\n" +
- "3\n";
+ "6\n";
res.close();
assertEquals(expectedResult, result);
@@ -1831,7 +1844,10 @@ public class TestTablePartitions extends QueryTestCaseBase {
"1,1,17.0\n" +
"2,2,38.0\n" +
"3,3,49.0\n" +
- "3,2,45.0\n";
+ "3,2,45.0\n" +
+ "null,null,null\n" +
+ "null,null,null\n" +
+ "null,null,null\n";
res.close();
assertEquals(expectedResult, result);
@@ -1871,7 +1887,10 @@ public class TestTablePartitions extends QueryTestCaseBase {
"N,1,1,36.0\n" +
"N,2,2,38.0\n" +
"R,3,2,45.0\n" +
- "R,3,3,49.0\n";
+ "R,3,3,49.0\n" +
+ "null,null,null,null\n" +
+ "null,null,null,null\n" +
+ "null,null,null,null\n";
res.close();
assertEquals(expectedResult, result);
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestTruncateTable.java
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestTruncateTable.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestTruncateTable.java
index 3ae0c60..24e6547 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestTruncateTable.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestTruncateTable.java
@@ -44,7 +44,7 @@ public class TestTruncateTable extends QueryTestCaseBase {
while (res.next()) {
numRows++;
}
- assertEquals(5, numRows);
+ assertEquals(8, numRows);
res.close();
executeString("truncate table truncate_table1");
@@ -58,7 +58,7 @@ public class TestTruncateTable extends QueryTestCaseBase {
assertEquals(0, numRows);
res.close();
} finally {
- executeString("DROP TABLE truncate_table1 PURGE");
+ executeString("DROP TABLE truncate_table1");
}
}
@@ -90,7 +90,7 @@ public class TestTruncateTable extends QueryTestCaseBase {
assertEquals(4, numRows);
res.close();
} finally {
- executeString("DROP TABLE truncate_table2 PURGE");
+ executeString("DROP TABLE truncate_table2");
}
}
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestUnionQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestUnionQuery.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestUnionQuery.java
index 4cce141..2023570 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestUnionQuery.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestUnionQuery.java
@@ -64,7 +64,7 @@ public class TestUnionQuery extends QueryTestCaseBase {
@SimpleTest
public final void testUnionAll1() throws Exception {
Optional<TajoResultSetBase[]> existing = runSimpleTests();
- verifyResultStats(existing, 8L);
+ verifyResultStats(existing, 14L);
}
/**
@@ -74,7 +74,7 @@ public class TestUnionQuery extends QueryTestCaseBase {
@SimpleTest
public final void testUnionAll2() throws Exception {
Optional<TajoResultSetBase[]> existing = runSimpleTests();
- verifyResultStats(existing, 10L);
+ verifyResultStats(existing, 16L);
}
/**
@@ -124,7 +124,7 @@ public class TestUnionQuery extends QueryTestCaseBase {
@SimpleTest
public final void testUnionAll7() throws Exception {
Optional<TajoResultSetBase[]> existing = runSimpleTests();
- verifyResultStats(existing, 10L);
+ verifyResultStats(existing, 16L);
}
@Test
@@ -171,7 +171,7 @@ public class TestUnionQuery extends QueryTestCaseBase {
// test filter pushdown
// with stage in union query
Optional<TajoResultSetBase[]> existing = runSimpleTests();
- verifyResultStats(existing, 5L);
+ verifyResultStats(existing, 8L);
}
@Test
@@ -180,7 +180,7 @@ public class TestUnionQuery extends QueryTestCaseBase {
// test filter pushdown
// with group by stage in union query
Optional<TajoResultSetBase[]> existing = runSimpleTests();
- verifyResultStats(existing, 7L);
+ verifyResultStats(existing, 9L);
}
@Test
@@ -208,7 +208,7 @@ public class TestUnionQuery extends QueryTestCaseBase {
@SimpleTest
public final void testUnion1() throws Exception {
Optional<TajoResultSetBase[]> existing = runSimpleTests();
- verifyResultStats(existing, 5L);
+ verifyResultStats(existing, 6L);
}
/**
@@ -218,7 +218,7 @@ public class TestUnionQuery extends QueryTestCaseBase {
@SimpleTest
public final void testUnion2() throws Exception {
Optional<TajoResultSetBase[]> existing = runSimpleTests();
- verifyResultStats(existing, 3L);
+ verifyResultStats(existing, 4L);
}
/**
@@ -268,7 +268,7 @@ public class TestUnionQuery extends QueryTestCaseBase {
@SimpleTest
public final void testUnion7() throws Exception {
Optional<TajoResultSetBase[]> existing = runSimpleTests();
- verifyResultStats(existing, 3L);
+ verifyResultStats(existing, 4L);
}
@Test
@@ -315,7 +315,7 @@ public class TestUnionQuery extends QueryTestCaseBase {
// test filter pushdown
// with stage in union query
Optional<TajoResultSetBase[]> existing = runSimpleTests();
- verifyResultStats(existing, 5L);
+ verifyResultStats(existing, 6L);
}
@Test
@@ -324,7 +324,7 @@ public class TestUnionQuery extends QueryTestCaseBase {
// test filter pushdown
// with group by stage in union query
Optional<TajoResultSetBase[]> existing = runSimpleTests();
- verifyResultStats(existing, 7L);
+ verifyResultStats(existing, 8L);
}
@Test
@@ -349,7 +349,7 @@ public class TestUnionQuery extends QueryTestCaseBase {
@SimpleTest
public final void testUnionAllWithSameAliasNames() throws Exception {
Optional<TajoResultSetBase[]> existing = runSimpleTests();
- verifyResultStats(existing, 10L);
+ verifyResultStats(existing, 16L);
}
@Test
@@ -370,7 +370,7 @@ public class TestUnionQuery extends QueryTestCaseBase {
@SimpleTest
public final void testUnionWithSameAliasNames() throws Exception {
Optional<TajoResultSetBase[]> existing = runSimpleTests();
- verifyResultStats(existing, 3L);
+ verifyResultStats(existing, 4L);
}
@Test
@@ -416,7 +416,7 @@ public class TestUnionQuery extends QueryTestCaseBase {
public final void testUnionWithCrossJoin() throws Exception {
// https://issues.apache.org/jira/browse/TAJO-881
Optional<TajoResultSetBase[]> existing = runSimpleTests();
- verifyResultStats(existing, 40L);
+ verifyResultStats(existing, 112L);
}
@Test
@@ -424,7 +424,7 @@ public class TestUnionQuery extends QueryTestCaseBase {
public final void testThreeJoinInUnion() throws Exception {
// https://issues.apache.org/jira/browse/TAJO-881
Optional<TajoResultSetBase[]> existing = runSimpleTests();
- verifyResultStats(existing, 30L);
+ verifyResultStats(existing, 33L);
}
@Test
@@ -445,7 +445,7 @@ public class TestUnionQuery extends QueryTestCaseBase {
@SimpleTest
public void testTajo1368Case2() throws Exception {
Optional<TajoResultSetBase[]> existing = runSimpleTests();
- verifyResultStats(existing, 10L);
+ verifyResultStats(existing, 16L);
}
@Test
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestWindowQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestWindowQuery.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestWindowQuery.java
index 54aa41e..2204ce2 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestWindowQuery.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestWindowQuery.java
@@ -25,8 +25,6 @@ import org.apache.tajo.TajoTestingCluster;
import org.apache.tajo.catalog.Schema;
import org.apache.tajo.catalog.SchemaBuilder;
import org.apache.tajo.common.TajoDataTypes;
-import org.apache.tajo.storage.StorageConstants;
-import org.apache.tajo.util.KeyValueSet;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -262,16 +260,12 @@ public class TestWindowQuery extends QueryTestCaseBase {
@Test
public final void testFirstValueTime() throws Exception {
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("id", TajoDataTypes.Type.INT4)
.add("time", TajoDataTypes.Type.TIME)
.build();
String[] data = new String[]{ "1|12:11:12", "2|10:11:13", "2|05:42:41" };
- TajoTestingCluster.createTable("firstvaluetime", schema, tableOptions, data, 1);
+ TajoTestingCluster.createTable(conf, "firstvaluetime", schema, data, 1);
try {
ResultSet res = executeString(
@@ -298,16 +292,12 @@ public class TestWindowQuery extends QueryTestCaseBase {
@Test
public final void testLastValueTime() throws Exception {
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("id", TajoDataTypes.Type.INT4)
.add("time", TajoDataTypes.Type.TIME)
.build();
String[] data = new String[]{ "1|12:11:12", "2|10:11:13", "2|05:42:41" };
- TajoTestingCluster.createTable("lastvaluetime", schema, tableOptions, data, 1);
+ TajoTestingCluster.createTable(conf, "lastvaluetime", schema, data, 1);
try {
ResultSet res = executeString(
@@ -334,16 +324,12 @@ public class TestWindowQuery extends QueryTestCaseBase {
@Test
public final void testLagTime() throws Exception {
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("id", TajoDataTypes.Type.INT4)
.add("time", TajoDataTypes.Type.TIME)
.build();
String[] data = new String[]{ "1|12:11:12", "2|10:11:13", "2|05:42:41" };
- TajoTestingCluster.createTable("lagtime", schema, tableOptions, data, 1);
+ TajoTestingCluster.createTable(conf, "lagtime", schema, data, 1);
try {
ResultSet res = executeString(
@@ -384,16 +370,12 @@ public class TestWindowQuery extends QueryTestCaseBase {
@Test
public final void testLeadTime() throws Exception {
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("id", TajoDataTypes.Type.INT4)
.add("time", TajoDataTypes.Type.TIME)
.build();
String[] data = new String[]{ "1|12:11:12", "2|10:11:13", "2|05:42:41" };
- TajoTestingCluster.createTable("leadtime", schema, tableOptions, data, 1);
+ TajoTestingCluster.createTable(conf, "leadtime", schema, data, 1);
try {
ResultSet res = executeString(
@@ -441,17 +423,13 @@ public class TestWindowQuery extends QueryTestCaseBase {
@Test
public final void testMultipleWindow() throws Exception {
- KeyValueSet tableOptions = new KeyValueSet();
- tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
- tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
-
Schema schema = SchemaBuilder.builder()
.add("id", TajoDataTypes.Type.INT4)
.add("time", TajoDataTypes.Type.TIME)
.add("name", TajoDataTypes.Type.TEXT)
.build();
String[] data = new String[]{ "1|12:11:12|abc", "2|10:11:13|def", "2|05:42:41|ghi" };
- TajoTestingCluster.createTable("multiwindow", schema, tableOptions, data, 1);
+ TajoTestingCluster.createTable(conf, "multiwindow", schema, data, 1);
try {
ResultSet res = executeString(
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/java/org/apache/tajo/querymaster/TestTaskStatusUpdate.java
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/querymaster/TestTaskStatusUpdate.java b/tajo-core-tests/src/test/java/org/apache/tajo/querymaster/TestTaskStatusUpdate.java
index 425a7d6..34eefda 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/querymaster/TestTaskStatusUpdate.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/querymaster/TestTaskStatusUpdate.java
@@ -58,9 +58,9 @@ public class TestTaskStatusUpdate extends QueryTestCaseBase {
res = executeQuery();
// tpch/lineitem.tbl
- long[] expectedNumRows = new long[]{5, 2, 2, 2};
- long[] expectedNumBytes = new long[]{604, 18, 18, 48};
- long[] expectedReadBytes = new long[]{604, 604, 18, 0};
+ long[] expectedNumRows = new long[]{8, 3, 3, 3};
+ long[] expectedNumBytes = new long[]{737, 26, 26, 68};
+ long[] expectedReadBytes = new long[]{737, 0, 26, 0};
QueryId queryId = getQueryId(res);
assertStatus(queryId, 2, expectedNumRows, expectedNumBytes, expectedReadBytes);
@@ -77,9 +77,9 @@ public class TestTaskStatusUpdate extends QueryTestCaseBase {
res = executeQuery();
// tpch/lineitem.tbl
- long[] expectedNumRows = new long[]{5, 2, 2, 2, 2, 2};
- long[] expectedNumBytes = new long[]{604, 162, 162, 138, 138, 236};
- long[] expectedReadBytes = new long[]{604, 604, 236, 0, 138, 0};
+ long[] expectedNumRows = new long[]{8, 3, 3, 3, 3, 3};
+ long[] expectedNumBytes = new long[]{737, 171, 171, 147, 147, 288};
+ long[] expectedReadBytes = new long[]{737, 0, 288, 0, 147, 0};
QueryId queryId = getQueryId(res);
assertStatus(queryId, 3, expectedNumRows, expectedNumBytes, expectedReadBytes);
@@ -106,9 +106,9 @@ public class TestTaskStatusUpdate extends QueryTestCaseBase {
res = executeQuery();
// in/out * stage(4)
- long[] expectedNumRows = new long[]{5, 5, 2, 2, 2, 2, 2, 2};
- long[] expectedNumBytes = new long[]{20, 75, 8, 34, 109, 34, 34, 64};
- long[] expectedReadBytes = new long[]{20, 20, 8, 8, 64, 0, 34, 0};
+ long[] expectedNumRows = new long[]{8, 8, 2, 2, 2, 2, 2, 2};
+ long[] expectedNumBytes = new long[]{26, 96, 8, 34, 130, 34, 34, 64};
+ long[] expectedReadBytes = new long[]{26, 0, 8, 0, 64, 0, 34, 0};
QueryId queryId = getQueryId(res);
assertStatus(queryId, 4, expectedNumRows, expectedNumBytes, expectedReadBytes);
@@ -140,34 +140,42 @@ public class TestTaskStatusUpdate extends QueryTestCaseBase {
long[] expectedReadBytes) throws Exception {
- QueryHistory queryHistory = testingCluster.getQueryHistory(queryId);
+ QueryHistory queryHistory = testingCluster.getQueryHistory(queryId);
- assertNotNull(queryHistory);
+ assertNotNull(queryHistory);
- List<StageHistory> stages = queryHistory.getStageHistories();
- assertEquals(numStages, stages.size());
+ List<StageHistory> stages = queryHistory.getStageHistories();
+ assertEquals(numStages, stages.size());
- Collections.sort(stages, new Comparator<StageHistory>() {
- @Override
- public int compare(StageHistory o1, StageHistory o2) {
- return o1.getExecutionBlockId().compareTo(o2.getExecutionBlockId());
- }
- });
+ Collections.sort(stages, new Comparator<StageHistory>() {
+ @Override
+ public int compare(StageHistory o1, StageHistory o2) {
+ return o1.getExecutionBlockId().compareTo(o2.getExecutionBlockId());
+ }
+ });
- int index = 0;
- for (StageHistory eachStage : stages) {
+ int index = 0;
+ StringBuilder expectedString = new StringBuilder();
+ StringBuilder actualString = new StringBuilder();
- assertEquals(expectedNumRows[index], eachStage.getTotalReadRows());
- assertEquals(expectedNumBytes[index], eachStage.getTotalInputBytes());
- assertEquals(expectedReadBytes[index], eachStage.getTotalReadBytes());
+ for (StageHistory eachStage : stages) {
+ expectedString.append(expectedNumRows[index]).append(",")
+ .append(expectedNumBytes[index]).append(",")
+ .append(expectedReadBytes[index]).append(",");
+ actualString.append(eachStage.getTotalReadRows()).append(",")
+ .append(eachStage.getTotalInputBytes()).append(",")
+ .append(eachStage.getTotalReadBytes()).append(",");
- index++;
+ index++;
- assertEquals(expectedNumRows[index], eachStage.getTotalWriteRows());
- assertEquals(expectedNumBytes[index],eachStage.getTotalWriteBytes());
+ expectedString.append(expectedNumRows[index]).append(",")
+ .append(expectedNumBytes[index]).append("\n");
+ actualString.append(eachStage.getTotalWriteRows()).append(",")
+ .append(eachStage.getTotalWriteBytes()).append("\n");
- index++;
- }
+ index++;
+ }
+ assertEquals(expectedString.toString(), actualString.toString());
}
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/java/org/apache/tajo/ws/rs/resources/TestQueryResultResource.java
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/ws/rs/resources/TestQueryResultResource.java b/tajo-core-tests/src/test/java/org/apache/tajo/ws/rs/resources/TestQueryResultResource.java
index 8b9c93d..e4880b3 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/ws/rs/resources/TestQueryResultResource.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/ws/rs/resources/TestQueryResultResource.java
@@ -226,11 +226,12 @@ public class TestQueryResultResource extends QueryTestCaseBase {
}
}
- assertEquals(5, tupleList.size());
+ assertEquals(8, tupleList.size());
- for (Tuple aTuple: tupleList) {
- assertTrue(aTuple.getInt4(response.getSchema().getColumnId("l_orderkey")) > 0);
+ for (int i = 0; i < 5; i++) {
+ assertTrue(tupleList.get(i).getInt4(response.getSchema().getColumnId("l_orderkey")) > 0);
}
+ assertEquals(0, tupleList.get(5).getInt4(response.getSchema().getColumnId("l_orderkey")));
}
@Test
@@ -267,7 +268,7 @@ public class TestQueryResultResource extends QueryTestCaseBase {
assertTrue(eos);
assertEquals(0, offset);
- assertEquals(5, count);
+ assertEquals(8, count);
DataInputStream queryResultSetInputStream =
@@ -295,11 +296,12 @@ public class TestQueryResultResource extends QueryTestCaseBase {
}
assertEquals(contentLength, receviedSize);
- assertEquals(5, tupleList.size());
+ assertEquals(8, tupleList.size());
- for (Tuple aTuple: tupleList) {
- assertTrue(aTuple.getInt4(response.getSchema().getColumnId("l_orderkey")) > 0);
+ for (int i = 0; i < 5; i++) {
+ assertTrue(tupleList.get(i).getInt4(response.getSchema().getColumnId("l_orderkey")) > 0);
}
+ assertEquals(0, tupleList.get(5).getInt4(response.getSchema().getColumnId("l_orderkey")));
}
@Test
@@ -336,7 +338,7 @@ public class TestQueryResultResource extends QueryTestCaseBase {
assertTrue(eos);
assertEquals(0, offset);
- assertEquals(5, count);
+ assertEquals(8, count);
assertTrue(length > 0);
DataInputStream queryResultSetInputStream =
@@ -353,7 +355,7 @@ public class TestQueryResultResource extends QueryTestCaseBase {
} catch (EOFException eof) {
}
- assertEquals(5, count);
+ assertEquals(8, count);
}
@Test
@@ -390,7 +392,7 @@ public class TestQueryResultResource extends QueryTestCaseBase {
assertTrue(eos);
assertEquals(0, offset);
- assertEquals(5, count);
+ assertEquals(8, count);
assertTrue(length > 0);
DataInputStream queryResultSetInputStream =
@@ -407,6 +409,6 @@ public class TestQueryResultResource extends QueryTestCaseBase {
} catch (EOFException eof) {
}
- assertEquals(5, count);
+ assertEquals(8, count);
}
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/resources/python/test_funcs.py
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/python/test_funcs.py b/tajo-core-tests/src/test/resources/python/test_funcs.py
index 1167afd..df3371c 100644
--- a/tajo-core-tests/src/test/resources/python/test_funcs.py
+++ b/tajo-core-tests/src/test/resources/python/test_funcs.py
@@ -30,4 +30,7 @@ def concat_py(str):
@output_type('int4')
def add_py(a,b):
- return a+b
+ if a != None and b != None:
+ return a+b
+ else:
+ return None
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/resources/python/test_udaf.py
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/python/test_udaf.py b/tajo-core-tests/src/test/resources/python/test_udaf.py
index da5a3fd..4e7b34d 100644
--- a/tajo-core-tests/src/test/resources/python/test_udaf.py
+++ b/tajo-core-tests/src/test/resources/python/test_udaf.py
@@ -30,22 +30,30 @@ class AvgPy:
# eval at the first stage
def eval(self, item):
- self.sum += item
- self.cnt += 1
+ if item != None: # null checking
+ self.sum += item
+ self.cnt += 1
# get intermediate result
def get_partial_result(self):
- return [self.sum, self.cnt]
+ if self.cnt == 0:
+ return None
+ else:
+ return [self.sum, self.cnt]
# merge intermediate results
def merge(self, list):
- self.sum += list[0]
- self.cnt += list[1]
+ if list: # null checking
+ self.sum += list[0]
+ self.cnt += list[1]
# get final result
@output_type('float8')
def get_final_result(self):
- return self.sum / float(self.cnt)
+ if self.cnt == 0:
+ return None
+ else:
+ return self.sum / float(self.cnt)
class CountPy:
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/resources/queries/TestOuterJoinQuery/testMultipleBroadcastDataFileWithZeroLength.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestOuterJoinQuery/testMultipleBroadcastDataFileWithZeroLength.sql b/tajo-core-tests/src/test/resources/queries/TestOuterJoinQuery/testMultipleBroadcastDataFileWithZeroLength.sql
index 6ae6c09..1dcfd77 100644
--- a/tajo-core-tests/src/test/resources/queries/TestOuterJoinQuery/testMultipleBroadcastDataFileWithZeroLength.sql
+++ b/tajo-core-tests/src/test/resources/queries/TestOuterJoinQuery/testMultipleBroadcastDataFileWithZeroLength.sql
@@ -1,3 +1,3 @@
select * from customer a
left outer join nation_multifile b on a.c_nationkey = b.n_nationkey
- where b.n_nationkey is null
\ No newline at end of file
+ where b.n_nationkey = 100;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/resources/queries/TestSortQuery/testTopK.sql
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestSortQuery/testTopK.sql b/tajo-core-tests/src/test/resources/queries/TestSortQuery/testTopK.sql
index 65519f0..c2acca4 100644
--- a/tajo-core-tests/src/test/resources/queries/TestSortQuery/testTopK.sql
+++ b/tajo-core-tests/src/test/resources/queries/TestSortQuery/testTopK.sql
@@ -1 +1 @@
-select l_orderkey, l_linenumber from lineitem order by l_orderkey desc, l_linenumber asc limit 3;
\ No newline at end of file
+select l_orderkey, l_linenumber from lineitem order by l_orderkey desc, l_linenumber asc limit 5;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/resources/queries/TestSortQuery/testTopkWithJson.json
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/queries/TestSortQuery/testTopkWithJson.json b/tajo-core-tests/src/test/resources/queries/TestSortQuery/testTopkWithJson.json
index 333037b..3ba8ec6 100644
--- a/tajo-core-tests/src/test/resources/queries/TestSortQuery/testTopkWithJson.json
+++ b/tajo-core-tests/src/test/resources/queries/TestSortQuery/testTopkWithJson.json
@@ -19,7 +19,7 @@
],
"Expr": {
"Num": {
- "Value": "3",
+ "Value": "5",
"ValueType": "Unsigned_Integer",
"OpType": "Literal"
},
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testAvgDouble.result
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testAvgDouble.result b/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testAvgDouble.result
index bd2a69f..2755056 100644
--- a/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testAvgDouble.result
+++ b/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testAvgDouble.result
@@ -2,4 +2,5 @@ l_orderkey,revenue
-------------------------------
1,0.065
2,0.0
-3,0.08
\ No newline at end of file
+3,0.08
+null,null
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testCount.result
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testCount.result b/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testCount.result
index 381cded..2956ff0 100644
--- a/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testCount.result
+++ b/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testCount.result
@@ -1,3 +1,3 @@
rownum
-------------------------------
-5
\ No newline at end of file
+8
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testSplitPart.result
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testSplitPart.result b/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testSplitPart.result
index d22cd68..b2a7d91 100644
--- a/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testSplitPart.result
+++ b/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testSplitPart.result
@@ -4,4 +4,7 @@ DELIVER
TAKE
TAKE
NONE
-TAKE
\ No newline at end of file
+TAKE
+null
+null
+null
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testSplitPartByString.result
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testSplitPartByString.result b/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testSplitPartByString.result
index ac8119d..f12988e 100644
--- a/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testSplitPartByString.result
+++ b/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testSplitPartByString.result
@@ -4,4 +4,7 @@ DELIVER IN PERSON
TA
TA
NONE
-TA
\ No newline at end of file
+TA
+null
+null
+null
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testSplitPartNested.result
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testSplitPartNested.result b/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testSplitPartNested.result
index ec0f07b..0200187 100644
--- a/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testSplitPartNested.result
+++ b/tajo-core-tests/src/test/resources/results/TestBuiltinFunctions/testSplitPartNested.result
@@ -4,4 +4,7 @@ null
KE
KE
null
-KE
\ No newline at end of file
+KE
+null
+null
+null
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/resources/results/TestCTASQuery/testCtasWithGroupby.result
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/results/TestCTASQuery/testCtasWithGroupby.result b/tajo-core-tests/src/test/resources/results/TestCTASQuery/testCtasWithGroupby.result
index 048902f..21b7a2a 100644
--- a/tajo-core-tests/src/test/resources/results/TestCTASQuery/testCtasWithGroupby.result
+++ b/tajo-core-tests/src/test/resources/results/TestCTASQuery/testCtasWithGroupby.result
@@ -4,4 +4,5 @@ col1,col2,key
1.0,1.0,36.0
2.0,2.0,38.0
3.0,2.0,45.0
-3.0,3.0,49.0
\ No newline at end of file
+3.0,3.0,49.0
+null,null,null
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/resources/results/TestCTASQuery/testCtasWithOrderby.result
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/results/TestCTASQuery/testCtasWithOrderby.result b/tajo-core-tests/src/test/resources/results/TestCTASQuery/testCtasWithOrderby.result
index 048902f..21b7a2a 100644
--- a/tajo-core-tests/src/test/resources/results/TestCTASQuery/testCtasWithOrderby.result
+++ b/tajo-core-tests/src/test/resources/results/TestCTASQuery/testCtasWithOrderby.result
@@ -4,4 +4,5 @@ col1,col2,key
1.0,1.0,36.0
2.0,2.0,38.0
3.0,2.0,45.0
-3.0,3.0,49.0
\ No newline at end of file
+3.0,3.0,49.0
+null,null,null
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO1224Case1.result
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO1224Case1.result b/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO1224Case1.result
index 19336a7..8ed0390 100644
--- a/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO1224Case1.result
+++ b/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO1224Case1.result
@@ -1,3 +1,3 @@
?count
-------------------------------
-5
\ No newline at end of file
+8
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO415Case.result
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO415Case.result b/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO415Case.result
index 6c527af..839a4e5 100644
--- a/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO415Case.result
+++ b/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO415Case.result
@@ -4,4 +4,5 @@ c_custkey,o_orderkey,cnt
2,2,1
3,3,1
4,null,1
-5,null,1
\ No newline at end of file
+5,null,1
+null,null,3
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO718Case.result
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO718Case.result b/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO718Case.result
index 86c4d57..ddee757 100644
--- a/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO718Case.result
+++ b/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO718Case.result
@@ -2,4 +2,5 @@ l_orderkey,l_orderkey1,t57801e5322bc50
-------------------------------
1,1,2
2,2,1
-3,3,2
\ No newline at end of file
+3,3,2
+null,null,0
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/c156e5c9/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO_1600.result
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO_1600.result b/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO_1600.result
index 7cb5166..b4ef88a 100644
--- a/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO_1600.result
+++ b/tajo-core-tests/src/test/resources/results/TestCaseByCases/testTAJO_1600.result
@@ -5,3 +5,4 @@ c_custkey,o_orderkey,o_orderstatus,o_orderdate
3,3,F,1993-10-14
4,null,null,null
5,null,null,null
+null,null,null,null