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/20 20:46:36 UTC
[38/48] TAJO-494: Extend TajoClient to run a query with a plan
context serialized as the JSON form. (jihoon)
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/main/java/org/apache/tajo/master/querymaster/QueryMasterManagerService.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/master/querymaster/QueryMasterManagerService.java b/tajo-core/src/main/java/org/apache/tajo/master/querymaster/QueryMasterManagerService.java
index 43c85d7..589a656 100644
--- a/tajo-core/src/main/java/org/apache/tajo/master/querymaster/QueryMasterManagerService.java
+++ b/tajo-core/src/main/java/org/apache/tajo/master/querymaster/QueryMasterManagerService.java
@@ -231,7 +231,7 @@ public class QueryMasterManagerService extends CompositeService
LOG.info("Receive executeQuery request:" + queryId);
queryMaster.handle(new QueryStartEvent(queryId,
new Session(request.getSession()),
- new QueryContext(request.getQueryContext()), request.getSql().getValue(),
+ new QueryContext(request.getQueryContext()), request.getExprInJson().getValue(),
request.getLogicalPlanJson().getValue()));
done.run(TajoWorker.TRUE_PROTO);
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/main/java/org/apache/tajo/master/querymaster/QueryMasterTask.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/master/querymaster/QueryMasterTask.java b/tajo-core/src/main/java/org/apache/tajo/master/querymaster/QueryMasterTask.java
index 4a14359..35d2cff 100644
--- a/tajo-core/src/main/java/org/apache/tajo/master/querymaster/QueryMasterTask.java
+++ b/tajo-core/src/main/java/org/apache/tajo/master/querymaster/QueryMasterTask.java
@@ -32,11 +32,10 @@ import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.util.Clock;
import org.apache.tajo.*;
import org.apache.tajo.algebra.Expr;
+import org.apache.tajo.algebra.JsonHelper;
import org.apache.tajo.catalog.CatalogService;
import org.apache.tajo.catalog.TableDesc;
import org.apache.tajo.conf.TajoConf;
-import org.apache.tajo.engine.parser.HiveQLAnalyzer;
-import org.apache.tajo.engine.parser.SQLAnalyzer;
import org.apache.tajo.engine.planner.LogicalOptimizer;
import org.apache.tajo.engine.planner.LogicalPlan;
import org.apache.tajo.engine.planner.LogicalPlanner;
@@ -93,7 +92,7 @@ public class QueryMasterTask extends CompositeService {
private MasterPlan masterPlan;
- private String sql;
+ private String jsonExpr;
private String logicalPlanJson;
@@ -119,7 +118,7 @@ public class QueryMasterTask extends CompositeService {
new ArrayList<TajoWorkerProtocol.TaskFatalErrorReport>();
public QueryMasterTask(QueryMaster.QueryMasterContext queryMasterContext,
- QueryId queryId, Session session, QueryContext queryContext, String sql,
+ QueryId queryId, Session session, QueryContext queryContext, String jsonExpr,
String logicalPlanJson) {
super(QueryMasterTask.class.getName());
@@ -127,7 +126,7 @@ public class QueryMasterTask extends CompositeService {
this.queryId = queryId;
this.session = session;
this.queryContext = queryContext;
- this.sql = sql;
+ this.jsonExpr = jsonExpr;
this.logicalPlanJson = logicalPlanJson;
this.querySubmitTime = System.currentTimeMillis();
}
@@ -243,7 +242,6 @@ public class QueryMasterTask extends CompositeService {
if(LOG.isDebugEnabled()) {
LOG.debug("SubQueryEventDispatcher:" + id + "," + event.getType());
}
- //Query query = queryMasterTasks.get(id.getQueryId()).getQuery();
query.getSubQuery(id).handle(event);
}
}
@@ -255,7 +253,6 @@ public class QueryMasterTask extends CompositeService {
if(LOG.isDebugEnabled()) {
LOG.debug("TaskEventDispatcher>" + taskId + "," + event.getType());
}
- //Query query = queryMasterTasks.get(taskId.getExecutionBlockId().getQueryId()).getQuery();
QueryUnit task = query.getSubQuery(taskId.getExecutionBlockId()).
getQueryUnit(taskId);
task.handle(event);
@@ -266,7 +263,6 @@ public class QueryMasterTask extends CompositeService {
implements EventHandler<TaskAttemptEvent> {
public void handle(TaskAttemptEvent event) {
QueryUnitAttemptId attemptId = event.getTaskAttemptId();
- //Query query = queryMasterTasks.get(attemptId.getQueryUnitId().getExecutionBlockId().getQueryId()).getQuery();
SubQuery subQuery = query.getSubQuery(attemptId.getQueryUnitId().getExecutionBlockId());
QueryUnit task = subQuery.getQueryUnit(attemptId.getQueryUnitId());
QueryUnitAttempt attempt = task.getAttempt(attemptId);
@@ -277,7 +273,6 @@ public class QueryMasterTask extends CompositeService {
private class TaskSchedulerDispatcher
implements EventHandler<TaskSchedulerEvent> {
public void handle(TaskSchedulerEvent event) {
- //Query query = queryMasterTasks.get(event.getExecutionBlockId().getQueryId()).getQuery();
SubQuery subQuery = query.getSubQuery(event.getExecutionBlockId());
subQuery.getTaskScheduler().handle(event);
}
@@ -330,14 +325,7 @@ public class QueryMasterTask extends CompositeService {
CatalogService catalog = getQueryTaskContext().getQueryMasterContext().getWorkerContext().getCatalog();
LogicalPlanner planner = new LogicalPlanner(catalog);
LogicalOptimizer optimizer = new LogicalOptimizer(systemConf);
- Expr expr;
- if (queryContext.isHiveQueryMode()) {
- HiveQLAnalyzer HiveQLAnalyzer = new HiveQLAnalyzer();
- expr = HiveQLAnalyzer.parse(sql);
- } else {
- SQLAnalyzer analyzer = new SQLAnalyzer();
- expr = analyzer.parse(sql);
- }
+ Expr expr = JsonHelper.fromJson(jsonExpr, Expr.class);
LogicalPlan plan = planner.createPlan(session, expr);
optimizer.optimize(plan);
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/main/proto/TajoWorkerProtocol.proto
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/proto/TajoWorkerProtocol.proto b/tajo-core/src/main/proto/TajoWorkerProtocol.proto
index 5d4ae44..e3d3028 100644
--- a/tajo-core/src/main/proto/TajoWorkerProtocol.proto
+++ b/tajo-core/src/main/proto/TajoWorkerProtocol.proto
@@ -132,8 +132,8 @@ message QueryExecutionRequestProto {
required QueryIdProto queryId = 1;
required SessionProto session = 2;
required KeyValueSetProto queryContext = 3;
- required StringProto sql = 4;
- optional StringProto logicalPlanJson = 5;
+ required StringProto exprInJson = 5;
+ optional StringProto logicalPlanJson = 6;
}
message GetTaskRequestProto {
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/java/org/apache/tajo/QueryTestCaseBase.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/QueryTestCaseBase.java b/tajo-core/src/test/java/org/apache/tajo/QueryTestCaseBase.java
index 3843c58..1d6ee86 100644
--- a/tajo-core/src/test/java/org/apache/tajo/QueryTestCaseBase.java
+++ b/tajo-core/src/test/java/org/apache/tajo/QueryTestCaseBase.java
@@ -237,6 +237,10 @@ public class QueryTestCaseBase {
return executeFile(name.getMethodName() + ".sql");
}
+ public ResultSet executeJsonQuery() throws Exception {
+ return executeJsonFile(name.getMethodName() + ".json");
+ }
+
/**
* Execute a query contained in the given named file. This methods tries to find the given file within the directory
* src/test/resources/results/<i>ClassName</i>.
@@ -258,6 +262,16 @@ public class QueryTestCaseBase {
return result;
}
+ public ResultSet executeJsonFile(String jsonFileName) throws Exception {
+ Path queryFilePath = getQueryFilePath(jsonFileName);
+ FileSystem fs = currentQueryPath.getFileSystem(testBase.getTestingCluster().getConfiguration());
+ assertTrue(queryFilePath.toString() + " existence check", fs.exists(queryFilePath));
+
+ ResultSet result = client.executeJsonQueryAndGetResult(FileUtil.readTextFile(new File(queryFilePath.toUri())));
+ assertNotNull("Query succeeded test", result);
+ return result;
+ }
+
/**
* Assert the equivalence between the expected result and an actual query result.
* If it isn't it throws an AssertionError.
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java
index 9e3c375..cf97090 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java
@@ -243,4 +243,13 @@ public class TestGroupByQuery extends QueryTestCaseBase {
assertResultSet(res);
cleanupQuery(res);
}
+
+ @Test
+ public final void testGroupbyWithJson() throws Exception {
+ // select l_orderkey, avg(l_partkey) total, sum(l_linenumber) as num from lineitem group by l_orderkey
+ // having total >= 2 or num = 3;
+ ResultSet res = executeJsonQuery();
+ assertResultSet(res);
+ cleanupQuery(res);
+ }
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
index 8692070..9bedc10 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
@@ -236,7 +236,7 @@ public class TestJoinQuery extends QueryTestCaseBase {
@Test
public void testCrossJoinWithAsterisk4() throws Exception {
- // select length(r_regionkey), *, c_custkey*10 from customer, region
+ // select length(r_comment) as len, *, c_custkey*10 from customer, region order by len,r_regionkey,r_name
ResultSet res = executeQuery();
assertResultSet(res);
cleanupQuery(res);
@@ -322,4 +322,43 @@ public class TestJoinQuery extends QueryTestCaseBase {
assertResultSet(res);
cleanupQuery(res);
}
+
+ @Test
+ public final void testJoinWithJson() throws Exception {
+ // select length(r_comment) as len, *, c_custkey*10 from customer, region order by len,r_regionkey,r_name
+ ResultSet res = executeJsonQuery();
+ assertResultSet(res);
+ cleanupQuery(res);
+ }
+
+ @Test
+ public final void testJoinWithJson2() throws Exception {
+ /*
+ select t.n_nationkey, t.n_name, t.n_regionkey, t.n_comment, ps.ps_availqty, s.s_suppkey
+ from (
+ select n_nationkey, n_name, n_regionkey, n_comment
+ from nation n
+ join region r on (n.n_regionkey = r.r_regionkey)
+ ) t
+ join supplier s on (s.s_nationkey = t.n_nationkey)
+ join partsupp ps on (s.s_suppkey = ps.ps_suppkey)
+ where t.n_name in ('ARGENTINA','ETHIOPIA', 'MOROCCO');
+ */
+ ResultSet res = executeJsonQuery();
+ assertResultSet(res);
+ cleanupQuery(res);
+ }
+
+ @Test
+ public final void testJoinOnMultipleDatabasesWithJson() throws Exception {
+ executeString("CREATE DATABASE JOINS");
+ assertDatabaseExists("joins");
+ executeString("CREATE TABLE JOINS.part_ as SELECT * FROM part");
+ assertTableExists("joins.part_");
+ executeString("CREATE TABLE JOINS.supplier_ as SELECT * FROM supplier");
+ assertTableExists("joins.supplier_");
+ ResultSet res = executeJsonQuery();
+ assertResultSet(res);
+ cleanupQuery(res);
+ }
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
index 37a748c..815994b 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java
@@ -296,6 +296,13 @@ public class TestSelectQuery extends QueryTestCaseBase {
}
@Test
+ public final void testSelectWithJson() throws Exception {
+ // select l_orderkey, l_partkey + 1 as plus1, l_partkey + 1 as plus2 from lineitem where l_orderkey > -1;
+ ResultSet res = executeJsonQuery();
+ assertResultSet(res);
+ cleanupQuery(res);
+ }
+
public final void testDatabaseRef() throws Exception {
if (!testingCluster.isHCatalogStoreRunning()) {
executeString("CREATE DATABASE \"TestSelectQuery\"").close();
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
index 206e638..2f5a755 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
@@ -143,4 +143,20 @@ public class TestSortQuery extends QueryTestCaseBase {
assertResultSet(res);
cleanupQuery(res);
}
+
+ @Test
+ public final void testSortWithJson() throws Exception {
+ // select max(l_quantity) as max_quantity, l_orderkey from lineitem group by l_orderkey order by max_quantity;
+ ResultSet res = executeJsonQuery();
+ assertResultSet(res);
+ cleanupQuery(res);
+ }
+
+ @Test
+ public final void testTopkWithJson() throws Exception {
+ // select l_orderkey, l_linenumber from lineitem order by l_orderkey desc limit 3;
+ ResultSet res = executeJsonQuery();
+ assertResultSet(res);
+ cleanupQuery(res);
+ }
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/java/org/apache/tajo/engine/query/TestTableSubQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestTableSubQuery.java b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestTableSubQuery.java
index 9be0302..bc643ab 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestTableSubQuery.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestTableSubQuery.java
@@ -57,4 +57,25 @@ public class TestTableSubQuery extends QueryTestCaseBase {
assertResultSet(res);
cleanupQuery(res);
}
+
+ @Test
+ public final void testGroupbySubqueryWithJson() throws Exception {
+ ResultSet res = executeJsonQuery();
+ assertResultSet(res);
+ cleanupQuery(res);
+ }
+
+ @Test
+ public final void testJoinSubqueryWithJson() throws Exception {
+ /*
+ SELECT
+ A.n_regionkey, B.r_regionkey, A.n_name, B.r_name
+ FROM
+ (SELECT * FROM nation WHERE n_name LIKE 'A%') A
+ JOIN region B ON A.n_regionkey=B.r_regionkey;
+ */
+ ResultSet res = executeJsonQuery();
+ assertResultSet(res);
+ cleanupQuery(res);
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/resources/queries/TestGroupByQuery/testGroupbyWithJson.json
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/queries/TestGroupByQuery/testGroupbyWithJson.json b/tajo-core/src/test/resources/queries/TestGroupByQuery/testGroupbyWithJson.json
new file mode 100644
index 0000000..7a60c64
--- /dev/null
+++ b/tajo-core/src/test/resources/queries/TestGroupByQuery/testGroupbyWithJson.json
@@ -0,0 +1,98 @@
+// select l_orderkey, avg(l_partkey) total, sum(l_linenumber) as num from lineitem group by l_orderkey
+// having total >= 2 or num = 3;
+{
+ "IsDistinct": false,
+ "Projections": [
+ {
+ "Expr": {
+ "ColumnName": "l_orderkey",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "AliasName": "total",
+ "Expr": {
+ "IsDistinct": false,
+ "Signature": "avg",
+ "FuncParams": [
+ {
+ "ColumnName": "l_partkey",
+ "OpType": "Column"
+ }
+ ],
+ "OpType": "GeneralSetFunction"
+ },
+ "OpType": "Target"
+ },
+ {
+ "AliasName": "num",
+ "Expr": {
+ "IsDistinct": false,
+ "Signature": "sum",
+ "FuncParams": [
+ {
+ "ColumnName": "l_linenumber",
+ "OpType": "Column"
+ }
+ ],
+ "OpType": "GeneralSetFunction"
+ },
+ "OpType": "Target"
+ }
+ ],
+ "Expr": {
+ "HavingCondition": {
+ "LeftExpr": {
+ "LeftExpr": {
+ "ColumnName": "total",
+ "OpType": "Column"
+ },
+ "RightExpr": {
+ "Value": "2",
+ "ValueType": "Unsigned_Integer",
+ "OpType": "Literal"
+ },
+ "OpType": "GreaterThanOrEquals"
+ },
+ "RightExpr": {
+ "LeftExpr": {
+ "ColumnName": "num",
+ "OpType": "Column"
+ },
+ "RightExpr": {
+ "Value": "3",
+ "ValueType": "Unsigned_Integer",
+ "OpType": "Literal"
+ },
+ "OpType": "Equals"
+ },
+ "OpType": "Or"
+ },
+ "Expr": {
+ "Groups": [
+ {
+ "GroupType": "OrdinaryGroup",
+ "Dimensions": [
+ {
+ "ColumnName": "l_orderkey",
+ "OpType": "Column"
+ }
+ ]
+ }
+ ],
+ "Expr": {
+ "Relations": [
+ {
+ "TableName": "lineitem",
+ "OpType": "Relation"
+ }
+ ],
+ "OpType": "RelationList"
+ },
+ "OpType": "Aggregation"
+ },
+ "OpType": "Having"
+ },
+ "OpType": "Projection"
+}
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/resources/queries/TestJoinQuery/testJoinOnMultipleDatabasesWithJson.json
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/queries/TestJoinQuery/testJoinOnMultipleDatabasesWithJson.json b/tajo-core/src/test/resources/queries/TestJoinQuery/testJoinOnMultipleDatabasesWithJson.json
new file mode 100644
index 0000000..874305d
--- /dev/null
+++ b/tajo-core/src/test/resources/queries/TestJoinQuery/testJoinOnMultipleDatabasesWithJson.json
@@ -0,0 +1,210 @@
+/*
+ select
+ s_acctbal,
+ s_name,
+ n_name,
+ JOINS.part_.p_partkey,
+ p_mfgr,
+ JOINS.supplier_.s_address,
+ JOINS.supplier_.s_phone,
+ s_comment
+ from
+ JOINS.part_,
+ JOINS.supplier_,
+ partsupp,
+ nation,
+ region
+ where
+ p_partkey = ps_partkey
+ and s_suppkey = ps_suppkey
+ and s_nationkey = n_nationkey
+ and n_regionkey = r_regionkey
+ order by
+ s_acctbal,
+ s_name,
+ n_name,
+ p_partkey;
+ */
+{
+ "IsDistinct": false,
+ "Projections": [
+ {
+ "Expr": {
+ "ColumnName": "s_acctbal",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "ColumnName": "s_name",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "ColumnName": "n_name",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "Qualifier": "joins.part_",
+ "ColumnName": "p_partkey",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "ColumnName": "p_mfgr",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "Qualifier": "joins.supplier_",
+ "ColumnName": "s_address",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "Qualifier": "joins.supplier_",
+ "ColumnName": "s_phone",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "ColumnName": "s_comment",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ }
+ ],
+ "Expr": {
+ "SortSpecs": [
+ {
+ "SortKey": {
+ "ColumnName": "s_acctbal",
+ "OpType": "Column"
+ },
+ "IsAsc": true,
+ "IsNullFirst": false
+ },
+ {
+ "SortKey": {
+ "ColumnName": "s_name",
+ "OpType": "Column"
+ },
+ "IsAsc": true,
+ "IsNullFirst": false
+ },
+ {
+ "SortKey": {
+ "ColumnName": "n_name",
+ "OpType": "Column"
+ },
+ "IsAsc": true,
+ "IsNullFirst": false
+ },
+ {
+ "SortKey": {
+ "ColumnName": "p_partkey",
+ "OpType": "Column"
+ },
+ "IsAsc": true,
+ "IsNullFirst": false
+ }
+ ],
+ "Expr": {
+ "SelectCondition": {
+ "LeftExpr": {
+ "LeftExpr": {
+ "ColumnName": "p_partkey",
+ "OpType": "Column"
+ },
+ "RightExpr": {
+ "ColumnName": "ps_partkey",
+ "OpType": "Column"
+ },
+ "OpType": "Equals"
+ },
+ "RightExpr": {
+ "LeftExpr": {
+ "LeftExpr": {
+ "ColumnName": "s_suppkey",
+ "OpType": "Column"
+ },
+ "RightExpr": {
+ "ColumnName": "ps_suppkey",
+ "OpType": "Column"
+ },
+ "OpType": "Equals"
+ },
+ "RightExpr": {
+ "LeftExpr": {
+ "LeftExpr": {
+ "ColumnName": "s_nationkey",
+ "OpType": "Column"
+ },
+ "RightExpr": {
+ "ColumnName": "n_nationkey",
+ "OpType": "Column"
+ },
+ "OpType": "Equals"
+ },
+ "RightExpr": {
+ "LeftExpr": {
+ "ColumnName": "n_regionkey",
+ "OpType": "Column"
+ },
+ "RightExpr": {
+ "ColumnName": "r_regionkey",
+ "OpType": "Column"
+ },
+ "OpType": "Equals"
+ },
+ "OpType": "And"
+ },
+ "OpType": "And"
+ },
+ "OpType": "And"
+ },
+ "Expr": {
+ "Relations": [
+ {
+ "TableName": "joins.part_",
+ "OpType": "Relation"
+ },
+ {
+ "TableName": "joins.supplier_",
+ "OpType": "Relation"
+ },
+ {
+ "TableName": "partsupp",
+ "OpType": "Relation"
+ },
+ {
+ "TableName": "nation",
+ "OpType": "Relation"
+ },
+ {
+ "TableName": "region",
+ "OpType": "Relation"
+ }
+ ],
+ "OpType": "RelationList"
+ },
+ "OpType": "Filter"
+ },
+ "OpType": "Sort"
+ },
+ "OpType": "Projection"
+}
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/resources/queries/TestJoinQuery/testJoinWithJson.json
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/queries/TestJoinQuery/testJoinWithJson.json b/tajo-core/src/test/resources/queries/TestJoinQuery/testJoinWithJson.json
new file mode 100644
index 0000000..bfccc6c
--- /dev/null
+++ b/tajo-core/src/test/resources/queries/TestJoinQuery/testJoinWithJson.json
@@ -0,0 +1,84 @@
+// select length(r_comment) as len, *, c_custkey*10 from customer, region order by len,r_regionkey,r_name
+{
+ "IsDistinct": false,
+ "Projections": [
+ {
+ "AliasName": "len",
+ "Expr": {
+ "Signature": "length",
+ "FuncParams": [
+ {
+ "ColumnName": "r_comment",
+ "OpType": "Column"
+ }
+ ],
+ "OpType": "Function"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "OpType": "Asterisk"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "LeftExpr": {
+ "ColumnName": "c_custkey",
+ "OpType": "Column"
+ },
+ "RightExpr": {
+ "Value": "10",
+ "ValueType": "Unsigned_Integer",
+ "OpType": "Literal"
+ },
+ "OpType": "Multiply"
+ },
+ "OpType": "Target"
+ }
+ ],
+ "Expr": {
+ "SortSpecs": [
+ {
+ "SortKey": {
+ "ColumnName": "len",
+ "OpType": "Column"
+ },
+ "IsAsc": true,
+ "IsNullFirst": false
+ },
+ {
+ "SortKey": {
+ "ColumnName": "r_regionkey",
+ "OpType": "Column"
+ },
+ "IsAsc": true,
+ "IsNullFirst": false
+ },
+ {
+ "SortKey": {
+ "ColumnName": "r_name",
+ "OpType": "Column"
+ },
+ "IsAsc": true,
+ "IsNullFirst": false
+ }
+ ],
+ "Expr": {
+ "Relations": [
+ {
+ "TableName": "customer",
+ "OpType": "Relation"
+ },
+ {
+ "TableName": "region",
+ "OpType": "Relation"
+ }
+ ],
+ "OpType": "RelationList"
+ },
+ "OpType": "Sort"
+ },
+ "OpType": "Projection"
+}
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/resources/queries/TestJoinQuery/testJoinWithJson2.json
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/queries/TestJoinQuery/testJoinWithJson2.json b/tajo-core/src/test/resources/queries/TestJoinQuery/testJoinWithJson2.json
new file mode 100644
index 0000000..353636a
--- /dev/null
+++ b/tajo-core/src/test/resources/queries/TestJoinQuery/testJoinWithJson2.json
@@ -0,0 +1,219 @@
+/*
+ select t.n_nationkey, t.n_name, t.n_regionkey, t.n_comment, ps.ps_availqty, s.s_suppkey
+ from (
+ select n_nationkey, n_name, n_regionkey, n_comment
+ from nation n
+ join region r on (n.n_regionkey = r.r_regionkey)
+ ) t
+ join supplier s on (s.s_nationkey = t.n_nationkey)
+ join partsupp ps on (s.s_suppkey = ps.ps_suppkey)
+ where t.n_name in ('ARGENTINA','ETHIOPIA', 'MOROCCO');
+ */
+{
+ "IsDistinct": false,
+ "Projections": [
+ {
+ "Expr": {
+ "Qualifier": "t",
+ "ColumnName": "n_nationkey",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "Qualifier": "t",
+ "ColumnName": "n_name",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "Qualifier": "t",
+ "ColumnName": "n_regionkey",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "Qualifier": "t",
+ "ColumnName": "n_comment",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "Qualifier": "ps",
+ "ColumnName": "ps_availqty",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "Qualifier": "s",
+ "ColumnName": "s_suppkey",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ }
+ ],
+ "Expr": {
+ "SelectCondition": {
+ "IsNot": false,
+ "LeftExpr": {
+ "Qualifier": "t",
+ "ColumnName": "n_name",
+ "OpType": "Column"
+ },
+ "RightExpr": {
+ "Values": [
+ {
+ "Value": "ARGENTINA",
+ "ValueType": "String",
+ "OpType": "Literal"
+ },
+ {
+ "Value": "ETHIOPIA",
+ "ValueType": "String",
+ "OpType": "Literal"
+ },
+ {
+ "Value": "MOROCCO",
+ "ValueType": "String",
+ "OpType": "Literal"
+ }
+ ],
+ "OpType": "ValueList"
+ },
+ "OpType": "InPredicate"
+ },
+ "Expr": {
+ "Relations": [
+ {
+ "JoinType": "INNER",
+ "JoinCondition": {
+ "LeftExpr": {
+ "Qualifier": "s",
+ "ColumnName": "s_suppkey",
+ "OpType": "Column"
+ },
+ "RightExpr": {
+ "Qualifier": "ps",
+ "ColumnName": "ps_suppkey",
+ "OpType": "Column"
+ },
+ "OpType": "Equals"
+ },
+ "IsNatural": false,
+ "LeftExpr": {
+ "JoinType": "INNER",
+ "JoinCondition": {
+ "LeftExpr": {
+ "Qualifier": "s",
+ "ColumnName": "s_nationkey",
+ "OpType": "Column"
+ },
+ "RightExpr": {
+ "Qualifier": "t",
+ "ColumnName": "n_nationkey",
+ "OpType": "Column"
+ },
+ "OpType": "Equals"
+ },
+ "IsNatural": false,
+ "LeftExpr": {
+ "SubPlan": {
+ "IsDistinct": false,
+ "Projections": [
+ {
+ "Expr": {
+ "ColumnName": "n_nationkey",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "ColumnName": "n_name",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "ColumnName": "n_regionkey",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "ColumnName": "n_comment",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ }
+ ],
+ "Expr": {
+ "Relations": [
+ {
+ "JoinType": "INNER",
+ "JoinCondition": {
+ "LeftExpr": {
+ "Qualifier": "n",
+ "ColumnName": "n_regionkey",
+ "OpType": "Column"
+ },
+ "RightExpr": {
+ "Qualifier": "r",
+ "ColumnName": "r_regionkey",
+ "OpType": "Column"
+ },
+ "OpType": "Equals"
+ },
+ "IsNatural": false,
+ "LeftExpr": {
+ "TableName": "nation",
+ "TableAlias": "n",
+ "OpType": "Relation"
+ },
+ "RightExpr": {
+ "TableName": "region",
+ "TableAlias": "r",
+ "OpType": "Relation"
+ },
+ "OpType": "Join"
+ }
+ ],
+ "OpType": "RelationList"
+ },
+ "OpType": "Projection"
+ },
+ "TableName": "t",
+ "OpType": "TablePrimaryTableSubQuery"
+ },
+ "RightExpr": {
+ "TableName": "supplier",
+ "TableAlias": "s",
+ "OpType": "Relation"
+ },
+ "OpType": "Join"
+ },
+ "RightExpr": {
+ "TableName": "partsupp",
+ "TableAlias": "ps",
+ "OpType": "Relation"
+ },
+ "OpType": "Join"
+ }
+ ],
+ "OpType": "RelationList"
+ },
+ "OpType": "Filter"
+ },
+ "OpType": "Projection"
+}
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/resources/queries/TestSelectQuery/testSelectWithJson.json
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/queries/TestSelectQuery/testSelectWithJson.json b/tajo-core/src/test/resources/queries/TestSelectQuery/testSelectWithJson.json
new file mode 100644
index 0000000..bf89ab5
--- /dev/null
+++ b/tajo-core/src/test/resources/queries/TestSelectQuery/testSelectWithJson.json
@@ -0,0 +1,74 @@
+// select l_orderkey, l_partkey + 1 as plus1, l_partkey + 1 as plus2 from lineitem where l_orderkey > -1;
+{
+ "IsDistinct": false,
+ "Projections": [
+ {
+ "Expr": {
+ "ColumnName": "l_orderkey",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "AliasName": "plus1",
+ "Expr": {
+ "LeftExpr": {
+ "ColumnName": "l_partkey",
+ "OpType": "Column"
+ },
+ "RightExpr": {
+ "Value": "1",
+ "ValueType": "Unsigned_Integer",
+ "OpType": "Literal"
+ },
+ "OpType": "Plus"
+ },
+ "OpType": "Target"
+ },
+ {
+ "AliasName": "plus2",
+ "Expr": {
+ "LeftExpr": {
+ "ColumnName": "l_partkey",
+ "OpType": "Column"
+ },
+ "RightExpr": {
+ "Value": "1",
+ "ValueType": "Unsigned_Integer",
+ "OpType": "Literal"
+ },
+ "OpType": "Plus"
+ },
+ "OpType": "Target"
+ }
+ ],
+ "Expr": {
+ "SelectCondition": {
+ "LeftExpr": {
+ "ColumnName": "l_orderkey",
+ "OpType": "Column"
+ },
+ "RightExpr": {
+ "IsNegative": true,
+ "Expr": {
+ "Value": "1",
+ "ValueType": "Unsigned_Integer",
+ "OpType": "Literal"
+ },
+ "OpType": "Sign"
+ },
+ "OpType": "GreaterThan"
+ },
+ "Expr": {
+ "Relations": [
+ {
+ "TableName": "lineitem",
+ "OpType": "Relation"
+ }
+ ],
+ "OpType": "RelationList"
+ },
+ "OpType": "Filter"
+ },
+ "OpType": "Projection"
+}
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/resources/queries/TestSortQuery/testSortWithJson.json
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/queries/TestSortQuery/testSortWithJson.json b/tajo-core/src/test/resources/queries/TestSortQuery/testSortWithJson.json
new file mode 100644
index 0000000..efcd0e0
--- /dev/null
+++ b/tajo-core/src/test/resources/queries/TestSortQuery/testSortWithJson.json
@@ -0,0 +1,65 @@
+// select max(l_quantity) as max_quantity, l_orderkey from lineitem group by l_orderkey order by max_quantity;
+{
+ "IsDistinct": false,
+ "Projections": [
+ {
+ "AliasName": "max_quantity",
+ "Expr": {
+ "IsDistinct": false,
+ "Signature": "max",
+ "FuncParams": [
+ {
+ "ColumnName": "l_quantity",
+ "OpType": "Column"
+ }
+ ],
+ "OpType": "GeneralSetFunction"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "ColumnName": "l_orderkey",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ }
+ ],
+ "Expr": {
+ "SortSpecs": [
+ {
+ "SortKey": {
+ "ColumnName": "max_quantity",
+ "OpType": "Column"
+ },
+ "IsAsc": true,
+ "IsNullFirst": false
+ }
+ ],
+ "Expr": {
+ "Groups": [
+ {
+ "GroupType": "OrdinaryGroup",
+ "Dimensions": [
+ {
+ "ColumnName": "l_orderkey",
+ "OpType": "Column"
+ }
+ ]
+ }
+ ],
+ "Expr": {
+ "Relations": [
+ {
+ "TableName": "lineitem",
+ "OpType": "Relation"
+ }
+ ],
+ "OpType": "RelationList"
+ },
+ "OpType": "Aggregation"
+ },
+ "OpType": "Sort"
+ },
+ "OpType": "Projection"
+}
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/resources/queries/TestSortQuery/testTopkWithJson.json
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/queries/TestSortQuery/testTopkWithJson.json b/tajo-core/src/test/resources/queries/TestSortQuery/testTopkWithJson.json
new file mode 100644
index 0000000..e3a264f
--- /dev/null
+++ b/tajo-core/src/test/resources/queries/TestSortQuery/testTopkWithJson.json
@@ -0,0 +1,51 @@
+// select l_orderkey, l_linenumber from lineitem order by l_orderkey desc limit 3;
+{
+ "IsDistinct": false,
+ "Projections": [
+ {
+ "Expr": {
+ "ColumnName": "l_orderkey",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "ColumnName": "l_linenumber",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ }
+ ],
+ "Expr": {
+ "Num": {
+ "Value": "3",
+ "ValueType": "Unsigned_Integer",
+ "OpType": "Literal"
+ },
+ "Expr": {
+ "SortSpecs": [
+ {
+ "SortKey": {
+ "ColumnName": "l_orderkey",
+ "OpType": "Column"
+ },
+ "IsAsc": false,
+ "IsNullFirst": false
+ }
+ ],
+ "Expr": {
+ "Relations": [
+ {
+ "TableName": "lineitem",
+ "OpType": "Relation"
+ }
+ ],
+ "OpType": "RelationList"
+ },
+ "OpType": "Sort"
+ },
+ "OpType": "Limit"
+ },
+ "OpType": "Projection"
+}
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/resources/queries/TestTableSubQuery/testGroupbySubqueryWithJson.json
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/queries/TestTableSubQuery/testGroupbySubqueryWithJson.json b/tajo-core/src/test/resources/queries/TestTableSubQuery/testGroupbySubqueryWithJson.json
new file mode 100644
index 0000000..f607a0b
--- /dev/null
+++ b/tajo-core/src/test/resources/queries/TestTableSubQuery/testGroupbySubqueryWithJson.json
@@ -0,0 +1,59 @@
+// select sum(l_extendedprice * l_discount) as revenue from (select * from lineitem) as l;
+{
+ "IsDistinct": false,
+ "Projections": [
+ {
+ "AliasName": "revenue",
+ "Expr": {
+ "IsDistinct": false,
+ "Signature": "sum",
+ "FuncParams": [
+ {
+ "LeftExpr": {
+ "ColumnName": "l_extendedprice",
+ "OpType": "Column"
+ },
+ "RightExpr": {
+ "ColumnName": "l_discount",
+ "OpType": "Column"
+ },
+ "OpType": "Multiply"
+ }
+ ],
+ "OpType": "GeneralSetFunction"
+ },
+ "OpType": "Target"
+ }
+ ],
+ "Expr": {
+ "Relations": [
+ {
+ "SubPlan": {
+ "IsDistinct": false,
+ "Projections": [
+ {
+ "Expr": {
+ "OpType": "Asterisk"
+ },
+ "OpType": "Target"
+ }
+ ],
+ "Expr": {
+ "Relations": [
+ {
+ "TableName": "lineitem",
+ "OpType": "Relation"
+ }
+ ],
+ "OpType": "RelationList"
+ },
+ "OpType": "Projection"
+ },
+ "TableName": "l",
+ "OpType": "TablePrimaryTableSubQuery"
+ }
+ ],
+ "OpType": "RelationList"
+ },
+ "OpType": "Projection"
+}
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/resources/queries/TestTableSubQuery/testJoinSubqueryWithJson.json
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/queries/TestTableSubQuery/testJoinSubqueryWithJson.json b/tajo-core/src/test/resources/queries/TestTableSubQuery/testJoinSubqueryWithJson.json
new file mode 100644
index 0000000..77f639c
--- /dev/null
+++ b/tajo-core/src/test/resources/queries/TestTableSubQuery/testJoinSubqueryWithJson.json
@@ -0,0 +1,108 @@
+{
+ "IsDistinct": false,
+ "Projections": [
+ {
+ "Expr": {
+ "Qualifier": "a",
+ "ColumnName": "n_regionkey",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "Qualifier": "b",
+ "ColumnName": "r_regionkey",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "Qualifier": "a",
+ "ColumnName": "n_name",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ },
+ {
+ "Expr": {
+ "Qualifier": "b",
+ "ColumnName": "r_name",
+ "OpType": "Column"
+ },
+ "OpType": "Target"
+ }
+ ],
+ "Expr": {
+ "Relations": [
+ {
+ "JoinType": "INNER",
+ "JoinCondition": {
+ "LeftExpr": {
+ "Qualifier": "a",
+ "ColumnName": "n_regionkey",
+ "OpType": "Column"
+ },
+ "RightExpr": {
+ "Qualifier": "b",
+ "ColumnName": "r_regionkey",
+ "OpType": "Column"
+ },
+ "OpType": "Equals"
+ },
+ "IsNatural": false,
+ "LeftExpr": {
+ "SubPlan": {
+ "IsDistinct": false,
+ "Projections": [
+ {
+ "Expr": {
+ "OpType": "Asterisk"
+ },
+ "OpType": "Target"
+ }
+ ],
+ "Expr": {
+ "SelectCondition": {
+ "IsNot": false,
+ "IsCaseInsensitive": false,
+ "LeftExpr": {
+ "ColumnName": "n_name",
+ "OpType": "Column"
+ },
+ "RightExpr": {
+ "Value": "A%",
+ "ValueType": "String",
+ "OpType": "Literal"
+ },
+ "OpType": "LikePredicate"
+ },
+ "Expr": {
+ "Relations": [
+ {
+ "TableName": "nation",
+ "OpType": "Relation"
+ }
+ ],
+ "OpType": "RelationList"
+ },
+ "OpType": "Filter"
+ },
+ "OpType": "Projection"
+ },
+ "TableName": "a",
+ "OpType": "TablePrimaryTableSubQuery"
+ },
+ "RightExpr": {
+ "TableName": "region",
+ "TableAlias": "b",
+ "OpType": "Relation"
+ },
+ "OpType": "Join"
+ }
+ ],
+ "OpType": "RelationList"
+ },
+ "OpType": "Projection"
+}
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/resources/results/TestGroupByQuery/testGroupbyWithJson.result
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestGroupByQuery/testGroupbyWithJson.result b/tajo-core/src/test/resources/results/TestGroupByQuery/testGroupbyWithJson.result
new file mode 100644
index 0000000..627db72
--- /dev/null
+++ b/tajo-core/src/test/resources/results/TestGroupByQuery/testGroupbyWithJson.result
@@ -0,0 +1,5 @@
+l_orderkey,total,num
+-------------------------------
+3,2.5,3
+1,1.0,3
+2,2.0,1
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/resources/results/TestJoinQuery/testJoinOnMultipleDatabasesWithJson.result
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestJoinQuery/testJoinOnMultipleDatabasesWithJson.result b/tajo-core/src/test/resources/results/TestJoinQuery/testJoinOnMultipleDatabasesWithJson.result
new file mode 100644
index 0000000..dc0968f
--- /dev/null
+++ b/tajo-core/src/test/resources/results/TestJoinQuery/testJoinOnMultipleDatabasesWithJson.result
@@ -0,0 +1,5 @@
+s_acctbal,s_name,n_name,p_partkey,p_mfgr,s_address,s_phone,s_comment
+-------------------------------
+4032.68,Supplier#000000002,ETHIOPIA,1,Manufacturer#1,89eJ5ksX3ImxJQBvxObC,,15-679-861-2259, slyly bold instructions. idle dependen
+4192.4,Supplier#000000003,ARGENTINA,2,Manufacturer#1,q1,G3Pj6OjIuUYfUoH18BFTKP5aU9bEV3,11-383-516-1199,blithely silent requests after the express dependencies are sl
+4641.08,Supplier#000000004,MOROCCO,3,Manufacturer#4,Bk7ah4CK8SYQTepEmvMkkgMwg,25-843-787-7479,riously even requests above the exp
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/resources/results/TestJoinQuery/testJoinWithJson.result
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestJoinQuery/testJoinWithJson.result b/tajo-core/src/test/resources/results/TestJoinQuery/testJoinWithJson.result
new file mode 100644
index 0000000..23d985e
--- /dev/null
+++ b/tajo-core/src/test/resources/results/TestJoinQuery/testJoinWithJson.result
@@ -0,0 +1,27 @@
+len,c_custkey,c_name,c_address,c_nationkey,c_phone,c_acctbal,c_mktsegment,c_comment,r_regionkey,r_name,r_comment,?multiply
+-------------------------------
+31,1,Customer#000000001,IVhzIApeRb ot,c,E,15,25-989-741-2988,711.56,BUILDING,to the even, regular platelets. regular, ironic epitaphs nag e,1,AMERICA,hs use ironic, even requests. s,10
+31,2,Customer#000000002,XSTf4,NCwDVaWNe6tEgvwfmRchLXak,13,23-768-687-3665,121.65,AUTOMOBILE,l accounts. blithely ironic theodolites integrate boldly: caref,1,AMERICA,hs use ironic, even requests. s,20
+31,3,Customer#000000003,MG9kdTD2WBHm,1,11-719-748-3364,7498.12,AUTOMOBILE, deposits eat slyly ironic, even instructions. express foxes detect slyly. blithely even accounts abov,1,AMERICA,hs use ironic, even requests. s,30
+31,4,Customer#000000004,XxVSJsLAGtn,4,14-128-190-5944,2866.83,MACHINERY, requests. final, regular ideas sleep final accou,1,AMERICA,hs use ironic, even requests. s,40
+31,5,Customer#000000005,KvpyuHCplrB84WgAiGV6sYpZq7Tj,3,13-750-942-6364,794.47,HOUSEHOLD,n accounts will have to unwind. foxes cajole accor,1,AMERICA,hs use ironic, even requests. s,50
+31,1,Customer#000000001,IVhzIApeRb ot,c,E,15,25-989-741-2988,711.56,BUILDING,to the even, regular platelets. regular, ironic epitaphs nag e,2,ASIA,ges. thinly even pinto beans ca,10
+31,2,Customer#000000002,XSTf4,NCwDVaWNe6tEgvwfmRchLXak,13,23-768-687-3665,121.65,AUTOMOBILE,l accounts. blithely ironic theodolites integrate boldly: caref,2,ASIA,ges. thinly even pinto beans ca,20
+31,3,Customer#000000003,MG9kdTD2WBHm,1,11-719-748-3364,7498.12,AUTOMOBILE, deposits eat slyly ironic, even instructions. express foxes detect slyly. blithely even accounts abov,2,ASIA,ges. thinly even pinto beans ca,30
+31,4,Customer#000000004,XxVSJsLAGtn,4,14-128-190-5944,2866.83,MACHINERY, requests. final, regular ideas sleep final accou,2,ASIA,ges. thinly even pinto beans ca,40
+31,5,Customer#000000005,KvpyuHCplrB84WgAiGV6sYpZq7Tj,3,13-750-942-6364,794.47,HOUSEHOLD,n accounts will have to unwind. foxes cajole accor,2,ASIA,ges. thinly even pinto beans ca,50
+45,1,Customer#000000001,IVhzIApeRb ot,c,E,15,25-989-741-2988,711.56,BUILDING,to the even, regular platelets. regular, ironic epitaphs nag e,3,EUROPE,ly final courts cajole furiously final excuse,10
+45,2,Customer#000000002,XSTf4,NCwDVaWNe6tEgvwfmRchLXak,13,23-768-687-3665,121.65,AUTOMOBILE,l accounts. blithely ironic theodolites integrate boldly: caref,3,EUROPE,ly final courts cajole furiously final excuse,20
+45,3,Customer#000000003,MG9kdTD2WBHm,1,11-719-748-3364,7498.12,AUTOMOBILE, deposits eat slyly ironic, even instructions. express foxes detect slyly. blithely even accounts abov,3,EUROPE,ly final courts cajole furiously final excuse,30
+45,4,Customer#000000004,XxVSJsLAGtn,4,14-128-190-5944,2866.83,MACHINERY, requests. final, regular ideas sleep final accou,3,EUROPE,ly final courts cajole furiously final excuse,40
+45,5,Customer#000000005,KvpyuHCplrB84WgAiGV6sYpZq7Tj,3,13-750-942-6364,794.47,HOUSEHOLD,n accounts will have to unwind. foxes cajole accor,3,EUROPE,ly final courts cajole furiously final excuse,50
+108,1,Customer#000000001,IVhzIApeRb ot,c,E,15,25-989-741-2988,711.56,BUILDING,to the even, regular platelets. regular, ironic epitaphs nag e,4,MIDDLE EAST,uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl,10
+108,2,Customer#000000002,XSTf4,NCwDVaWNe6tEgvwfmRchLXak,13,23-768-687-3665,121.65,AUTOMOBILE,l accounts. blithely ironic theodolites integrate boldly: caref,4,MIDDLE EAST,uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl,20
+108,3,Customer#000000003,MG9kdTD2WBHm,1,11-719-748-3364,7498.12,AUTOMOBILE, deposits eat slyly ironic, even instructions. express foxes detect slyly. blithely even accounts abov,4,MIDDLE EAST,uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl,30
+108,4,Customer#000000004,XxVSJsLAGtn,4,14-128-190-5944,2866.83,MACHINERY, requests. final, regular ideas sleep final accou,4,MIDDLE EAST,uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl,40
+108,5,Customer#000000005,KvpyuHCplrB84WgAiGV6sYpZq7Tj,3,13-750-942-6364,794.47,HOUSEHOLD,n accounts will have to unwind. foxes cajole accor,4,MIDDLE EAST,uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl,50
+115,1,Customer#000000001,IVhzIApeRb ot,c,E,15,25-989-741-2988,711.56,BUILDING,to the even, regular platelets. regular, ironic epitaphs nag e,0,AFRICA,lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to ,10
+115,2,Customer#000000002,XSTf4,NCwDVaWNe6tEgvwfmRchLXak,13,23-768-687-3665,121.65,AUTOMOBILE,l accounts. blithely ironic theodolites integrate boldly: caref,0,AFRICA,lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to ,20
+115,3,Customer#000000003,MG9kdTD2WBHm,1,11-719-748-3364,7498.12,AUTOMOBILE, deposits eat slyly ironic, even instructions. express foxes detect slyly. blithely even accounts abov,0,AFRICA,lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to ,30
+115,4,Customer#000000004,XxVSJsLAGtn,4,14-128-190-5944,2866.83,MACHINERY, requests. final, regular ideas sleep final accou,0,AFRICA,lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to ,40
+115,5,Customer#000000005,KvpyuHCplrB84WgAiGV6sYpZq7Tj,3,13-750-942-6364,794.47,HOUSEHOLD,n accounts will have to unwind. foxes cajole accor,0,AFRICA,lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to ,50
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/resources/results/TestJoinQuery/testJoinWithJson2.result
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestJoinQuery/testJoinWithJson2.result b/tajo-core/src/test/resources/results/TestJoinQuery/testJoinWithJson2.result
new file mode 100644
index 0000000..155ba42
--- /dev/null
+++ b/tajo-core/src/test/resources/results/TestJoinQuery/testJoinWithJson2.result
@@ -0,0 +1,5 @@
+n_nationkey,n_name,n_regionkey,n_comment,ps_availqty,s_suppkey
+-------------------------------
+1,ARGENTINA,1,al foxes promise slyly according to the regular accounts. bold requests alon,8895,3
+5,ETHIOPIA,0,ven packages wake quickly. regu,3325,2
+15,MOROCCO,0,rns. blithely bold courts among the closely regular packages use furiously bold platelets?,4651,4
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/resources/results/TestSelectQuery/testSelectWithJson.result
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestSelectQuery/testSelectWithJson.result b/tajo-core/src/test/resources/results/TestSelectQuery/testSelectWithJson.result
new file mode 100644
index 0000000..b114098
--- /dev/null
+++ b/tajo-core/src/test/resources/results/TestSelectQuery/testSelectWithJson.result
@@ -0,0 +1,7 @@
+l_orderkey,plus1,plus2
+-------------------------------
+1,2,2
+1,2,2
+2,3,3
+3,3,3
+3,4,4
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/resources/results/TestSortQuery/testSortWithJson.result
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestSortQuery/testSortWithJson.result b/tajo-core/src/test/resources/results/TestSortQuery/testSortWithJson.result
new file mode 100644
index 0000000..bc0bf1b
--- /dev/null
+++ b/tajo-core/src/test/resources/results/TestSortQuery/testSortWithJson.result
@@ -0,0 +1,5 @@
+max_quantity,l_orderkey
+-------------------------------
+36.0,1
+38.0,2
+49.0,3
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/resources/results/TestSortQuery/testTopkWithJson.result
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestSortQuery/testTopkWithJson.result b/tajo-core/src/test/resources/results/TestSortQuery/testTopkWithJson.result
new file mode 100644
index 0000000..df40678
--- /dev/null
+++ b/tajo-core/src/test/resources/results/TestSortQuery/testTopkWithJson.result
@@ -0,0 +1,5 @@
+l_orderkey,l_linenumber
+-------------------------------
+3,1
+3,2
+2,1
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/resources/results/TestTableSubQuery/testGroupbySubqueryWithJson.result
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestTableSubQuery/testGroupbySubqueryWithJson.result b/tajo-core/src/test/resources/results/TestTableSubQuery/testGroupbySubqueryWithJson.result
new file mode 100644
index 0000000..628924b
--- /dev/null
+++ b/tajo-core/src/test/resources/results/TestTableSubQuery/testGroupbySubqueryWithJson.result
@@ -0,0 +1,3 @@
+revenue
+-------------------------------
+12908.3436
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tajo/blob/9bbf87e3/tajo-core/src/test/resources/results/TestTableSubQuery/testJoinSubqueryWithJson.result
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestTableSubQuery/testJoinSubqueryWithJson.result b/tajo-core/src/test/resources/results/TestTableSubQuery/testJoinSubqueryWithJson.result
new file mode 100644
index 0000000..0c0acd3
--- /dev/null
+++ b/tajo-core/src/test/resources/results/TestTableSubQuery/testJoinSubqueryWithJson.result
@@ -0,0 +1,4 @@
+n_regionkey,r_regionkey,n_name,r_name
+-------------------------------
+0,0,ALGERIA,AFRICA
+1,1,ARGENTINA,AMERICA
\ No newline at end of file