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 2015/09/02 13:06:24 UTC

[01/39] tajo git commit: initial work.

Repository: tajo
Updated Branches:
  refs/heads/TAJO-1730 [created] 555ac7d85


initial work.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/45479947
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/45479947
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/45479947

Branch: refs/heads/TAJO-1730
Commit: 45479947332fef46d34a023751b8656a24495539
Parents: 00ccb8b
Author: Hyunsik Choi <hy...@apache.org>
Authored: Fri Jul 31 09:01:45 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Fri Jul 31 09:01:45 2015 +0900

----------------------------------------------------------------------
 .../org/apache/tajo/catalog/CatalogServer.java  |   5 -
 tajo-storage/pom.xml                            |   1 +
 .../src/main/resources/storage-default.json     |   4 +
 tajo-storage/tajo-storage-jdbc/pom.xml          | 350 +++++++++++++++++++
 .../tajo/storage/jdbc/JdbcTablespace.java       | 146 ++++++++
 .../src/main/proto/StorageFragmentProtos.proto  |  36 ++
 .../tajo/storage/hbase/TestJdbcTableSpace.java  |  72 ++++
 7 files changed, 609 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/45479947/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
index 0327367..338f4c8 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
@@ -105,11 +105,6 @@ public class CatalogServer extends AbstractService {
     this.builtingFuncs = sqlFuncs;
   }
 
-  public void reloadBuiltinFunctions(List<FunctionDesc> builtingFuncs) throws ServiceException {
-    this.builtingFuncs = builtingFuncs;
-    initBuiltinFunctions(builtingFuncs);
-  }
-
   @Override
   public void serviceInit(Configuration conf) throws Exception {
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/45479947/tajo-storage/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/pom.xml b/tajo-storage/pom.xml
index 913e719..9e2fda4 100644
--- a/tajo-storage/pom.xml
+++ b/tajo-storage/pom.xml
@@ -37,6 +37,7 @@
     <module>tajo-storage-common</module>
     <module>tajo-storage-hdfs</module>
     <module>tajo-storage-hbase</module>
+    <module>tajo-storage-jdbc</module>
   </modules>
 
   <build>

http://git-wip-us.apache.org/repos/asf/tajo/blob/45479947/tajo-storage/tajo-storage-common/src/main/resources/storage-default.json
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/resources/storage-default.json b/tajo-storage/tajo-storage-common/src/main/resources/storage-default.json
index 40e17f4..16d20db 100644
--- a/tajo-storage/tajo-storage-common/src/main/resources/storage-default.json
+++ b/tajo-storage/tajo-storage-common/src/main/resources/storage-default.json
@@ -15,6 +15,10 @@
     "hbase": {
       "handler": "org.apache.tajo.storage.hbase.HBaseTablespace",
       "default-format": "hbase"
+    },
+    "jdbc": {
+      "handler": "org.apache.tajo.storage.jdbc.JdbcTablespace",
+      "default-format": "hbase"
     }
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/45479947/tajo-storage/tajo-storage-jdbc/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/pom.xml b/tajo-storage/tajo-storage-jdbc/pom.xml
new file mode 100644
index 0000000..93c15bb
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/pom.xml
@@ -0,0 +1,350 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>tajo-project</artifactId>
+    <groupId>org.apache.tajo</groupId>
+    <version>0.11.0-SNAPSHOT</version>
+    <relativePath>../../tajo-project</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>tajo-storage-jdbc</artifactId>
+  <packaging>jar</packaging>
+  <name>Tajo JDBC storage common</name>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+  </properties>
+
+  <repositories>
+    <repository>
+      <id>repository.jboss.org</id>
+      <url>https://repository.jboss.org/nexus/content/repositories/releases/
+      </url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.6</source>
+          <target>1.6</target>
+          <encoding>${project.build.sourceEncoding}</encoding>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.rat</groupId>
+        <artifactId>apache-rat-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>src/main/resources/*.json</exclude>
+            <exclude>src/test/resources/*.json</exclude>
+          </excludes>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>verify</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <systemProperties>
+            <tajo.test>TRUE</tajo.test>
+          </systemProperties>
+          <argLine>-Xms512m -Xmx1024m -XX:MaxPermSize=128m -Dfile.encoding=UTF-8</argLine>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>2.4</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>create-protobuf-generated-sources-directory</id>
+            <phase>initialize</phase>
+            <configuration>
+              <target>
+                <mkdir dir="target/generated-sources/proto" />
+              </target>
+            </configuration>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <version>1.2</version>
+        <executions>
+          <execution>
+            <id>generate-sources</id>
+            <phase>generate-sources</phase>
+            <configuration>
+              <executable>protoc</executable>
+              <arguments>
+                <argument>-Isrc/main/proto/</argument>
+                <argument>--proto_path=../../tajo-common/src/main/proto</argument>
+                <argument>--proto_path=../../tajo-catalog/tajo-catalog-common/src/main/proto</argument>
+                <argument>--java_out=target/generated-sources/proto</argument>
+                <argument>src/main/proto/StorageFragmentProtos.proto</argument>
+              </arguments>
+            </configuration>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <version>1.5</version>
+        <executions>
+          <execution>
+            <id>add-source</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>add-source</goal>
+            </goals>
+            <configuration>
+              <sources>
+                <source>target/generated-sources/proto</source>
+              </sources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-report-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-common</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-catalog-common</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-plan</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-storage-common</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-storage-hdfs</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-common</artifactId>
+      <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <artifactId>zookeeper</artifactId>
+          <groupId>org.apache.zookeeper</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>slf4j-api</artifactId>
+          <groupId>org.slf4j</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>jersey-json</artifactId>
+          <groupId>com.sun.jersey</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdfs</artifactId>
+      <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-el</groupId>
+          <artifactId>commons-el</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-runtime</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-compiler</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.mortbay.jetty</groupId>
+          <artifactId>jsp-2.1-jetty</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.sun.jersey.jersey-test-framework</groupId>
+          <artifactId>jersey-test-framework-grizzly2</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-minicluster</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-el</groupId>
+          <artifactId>commons-el</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-runtime</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-compiler</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.mortbay.jetty</groupId>
+          <artifactId>jsp-2.1-jetty</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.sun.jersey.jersey-test-framework</groupId>
+          <artifactId>jersey-test-framework-grizzly2</artifactId>
+        </exclusion>
+        <exclusion>
+          <artifactId>hadoop-yarn-server-tests</artifactId>
+          <groupId>org.apache.hadoop</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>hadoop-mapreduce-client-jobclient</artifactId>
+          <groupId>org.apache.hadoop</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>hadoop-mapreduce-client-app</artifactId>
+          <groupId>org.apache.hadoop</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>hadoop-yarn-api</artifactId>
+          <groupId>org.apache.hadoop</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>hadoop-mapreduce-client-hs</artifactId>
+          <groupId>org.apache.hadoop</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>hadoop-mapreduce-client-core</artifactId>
+          <groupId>org.apache.hadoop</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-mapreduce-client-core</artifactId>
+      <version>${hadoop.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.google.protobuf</groupId>
+      <artifactId>protobuf-java</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <profiles>
+    <profile>
+      <id>docs</id>
+      <activation>
+        <activeByDefault>false</activeByDefault>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-javadoc-plugin</artifactId>
+            <executions>
+              <execution>
+                <!-- build javadoc jars per jar for publishing to maven -->
+                <id>module-javadocs</id>
+                <phase>package</phase>
+                <goals>
+                  <goal>jar</goal>
+                </goals>
+                <configuration>
+                  <destDir>${project.build.directory}</destDir>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-report-plugin</artifactId>
+        <version>2.15</version>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>

http://git-wip-us.apache.org/repos/asf/tajo/blob/45479947/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
new file mode 100644
index 0000000..95fd258
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.tajo.ExecutionBlockId;
+import org.apache.tajo.OverridableConf;
+import org.apache.tajo.catalog.Schema;
+import org.apache.tajo.catalog.SortSpec;
+import org.apache.tajo.catalog.TableDesc;
+import org.apache.tajo.catalog.TableMeta;
+import org.apache.tajo.plan.LogicalPlan;
+import org.apache.tajo.plan.logical.LogicalNode;
+import org.apache.tajo.plan.logical.ScanNode;
+import org.apache.tajo.storage.FormatProperty;
+import org.apache.tajo.storage.StorageProperty;
+import org.apache.tajo.storage.Tablespace;
+import org.apache.tajo.storage.TupleRange;
+import org.apache.tajo.storage.fragment.Fragment;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <h3>URI Examples:</h3>
+ * <ul>
+ *   <li>jdbc:mysql//primaryhost,secondaryhost1,secondaryhost2/test?profileSQL=true</li>
+ * </ul>
+ */
+public class JdbcTablespace extends Tablespace {
+
+  public JdbcTablespace(String name, URI uri) {
+    super(name, uri);
+  }
+
+  @Override
+  protected void storageInit() throws IOException {
+
+  }
+
+  @Override
+  public void setConfig(String name, String value) {
+
+  }
+
+  @Override
+  public void setConfigs(Map<String, String> configs) {
+
+  }
+
+  @Override
+  public long getTableVolume(URI uri) throws IOException {
+    return 0;
+  }
+
+  @Override
+  public URI getTableUri(String databaseName, String tableName) {
+    return null;
+  }
+
+  @Override
+  public List<Fragment> getSplits(String fragmentId, TableDesc tableDesc, ScanNode scanNode) throws IOException {
+    return null;
+  }
+
+  @Override
+  public List<Fragment> getNonForwardSplit(TableDesc tableDesc, int currentPage, int numFragments) throws IOException {
+    return null;
+  }
+
+  static final StorageProperty STORAGE_PROPERTY = new StorageProperty("rowstore", false, true, false);
+
+  @Override
+  public StorageProperty getProperty() {
+    return STORAGE_PROPERTY;
+  }
+
+  @Override
+  public FormatProperty getFormatProperty(TableMeta meta) {
+    return null;
+  }
+
+  @Override
+  public void close() {
+
+  }
+
+  @Override
+  public TupleRange[] getInsertSortRanges(OverridableConf queryContext, TableDesc tableDesc, Schema inputSchema, SortSpec[] sortSpecs, TupleRange dataRange) throws IOException {
+    return new TupleRange[0];
+  }
+
+  @Override
+  public void verifySchemaToWrite(TableDesc tableDesc, Schema outSchema) throws IOException {
+
+  }
+
+  @Override
+  public void createTable(TableDesc tableDesc, boolean ifNotExists) throws IOException {
+
+  }
+
+  @Override
+  public void purgeTable(TableDesc tableDesc) throws IOException {
+
+  }
+
+  @Override
+  public void prepareTable(LogicalNode node) throws IOException {
+
+  }
+
+  @Override
+  public Path commitTable(OverridableConf queryContext, ExecutionBlockId finalEbId, LogicalPlan plan, Schema schema,
+                          TableDesc tableDesc) throws IOException {
+    return null;
+  }
+
+  @Override
+  public void rollbackTable(LogicalNode node) throws IOException {
+
+  }
+
+  @Override
+  public URI getStagingUri(OverridableConf context, String queryId, TableMeta meta) throws IOException {
+    return null;
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/45479947/tajo-storage/tajo-storage-jdbc/src/main/proto/StorageFragmentProtos.proto
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/proto/StorageFragmentProtos.proto b/tajo-storage/tajo-storage-jdbc/src/main/proto/StorageFragmentProtos.proto
new file mode 100644
index 0000000..33d45b3
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/main/proto/StorageFragmentProtos.proto
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+option java_package = "org.apache.tajo.storage.hbase";
+option java_outer_classname = "StorageFragmentProtos";
+option optimize_for = SPEED;
+option java_generic_services = false;
+option java_generate_equals_and_hash = true;
+
+import "CatalogProtos.proto";
+
+message HBaseFragmentProto {
+  required string uri = 1;
+  required string tableName = 2;
+  required string hbaseTableName = 3;
+  required bytes startRow = 4;
+  required bytes stopRow = 5;
+  required bool last = 6;
+  required int64 length = 7;
+  optional string regionLocation = 8;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/45479947/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/hbase/TestJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/hbase/TestJdbcTableSpace.java b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/hbase/TestJdbcTableSpace.java
new file mode 100644
index 0000000..f489e47
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/hbase/TestJdbcTableSpace.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.hbase;
+
+import org.apache.tajo.catalog.Column;
+import org.apache.tajo.common.TajoDataTypes.Type;
+import org.apache.tajo.conf.TajoConf;
+import org.apache.tajo.datum.Datum;
+import org.apache.tajo.datum.TextDatum;
+import org.apache.tajo.plan.expr.*;
+import org.apache.tajo.plan.logical.ScanNode;
+import org.apache.tajo.storage.TablespaceManager;
+import org.apache.tajo.storage.jdbc.JdbcTablespace;
+import org.apache.tajo.util.Pair;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.List;
+import java.util.Set;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+public class TestJdbcTableSpace {
+  @BeforeClass
+  public static void setUp() throws IOException {
+    String mysqlUri = "jdbc:mysql://host1:2171/db1";
+    JdbcTablespace mysqlTablespace = new JdbcTablespace("cluster2", URI.create(mysqlUri));
+    mysqlTablespace.init(new TajoConf());
+    TablespaceManager.addTableSpaceForTest(mysqlTablespace);
+
+    String pgsqlUri = "jdbc:postgres://host1:2615/db2";
+    JdbcTablespace pgSQLTablespace = new JdbcTablespace("cluster3", URI.create(pgsqlUri));
+    pgSQLTablespace.init(new TajoConf());
+    TablespaceManager.addTableSpaceForTest(pgSQLTablespace);
+  }
+
+  @Test
+  public void testTablespaceHandler() throws Exception {
+    assertTrue((TablespaceManager.getByName("cluster2").get()) instanceof JdbcTablespace);
+    assertEquals("cluster2", (TablespaceManager.getByName("cluster2").get().getName()));
+    assertTrue((TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get()) instanceof JdbcTablespace);
+    assertEquals(URI.create("jdbc:mysql://host1:2171/db1"),
+        TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get().getUri());
+
+    assertTrue((TablespaceManager.getByName("cluster3").get()) instanceof JdbcTablespace);
+    assertEquals("cluster3", (TablespaceManager.getByName("cluster3").get().getName()));
+    assertTrue((TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get()) instanceof JdbcTablespace);
+
+    assertEquals(URI.create("jdbc:postgres://host1:2615/db2"),
+        TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get().getUri());
+  }
+}


[07/39] tajo git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730

Posted by hy...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/fe0b8a76
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/fe0b8a76
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/fe0b8a76

Branch: refs/heads/TAJO-1730
Commit: fe0b8a769a80322538517c3a5385d1bca042bd60
Parents: 39e7bd8 f0ab0ca
Author: Hyunsik Choi <hy...@apache.org>
Authored: Thu Aug 13 23:16:42 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Thu Aug 13 23:16:42 2015 +0900

----------------------------------------------------------------------
 BUILDING                                        |   2 +-
 CHANGES                                         |  24 +-
 README                                          |   2 +-
 pom.xml                                         |  10 +-
 tajo-algebra/pom.xml                            |   5 -
 tajo-catalog/tajo-catalog-client/pom.xml        |   5 -
 .../tajo/catalog/AbstractCatalogClient.java     | 290 ++++++----
 .../src/main/proto/CatalogProtocol.proto        |   1 -
 tajo-catalog/tajo-catalog-common/pom.xml        |   5 -
 .../org/apache/tajo/catalog/CatalogService.java | 103 ++--
 .../org/apache/tajo/catalog/CatalogUtil.java    |  14 +-
 .../org/apache/tajo/catalog/FunctionDesc.java   |  12 +-
 .../apache/tajo/catalog/MetadataProvider.java   |   2 +-
 .../org/apache/tajo/catalog/NestedPathUtil.java |   2 +-
 .../java/org/apache/tajo/catalog/Schema.java    |   2 +-
 .../exception/AmbiguousFunctionException.java   |  36 --
 ...biguousPartitionDirectoryExistException.java |  30 -
 .../exception/AmbiguousTableException.java      |  33 --
 .../catalog/exception/CatalogException.java     |  35 --
 .../catalog/exception/CatalogExceptionUtil.java |  45 --
 .../exception/DuplicateColumnException.java     |  34 --
 .../exception/DuplicateDatabaseException.java   |  34 --
 .../exception/DuplicateFunctionException.java   |  32 --
 .../exception/DuplicateIndexException.java      |  34 --
 .../exception/DuplicatePartitionException.java  |  35 --
 .../exception/DuplicateTableException.java      |  35 --
 .../exception/DuplicateTablespaceException.java |  28 -
 .../InsufficientPrivilegeException.java         |  29 -
 .../catalog/exception/InvalidNameException.java |  29 -
 .../exception/MetadataConnectionException.java  |  32 --
 .../exception/UndefinedColumnException.java     |  35 --
 .../exception/UndefinedDatabaseException.java   |  35 --
 .../exception/UndefinedFunctionException.java   |  46 --
 .../exception/UndefinedIndexException.java      |  33 --
 .../exception/UndefinedPartitionException.java  |  35 --
 .../UndefinedPartitionKeyException.java         |  30 -
 .../UndefinedPartitionMethodException.java      |  30 -
 .../exception/UndefinedTableException.java      |  40 --
 .../exception/UndefinedTablespaceException.java |  34 --
 .../src/main/proto/CatalogProtos.proto          |   3 +-
 .../apache/tajo/catalog/TestFunctionDesc.java   |   8 +-
 .../org/apache/tajo/catalog/TestSchema.java     |   1 -
 .../tajo-catalog-drivers/tajo-hive/pom.xml      |   5 -
 .../tajo/catalog/store/HiveCatalogStore.java    | 124 ++---
 .../tajo/catalog/store/HiveCatalogUtil.java     |  11 +-
 tajo-catalog/tajo-catalog-server/pom.xml        |   5 -
 .../org/apache/tajo/catalog/CatalogServer.java  | 336 ++----------
 .../tajo/catalog/LinkedMetadataManager.java     |   6 +-
 .../InfoSchemaMetadataDictionary.java           |   2 +-
 .../tajo/catalog/store/AbstractDBStore.java     | 543 ++++++++++---------
 .../apache/tajo/catalog/store/CatalogStore.java | 160 +++---
 .../apache/tajo/catalog/store/DerbyStore.java   |  13 +-
 .../apache/tajo/catalog/store/MariaDBStore.java |   6 +-
 .../org/apache/tajo/catalog/store/MemStore.java | 127 +++--
 .../apache/tajo/catalog/store/MySQLStore.java   |   6 +-
 .../apache/tajo/catalog/store/OracleStore.java  |  11 +-
 .../tajo/catalog/store/PostgreSQLStore.java     |  10 +-
 .../catalog/store/XMLCatalogSchemaManager.java  |  59 +-
 .../org/apache/tajo/catalog/TestCatalog.java    |  89 +--
 .../tajo/catalog/TestLinkedMetadataManager.java |  23 +-
 tajo-cli/pom.xml                                |   5 -
 .../java/org/apache/tajo/cli/tsql/TajoCli.java  |  81 ++-
 .../tsql/commands/ConnectDatabaseCommand.java   |  40 +-
 .../cli/tsql/commands/DescTableCommand.java     |   3 +-
 .../cli/tsql/commands/TajoShellCommand.java     |   7 +-
 tajo-client/pom.xml                             |   5 -
 .../apache/tajo/client/CatalogAdminClient.java  |  49 +-
 .../tajo/client/CatalogAdminClientImpl.java     | 103 ++--
 .../apache/tajo/client/ClientExceptionUtil.java | 106 ----
 .../org/apache/tajo/client/QueryClient.java     |  35 +-
 .../org/apache/tajo/client/QueryClientImpl.java |  88 +--
 .../apache/tajo/client/SessionConnection.java   |  33 +-
 .../org/apache/tajo/client/TajoClientImpl.java  |  68 +--
 .../org/apache/tajo/client/TajoClientUtil.java  |   3 +-
 .../apache/tajo/client/v2/ClientDelegate.java   |   5 +-
 .../tajo/client/v2/LegacyClientDelegate.java    |  80 ++-
 .../org/apache/tajo/client/v2/TajoClient.java   |   5 +-
 .../ClientUnableToConnectException.java         |   2 +-
 .../org/apache/tajo/jdbc/WaitingResultSet.java  |   4 +
 .../org/apache/tajo/storage/RowStoreUtil.java   |   9 +-
 tajo-common/pom.xml                             |   5 -
 .../exception/AmbiguousFunctionException.java   |  33 ++
 ...biguousPartitionDirectoryExistException.java |  35 ++
 .../tajo/exception/AmbiguousTableException.java |  33 ++
 .../CatalogUpgradeRequiredException.java        |  33 ++
 .../exception/DataTypeMismatchException.java    |  34 ++
 .../tajo/exception/DefaultTajoException.java    |  34 ++
 .../exception/DuplicateColumnException.java     |  34 ++
 .../exception/DuplicateDatabaseException.java   |  33 ++
 .../exception/DuplicateFunctionException.java   |  34 ++
 .../tajo/exception/DuplicateIndexException.java |  34 ++
 .../exception/DuplicatePartitionException.java  |  35 ++
 .../tajo/exception/DuplicateTableException.java |  35 ++
 .../exception/DuplicateTablespaceException.java |  34 ++
 .../apache/tajo/exception/ErrorMessages.java    |  25 +-
 .../apache/tajo/exception/ExceptionUtil.java    | 133 ++++-
 .../InsufficientPrivilegeException.java         |  33 ++
 .../tajo/exception/InternalException.java       |  43 --
 .../exception/InvalidDataTypeException.java     |   7 +-
 .../tajo/exception/InvalidNameException.java    |  34 ++
 .../exception/InvalidOperationException.java    |   3 -
 .../InvalidTablePropertyException.java          |  33 ++
 .../LMDNoMatchedDatatypeException.java          |  34 ++
 .../exception/MetadataConnectionException.java  |  31 ++
 .../MissingTablePropertyException.java          |  33 ++
 .../tajo/exception/NotImplementedException.java |  39 ++
 .../tajo/exception/QueryFailedException.java    |  34 ++
 .../tajo/exception/QueryKilledException.java    |  34 ++
 .../tajo/exception/QueryNotFoundException.java  |  33 ++
 .../apache/tajo/exception/ReturnStateUtil.java  |  26 +-
 .../apache/tajo/exception/SQLExceptionUtil.java |   2 -
 .../apache/tajo/exception/SQLSyntaxError.java   |  35 ++
 .../org/apache/tajo/exception/TajoError.java    |   3 +-
 .../apache/tajo/exception/TajoException.java    |   4 +-
 .../tajo/exception/TajoExceptionInterface.java  |  33 --
 .../tajo/exception/TajoInternalError.java       |   1 -
 .../tajo/exception/TajoRuntimeException.java    |   2 +-
 .../UnavailableTableLocationException.java      |  33 ++
 .../exception/UndefinedColumnException.java     |  36 ++
 .../exception/UndefinedDatabaseException.java   |  36 ++
 .../exception/UndefinedFunctionException.java   |  35 ++
 .../tajo/exception/UndefinedIndexException.java |  38 ++
 .../exception/UndefinedPartitionException.java  |  35 ++
 .../UndefinedPartitionKeyException.java         |  34 ++
 .../UndefinedPartitionMethodException.java      |  35 ++
 .../tajo/exception/UndefinedTableException.java |  39 ++
 .../exception/UndefinedTablespaceException.java |  34 ++
 .../tajo/exception/UnimplementedException.java  |  34 --
 .../exception/UnknownDataFormatException.java   |  36 ++
 .../exception/UnknownDataTypeException.java     |  32 --
 .../exception/UnsupportedDataTypeException.java |  35 ++
 .../apache/tajo/storage/StorageConstants.java   |   3 +
 .../java/org/apache/tajo/storage/VTuple.java    |   6 +-
 .../java/org/apache/tajo/util/StringUtils.java  |  25 +-
 tajo-common/src/main/proto/errors.proto         |  19 +-
 tajo-core/pom.xml                               |   5 -
 .../tajo/engine/function/FailFunction.java      |  70 +++
 .../engine/function/json/JsonArrayContains.java | 103 ++++
 .../tajo/engine/function/json/JsonArrayGet.java |  82 +++
 .../engine/function/json/JsonArrayLength.java   |  67 +++
 .../function/json/JsonExtractPathText.java      |  12 +-
 .../function/json/ScalarJsonFunction.java       |  38 ++
 .../apache/tajo/engine/parser/SQLAnalyzer.java  |   3 +-
 .../tajo/engine/parser/SQLSyntaxError.java      |  51 --
 .../tajo/engine/planner/PhysicalPlanner.java    |   9 +-
 .../engine/planner/PhysicalPlannerImpl.java     |  15 +-
 .../engine/planner/global/GlobalPlanner.java    |  21 +-
 .../physical/RangeShuffleFileWriteExec.java     |  19 +-
 .../org/apache/tajo/master/GlobalEngine.java    |   8 +-
 .../java/org/apache/tajo/master/TajoMaster.java |   7 +-
 .../tajo/master/TajoMasterClientService.java    |  43 +-
 .../tajo/master/exec/CreateTableExecutor.java   |  19 +-
 .../apache/tajo/master/exec/DDLExecutor.java    |  72 ++-
 .../apache/tajo/master/exec/QueryExecutor.java  |   4 +-
 .../tajo/querymaster/DefaultTaskScheduler.java  | 115 ++--
 .../java/org/apache/tajo/querymaster/Query.java |  11 +-
 .../tajo/querymaster/QueryMasterTask.java       |   3 +-
 .../apache/tajo/querymaster/Repartitioner.java  |  26 +-
 .../java/org/apache/tajo/querymaster/Stage.java |   5 +-
 .../tajo/webapp/QueryExecutorServlet.java       |   9 +-
 .../org/apache/tajo/worker/TajoQueryEngine.java |   6 +-
 .../tajo/ws/rs/resources/DatabasesResource.java |  60 +-
 .../tajo/ws/rs/resources/TablesResource.java    |  24 +-
 .../java/org/apache/tajo/QueryTestCaseBase.java |  19 +-
 .../org/apache/tajo/benchmark/TestTPCH.java     |   7 +
 .../tajo/cli/tsql/TestTajoCliNegatives.java     | 146 +++++
 .../TestCatalogAdminClientExceptions.java       | 103 ++++
 .../tajo/client/TestQueryClientExceptions.java  | 126 +++++
 .../org/apache/tajo/client/TestTajoClient.java  |  22 +-
 .../tajo/client/TestTajoClientFailures.java     |  79 ---
 .../apache/tajo/client/v2/TestTajoClientV2.java |  50 +-
 .../tajo/engine/eval/TestEvalTreeUtil.java      |   3 +-
 .../tajo/engine/eval/TestSQLExpression.java     |   2 +-
 .../function/TestConditionalExpressions.java    |   2 +-
 .../tajo/engine/function/TestJsonFunctions.java |  31 ++
 .../planner/physical/TestPhysicalPlanner.java   |   5 +-
 .../tajo/engine/query/TestAlterTablespace.java  |   4 +-
 .../tajo/engine/query/TestCreateTable.java      |   2 +-
 .../tajo/engine/query/TestHBaseTable.java       |  18 +-
 .../apache/tajo/engine/query/TestJoinQuery.java |   2 -
 .../engine/query/TestSelectNestedRecord.java    |  10 +
 .../tajo/engine/query/TestSelectQuery.java      |  27 +
 .../tajo/engine/query/TestTruncateTable.java    |  14 +-
 .../TestSelectNestedRecord/sample2/sample2.json |   1 +
 .../TestSelectNestedRecord/sample2_ddl.sql      |  10 +-
 .../TestSelectNestedRecord/testSelect3.sql      |   1 +
 .../queries/TestTPCH/testFirstJoinInQ7.sql      |  13 +
 .../queries/TestTruncateTable/table1_ddl.sql    |   2 +-
 .../TestSelectNestedRecord/testSelect3.result   |   3 +
 .../testSelectWithCommonQuals1.1.plan           |   7 +
 .../testSelectWithCommonQuals1.1.result         |  27 +
 .../testSelectWithCommonQuals2.1.plan           |   7 +
 .../testSelectWithCommonQuals2.1.result         |  27 +
 .../testSelectWithCommonQuals3.1.plan           |   7 +
 .../testSelectWithCommonQuals3.1.result         |   7 +
 .../results/TestTPCH/testFirstJoinInQ7.plan     | 156 ++++++
 .../results/TestTPCH/testFirstJoinInQ7.result   |   4 +
 .../testAlterTableAddDropPartition.result       |   2 +-
 .../testQueryFailure.result                     |   0
 .../TestTajoCliNegatives/testQuerySyntax.result |   3 +
 .../src/main/sphinx/functions/json_func.rst     |  55 +-
 tajo-docs/src/main/sphinx/getting_started.rst   |   2 +-
 tajo-jdbc/pom.xml                               |   5 -
 tajo-metrics/pom.xml                            |   5 -
 tajo-plan/pom.xml                               |   5 -
 .../org/apache/tajo/plan/ExprAnnotator.java     |  15 +-
 .../org/apache/tajo/plan/ExprNormalizer.java    |   2 +-
 .../tajo/plan/LogicalPlanPreprocessor.java      |   2 +-
 .../org/apache/tajo/plan/LogicalPlanner.java    |  10 +-
 .../org/apache/tajo/plan/TypeDeterminant.java   |  10 +-
 .../plan/expr/AggregationFunctionCallEval.java  |   7 +-
 .../tajo/plan/expr/BasicEvalNodeVisitor.java    |  23 +-
 .../apache/tajo/plan/expr/EvalNodeVisitor2.java |   2 +-
 .../org/apache/tajo/plan/expr/EvalTreeUtil.java |  31 +-
 .../tajo/plan/function/AggFunctionInvoke.java   |   3 +-
 .../function/ClassBasedAggFunctionInvoke.java   |   3 +-
 .../ClassBasedScalarFunctionInvoke.java         |   5 +-
 .../tajo/plan/function/FunctionInvoke.java      |   5 +-
 .../org/apache/tajo/plan/logical/JoinNode.java  |   4 +
 .../tajo/plan/nameresolver/NameResolver.java    |  19 +-
 .../plan/nameresolver/ResolverByLegacy.java     |   3 +-
 .../tajo/plan/nameresolver/ResolverByRels.java  |   7 +-
 .../nameresolver/ResolverByRelsAndSubExprs.java |   7 +-
 .../nameresolver/ResolverBySubExprsAndRels.java |   7 +-
 .../BaseLogicalPlanRewriteRuleProvider.java     |   7 +-
 .../rules/CommonConditionReduceRule.java        | 221 ++++++++
 .../plan/rewrite/rules/FilterPushDownRule.java  |  18 +-
 .../rewrite/rules/ProjectionPushDownRule.java   |   2 +-
 .../tajo/plan/serder/EvalNodeDeserializer.java  |  10 +-
 .../plan/serder/LogicalNodeDeserializer.java    |   6 +-
 .../tajo/plan/serder/LogicalNodeSerializer.java |   7 +-
 .../org/apache/tajo/plan/util/IndexUtil.java    |   2 +-
 .../org/apache/tajo/plan/util/PlannerUtil.java  |  16 +-
 .../tajo/plan/verifier/ExprsVerifier.java       |   5 +-
 .../plan/verifier/PreLogicalPlanVerifier.java   |  14 +-
 .../tajo/plan/verifier/VerificationState.java   |   1 -
 tajo-project/pom.xml                            |  17 +-
 tajo-rpc/tajo-rpc-common/pom.xml                |   5 -
 .../java/org/apache/tajo/rpc/RpcConstants.java  |   2 +-
 tajo-rpc/tajo-rpc-protobuf/pom.xml              |   5 -
 .../java/org/apache/tajo/rpc/TestAsyncRpc.java  |   4 +-
 .../org/apache/tajo/rpc/TestBlockingRpc.java    |   4 +-
 tajo-rpc/tajo-ws-rs/pom.xml                     |   5 -
 tajo-storage/tajo-storage-common/pom.xml        |   5 -
 .../apache/tajo/storage/AbstractScanner.java    |  20 +-
 .../org/apache/tajo/storage/RowStoreUtil.java   |   8 +-
 .../org/apache/tajo/storage/Tablespace.java     |  14 +-
 tajo-storage/tajo-storage-hbase/pom.xml         |   5 -
 .../storage/hbase/AbstractHBaseAppender.java    |  10 +-
 .../tajo/storage/hbase/ColumnMapping.java       |  37 +-
 .../HBaseBinarySerializerDeserializer.java      |   2 +-
 .../apache/tajo/storage/hbase/HBaseScanner.java |   8 +-
 .../tajo/storage/hbase/HBaseTablespace.java     |  79 +--
 .../hbase/HBaseTextSerializerDeserializer.java  |   2 +-
 .../storage/hbase/SortedInsertRewriter.java     |   6 +-
 tajo-storage/tajo-storage-hdfs/pom.xml          |  13 +-
 .../org/apache/tajo/storage/FileTablespace.java |   2 +-
 .../java/org/apache/tajo/storage/RawFile.java   |   9 +-
 .../java/org/apache/tajo/storage/RowFile.java   |   9 +-
 .../apache/tajo/storage/avro/AvroAppender.java  |   6 +-
 .../tajo/storage/json/JsonLineDeserializer.java |   4 +-
 .../tajo/storage/json/JsonLineSerializer.java   |   4 +-
 .../org/apache/tajo/storage/orc/ORCScanner.java |   6 +-
 .../tajo/storage/parquet/ParquetAppender.java   |   5 -
 .../storage/rawfile/DirectRawFileWriter.java    |  18 +-
 .../org/apache/tajo/storage/rcfile/RCFile.java  |  14 -
 .../sequencefile/SequenceFileAppender.java      |  22 -
 .../tajo/storage/text/DelimitedLineReader.java  |   4 +-
 tajo-thirdparty/asm/pom.xml                     |   5 -
 269 files changed, 4692 insertions(+), 3292 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/fe0b8a76/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/MetadataProvider.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/fe0b8a76/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/fe0b8a76/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/LinkedMetadataManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/fe0b8a76/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestLinkedMetadataManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/fe0b8a76/tajo-core/src/main/java/org/apache/tajo/master/TajoMaster.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/fe0b8a76/tajo-core/src/test/java/org/apache/tajo/engine/query/TestHBaseTable.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/fe0b8a76/tajo-project/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/fe0b8a76/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/fe0b8a76/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/fe0b8a76/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
----------------------------------------------------------------------


[29/39] tajo git commit: Add JdbcFragment and its protobuf definition.

Posted by hy...@apache.org.
Add JdbcFragment and its protobuf definition.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/8b76167e
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/8b76167e
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/8b76167e

Branch: refs/heads/TAJO-1730
Commit: 8b76167e8945e9048138f72b1646117599d97108
Parents: 177291d
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sat Aug 22 01:07:11 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sat Aug 22 01:07:11 2015 +0900

----------------------------------------------------------------------
 .../apache/tajo/storage/jdbc/JdbcFragment.java  | 51 ++++++++++++++++++--
 .../tajo/storage/jdbc/JdbcTablespace.java       |  9 +---
 .../src/main/proto/JdbcFragmentProtos.proto     |  2 +
 .../storage/mysql/TestMysqlJdbcTableSpace.java  |  1 +
 4 files changed, 53 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/8b76167e/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcFragment.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcFragment.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcFragment.java
index 960267a..2fc42b7 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcFragment.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcFragment.java
@@ -18,14 +18,43 @@
 
 package org.apache.tajo.storage.jdbc;
 
+import com.google.protobuf.ByteString;
+import com.google.protobuf.InvalidProtocolBufferException;
+import org.apache.tajo.BuiltinStorages;
 import org.apache.tajo.catalog.proto.CatalogProtos;
 import org.apache.tajo.storage.fragment.Fragment;
+import org.apache.tajo.storage.jdbc.JdbcFragmentProtos.JdbcFragmentProto;
+import org.apache.tajo.util.TUtil;
 
-public class JdbcFragment implements Fragment, Cloneable {
+public class JdbcFragment implements Fragment, Comparable<JdbcFragment>, Cloneable {
+  String uri;
   String inputSourceId;
-
   String [] hostNames;
 
+
+  public JdbcFragment(ByteString raw) throws InvalidProtocolBufferException {
+    JdbcFragmentProto.Builder builder = JdbcFragmentProto.newBuilder();
+    builder.mergeFrom(raw);
+    builder.build();
+    init(builder.build());
+  }
+
+  public JdbcFragment(String inputSourceId, String uri) {
+    this.inputSourceId = inputSourceId;
+    this.uri = uri;
+    this.hostNames = extractHosts(uri);
+  }
+
+  private void init(JdbcFragmentProto proto) {
+    this.uri = proto.getUri();
+    this.inputSourceId = proto.getInputSourceId();
+    this.hostNames = proto.getHostsList().toArray(new String [proto.getHostsCount()]);
+  }
+
+  private String [] extractHosts(String uri) {
+    return new String [] {};
+  }
+
   @Override
   public String getTableName() {
     return inputSourceId;
@@ -33,7 +62,18 @@ public class JdbcFragment implements Fragment, Cloneable {
 
   @Override
   public CatalogProtos.FragmentProto getProto() {
-    return null;
+    JdbcFragmentProto.Builder builder = JdbcFragmentProto.newBuilder();
+    builder.setInputSourceId(this.inputSourceId);
+    builder.setUri(this.uri);
+    if(hostNames != null) {
+      builder.addAllHosts(TUtil.newList(hostNames));
+    }
+
+    CatalogProtos.FragmentProto.Builder fragmentBuilder = CatalogProtos.FragmentProto.newBuilder();
+    fragmentBuilder.setId(this.inputSourceId);
+    fragmentBuilder.setStoreType(BuiltinStorages.TEXT);
+    fragmentBuilder.setContents(builder.buildPartial().toByteString());
+    return fragmentBuilder.build();
   }
 
   @Override
@@ -55,4 +95,9 @@ public class JdbcFragment implements Fragment, Cloneable {
   public boolean isEmpty() {
     return false;
   }
+
+  @Override
+  public int compareTo(JdbcFragment o) {
+    return this.uri.compareTo(o.uri);
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/8b76167e/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
index f66c5dc..04709b0 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
@@ -18,6 +18,7 @@
 
 package org.apache.tajo.storage.jdbc;
 
+import com.google.common.collect.Lists;
 import net.minidev.json.JSONObject;
 import org.apache.hadoop.fs.Path;
 import org.apache.tajo.ExecutionBlockId;
@@ -29,7 +30,6 @@ import org.apache.tajo.exception.UnsupportedException;
 import org.apache.tajo.plan.LogicalPlan;
 import org.apache.tajo.plan.expr.EvalNode;
 import org.apache.tajo.plan.logical.LogicalNode;
-import org.apache.tajo.plan.logical.ScanNode;
 import org.apache.tajo.storage.FormatProperty;
 import org.apache.tajo.storage.StorageProperty;
 import org.apache.tajo.storage.Tablespace;
@@ -75,12 +75,7 @@ public abstract class JdbcTablespace extends Tablespace {
   public List<Fragment> getSplits(String inputSourceId,
                                   TableDesc tableDesc,
                                   @Nullable EvalNode filterCondition) throws IOException {
-    return null;
-  }
-
-  @Override
-  public List<Fragment> getNonForwardSplit(TableDesc tableDesc, int currentPage, int numFragments) throws IOException {
-    return null;
+    return Lists.newArrayList((Fragment)new JdbcFragment(inputSourceId, tableDesc.getUri().toASCIIString()));
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/tajo/blob/8b76167e/tajo-storage/tajo-storage-jdbc/src/main/proto/JdbcFragmentProtos.proto
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/proto/JdbcFragmentProtos.proto b/tajo-storage/tajo-storage-jdbc/src/main/proto/JdbcFragmentProtos.proto
index a09c8f1..f642e07 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/proto/JdbcFragmentProtos.proto
+++ b/tajo-storage/tajo-storage-jdbc/src/main/proto/JdbcFragmentProtos.proto
@@ -26,4 +26,6 @@ import "CatalogProtos.proto";
 
 message JdbcFragmentProto {
   required string uri = 1;
+  required string input_source_id = 2;
+  repeated string hosts = 3;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/8b76167e/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMysqlJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMysqlJdbcTableSpace.java b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMysqlJdbcTableSpace.java
index df377b6..6d2ad1b 100644
--- a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMysqlJdbcTableSpace.java
+++ b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMysqlJdbcTableSpace.java
@@ -20,6 +20,7 @@ package org.apache.tajo.storage.mysql;
 
 import com.google.common.collect.ImmutableSet;
 import io.airlift.testing.mysql.TestingMySqlServer;
+import org.apache.tajo.QueryTestCaseBase;
 import org.apache.tajo.storage.TablespaceManager;
 import org.junit.BeforeClass;
 import org.junit.Test;


[04/39] tajo git commit: Add base implementation for mysql and pgsql storages.

Posted by hy...@apache.org.
http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
new file mode 100644
index 0000000..6ccc288
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.pgsql;
+
+import net.minidev.json.JSONObject;
+import org.apache.tajo.catalog.MetadataProvider;
+import org.apache.tajo.storage.jdbc.JdbcTablespace;
+
+import java.net.URI;
+
+/**
+ * <h3>URI Examples:</h3>
+ * <ul>
+ *   <li>jdbc:mysql//primaryhost,secondaryhost1,secondaryhost2/test?profileSQL=true</li>
+ * </ul>
+ */
+public class PgSQLTablespace extends JdbcTablespace {
+
+  public PgSQLTablespace(String name, URI uri, JSONObject config) {
+    super(name, uri, config);
+  }
+
+  public MetadataProvider getMetadataProvider() {
+    return new PgSQLMetadataProvider(this, "db1");
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java
new file mode 100644
index 0000000..577176f
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.pgsql;
+
+import io.airlift.testing.postgresql.TestingPostgreSqlServer;
+import org.apache.tajo.conf.TajoConf;
+import org.apache.tajo.storage.TablespaceManager;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.net.URI;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.Statement;
+
+import static org.junit.Assert.*;
+
+public class TestPgSQLJdbcTableSpace {
+  @BeforeClass
+  public static void setUp() throws IOException {
+    String mysqlUri = "jdbc:mysql://host1:2171/db1";
+    PgSQLTablespace mysqlTablespace = new PgSQLTablespace("cluster2", URI.create(mysqlUri), null);
+    mysqlTablespace.init(new TajoConf());
+    TablespaceManager.addTableSpaceForTest(mysqlTablespace);
+
+    String pgsqlUri = "jdbc:postgres://host1:2615/db2";
+    PgSQLTablespace pgSQLTablespace = new PgSQLTablespace("cluster3", URI.create(pgsqlUri), null);
+    pgSQLTablespace.init(new TajoConf());
+    TablespaceManager.addTableSpaceForTest(pgSQLTablespace);
+  }
+
+  @Test
+  public void testTablespaceHandler() throws Exception {
+    assertTrue((TablespaceManager.getByName("cluster2").get()) instanceof PgSQLTablespace);
+    assertEquals("cluster2", (TablespaceManager.getByName("cluster2").get().getName()));
+    assertTrue((TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get()) instanceof PgSQLTablespace);
+    assertEquals(URI.create("jdbc:mysql://host1:2171/db1"),
+        TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get().getUri());
+
+    assertTrue((TablespaceManager.getByName("cluster3").get()) instanceof PgSQLTablespace);
+    assertEquals("cluster3", (TablespaceManager.getByName("cluster3").get().getName()));
+    assertTrue((TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get()) instanceof PgSQLTablespace);
+
+    assertEquals(URI.create("jdbc:postgres://host1:2615/db2"),
+        TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get().getUri());
+  }
+
+  @Test
+  public void test() throws Exception {
+    try (TestingPostgreSqlServer server = new TestingPostgreSqlServer("testuser", "testdb")) {
+      assertEquals(server.getUser(), "testuser");
+      assertEquals(server.getDatabase(), "testdb");
+      assertEquals(server.getJdbcUrl().substring(0, 5), "jdbc:");
+      assertEquals(server.getPort(), URI.create(server.getJdbcUrl().substring(5)).getPort());
+
+      try (Connection connection = DriverManager.getConnection(server.getJdbcUrl())) {
+        try (Statement statement = connection.createStatement()) {
+          statement.execute("CREATE TABLE test_table (c1 bigint PRIMARY KEY)");
+          statement.execute("INSERT INTO test_table (c1) VALUES (1)");
+          try (ResultSet resultSet = statement.executeQuery("SELECT count(*) FROM test_table")) {
+            assertTrue(resultSet.next());
+            assertEquals(resultSet.getLong(1), 1L);
+            assertFalse(resultSet.next());
+          }
+        }
+      }
+    }
+  }
+}


[09/39] tajo git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730

Posted by hy...@apache.org.
http://git-wip-us.apache.org/repos/asf/tajo/blob/77dfbbdf/tajo-cluster-tests/src/test/java/org/apache/tajo/TajoTestingCluster.java
----------------------------------------------------------------------
diff --cc tajo-cluster-tests/src/test/java/org/apache/tajo/TajoTestingCluster.java
index 0000000,71ef0ea..a0f1280
mode 000000,100644..100644
--- a/tajo-cluster-tests/src/test/java/org/apache/tajo/TajoTestingCluster.java
+++ b/tajo-cluster-tests/src/test/java/org/apache/tajo/TajoTestingCluster.java
@@@ -1,0 -1,778 +1,778 @@@
+ /**
+  * Licensed to the Apache Software Foundation (ASF) under one
+  * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
+  * regarding copyright ownership.  The ASF licenses this file
+  * to you under the Apache License, Version 2.0 (the
+  * "License"); you may not use this file except in compliance
+  * with the License.  You may obtain a copy of the License at
+  *
+  *     http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+ 
+ package org.apache.tajo;
+ 
+ import com.google.common.base.Charsets;
+ import com.google.common.io.Closeables;
+ import com.google.common.io.Files;
+ import org.apache.commons.lang.StringUtils;
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+ import org.apache.hadoop.fs.*;
+ import org.apache.hadoop.hdfs.DFSConfigKeys;
+ import org.apache.hadoop.hdfs.HdfsConfiguration;
+ import org.apache.hadoop.hdfs.MiniDFSCluster;
+ import org.apache.hadoop.util.ShutdownHookManager;
+ import org.apache.log4j.Level;
+ import org.apache.log4j.Logger;
+ import org.apache.tajo.catalog.*;
+ import org.apache.tajo.client.TajoClient;
+ import org.apache.tajo.client.TajoClientImpl;
+ import org.apache.tajo.client.TajoClientUtil;
+ import org.apache.tajo.conf.TajoConf;
+ import org.apache.tajo.conf.TajoConf.ConfVars;
+ import org.apache.tajo.engine.planner.global.rewriter.GlobalPlanTestRuleProvider;
+ import org.apache.tajo.master.TajoMaster;
+ import org.apache.tajo.plan.rewrite.LogicalPlanTestRuleProvider;
+ import org.apache.tajo.querymaster.Query;
+ import org.apache.tajo.querymaster.QueryMasterTask;
+ import org.apache.tajo.querymaster.Stage;
+ import org.apache.tajo.querymaster.StageState;
+ import org.apache.tajo.service.ServiceTrackerFactory;
+ import org.apache.tajo.storage.FileTablespace;
+ import org.apache.tajo.storage.TablespaceManager;
+ import org.apache.tajo.util.CommonTestingUtil;
+ import org.apache.tajo.util.KeyValueSet;
+ import org.apache.tajo.util.NetUtils;
+ import org.apache.tajo.util.Pair;
+ import org.apache.tajo.worker.TajoWorker;
+ 
+ import java.io.File;
+ import java.io.IOException;
+ import java.io.Writer;
+ import java.net.InetSocketAddress;
+ import java.net.URI;
+ import java.sql.ResultSet;
+ import java.sql.SQLException;
+ import java.util.ArrayList;
+ import java.util.List;
+ import java.util.TimeZone;
+ import java.util.UUID;
+ 
+ public class TajoTestingCluster {
+ 	private static Log LOG = LogFactory.getLog(TajoTestingCluster.class);
+ 	private TajoConf conf;
+   private FileSystem defaultFS;
+   private MiniDFSCluster dfsCluster;
+ 	private MiniCatalogServer catalogServer;
+   private HBaseTestClusterUtil hbaseUtil;
+ 
+   private TajoMaster tajoMaster;
+   private List<TajoWorker> tajoWorkers = new ArrayList<TajoWorker>();
+   private boolean isDFSRunning = false;
+   private boolean isTajoClusterRunning = false;
+   private boolean isCatalogServerRunning = false;
+ 
+ 	private File clusterTestBuildDir = null;
+ 
+ 	/**
+ 	 * Default parent directory for test output.
+ 	 */
+ 	public static final String DEFAULT_TEST_DIRECTORY = "target/" + 
+ 	    System.getProperty("tajo.test.data.dir", "test-data");
+ 
+   /**
+    * True If HiveCatalogStore is used. Otherwise, it is FALSE.
+    */
+   public Boolean isHiveCatalogStoreUse = false;
+ 
+   private static final String LOG_LEVEL;
+ 
+   static {
+     LOG_LEVEL = System.getProperty("LOG_LEVEL");
+   }
+ 
+   public TajoTestingCluster() {
+     this(false);
+   }
+ 
+   public TajoTestingCluster(boolean masterHaEMode) {
+     this.conf = new TajoConf();
+     this.conf.setBoolVar(ConfVars.TAJO_MASTER_HA_ENABLE, masterHaEMode);
+ 
+     initTestDir();
+     setTestingFlagProperties();
+     initPropertiesAndConfigs();
+   }
+ 
+   void setTestingFlagProperties() {
+     System.setProperty(CommonTestingUtil.TAJO_TEST_KEY, CommonTestingUtil.TAJO_TEST_TRUE);
+     conf.set(CommonTestingUtil.TAJO_TEST_KEY, CommonTestingUtil.TAJO_TEST_TRUE);
+   }
+ 
+   void initPropertiesAndConfigs() {
+ 
+     // Set time zone
+     TimeZone testDefaultTZ = TimeZone.getTimeZone(TajoConstants.DEFAULT_SYSTEM_TIMEZONE);
+     conf.setSystemTimezone(testDefaultTZ);
+     TimeZone.setDefault(testDefaultTZ);
+ 
+     // Injection of equality testing code of logical plan (de)serialization
+     conf.setClassVar(ConfVars.LOGICAL_PLAN_REWRITE_RULE_PROVIDER_CLASS, LogicalPlanTestRuleProvider.class);
+     conf.setClassVar(ConfVars.GLOBAL_PLAN_REWRITE_RULE_PROVIDER_CLASS, GlobalPlanTestRuleProvider.class);
+ 
+     conf.setInt(ConfVars.WORKER_RESOURCE_AVAILABLE_CPU_CORES.varname, 4);
+     conf.setInt(ConfVars.WORKER_RESOURCE_AVAILABLE_MEMORY_MB.varname, 2000);
+     conf.setInt(ConfVars.WORKER_RESOURCE_AVAILABLE_DISK_PARALLEL_NUM.varname, 3);
+     conf.setInt(ConfVars.SHUFFLE_FETCHER_PARALLEL_EXECUTION_MAX_NUM.varname, 2);
+ 
+     // Client API RPC
+     conf.setIntVar(ConfVars.RPC_CLIENT_WORKER_THREAD_NUM, 2);
+ 
+     //Client API service RPC Server
+     conf.setIntVar(ConfVars.MASTER_SERVICE_RPC_SERVER_WORKER_THREAD_NUM, 2);
+     conf.setIntVar(ConfVars.WORKER_SERVICE_RPC_SERVER_WORKER_THREAD_NUM, 2);
+     conf.setIntVar(ConfVars.REST_SERVICE_RPC_SERVER_WORKER_THREAD_NUM, 2);
+ 
+     // Internal RPC Client
+     conf.setIntVar(ConfVars.INTERNAL_RPC_CLIENT_WORKER_THREAD_NUM, 2);
+     conf.setIntVar(ConfVars.SHUFFLE_RPC_CLIENT_WORKER_THREAD_NUM, 2);
+ 
+     // Internal RPC Server
+     conf.setIntVar(ConfVars.MASTER_RPC_SERVER_WORKER_THREAD_NUM, 2);
+     conf.setIntVar(ConfVars.QUERY_MASTER_RPC_SERVER_WORKER_THREAD_NUM, 2);
+     conf.setIntVar(ConfVars.WORKER_RPC_SERVER_WORKER_THREAD_NUM, 2);
+     conf.setIntVar(ConfVars.CATALOG_RPC_SERVER_WORKER_THREAD_NUM, 2);
+     conf.setIntVar(ConfVars.SHUFFLE_RPC_SERVER_WORKER_THREAD_NUM, 2);
+ 
+     // Memory cache termination
+     conf.setIntVar(ConfVars.WORKER_HISTORY_EXPIRE_PERIOD, 1);
+ 
+     // Python function path
+     conf.setStrings(ConfVars.PYTHON_CODE_DIR.varname, getClass().getResource("/python").toString());
+ 
+     /* Since Travis CI limits the size of standard output log up to 4MB */
+     if (!StringUtils.isEmpty(LOG_LEVEL)) {
+       Level defaultLevel = Logger.getRootLogger().getLevel();
+       Logger.getLogger("org.apache.tajo").setLevel(Level.toLevel(LOG_LEVEL.toUpperCase(), defaultLevel));
+       Logger.getLogger("org.apache.hadoop").setLevel(Level.toLevel(LOG_LEVEL.toUpperCase(), defaultLevel));
+       Logger.getLogger("org.apache.zookeeper").setLevel(Level.toLevel(LOG_LEVEL.toUpperCase(), defaultLevel));
+       Logger.getLogger("BlockStateChange").setLevel(Level.toLevel(LOG_LEVEL.toUpperCase(), defaultLevel));
+       Logger.getLogger("org.mortbay.log").setLevel(Level.toLevel(LOG_LEVEL.toUpperCase(), defaultLevel));
+     }
+   }
+ 
+ 	public TajoConf getConfiguration() {
+ 		return this.conf;
+ 	}
+ 
+   public void initTestDir() {
+     if (clusterTestBuildDir == null) {
+       clusterTestBuildDir = setupClusterTestBuildDir();
+     }
+   }
+ 
+ 	/**
+ 	 * @return Where to write test data on local filesystem; usually
+ 	 * {@link #DEFAULT_TEST_DIRECTORY}
+ 	 * @see #setupClusterTestBuildDir()
+ 	 */
+ 	public File getTestDir() {
+ 		return clusterTestBuildDir;
+ 	}
+ 
+ 	/**
+ 	 * @param subdirName
+ 	 * @return Path to a subdirectory named <code>subdirName</code> under
+ 	 * {@link #getTestDir()}.
+ 	 * @see #setupClusterTestBuildDir()
+ 	 */
+ 	public static File getTestDir(final String subdirName) {
+ 		return new File(new File(DEFAULT_TEST_DIRECTORY), subdirName);
+   }
+ 
+ 	public static File setupClusterTestBuildDir() {
+ 		String randomStr = UUID.randomUUID().toString();
+ 		String dirStr = getTestDir(randomStr).toString();
+ 		File dir = new File(dirStr).getAbsoluteFile();
+ 		// Have it cleaned up on exit
+ 		dir.deleteOnExit();
+ 		return dir;
+ 	}
+ 
+   ////////////////////////////////////////////////////////
+   // HDFS Section
+   ////////////////////////////////////////////////////////
+   /**
+    * Start a minidfscluster.
+    * @param servers How many DNs to start.
+    * @throws Exception
+    * @see {@link #shutdownMiniDFSCluster()}
+    * @return The mini dfs cluster created.
+    */
+   public MiniDFSCluster startMiniDFSCluster(int servers) throws Exception {
+     return startMiniDFSCluster(servers, null, null);
+   }
+ 
+   /**
+    * Start a minidfscluster.
+    * Can only create one.
+    * @param servers How many DNs to start.
+    * @param dir Where to home your dfs cluster.
+    * @param hosts hostnames DNs to run on.
+    * @throws Exception
+    * @see {@link #shutdownMiniDFSCluster()}
+    * @return The mini dfs cluster created.
+    * @throws java.io.IOException
+    */
+   public MiniDFSCluster startMiniDFSCluster(int servers,
+                                             File dir,
+                                             final String hosts[])
+       throws IOException {
+ 
+     conf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, dir.toString());
+     conf.setInt(DFSConfigKeys.DFS_REPLICATION_KEY, 1);
+     conf.setBoolean(DFSConfigKeys.DFS_CLIENT_READ_SHORTCIRCUIT_KEY, false);
+     MiniDFSCluster.Builder builder = new MiniDFSCluster.Builder(new HdfsConfiguration(conf));
+     builder.hosts(hosts);
+     builder.numDataNodes(servers);
+     builder.format(true);
+     builder.manageNameDfsDirs(true);
+     builder.manageDataDfsDirs(true);
+     builder.waitSafeMode(true);
+     this.dfsCluster = builder.build();
+ 
+     // Set this just-started cluster as our filesystem.
+     this.defaultFS = this.dfsCluster.getFileSystem();
+     this.conf.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, defaultFS.getUri().toString());
+     this.conf.setVar(TajoConf.ConfVars.ROOT_DIR, defaultFS.getUri() + "/tajo");
+     isDFSRunning = true;
+     return this.dfsCluster;
+   }
+ 
+   public void shutdownMiniDFSCluster() throws Exception {
+     if (this.dfsCluster != null) {
+       try {
+         FileSystem fs = this.dfsCluster.getFileSystem();
+         if (fs != null) fs.close();
+       } catch (IOException e) {
+         System.err.println("error closing file system: " + e);
+       }
+       // The below throws an exception per dn, AsynchronousCloseException.
+       this.dfsCluster.shutdown();
+     }
+   }
+ 
+   public boolean isRunningDFSCluster() {
+     return this.defaultFS != null;
+   }
+ 
+   public MiniDFSCluster getMiniDFSCluster() {
+     return this.dfsCluster;
+   }
+ 
+   public FileSystem getDefaultFileSystem() {
+     return this.defaultFS;
+   }
+ 
+   public HBaseTestClusterUtil getHBaseUtil() {
+     return hbaseUtil;
+   }
+ 
+   ////////////////////////////////////////////////////////
+   // Catalog Section
+   ////////////////////////////////////////////////////////
+   public MiniCatalogServer startCatalogCluster() throws Exception {
+     if(isCatalogServerRunning) throw new IOException("Catalog Cluster already running");
+ 
+     TajoConf c = getConfiguration();
+ 
+     conf.set(CatalogConstants.STORE_CLASS, "org.apache.tajo.catalog.store.MemStore");
+     conf.set(CatalogConstants.CATALOG_URI, "jdbc:derby:" + clusterTestBuildDir.getAbsolutePath() + "/db");
+     LOG.info("Apache Derby repository is set to " + conf.get(CatalogConstants.CATALOG_URI));
+     conf.setVar(ConfVars.CATALOG_ADDRESS, "localhost:0");
+ 
+     catalogServer = new MiniCatalogServer(conf);
+     CatalogServer catServer = catalogServer.getCatalogServer();
+     InetSocketAddress sockAddr = catServer.getBindAddress();
+     c.setVar(ConfVars.CATALOG_ADDRESS, NetUtils.normalizeInetSocketAddress(sockAddr));
+     isCatalogServerRunning = true;
+     return this.catalogServer;
+   }
+ 
+   public void shutdownCatalogCluster() {
+     if (catalogServer != null) {
+       this.catalogServer.shutdown();
+     }
+     isCatalogServerRunning = false;
+   }
+ 
+   public MiniCatalogServer getMiniCatalogCluster() {
+     return this.catalogServer;
+   }
+ 
+   public boolean isHiveCatalogStoreRunning() {
+     return isHiveCatalogStoreUse;
+   }
+ 
+   ////////////////////////////////////////////////////////
+   // Tajo Cluster Section
+   ////////////////////////////////////////////////////////
+   private void startMiniTajoCluster(File testBuildDir,
+                                                final int numSlaves,
+                                                boolean local) throws Exception {
+     TajoConf c = getConfiguration();
+     c.setVar(ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS, "localhost:0");
+     c.setVar(ConfVars.TAJO_MASTER_UMBILICAL_RPC_ADDRESS, "localhost:0");
+     c.setVar(ConfVars.RESOURCE_TRACKER_RPC_ADDRESS, "localhost:0");
+     c.setVar(ConfVars.WORKER_PEER_RPC_ADDRESS, "localhost:0");
+     c.setVar(ConfVars.WORKER_TEMPORAL_DIR, "file://" + testBuildDir.getAbsolutePath() + "/tajo-localdir");
+     c.setIntVar(ConfVars.REST_SERVICE_PORT, 0);
+ 
+     LOG.info("derby repository is set to "+conf.get(CatalogConstants.CATALOG_URI));
+ 
+     if (!local) {
+       String tajoRootDir = getMiniDFSCluster().getFileSystem().getUri().toString() + "/tajo";
+       c.setVar(ConfVars.ROOT_DIR, tajoRootDir);
+ 
+       URI defaultTsUri = TajoConf.getWarehouseDir(c).toUri();
+       FileTablespace defaultTableSpace =
 -          new FileTablespace(TablespaceManager.DEFAULT_TABLESPACE_NAME, defaultTsUri);
++          new FileTablespace(TablespaceManager.DEFAULT_TABLESPACE_NAME, defaultTsUri, null);
+       defaultTableSpace.init(conf);
+       TablespaceManager.addTableSpaceForTest(defaultTableSpace);
+ 
+     } else {
+       c.setVar(ConfVars.ROOT_DIR, "file://" + testBuildDir.getAbsolutePath() + "/tajo");
+     }
+ 
+     setupCatalogForTesting(c, testBuildDir);
+ 
+     tajoMaster = new TajoMaster();
+     tajoMaster.init(c);
+     tajoMaster.start();
+ 
+     this.conf.setVar(ConfVars.WORKER_PEER_RPC_ADDRESS, c.getVar(ConfVars.WORKER_PEER_RPC_ADDRESS));
+     this.conf.setVar(ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS, c.getVar(ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS));
+ 
+     InetSocketAddress tajoMasterAddress = tajoMaster.getContext().getTajoMasterService().getBindAddress();
+ 
+     this.conf.setVar(ConfVars.TAJO_MASTER_UMBILICAL_RPC_ADDRESS,
+         tajoMasterAddress.getHostName() + ":" + tajoMasterAddress.getPort());
+     this.conf.setVar(ConfVars.RESOURCE_TRACKER_RPC_ADDRESS, c.getVar(ConfVars.RESOURCE_TRACKER_RPC_ADDRESS));
+     this.conf.setVar(ConfVars.CATALOG_ADDRESS, c.getVar(ConfVars.CATALOG_ADDRESS));
+     
+     InetSocketAddress tajoRestAddress = tajoMaster.getContext().getRestServer().getBindAddress();
+     
+     this.conf.setIntVar(ConfVars.REST_SERVICE_PORT, tajoRestAddress.getPort());
+ 
+     startTajoWorkers(numSlaves);
+ 
+     isTajoClusterRunning = true;
+     LOG.info("Mini Tajo cluster is up");
+     LOG.info("====================================================================================");
+     LOG.info("=                           MiniTajoCluster starts up                              =");
+     LOG.info("====================================================================================");
+     LOG.info("= * Master Address: " + tajoMaster.getMasterName());
+     LOG.info("= * CatalogStore: " + tajoMaster.getCatalogServer().getStoreClassName());
+     LOG.info("------------------------------------------------------------------------------------");
+     LOG.info("= * Warehouse Dir: " + TajoConf.getWarehouseDir(c));
+     LOG.info("= * Worker Tmp Dir: " + c.getVar(ConfVars.WORKER_TEMPORAL_DIR));
+     LOG.info("====================================================================================");
+   }
+ 
+   private void setupCatalogForTesting(TajoConf c, File testBuildDir) throws IOException {
+     final String HIVE_CATALOG_CLASS_NAME = "org.apache.tajo.catalog.store.HiveCatalogStore";
+     boolean hiveCatalogClassExists = false;
+     try {
+       getClass().getClassLoader().loadClass(HIVE_CATALOG_CLASS_NAME);
+       hiveCatalogClassExists = true;
+     } catch (ClassNotFoundException e) {
+       LOG.info("HiveCatalogStore is not available.");
+     }
+     String driverClass = System.getProperty(CatalogConstants.STORE_CLASS);
+ 
+     if (hiveCatalogClassExists &&
+         driverClass != null && driverClass.equals(HIVE_CATALOG_CLASS_NAME)) {
+       try {
+         getClass().getClassLoader().loadClass(HIVE_CATALOG_CLASS_NAME);
+         String jdbcUri = "jdbc:derby:;databaseName="+ testBuildDir.toURI().getPath()  + "/metastore_db;create=true";
+         c.set("hive.metastore.warehouse.dir", TajoConf.getWarehouseDir(c).toString() + "/default");
+         c.set("javax.jdo.option.ConnectionURL", jdbcUri);
+         c.set(TajoConf.ConfVars.WAREHOUSE_DIR.varname, conf.getVar(ConfVars.WAREHOUSE_DIR));
+         c.set(CatalogConstants.STORE_CLASS, HIVE_CATALOG_CLASS_NAME);
+         Path defaultDatabasePath = new Path(TajoConf.getWarehouseDir(c).toString() + "/default");
+         FileSystem fs = defaultDatabasePath.getFileSystem(c);
+         if (!fs.exists(defaultDatabasePath)) {
+           fs.mkdirs(defaultDatabasePath);
+         }
+         isHiveCatalogStoreUse = true;
+       } catch (ClassNotFoundException cnfe) {
+         throw new IOException(cnfe);
+       }
+     } else { // for derby
+       c.set(CatalogConstants.STORE_CLASS, "org.apache.tajo.catalog.store.MemStore");
+       c.set(CatalogConstants.CATALOG_URI, "jdbc:derby:" + testBuildDir.getAbsolutePath() + "/db");
+     }
+     c.setVar(ConfVars.CATALOG_ADDRESS, "localhost:0");
+   }
+ 
+   private void startTajoWorkers(int numSlaves) throws Exception {
+     for(int i = 0; i < 1; i++) {
+       TajoWorker tajoWorker = new TajoWorker();
+ 
+       TajoConf workerConf  = new TajoConf(this.conf);
+ 
+       workerConf.setVar(ConfVars.WORKER_INFO_ADDRESS, "localhost:0");
+       workerConf.setVar(ConfVars.WORKER_CLIENT_RPC_ADDRESS, "localhost:0");
+       workerConf.setVar(ConfVars.WORKER_PEER_RPC_ADDRESS, "localhost:0");
+ 
+       workerConf.setVar(ConfVars.WORKER_QM_RPC_ADDRESS, "localhost:0");
+       
+       tajoWorker.startWorker(workerConf, new String[0]);
+ 
+       LOG.info("MiniTajoCluster Worker #" + (i + 1) + " started.");
+       tajoWorkers.add(tajoWorker);
+     }
+   }
+ 
+   public TajoMaster getMaster() {
+     return this.tajoMaster;
+   }
+ 
+   public List<TajoWorker> getTajoWorkers() {
+     return this.tajoWorkers;
+   }
+ 
+   public void shutdownMiniTajoCluster() {
+     if(this.tajoMaster != null) {
+       this.tajoMaster.stop();
+     }
+     for(TajoWorker eachWorker: tajoWorkers) {
+       eachWorker.stopWorkerForce();
+     }
+     tajoWorkers.clear();
+     this.tajoMaster= null;
+   }
+ 
+   ////////////////////////////////////////////////////////
+   // Meta Cluster Section
+   ////////////////////////////////////////////////////////
+   /**
+    * @throws java.io.IOException If a cluster -- dfs or engine -- already running.
+    */
+   void isRunningCluster() throws IOException {
+     if (!isTajoClusterRunning && !isCatalogServerRunning && !isDFSRunning) return;
+     throw new IOException("Cluster already running at " +
+         this.clusterTestBuildDir);
+   }
+ 
+   /**
+    * This method starts up a tajo cluster with a given number of clusters in
+    * distributed mode.
+    *
+    * @param numSlaves the number of tajo cluster to start up
+    * @throws Exception
+    */
+   public void startMiniCluster(final int numSlaves)
+       throws Exception {
+     startMiniCluster(numSlaves, null);
+   }
+ 
+   public void startMiniCluster(final int numSlaves, final String [] dataNodeHosts) throws Exception {
+ 
+     int numDataNodes = numSlaves;
+     if(dataNodeHosts != null && dataNodeHosts.length != 0) {
+       numDataNodes = dataNodeHosts.length;
+     }
+ 
+     LOG.info("Starting up minicluster with 1 master(s) and " +
+         numSlaves + " worker(s) and " + numDataNodes + " datanode(s)");
+ 
+     // If we already bring up the cluster, fail.
+     isRunningCluster();
+     if (clusterTestBuildDir != null) {
+       LOG.info("Using passed path: " + clusterTestBuildDir);
+     }
+ 
+     startMiniDFSCluster(numDataNodes, clusterTestBuildDir, dataNodeHosts);
+     this.dfsCluster.waitClusterUp();
+ 
+     conf.setInt("hbase.hconnection.threads.core", 5);
+     conf.setInt("hbase.hconnection.threads.max", 50);
+     hbaseUtil = new HBaseTestClusterUtil(conf, clusterTestBuildDir);
+ 
+     startMiniTajoCluster(this.clusterTestBuildDir, numSlaves, false);
+   }
+ 
+   public void startMiniClusterInLocal(final int numSlaves) throws Exception {
+     isRunningCluster();
+ 
+     if (clusterTestBuildDir != null) {
+       LOG.info("Using passed path: " + clusterTestBuildDir);
+     }
+ 
+     startMiniTajoCluster(this.clusterTestBuildDir, numSlaves, true);
+   }
+ 
+   public void shutdownMiniCluster() throws IOException {
+     LOG.info("========================================");
+     LOG.info("Minicluster is stopping");
+     LOG.info("========================================");
+ 
+     try {
+       Thread.sleep(3000);
+     } catch (InterruptedException e) {
+       e.printStackTrace();
+     }
+ 
+     shutdownMiniTajoCluster();
+ 
+     if(this.catalogServer != null) {
+       shutdownCatalogCluster();
+       isCatalogServerRunning = false;
+     }
+ 
+     try {
+       Thread.sleep(3000);
+     } catch (InterruptedException e) {
+       e.printStackTrace();
+     }
+ 
+     if(this.dfsCluster != null) {
+       try {
+         FileSystem fs = this.dfsCluster.getFileSystem();
+         if (fs != null) fs.close();
+         this.dfsCluster.shutdown();
+       } catch (IOException e) {
+         System.err.println("error closing file system: " + e);
+       }
+       isDFSRunning = false;
+     }
+ 
+     if(this.clusterTestBuildDir != null && this.clusterTestBuildDir.exists()) {
+       if(!ShutdownHookManager.get().isShutdownInProgress()) {
+         //TODO clean test dir when ShutdownInProgress
+         LocalFileSystem localFS = LocalFileSystem.getLocal(conf);
+         localFS.delete(new Path(clusterTestBuildDir.toString()), true);
+         localFS.close();
+       }
+       this.clusterTestBuildDir = null;
+     }
+ 
+     if(hbaseUtil != null) {
+       hbaseUtil.stopZooKeeperCluster();
+       hbaseUtil.stopHBaseCluster();
+     }
+ 
+     LOG.info("Minicluster is down");
+     isTajoClusterRunning = false;
+   }
+ 
+   public TajoClient newTajoClient() throws Exception {
+     return new TajoClientImpl(ServiceTrackerFactory.get(getConfiguration()));
+   }
+ 
+   public static ResultSet run(String[] names,
+                               Schema[] schemas,
+                               KeyValueSet tableOption,
+                               String[][] tables,
+                               String query,
+                               TajoClient client) throws Exception {
+     TajoTestingCluster util = TpchTestBase.getInstance().getTestingCluster();
+ 
+     FileSystem fs = util.getDefaultFileSystem();
+     Path rootDir = TajoConf.getWarehouseDir(util.getConfiguration());
+     fs.mkdirs(rootDir);
+     for (int i = 0; i < names.length; i++) {
+       createTable(names[i], schemas[i], tableOption, tables[i]);
+     }
+     Thread.sleep(1000);
+     ResultSet res = client.executeQueryAndGetResult(query);
+     return res;
+   }
+ 
+   public static ResultSet run(String[] names,
+                               Schema[] schemas,
+                               KeyValueSet tableOption,
+                               String[][] tables,
+                               String query) throws Exception {
+     TpchTestBase instance = TpchTestBase.getInstance();
+     TajoTestingCluster util = instance.getTestingCluster();
+     while(true) {
+       if(util.getMaster().isMasterRunning()) {
+         break;
+       }
+       Thread.sleep(1000);
+     }
+     TajoConf conf = util.getConfiguration();
+     TajoClient client = new TajoClientImpl(ServiceTrackerFactory.get(conf));
+ 
+     try {
+       return run(names, schemas, tableOption, tables, query, client);
+     } finally {
+       client.close();
+     }
+   }
+ 
+   public static TajoClient newTajoClient(TajoTestingCluster util) throws SQLException, InterruptedException {
+     while(true) {
+       if(util.getMaster().isMasterRunning()) {
+         break;
+       }
+       Thread.sleep(1000);
+     }
+     TajoConf conf = util.getConfiguration();
+     return new TajoClientImpl(ServiceTrackerFactory.get(conf));
+   }
+ 
+   public static void createTable(String tableName, Schema schema,
+                                  KeyValueSet tableOption, String[] tableDatas) throws Exception {
+     createTable(tableName, schema, tableOption, tableDatas, 1);
+   }
+ 
+   public static void createTable(String tableName, Schema schema,
+                                  KeyValueSet tableOption, String[] tableDatas, int numDataFiles) throws Exception {
+     TpchTestBase instance = TpchTestBase.getInstance();
+     TajoTestingCluster util = instance.getTestingCluster();
+     TajoClient client = newTajoClient(util);
+     try {
+       FileSystem fs = util.getDefaultFileSystem();
+       Path rootDir = TajoConf.getWarehouseDir(util.getConfiguration());
+       if (!fs.exists(rootDir)) {
+         fs.mkdirs(rootDir);
+       }
+       Path tablePath;
+       if (CatalogUtil.isFQTableName(tableName)) {
+         Pair<String, String> name = CatalogUtil.separateQualifierAndName(tableName);
+         tablePath = new Path(rootDir, new Path(name.getFirst(), name.getSecond()));
+       } else {
+         tablePath = new Path(rootDir, tableName);
+       }
+ 
+       fs.mkdirs(tablePath);
+       if (tableDatas.length > 0) {
+         int recordPerFile = tableDatas.length / numDataFiles;
+         if (recordPerFile == 0) {
+           recordPerFile = 1;
+         }
+         FSDataOutputStream out = null;
+         for (int j = 0; j < tableDatas.length; j++) {
+           if (out == null || j % recordPerFile == 0) {
+             if (out != null) {
+               out.close();
+             }
+             Path dfsPath = new Path(tablePath, tableName + j + ".tbl");
+             out = fs.create(dfsPath);
+           }
+           out.write((tableDatas[j] + "\n").getBytes());
+         }
+         if (out != null) {
+           out.close();
+         }
+       }
+       TableMeta meta = CatalogUtil.newTableMeta("TEXT", tableOption);
+       client.createExternalTable(tableName, schema, tablePath.toUri(), meta);
+     } finally {
+       client.close();
+     }
+   }
+ 
+     /**
+     * Write lines to a file.
+     *
+     * @param file File to write lines to
+     * @param lines Strings written to the file
+     * @throws java.io.IOException
+     */
+   private static void writeLines(File file, String... lines)
+       throws IOException {
+     Writer writer = Files.newWriter(file, Charsets.UTF_8);
+     try {
+       for (String line : lines) {
+         writer.write(line);
+         writer.write('\n');
+       }
+     } finally {
+       Closeables.closeQuietly(writer);
+     }
+   }
+ 
+   public void setAllTajoDaemonConfValue(String key, String value) {
+     tajoMaster.getContext().getConf().set(key, value);
+     setAllWorkersConfValue(key, value);
+   }
+ 
+   public void setAllWorkersConfValue(String key, String value) {
+     for (TajoWorker eachWorker: tajoWorkers) {
+       eachWorker.getConfig().set(key, value);
+     }
+   }
+ 
+   public void waitForQuerySubmitted(QueryId queryId) throws Exception {
+     waitForQuerySubmitted(queryId, 50);
+   }
+ 
+   public void waitForQuerySubmitted(QueryId queryId, int delay) throws Exception {
+     QueryMasterTask qmt = null;
+ 
+     int i = 0;
+     while (qmt == null || TajoClientUtil.isQueryWaitingForSchedule(qmt.getState())) {
+       try {
+         Thread.sleep(delay);
+ 
+         if (qmt == null) {
+           qmt = getQueryMasterTask(queryId);
+         }
+       } catch (InterruptedException e) {
+       }
+       if (++i > 200) {
+         throw new IOException("Timed out waiting for query to start");
+       }
+     }
+   }
+ 
+   public void waitForQueryState(Query query, TajoProtos.QueryState expected, int delay) throws Exception {
+     int i = 0;
+     while (query == null || query.getSynchronizedState() != expected) {
+       try {
+         Thread.sleep(delay);
+       } catch (InterruptedException e) {
+       }
+       if (++i > 200) {
+         throw new IOException("Timed out waiting. expected: " + expected +
+             ", actual: " + query != null ? String.valueOf(query.getSynchronizedState()) : String.valueOf(query));
+       }
+     }
+   }
+ 
+   public void waitForStageState(Stage stage, StageState expected, int delay) throws Exception {
+ 
+     int i = 0;
+     while (stage == null || stage.getSynchronizedState() != expected) {
+       try {
+         Thread.sleep(delay);
+       } catch (InterruptedException e) {
+       }
+       if (++i > 200) {
+         throw new IOException("Timed out waiting");
+       }
+     }
+   }
+ 
+   public QueryMasterTask getQueryMasterTask(QueryId queryId) {
+     QueryMasterTask qmt = null;
+     for (TajoWorker worker : getTajoWorkers()) {
+       qmt = worker.getWorkerContext().getQueryMaster().getQueryMasterTask(queryId, true);
+       if (qmt != null && queryId.equals(qmt.getQueryId())) {
+         break;
+       }
+     }
+     return qmt;
+   }
+ }


[34/39] tajo git commit: Basic pushdown to PostgreSQL has been completed.

Posted by hy...@apache.org.
Basic pushdown to PostgreSQL has been completed.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/fa819881
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/fa819881
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/fa819881

Branch: refs/heads/TAJO-1730
Commit: fa819881573f89fadd415ce5bd9b1a0280be3702
Parents: d3a016a
Author: Hyunsik Choi <hy...@apache.org>
Authored: Mon Aug 31 17:11:44 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Mon Aug 31 17:11:44 2015 +0900

----------------------------------------------------------------------
 .../java/org/apache/tajo/catalog/TableUtil.java |  51 ---
 .../apache/tajo/catalog/TestFunctionDesc.java   |  19 --
 .../tajo/catalog/store/AbstractDBStore.java     |   4 +-
 .../tajo/client/CatalogAdminClientImpl.java     |   8 +-
 .../java/org/apache/tajo/QueryTestCaseBase.java |  13 +-
 .../test/java/org/apache/tajo/TpchTestBase.java |   4 +-
 .../src/test/resources/tpch/customer.tbl        |  10 +-
 .../src/test/resources/tpch/lineitem.tbl        |  10 +-
 .../src/test/resources/tpch/nation.tbl          |  50 +--
 .../src/test/resources/tpch/orders.tbl          |   6 +-
 .../src/test/resources/tpch/partsupp.tbl        |   6 +-
 .../src/test/resources/tpch/region.tbl          |  10 +-
 .../src/test/resources/tpch/supplier.tbl        |   6 +-
 .../org/apache/tajo/storage/StorageService.java |   5 +
 .../java/org/apache/tajo/util/FileUtil.java     | 117 ++-----
 .../org/apache/tajo/util/JavaResourceUtil.java  |  46 +++
 .../java/org/apache/tajo/util/StringUtils.java  |  37 ++-
 .../org/apache/tajo/util/TestFileUtils.java     |  65 +---
 .../apache/tajo/cli/tools/TestDDLBuilder.java   |  10 +-
 .../tajo/engine/parser/TestSQLAnalyzer.java     | 139 +++++----
 .../apache/tajo/engine/query/TestJoinQuery.java |   4 +-
 .../org/apache/tajo/storage/TestRowFile.java    |   8 +-
 .../tajo/engine/codegen/EvalCodeGenerator.java  |   4 +-
 .../engine/planner/PhysicalPlannerImpl.java     |   2 +
 .../physical/OperatorPushableScanExec.java      |  56 ++++
 .../engine/planner/physical/SeqScanExec.java    |  12 +-
 .../apache/tajo/master/exec/QueryExecutor.java  |   1 +
 .../org/apache/tajo/plan/LogicalPlanner.java    |  34 +-
 .../apache/tajo/plan/expr/AlgebraicUtil.java    |   2 +-
 .../org/apache/tajo/plan/expr/EvalType.java     |  14 +-
 .../tajo/plan/expr/SimpleEvalNodeVisitor.java   |   9 +-
 .../plan/exprrewrite/rules/ConstantFolding.java |   2 +-
 .../exprrewrite/rules/ConstantPropagation.java  |   2 +-
 .../org/apache/tajo/plan/logical/ScanNode.java  |  30 +-
 .../rules/CommonConditionReduceRule.java        |   2 +-
 .../tajo/plan/serder/EvalNodeSerializer.java    |   6 +-
 .../org/apache/tajo/plan/util/PlannerUtil.java  |  35 +--
 tajo-plan/src/main/proto/Plan.proto             |  13 +-
 .../apache/tajo/storage/AbstractScanner.java    |  10 +
 .../org/apache/tajo/storage/MergeScanner.java   |  11 +
 .../org/apache/tajo/storage/NullScanner.java    |  11 +
 .../org/apache/tajo/storage/PlanPushable.java   |  36 +++
 .../java/org/apache/tajo/storage/Scanner.java   |  15 +
 .../org/apache/tajo/storage/Tablespace.java     |  47 +--
 .../apache/tajo/storage/TablespaceManager.java  |  23 +-
 .../storage/fragment/FragmentConvertor.java     |   5 +-
 .../src/main/resources/storage-default.xml      |   6 +-
 .../src/test/resources/storage-default.xml      |   4 +
 .../apache/tajo/storage/hbase/HBaseScanner.java |  10 +
 .../tajo/storage/hbase/HBaseTablespace.java     |  11 +-
 .../org/apache/tajo/storage/FileScanner.java    |  12 +
 .../org/apache/tajo/storage/FileTablespace.java |  13 +-
 .../tajo/storage/text/CSVLineDeserializer.java  |   8 +-
 .../tajo/storage/TestDelimitedTextFile.java     |  12 +-
 .../org/apache/tajo/storage/TestLineReader.java |   3 +-
 .../org/apache/tajo/storage/TestStorages.java   |  22 +-
 .../apache/tajo/storage/avro/TestAvroUtil.java  |   3 +-
 .../apache/tajo/storage/json/TestJsonSerDe.java |   4 +-
 .../tajo/storage/jdbc/ConnectionInfo.java       |   2 +-
 .../apache/tajo/storage/jdbc/JdbcFragment.java  |  32 +-
 .../storage/jdbc/JdbcMetadataProviderBase.java  |  15 +-
 .../apache/tajo/storage/jdbc/JdbcScanner.java   | 310 +++++++++++++++++++
 .../tajo/storage/jdbc/JdbcTablespace.java       |  34 +-
 .../apache/tajo/storage/jdbc/SQLBuilder.java    | 172 ++++++++++
 .../storage/jdbc/SQLExpressionGenerator.java    | 216 +++++++++++++
 .../storage/jdbc/JdbcTablespaceTestBase.java    |  23 --
 .../tajo/storage/mysql/MySQLTablespace.java     |  29 ++
 .../tajo/storage/mysql/MysqlJdbcScanner.java    |  40 +++
 .../tajo/storage/mysql/EmbedMySQLServer.java    |   4 +-
 .../mysql/TestMySQLMetadataProvider.java        |   4 +-
 .../src/test/resources/tpch/customer.sql        |  10 -
 .../src/test/resources/tpch/lineitem.sql        |  18 --
 .../src/test/resources/tpch/mysql/customer.sql  |  10 +
 .../src/test/resources/tpch/mysql/lineitem.sql  |  18 ++
 .../src/test/resources/tpch/mysql/nation.sql    |   6 +
 .../src/test/resources/tpch/mysql/orders.sql    |  11 +
 .../src/test/resources/tpch/mysql/part.sql      |  11 +
 .../src/test/resources/tpch/mysql/partsupp.sql  |   7 +
 .../src/test/resources/tpch/mysql/region.sql    |   5 +
 .../src/test/resources/tpch/mysql/supplier.sql  |   9 +
 .../src/test/resources/tpch/nation.sql          |   6 -
 .../src/test/resources/tpch/orders.sql          |  11 -
 .../src/test/resources/tpch/part.sql            |  11 -
 .../src/test/resources/tpch/partsupp.sql        |   7 -
 .../src/test/resources/tpch/region.sql          |   5 -
 .../src/test/resources/tpch/supplier.sql        |   9 -
 .../tajo/storage/pgsql/PgSQLJdbcScanner.java    |  36 +++
 .../tajo/storage/pgsql/PgSQLTablespace.java     |  32 ++
 .../tajo/storage/pgsql/EmbedPgSQLServer.java    |  38 ++-
 .../storage/pgsql/TestPgSQLEndPointTests.java   |  26 +-
 .../tajo/storage/pgsql/TestPgSQLQueryTests.java |  31 +-
 .../pgsql/TestPgSQLSimpleQueryTests.java        |  47 +++
 .../queries/TestPgSQLQueryTests/select_all.sql  |   0
 .../TestPgSQLQueryTests/testSimpleFilter.sql    |   1 +
 .../TestPgSQLSimpleQueryTests/testSelectAll.sql |   1 +
 .../testSelectLimit.sql                         |   1 +
 .../TestPgSQLQueryTests/select_all.result       |   0
 .../TestPgSQLQueryTests/testSimpleFilter.result |   5 +
 .../testSelectAll.result                        |   7 +
 .../testSelectLimit.result                      |   5 +
 .../src/test/resources/tpch/customer.sql        |  10 -
 .../src/test/resources/tpch/lineitem.sql        |  18 --
 .../src/test/resources/tpch/nation.sql          |   6 -
 .../src/test/resources/tpch/orders.sql          |  11 -
 .../src/test/resources/tpch/part.sql            |  11 -
 .../src/test/resources/tpch/partsupp.sql        |   7 -
 .../src/test/resources/tpch/pgsql/customer.sql  |  10 +
 .../src/test/resources/tpch/pgsql/lineitem.sql  |  18 ++
 .../src/test/resources/tpch/pgsql/nation.sql    |   6 +
 .../src/test/resources/tpch/pgsql/orders.sql    |  11 +
 .../src/test/resources/tpch/pgsql/part.sql      |  11 +
 .../src/test/resources/tpch/pgsql/partsupp.sql  |   7 +
 .../src/test/resources/tpch/pgsql/region.sql    |   5 +
 .../src/test/resources/tpch/pgsql/supplier.sql  |   9 +
 .../src/test/resources/tpch/region.sql          |   5 -
 .../src/test/resources/tpch/supplier.sql        |   9 -
 116 files changed, 1794 insertions(+), 743 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/TableUtil.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/TableUtil.java b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/TableUtil.java
deleted file mode 100644
index 76aec33..0000000
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/TableUtil.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.catalog;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FSDataInputStream;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.tajo.catalog.proto.CatalogProtos.TableProto;
-import org.apache.tajo.util.FileUtil;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
-public class TableUtil {
-  public static TableMeta getTableMeta(Configuration conf, Path tablePath) 
-      throws IOException {
-    TableMeta meta = null;
-    
-    FileSystem fs = tablePath.getFileSystem(conf);
-    
-    Path tableMetaPath = new Path(tablePath, ".meta");
-    if(!fs.exists(tableMetaPath)) {
-      throw new FileNotFoundException(".meta file not found in "+tablePath.toString());
-    }
-    FSDataInputStream tableMetaIn = 
-      fs.open(tableMetaPath);
-
-    TableProto tableProto = (TableProto) FileUtil.loadProto(tableMetaIn, 
-      TableProto.getDefaultInstance());
-    meta = new TableMeta(tableProto);
-
-    return meta;
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestFunctionDesc.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestFunctionDesc.java b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestFunctionDesc.java
index 16e85f0..e8170ee 100644
--- a/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestFunctionDesc.java
+++ b/tajo-catalog/tajo-catalog-common/src/test/java/org/apache/tajo/catalog/TestFunctionDesc.java
@@ -71,25 +71,6 @@ public class TestFunctionDesc {
     assertEquals(Type.INT4, desc.getReturnType().getType());
     assertArrayEquals(CatalogUtil.newSimpleDataTypeArray(Type.INT4, Type.INT8),
         desc.getParamTypes());
-
-    CommonTestingUtil.getTestDir(TEST_PATH);
-    File save = new File(TEST_PATH + "/save.dat");
-    FileUtil.writeProto(save, desc.getProto());
-
-    FunctionDescProto proto = FunctionDescProto.getDefaultInstance();
-    proto = (FunctionDescProto) FileUtil.loadProto(save, proto);
-
-    FunctionDesc newDesc = new FunctionDesc(proto);
-
-    assertEquals("sum", newDesc.getFunctionName());
-    assertEquals(TestSum.class, newDesc.getLegacyFuncClass());
-    assertEquals(FunctionType.GENERAL, newDesc.getFuncType());
-    assertEquals(Type.INT4, newDesc.getReturnType().getType());
-
-    assertArrayEquals(CatalogUtil.newSimpleDataTypeArray(Type.INT4, Type.INT8),
-        newDesc.getParamTypes());
-
-    assertEquals(desc.getProto(), newDesc.getProto());
   }
   
   @Test

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
index cd8dcb6..7eeaabd 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
@@ -36,7 +36,7 @@ import org.apache.tajo.common.TajoDataTypes;
 import org.apache.tajo.common.TajoDataTypes.Type;
 import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.exception.*;
-import org.apache.tajo.util.FileUtil;
+import org.apache.tajo.util.JavaResourceUtil;
 import org.apache.tajo.util.Pair;
 import org.apache.tajo.util.TUtil;
 
@@ -187,7 +187,7 @@ public abstract class AbstractDBStore extends CatalogConstants implements Catalo
 
   public String readSchemaFile(String path) {
     try {
-      return FileUtil.readTextFileFromResource("schemas/" + path);
+      return JavaResourceUtil.readTextFromResource("schemas/" + path);
     } catch (IOException e) {
       throw new TajoInternalError(e);
     }

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-client/src/main/java/org/apache/tajo/client/CatalogAdminClientImpl.java
----------------------------------------------------------------------
diff --git a/tajo-client/src/main/java/org/apache/tajo/client/CatalogAdminClientImpl.java b/tajo-client/src/main/java/org/apache/tajo/client/CatalogAdminClientImpl.java
index af1278d..d5ade14 100644
--- a/tajo-client/src/main/java/org/apache/tajo/client/CatalogAdminClientImpl.java
+++ b/tajo-client/src/main/java/org/apache/tajo/client/CatalogAdminClientImpl.java
@@ -87,15 +87,15 @@ public class CatalogAdminClientImpl implements CatalogAdminClient {
   }
 
   @Override
-  public void dropDatabase(final String databaseName) throws UndefinedDatabaseException {
+  public void dropDatabase(final String databaseName)
+      throws UndefinedDatabaseException, InsufficientPrivilegeException {
 
     try {
       final BlockingInterface stub = conn.getTMStub();
       final ReturnState state = stub.dropDatabase(null, conn.getSessionedString(databaseName));
 
-      if (isThisError(state, ResultCode.UNDEFINED_DATABASE)) {
-        throw new UndefinedDatabaseException(state);
-      }
+      throwsIfThisError(state, UndefinedDatabaseException.class);
+      throwsIfThisError(state, InsufficientPrivilegeException.class);
       ensureOk(state);
 
     } catch (ServiceException e) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-cluster-tests/src/test/java/org/apache/tajo/QueryTestCaseBase.java
----------------------------------------------------------------------
diff --git a/tajo-cluster-tests/src/test/java/org/apache/tajo/QueryTestCaseBase.java b/tajo-cluster-tests/src/test/java/org/apache/tajo/QueryTestCaseBase.java
index 6796921..6638958 100644
--- a/tajo-cluster-tests/src/test/java/org/apache/tajo/QueryTestCaseBase.java
+++ b/tajo-cluster-tests/src/test/java/org/apache/tajo/QueryTestCaseBase.java
@@ -40,6 +40,7 @@ import org.apache.tajo.client.TajoClient;
 import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.engine.parser.SQLAnalyzer;
 import org.apache.tajo.engine.query.QueryContext;
+import org.apache.tajo.exception.InsufficientPrivilegeException;
 import org.apache.tajo.exception.TajoException;
 import org.apache.tajo.exception.UndefinedTableException;
 import org.apache.tajo.master.GlobalEngine;
@@ -225,11 +226,19 @@ public class QueryTestCaseBase {
     // if the current database is "default", shouldn't drop it.
     if (!currentDatabase.equals(TajoConstants.DEFAULT_DATABASE_NAME)) {
       for (String tableName : catalog.getAllTableNames(currentDatabase)) {
-        client.updateQuery("DROP TABLE IF EXISTS " + tableName);
+        try {
+          client.updateQuery("DROP TABLE IF EXISTS " + tableName);
+        } catch (InsufficientPrivilegeException i) {
+          LOG.warn("relation '" + tableName + "' is read only.");
+        }
       }
 
       client.selectDatabase(TajoConstants.DEFAULT_DATABASE_NAME);
-      client.dropDatabase(currentDatabase);
+      try {
+        client.dropDatabase(currentDatabase);
+      } catch (InsufficientPrivilegeException e) {
+        LOG.warn("database '" + currentDatabase + "' is read only.");
+      }
     }
     client.close();
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-cluster-tests/src/test/java/org/apache/tajo/TpchTestBase.java
----------------------------------------------------------------------
diff --git a/tajo-cluster-tests/src/test/java/org/apache/tajo/TpchTestBase.java b/tajo-cluster-tests/src/test/java/org/apache/tajo/TpchTestBase.java
index 027e735..62f7477 100644
--- a/tajo-cluster-tests/src/test/java/org/apache/tajo/TpchTestBase.java
+++ b/tajo-cluster-tests/src/test/java/org/apache/tajo/TpchTestBase.java
@@ -27,10 +27,10 @@ import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.storage.StorageConstants;
 import org.apache.tajo.util.CommonTestingUtil;
 import org.apache.tajo.util.FileUtil;
+import org.apache.tajo.util.JavaResourceUtil;
 import org.apache.tajo.util.KeyValueSet;
 
 import java.io.File;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.sql.ResultSet;
 import java.util.Map;
@@ -76,7 +76,7 @@ public class TpchTestBase {
     File tpchTablesDir = new File(new File(CommonTestingUtil.getTestDir().toUri()), "tpch");
 
     for (int i = 0; i < names.length; i++) {
-      String str = FileUtil.readTextFileFromResource("tpch/" + names[i] + ".tbl");
+      String str = JavaResourceUtil.readTextFromResource("tpch/" + names[i] + ".tbl");
       Path tablePath = new Path(new Path(tpchTablesDir.toURI()), names[i] + ".tbl");
       FileUtil.writeTextToFile(str, tablePath);
       paths[i] = tablePath.toString();

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-cluster-tests/src/test/resources/tpch/customer.tbl
----------------------------------------------------------------------
diff --git a/tajo-cluster-tests/src/test/resources/tpch/customer.tbl b/tajo-cluster-tests/src/test/resources/tpch/customer.tbl
index 4f684c6..d1114fa 100644
--- a/tajo-cluster-tests/src/test/resources/tpch/customer.tbl
+++ b/tajo-cluster-tests/src/test/resources/tpch/customer.tbl
@@ -1,5 +1,5 @@
-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|Customer#000000002|XSTf4,NCwDVaWNe6tEgvwfmRchLXak|13|23-768-687-3665|121.65|AUTOMOBILE|l accounts. blithely ironic theodolites integrate boldly: caref|
-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|Customer#000000004|XxVSJsLAGtn|4|14-128-190-5944|2866.83|MACHINERY| requests. final, regular ideas sleep final accou|
-5|Customer#000000005|KvpyuHCplrB84WgAiGV6sYpZq7Tj|3|13-750-942-6364|794.47|HOUSEHOLD|n accounts will have to unwind. foxes cajole accor|
+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|Customer#000000002|XSTf4,NCwDVaWNe6tEgvwfmRchLXak|13|23-768-687-3665|121.65|AUTOMOBILE|l accounts. blithely ironic theodolites integrate boldly: caref
+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|Customer#000000004|XxVSJsLAGtn|4|14-128-190-5944|2866.83|MACHINERY| requests. final, regular ideas sleep final accou
+5|Customer#000000005|KvpyuHCplrB84WgAiGV6sYpZq7Tj|3|13-750-942-6364|794.47|HOUSEHOLD|n accounts will have to unwind. foxes cajole accor

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-cluster-tests/src/test/resources/tpch/lineitem.tbl
----------------------------------------------------------------------
diff --git a/tajo-cluster-tests/src/test/resources/tpch/lineitem.tbl b/tajo-cluster-tests/src/test/resources/tpch/lineitem.tbl
index e3beac9..47a0ea2 100644
--- a/tajo-cluster-tests/src/test/resources/tpch/lineitem.tbl
+++ b/tajo-cluster-tests/src/test/resources/tpch/lineitem.tbl
@@ -1,5 +1,5 @@
-1|1|7706|1|17|21168.23|0.04|0.02|N|O|1996-03-13|1996-02-12|1996-03-22|DELIVER IN PERSON|TRUCK|egular courts above the|
-1|1|7311|2|36|45983.16|0.09|0.06|N|O|1996-04-12|1996-02-28|1996-04-20|TAKE BACK RETURN|MAIL|ly final dependencies: slyly bold |
-2|2|1191|1|38|44694.46|0.00|0.05|N|O|1997-01-28|1997-01-14|1997-02-02|TAKE BACK RETURN|RAIL|ven requests. deposits breach a|
-3|2|1798|1|45|54058.05|0.06|0.00|R|F|1994-02-02|1994-01-04|1994-02-23|NONE|AIR|ongside of the furiously brave acco|
-3|3|6540|2|49|46796.47|0.10|0.00|R|F|1993-11-09|1993-12-20|1993-11-24|TAKE BACK RETURN|RAIL| unusual accounts. eve|
+1|1|7706|1|17|21168.23|0.04|0.02|N|O|1996-03-13|1996-02-12|1996-03-22|DELIVER IN PERSON|TRUCK|egular courts above the
+1|1|7311|2|36|45983.16|0.09|0.06|N|O|1996-04-12|1996-02-28|1996-04-20|TAKE BACK RETURN|MAIL|ly final dependencies: slyly bold
+2|2|1191|1|38|44694.46|0.00|0.05|N|O|1997-01-28|1997-01-14|1997-02-02|TAKE BACK RETURN|RAIL|ven requests. deposits breach a
+3|2|1798|1|45|54058.05|0.06|0.00|R|F|1994-02-02|1994-01-04|1994-02-23|NONE|AIR|ongside of the furiously brave acco
+3|3|6540|2|49|46796.47|0.10|0.00|R|F|1993-11-09|1993-12-20|1993-11-24|TAKE BACK RETURN|RAIL| unusual accounts. eve

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-cluster-tests/src/test/resources/tpch/nation.tbl
----------------------------------------------------------------------
diff --git a/tajo-cluster-tests/src/test/resources/tpch/nation.tbl b/tajo-cluster-tests/src/test/resources/tpch/nation.tbl
index ed3fd5b..bd42b90 100644
--- a/tajo-cluster-tests/src/test/resources/tpch/nation.tbl
+++ b/tajo-cluster-tests/src/test/resources/tpch/nation.tbl
@@ -1,25 +1,25 @@
-0|ALGERIA|0| haggle. carefully final deposits detect slyly agai|
-1|ARGENTINA|1|al foxes promise slyly according to the regular accounts. bold requests alon|
-2|BRAZIL|1|y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special |
-3|CANADA|1|eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold|
-4|EGYPT|4|y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d|
-5|ETHIOPIA|0|ven packages wake quickly. regu|
-6|FRANCE|3|refully final requests. regular, ironi|
-7|GERMANY|3|l platelets. regular accounts x-ray: unusual, regular acco|
-8|INDIA|2|ss excuses cajole slyly across the packages. deposits print aroun|
-9|INDONESIA|2| slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull|
-10|IRAN|4|efully alongside of the slyly final dependencies. |
-11|IRAQ|4|nic deposits boost atop the quickly final requests? quickly regula|
-12|JAPAN|2|ously. final, express gifts cajole a|
-13|JORDAN|4|ic deposits are blithely about the carefully regular pa|
-14|KENYA|0| pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t|
-15|MOROCCO|0|rns. blithely bold courts among the closely regular packages use furiously bold platelets?|
-16|MOZAMBIQUE|0|s. ironic, unusual asymptotes wake blithely r|
-17|PERU|1|platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun|
-18|CHINA|2|c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos|
-19|ROMANIA|3|ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account|
-20|SAUDI ARABIA|4|ts. silent requests haggle. closely express packages sleep across the blithely|
-21|VIETNAM|2|hely enticingly express accounts. even, final |
-22|RUSSIA|3| requests against the platelets use never according to the quickly regular pint|
-23|UNITED KINGDOM|3|eans boost carefully special requests. accounts are. carefull|
-24|UNITED STATES|1|y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be|
+0|ALGERIA|0| haggle. carefully final deposits detect slyly agai
+1|ARGENTINA|1|al foxes promise slyly according to the regular accounts. bold requests alon
+2|BRAZIL|1|y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special
+3|CANADA|1|eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold
+4|EGYPT|4|y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d
+5|ETHIOPIA|0|ven packages wake quickly. regu
+6|FRANCE|3|refully final requests. regular, ironi
+7|GERMANY|3|l platelets. regular accounts x-ray: unusual, regular acco
+8|INDIA|2|ss excuses cajole slyly across the packages. deposits print aroun
+9|INDONESIA|2| slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull
+10|IRAN|4|efully alongside of the slyly final dependencies.
+11|IRAQ|4|nic deposits boost atop the quickly final requests? quickly regula
+12|JAPAN|2|ously. final, express gifts cajole a
+13|JORDAN|4|ic deposits are blithely about the carefully regular pa
+14|KENYA|0| pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t
+15|MOROCCO|0|rns. blithely bold courts among the closely regular packages use furiously bold platelets?
+16|MOZAMBIQUE|0|s. ironic, unusual asymptotes wake blithely r
+17|PERU|1|platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun
+18|CHINA|2|c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos
+19|ROMANIA|3|ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account
+20|SAUDI ARABIA|4|ts. silent requests haggle. closely express packages sleep across the blithely
+21|VIETNAM|2|hely enticingly express accounts. even, final
+22|RUSSIA|3| requests against the platelets use never according to the quickly regular pint
+23|UNITED KINGDOM|3|eans boost carefully special requests. accounts are. carefull
+24|UNITED STATES|1|y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-cluster-tests/src/test/resources/tpch/orders.tbl
----------------------------------------------------------------------
diff --git a/tajo-cluster-tests/src/test/resources/tpch/orders.tbl b/tajo-cluster-tests/src/test/resources/tpch/orders.tbl
index 15a1b6f..09fcbf1 100644
--- a/tajo-cluster-tests/src/test/resources/tpch/orders.tbl
+++ b/tajo-cluster-tests/src/test/resources/tpch/orders.tbl
@@ -1,3 +1,3 @@
-1|3|O|173665.47|1996-01-02|5-LOW|Clerk#000000951|0|nstructions sleep furiously among |
-2|4|O|46929.18|1996-12-01|1-URGENT|Clerk#000000880|0| foxes. pending accounts at the pending, silent asymptot|
-3|2|F|193846.25|1993-10-14|5-LOW|Clerk#000000955|0|sly final accounts boost. carefully regular ideas cajole carefully. depos|
+1|3|O|173665.47|1996-01-02|5-LOW|Clerk#000000951|0|nstructions sleep furiously among
+2|4|O|46929.18|1996-12-01|1-URGENT|Clerk#000000880|0| foxes. pending accounts at the pending, silent asymptot
+3|2|F|193846.25|1993-10-14|5-LOW|Clerk#000000955|0|sly final accounts boost. carefully regular ideas cajole carefully. depos

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-cluster-tests/src/test/resources/tpch/partsupp.tbl
----------------------------------------------------------------------
diff --git a/tajo-cluster-tests/src/test/resources/tpch/partsupp.tbl b/tajo-cluster-tests/src/test/resources/tpch/partsupp.tbl
index a6211e6..3912eb7 100644
--- a/tajo-cluster-tests/src/test/resources/tpch/partsupp.tbl
+++ b/tajo-cluster-tests/src/test/resources/tpch/partsupp.tbl
@@ -1,3 +1,3 @@
-1|2|3325|771.64|, even theodolites. regular, final theodolites eat after the carefully pending foxes. furiously regular deposits sleep slyly. carefully bold realms above the ironic dependencies haggle careful|
-2|3|8895|1.01|nic accounts. final accounts sleep furiously about the ironic, bold packages. regular, regular accounts|
-3|4|4651|920.92|ilent foxes affix furiously quickly unusual requests. even packages across the carefully even theodolites nag above the sp|
+1|2|3325|771.64|, even theodolites. regular, final theodolites eat after the carefully pending foxes. furiously regular deposits sleep slyly. carefully bold realms above the ironic dependencies haggle careful
+2|3|8895|1.01|nic accounts. final accounts sleep furiously about the ironic, bold packages. regular, regular accounts
+3|4|4651|920.92|ilent foxes affix furiously quickly unusual requests. even packages across the carefully even theodolites nag above the sp

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-cluster-tests/src/test/resources/tpch/region.tbl
----------------------------------------------------------------------
diff --git a/tajo-cluster-tests/src/test/resources/tpch/region.tbl b/tajo-cluster-tests/src/test/resources/tpch/region.tbl
index c5ebb63..ae117c2 100644
--- a/tajo-cluster-tests/src/test/resources/tpch/region.tbl
+++ b/tajo-cluster-tests/src/test/resources/tpch/region.tbl
@@ -1,5 +1,5 @@
-0|AFRICA|lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to |
-1|AMERICA|hs use ironic, even requests. s|
-2|ASIA|ges. thinly even pinto beans ca|
-3|EUROPE|ly final courts cajole furiously final excuse|
-4|MIDDLE EAST|uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl|
+0|AFRICA|lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to
+1|AMERICA|hs use ironic, even requests. s
+2|ASIA|ges. thinly even pinto beans ca
+3|EUROPE|ly final courts cajole furiously final excuse
+4|MIDDLE EAST|uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-cluster-tests/src/test/resources/tpch/supplier.tbl
----------------------------------------------------------------------
diff --git a/tajo-cluster-tests/src/test/resources/tpch/supplier.tbl b/tajo-cluster-tests/src/test/resources/tpch/supplier.tbl
index a6fafb3..253301c 100644
--- a/tajo-cluster-tests/src/test/resources/tpch/supplier.tbl
+++ b/tajo-cluster-tests/src/test/resources/tpch/supplier.tbl
@@ -1,3 +1,3 @@
-2|Supplier#000000002|89eJ5ksX3ImxJQBvxObC,|5|15-679-861-2259|4032.68| slyly bold instructions. idle dependen|
-3|Supplier#000000003|q1,G3Pj6OjIuUYfUoH18BFTKP5aU9bEV3|1|11-383-516-1199|4192.40|blithely silent requests after the express dependencies are sl|
-4|Supplier#000000004|Bk7ah4CK8SYQTepEmvMkkgMwg|15|25-843-787-7479|4641.08|riously even requests above the exp|
+2|Supplier#000000002|89eJ5ksX3ImxJQBvxObC,|5|15-679-861-2259|4032.68| slyly bold instructions. idle dependen
+3|Supplier#000000003|q1,G3Pj6OjIuUYfUoH18BFTKP5aU9bEV3|1|11-383-516-1199|4192.40|blithely silent requests after the express dependencies are sl
+4|Supplier#000000004|Bk7ah4CK8SYQTepEmvMkkgMwg|15|25-843-787-7479|4641.08|riously even requests above the exp

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-common/src/main/java/org/apache/tajo/storage/StorageService.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/storage/StorageService.java b/tajo-common/src/main/java/org/apache/tajo/storage/StorageService.java
index 4e5741b..44349ba 100644
--- a/tajo-common/src/main/java/org/apache/tajo/storage/StorageService.java
+++ b/tajo-common/src/main/java/org/apache/tajo/storage/StorageService.java
@@ -18,7 +18,10 @@
 
 package org.apache.tajo.storage;
 
+import org.apache.tajo.exception.UnsupportedException;
+
 import javax.annotation.Nullable;
+import java.io.IOException;
 import java.net.URI;
 
 /**
@@ -35,4 +38,6 @@ public interface StorageService {
    * @return Table URI
    */
   URI getTableURI(@Nullable String spaceName, String databaseName, String tableName);
+
+  long getTableVolumn(URI uri) throws UnsupportedException;
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-common/src/main/java/org/apache/tajo/util/FileUtil.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/FileUtil.java b/tajo-common/src/main/java/org/apache/tajo/util/FileUtil.java
index 5216eb8..430d49d 100644
--- a/tajo-common/src/main/java/org/apache/tajo/util/FileUtil.java
+++ b/tajo-common/src/main/java/org/apache/tajo/util/FileUtil.java
@@ -18,104 +18,28 @@
 
 package org.apache.tajo.util;
 
-import com.google.protobuf.Message;
 import org.apache.commons.logging.Log;
-import org.apache.hadoop.fs.*;
+import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.IOUtils;
 import org.apache.tajo.conf.TajoConf;
 
 import java.io.*;
-import java.net.URL;
 import java.nio.charset.Charset;
 
+/**
+ * Simple File Utilities
+ */
 public class FileUtil {
-  public static void writeProto(File file, Message proto) throws IOException {
-    FileOutputStream stream = null;
-    try {
-      stream = new FileOutputStream(file);
-      stream.write(proto.toByteArray());
-    } finally {
-      IOUtils.closeStream(stream);
-    }
-  }
-
-  public static void writeProto(OutputStream out, Message proto) throws IOException {
-    out.write(proto.toByteArray());
-  }
-
-  public static void writeProto(FileSystem fs, Path path, Message proto) throws IOException {
-    FSDataOutputStream stream = fs.create(path);
-    try {
-      stream.write(proto.toByteArray());
-    } finally {
-      IOUtils.closeStream(stream);
-    }
-  }
-
-  public static Message loadProto(File file, Message proto) throws IOException {
-    FileInputStream in = null;
-    try {
-      in = new FileInputStream(file);
-      Message.Builder builder = proto.newBuilderForType().mergeFrom(in);
-      return builder.build();
-    } finally {
-      IOUtils.closeStream(in);
-    }
-  }
-
-  public static Message loadProto(InputStream in, Message proto) throws IOException {
-    Message.Builder builder = proto.newBuilderForType().mergeFrom(in);
-    return builder.build();
-  }
-
-  public static Message loadProto(FileSystem fs,
-                                  Path path, Message proto) throws IOException {
-    FSDataInputStream in = null;
-    try {
-      in = new FSDataInputStream(fs.open(path));
-      Message.Builder builder = proto.newBuilderForType().mergeFrom(in);
-      return builder.build();
-    } finally {
-      IOUtils.closeStream(in);
-    }
-  }
-
-  public static URL getResourcePath(String resource) throws IOException {
-    return ClassLoader.getSystemResource(resource);
-  }
 
   /**
-   * It returns a string from a text file found in classpath.
+   * Read a file stored in a local file system and return the string contents.
    *
-   * @param resource Resource file name
-   * @return String contents if exists. Otherwise, it will return null.
+   * @param file File
+   * @return String contents
    * @throws IOException
    */
-  public static String readTextFileFromResource(String resource) throws IOException {
-    InputStream stream = ClassLoader.getSystemResourceAsStream(resource);
-    if (stream != null) {
-      return readTextFromStream(stream);
-    } else {
-      return null;
-    }
-  }
-
-  public static String readTextFromStream(InputStream inputStream)
-      throws IOException {
-    try {
-      StringBuilder fileData = new StringBuilder(1000);
-      byte[] buf = new byte[1024];
-      int numRead;
-      while ((numRead = inputStream.read(buf)) != -1) {
-        String readData = new String(buf, 0, numRead, Charset.defaultCharset());
-        fileData.append(readData);
-      }
-      return fileData.toString();
-    } finally {
-      IOUtils.closeStream(inputStream);
-    }
-  }
-
   public static String readTextFile(File file) throws IOException {
     StringBuilder fileData = new StringBuilder(1000);
     BufferedReader reader = new BufferedReader(new FileReader(file));
@@ -133,6 +57,13 @@ public class FileUtil {
     return fileData.toString();
   }
 
+  /**
+   * Write a string into a file
+   *
+   * @param text
+   * @param path File path
+   * @throws IOException
+   */
   public static void writeTextToFile(String text, Path path) throws IOException {
     FileSystem fs = path.getFileSystem(new TajoConf());
     if (!fs.exists(path.getParent())) {
@@ -143,6 +74,22 @@ public class FileUtil {
     out.close();
   }
 
+  public static String readTextFromStream(InputStream inputStream)
+      throws IOException {
+    try {
+      StringBuilder fileData = new StringBuilder(1000);
+      byte[] buf = new byte[1024];
+      int numRead;
+      while ((numRead = inputStream.read(buf)) != -1) {
+        String readData = new String(buf, 0, numRead, Charset.defaultCharset());
+        fileData.append(readData);
+      }
+      return fileData.toString();
+    } finally {
+      IOUtils.closeStream(inputStream);
+    }
+  }
+
   public static void writeTextToStream(String text, OutputStream outputStream) throws IOException {
     try {
       outputStream.write(text.getBytes());

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-common/src/main/java/org/apache/tajo/util/JavaResourceUtil.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/JavaResourceUtil.java b/tajo-common/src/main/java/org/apache/tajo/util/JavaResourceUtil.java
new file mode 100644
index 0000000..cd19b5e
--- /dev/null
+++ b/tajo-common/src/main/java/org/apache/tajo/util/JavaResourceUtil.java
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+public class JavaResourceUtil {
+
+  public static URL getResourceURL(String resource) throws IOException {
+    return ClassLoader.getSystemResource(resource);
+  }
+
+  /**
+   * It returns a string from a text file found in classpath.
+   *
+   * @param resource Resource file name
+   * @return String contents if exists. Otherwise, it will return null.
+   * @throws IOException
+   */
+  public static String readTextFromResource(String resource) throws IOException {
+    InputStream stream = ClassLoader.getSystemResourceAsStream(resource);
+    if (stream != null) {
+      return FileUtil.readTextFromStream(stream);
+    } else {
+      return null;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-common/src/main/java/org/apache/tajo/util/StringUtils.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/StringUtils.java b/tajo-common/src/main/java/org/apache/tajo/util/StringUtils.java
index 7a9f0c3..aa426c8 100644
--- a/tajo-common/src/main/java/org/apache/tajo/util/StringUtils.java
+++ b/tajo-common/src/main/java/org/apache/tajo/util/StringUtils.java
@@ -18,6 +18,7 @@
 
 package org.apache.tajo.util;
 
+import com.google.common.base.Function;
 import io.netty.util.CharsetUtil;
 import org.apache.commons.lang.CharUtils;
 import org.apache.commons.lang.StringEscapeUtils;
@@ -405,7 +406,17 @@ public class StringUtils {
    * @return A joined string
    */
   public static String join(Object[] objects) {
-    return join(objects, ", ", 0, objects.length);
+    return join(objects, ",");
+  }
+
+  /**
+   * Concatenate all objects' string with the delimiter ", "
+   *
+   * @param objects Iterable objects
+   * @return A joined string
+   */
+  public static String join(Object[] objects, String delimiter) {
+    return join(objects, delimiter, 0, objects.length);
   }
 
   /**
@@ -430,6 +441,28 @@ public class StringUtils {
    * @return A joined string
    */
   public static String join(Object[] objects, String delimiter, int startIndex, int length) {
+    return join(objects, delimiter, startIndex, length, new Function<Object, String>() {
+      @Override
+      public String apply(Object input) {
+        return input.toString();
+      }
+    });
+  }
+
+
+  /**
+   * Concatenate all objects' string with a delimiter string
+   *
+   * @param objects object array
+   * @param delimiter Delimiter string
+   * @param f convert from a type to string
+   * @return A joined string
+   */
+  public static <T> String join(T [] objects, String delimiter, Function<T, String> f) {
+    return join(objects, delimiter, 0, objects.length, f);
+  }
+
+  public static <T> String join(T [] objects, String delimiter, int startIndex, int length, Function<T, String> f) {
     boolean first = true;
     StringBuilder sb = new StringBuilder();
     int endIndex = startIndex + length;
@@ -440,7 +473,7 @@ public class StringUtils {
         sb.append(delimiter);
       }
 
-      sb.append(objects[i].toString());
+      sb.append(f.apply(objects[i]));
     }
 
     return sb.toString();

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-common/src/test/java/org/apache/tajo/util/TestFileUtils.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/util/TestFileUtils.java b/tajo-common/src/test/java/org/apache/tajo/util/TestFileUtils.java
index 1e7d3c3..90b1a39 100644
--- a/tajo-common/src/test/java/org/apache/tajo/util/TestFileUtils.java
+++ b/tajo-common/src/test/java/org/apache/tajo/util/TestFileUtils.java
@@ -18,21 +18,11 @@
 
 package org.apache.tajo.util;
 
-import com.google.protobuf.Message;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
+import org.apache.tajo.util.TestProtos.TestMessageProto;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Test;
-import org.apache.tajo.util.TestProtos.TestMessageProto;
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import static org.junit.Assert.assertEquals;
 
 public class TestFileUtils {
 	private static final String TEST_PATH = "target/test-data/TestFileUTils";
@@ -56,52 +46,9 @@ public class TestFileUtils {
 	
 	@After
 	public void tearDown() throws Exception {
-		File testDir = new File(TEST_PATH);
-		if(testDir.exists()) {
-			testDir.delete();
-		}
-	}
-
-	@Test
-	public final void testWriteLoadProtoFromFile() throws IOException {		
-		File file = new File(TEST_PATH+"/file.bin");
-		file.createNewFile();
-		FileUtil.writeProto(file, proto);
-		
-		Message defaultInstance = TestMessageProto.getDefaultInstance();
-		TestMessageProto message = (TestMessageProto) 
-			FileUtil.loadProto(new File(TEST_PATH+"/file.bin"), defaultInstance);
-		
-		assertEquals(proto, message);
-	}
-
-	@Test
-	public final void testWriteLoadProtoFromStream() throws IOException {
-		FileOutputStream out = new FileOutputStream(new File(TEST_PATH+"/file.bin"));		
-		FileUtil.writeProto(out, proto);
-		
-		
-		FileInputStream in = new FileInputStream(new File(TEST_PATH+"/file.bin"));
-		Message defaultInstance = TestMessageProto.getDefaultInstance();
-		TestMessageProto message = (TestMessageProto) 
-			FileUtil.loadProto(in, defaultInstance);
-		
-		assertEquals(proto, message);
-	}
-
-	@Test
-	public final void testWriteLoadProtoFromPath() throws IOException {	
-		Path path = new Path(TEST_PATH+"/file.bin");
-    Configuration conf = new Configuration();
-    FileSystem localFS = FileSystem.getLocal(conf);
-		FileUtil.writeProto(localFS, path, proto);
-		
-		Message defaultInstance = TestMessageProto.getDefaultInstance();
-		TestMessageProto message = (TestMessageProto) 
-			FileUtil.loadProto(localFS, new Path(TEST_PATH+"/file.bin"),
-          defaultInstance);
-		
-		assertEquals(proto, message);
-	}
-	
+    File testDir = new File(TEST_PATH);
+    if (testDir.exists()) {
+      testDir.delete();
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-core-tests/src/test/java/org/apache/tajo/cli/tools/TestDDLBuilder.java
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/cli/tools/TestDDLBuilder.java b/tajo-core-tests/src/test/java/org/apache/tajo/cli/tools/TestDDLBuilder.java
index 06a54c4..bb8cf1b 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/cli/tools/TestDDLBuilder.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/cli/tools/TestDDLBuilder.java
@@ -25,7 +25,7 @@ import org.apache.tajo.catalog.partition.PartitionMethodDesc;
 import org.apache.tajo.catalog.proto.CatalogProtos;
 import org.apache.tajo.common.TajoDataTypes;
 import org.apache.tajo.storage.StorageConstants;
-import org.apache.tajo.util.FileUtil;
+import org.apache.tajo.util.JavaResourceUtil;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
@@ -61,7 +61,7 @@ public class TestDDLBuilder {
     TableDesc desc = new TableDesc("db1.table1", schema1, meta1, new Path("/table1").toUri());
     desc.setPartitionMethod(partitionMethod1);
     desc.setExternal(true);
-    assertEquals(FileUtil.readTextFileFromResource("results/testDDLBuilder/testBuildDDLForExternalTable.result"),
+    assertEquals(JavaResourceUtil.readTextFromResource("results/testDDLBuilder/testBuildDDLForExternalTable.result"),
         DDLBuilder.buildDDLForExternalTable(desc));
   }
 
@@ -87,20 +87,20 @@ public class TestDDLBuilder {
     TableDesc desc = new TableDesc("db1.TABLE2", schema2, meta1, new Path("/table1").toUri());
     desc.setPartitionMethod(partitionMethod2);
     desc.setExternal(true);
-    assertEquals(FileUtil.readTextFileFromResource("results/testDDLBuilder/testBuildDDLQuotedTableName1.result"),
+    assertEquals(JavaResourceUtil.readTextFromResource("results/testDDLBuilder/testBuildDDLQuotedTableName1.result"),
         DDLBuilder.buildDDLForExternalTable(desc));
 
     desc = new TableDesc("db1.TABLE1", schema2, meta1, new Path("/table1").toUri());
     desc.setPartitionMethod(partitionMethod2);
     desc.setExternal(false);
-    assertEquals(FileUtil.readTextFileFromResource("results/testDDLBuilder/testBuildDDLQuotedTableName2.result"),
+    assertEquals(JavaResourceUtil.readTextFromResource("results/testDDLBuilder/testBuildDDLQuotedTableName2.result"),
         DDLBuilder.buildDDLForBaseTable(desc));
   }
 
   @Test
   public void testBuildDDLForBaseTable() throws Exception {
     TableDesc desc = new TableDesc("db1.table2", schema1, meta1, new Path("/table1").toUri());
-    assertEquals(FileUtil.readTextFileFromResource("results/testDDLBuilder/testBuildDDLForBaseTable.result"),
+    assertEquals(JavaResourceUtil.readTextFromResource("results/testDDLBuilder/testBuildDDLForBaseTable.result"),
         DDLBuilder.buildDDLForBaseTable(desc));
   }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-core-tests/src/test/java/org/apache/tajo/engine/parser/TestSQLAnalyzer.java
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/parser/TestSQLAnalyzer.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/parser/TestSQLAnalyzer.java
index e9a9305..f53fbfd 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/parser/TestSQLAnalyzer.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/parser/TestSQLAnalyzer.java
@@ -22,10 +22,9 @@ import org.antlr.v4.runtime.ANTLRInputStream;
 import org.antlr.v4.runtime.CommonTokenStream;
 import org.apache.tajo.algebra.*;
 import org.apache.tajo.engine.parser.SQLParser.SqlContext;
-import org.apache.tajo.util.FileUtil;
+import org.apache.tajo.util.JavaResourceUtil;
 import org.junit.Test;
 
-import java.io.File;
 import java.io.IOException;
 import java.util.Iterator;
 
@@ -51,8 +50,8 @@ public class TestSQLAnalyzer {
   }
 
   public void assertParseResult(String sqlFileName, String resultFileName) throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/TestSQLAnalyzer/" + sqlFileName);
-    String result = FileUtil.readTextFileFromResource("results/TestSQLAnalyzer/" + resultFileName);
+    String sql = JavaResourceUtil.readTextFromResource("queries/TestSQLAnalyzer/" + sqlFileName);
+    String result = JavaResourceUtil.readTextFromResource("results/TestSQLAnalyzer/" + resultFileName);
 
     Expr expr = parseQuery(sql);
     assertEquals(result.trim(), expr.toJson().trim());
@@ -61,223 +60,223 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testSelect1() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/select_1.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/select_1.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testSelect2() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/select_2.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/select_2.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testSelect3() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/select_3.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/select_3.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testSelect4() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/select_4.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/select_4.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testSelect5() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/select_5.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/select_5.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testAsterisk1() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/asterisk_1.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/asterisk_1.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testAsterisk2() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/asterisk_2.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/asterisk_2.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testAsterisk3() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/asterisk_3.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/asterisk_3.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testAsterisk4() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/asterisk_4.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/asterisk_4.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testGroupby1() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/groupby_1.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/groupby_1.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testJoin1() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/join_1.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/join_1.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testJoin2() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/join_2.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/join_2.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testJoin3() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/join_3.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/join_3.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testJoin4() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/join_4.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/join_4.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testJoin5() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/join_5.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/join_5.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testJoin6() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/join_6.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/join_6.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testJoin7() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/join_7.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/join_7.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testJoin8() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/join_8.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/join_8.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testJoin9() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/join_9.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/join_9.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testJoin10() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/join_10.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/join_10.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testJoin11() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/join_11.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/join_11.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testSet1() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/set_1.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/set_1.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testSet2() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/set_2.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/set_2.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testSet3() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/set_3.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/set_3.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testSet4() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/set_4.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/set_4.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testDropTable() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/drop_table.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/drop_table.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable1() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/create_table_1.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/create_table_1.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable2() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/create_table_2.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/create_table_2.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable3() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/create_table_3.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/create_table_3.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable4() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/create_table_4.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/create_table_4.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable5() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/create_table_5.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/create_table_5.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable6() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/create_table_6.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/create_table_6.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable7() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/create_table_7.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/create_table_7.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable8() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/create_table_8.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/create_table_8.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable9() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/create_table_9.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/create_table_9.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTable10() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/create_table_10.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/create_table_10.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testCreateTableLike1() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/create_table_like_1.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/create_table_like_1.sql");
     Expr expr = parseQuery(sql);
     assertEquals(OpType.CreateTable, expr.getType());
     CreateTable createTable = (CreateTable) expr;
@@ -286,7 +285,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testCreateTablePartitionByHash1() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/create_table_partition_by_hash_1.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/create_table_partition_by_hash_1.sql");
     Expr expr = parseQuery(sql);
     assertEquals(OpType.CreateTable, expr.getType());
     CreateTable createTable = (CreateTable) expr;
@@ -299,7 +298,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testCreateTablePartitionByHash2() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/create_table_partition_by_hash_2.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/create_table_partition_by_hash_2.sql");
     Expr expr = parseQuery(sql);
     assertEquals(OpType.CreateTable, expr.getType());
     CreateTable createTable = (CreateTable) expr;
@@ -313,7 +312,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testCreateTablePartitionByRange() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/create_table_partition_by_range.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/create_table_partition_by_range.sql");
     Expr expr = parseQuery(sql);
     assertEquals(OpType.CreateTable, expr.getType());
     CreateTable createTable = (CreateTable) expr;
@@ -326,7 +325,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testCreateTablePartitionByList() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/create_table_partition_by_list.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/create_table_partition_by_list.sql");
     Expr expr = parseQuery(sql);
     assertEquals(OpType.CreateTable, expr.getType());
     CreateTable createTable = (CreateTable) expr;
@@ -351,7 +350,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testCreateTablePartitionByColumn() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/create_table_partition_by_column.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/create_table_partition_by_column.sql");
     Expr expr = parseQuery(sql);
     assertEquals(OpType.CreateTable, expr.getType());
     CreateTable createTable = (CreateTable) expr;
@@ -366,7 +365,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testAlterTableAddPartition1() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/alter_table_add_partition_1.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/alter_table_add_partition_1.sql");
     Expr expr = parseQuery(sql);
     assertEquals(OpType.AlterTable, expr.getType());
     AlterTable alterTable = (AlterTable)expr;
@@ -384,7 +383,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testAlterTableAddPartition2() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/alter_table_add_partition_2.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/alter_table_add_partition_2.sql");
     Expr expr = parseQuery(sql);
     assertEquals(OpType.AlterTable, expr.getType());
     AlterTable alterTable = (AlterTable)expr;
@@ -403,7 +402,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testAlterTableAddPartition3() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/alter_table_add_partition_3.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/alter_table_add_partition_3.sql");
     Expr expr = parseQuery(sql);
     assertEquals(OpType.AlterTable, expr.getType());
     AlterTable alterTable = (AlterTable)expr;
@@ -425,7 +424,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testAlterTableAddPartition4() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/alter_table_add_partition_4.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/alter_table_add_partition_4.sql");
     Expr expr = parseQuery(sql);
     assertEquals(OpType.AlterTable, expr.getType());
     AlterTable alterTable = (AlterTable)expr;
@@ -440,7 +439,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testAlterTableAddPartition5() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/alter_table_add_partition_5.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/alter_table_add_partition_5.sql");
     Expr expr = parseQuery(sql);
     assertEquals(OpType.AlterTable, expr.getType());
     AlterTable alterTable = (AlterTable)expr;
@@ -455,7 +454,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testAlterTableDropPartition1() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/alter_table_drop_partition_1.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/alter_table_drop_partition_1.sql");
     Expr expr = parseQuery(sql);
     assertEquals(OpType.AlterTable, expr.getType());
     AlterTable alterTable = (AlterTable)expr;
@@ -474,7 +473,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testAlterTableDropPartition2() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/alter_table_drop_partition_2.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/alter_table_drop_partition_2.sql");
     Expr expr = parseQuery(sql);
     assertEquals(OpType.AlterTable, expr.getType());
     AlterTable alterTable = (AlterTable)expr;
@@ -496,7 +495,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testAlterTableDropPartition3() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/alter_table_drop_partition_3.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/alter_table_drop_partition_3.sql");
     Expr expr = parseQuery(sql);
     assertEquals(OpType.AlterTable, expr.getType());
     AlterTable alterTable = (AlterTable)expr;
@@ -512,7 +511,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testAlterTableDropPartition4() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/alter_table_drop_partition_4.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/alter_table_drop_partition_4.sql");
     Expr expr = parseQuery(sql);
     assertEquals(OpType.AlterTable, expr.getType());
     AlterTable alterTable = (AlterTable)expr;
@@ -528,7 +527,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testAlterTableSetProperty1() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/alter_table_set_property_1.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/alter_table_set_property_1.sql");
     Expr expr = parseQuery(sql);
     assertEquals(OpType.AlterTable, expr.getType());
     AlterTable alterTable = (AlterTable)expr;
@@ -540,7 +539,7 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testAlterTableSetProperty2() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/alter_table_set_property_2.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/alter_table_set_property_2.sql");
     Expr expr = parseQuery(sql);
     assertEquals(OpType.AlterTable, expr.getType());
     AlterTable alterTable = (AlterTable)expr;
@@ -553,7 +552,7 @@ public class TestSQLAnalyzer {
   @Test
   public void testAlterTableSetProperty3() throws IOException {
     // update multiple table properties with a single 'SET PROPERTY' sql
-    String sql = FileUtil.readTextFileFromResource("queries/default/alter_table_set_property_3.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/alter_table_set_property_3.sql");
     Expr expr = parseQuery(sql);
     assertEquals(OpType.AlterTable, expr.getType());
     AlterTable alterTable = (AlterTable)expr;
@@ -567,73 +566,73 @@ public class TestSQLAnalyzer {
 
   @Test
   public void testTableSubQuery1() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/table_subquery1.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/table_subquery1.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testTableSubQuery2() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/table_subquery2.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/table_subquery2.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testInSubquery1() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/in_subquery_1.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/in_subquery_1.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testInSubquery2() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/in_subquery_2.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/in_subquery_2.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testExistsPredicate1() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/exists_predicate_1.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/exists_predicate_1.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testExistsPredicate2() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/exists_predicate_2.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/exists_predicate_2.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testInsertIntoTable() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/insert_into_select_1.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/insert_into_select_1.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testInsertIntoLocation() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/insert_into_select_2.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/insert_into_select_2.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testInsertIntoTable2() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/insert_into_select_3.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/insert_into_select_3.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testInsertOverwriteIntoTable() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/insert_overwrite_into_select_1.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/insert_overwrite_into_select_1.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testInsertOverwriteIntoLocation() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/insert_overwrite_into_select_2.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/insert_overwrite_into_select_2.sql");
     parseQuery(sql);
   }
 
   @Test
   public void testInsertOverwriteIntoTable2() throws IOException {
-    String sql = FileUtil.readTextFileFromResource("queries/default/insert_overwrite_into_select_3.sql");
+    String sql = JavaResourceUtil.readTextFromResource("queries/default/insert_overwrite_into_select_3.sql");
     parseQuery(sql);
   }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/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 e5b9b98..8652f52 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
@@ -37,7 +37,7 @@ import org.apache.tajo.datum.Int4Datum;
 import org.apache.tajo.datum.TextDatum;
 import org.apache.tajo.exception.TajoException;
 import org.apache.tajo.storage.*;
-import org.apache.tajo.util.FileUtil;
+import org.apache.tajo.util.JavaResourceUtil;
 import org.apache.tajo.util.KeyValueSet;
 import org.junit.runners.Parameterized.Parameters;
 
@@ -244,7 +244,7 @@ public class TestJoinQuery extends QueryTestCaseBase {
     TableMeta tableMeta = table.getMeta();
     Schema schema = table.getLogicalSchema();
 
-    String[] rows = FileUtil.readTextFileFromResource("tpch/" + tableName + ".tbl").split("\n");
+    String[] rows = JavaResourceUtil.readTextFromResource("tpch/" + tableName + ".tbl").split("\n");
 
     assertTrue(rows.length > 0);
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-core-tests/src/test/java/org/apache/tajo/storage/TestRowFile.java
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/storage/TestRowFile.java b/tajo-core-tests/src/test/java/org/apache/tajo/storage/TestRowFile.java
index e45dd75..c1d5a97 100644
--- a/tajo-core-tests/src/test/java/org/apache/tajo/storage/TestRowFile.java
+++ b/tajo-core-tests/src/test/java/org/apache/tajo/storage/TestRowFile.java
@@ -74,13 +74,10 @@ public class TestRowFile {
     FileTablespace sm = (FileTablespace) TablespaceManager.get(cluster.getDefaultFileSystem().getUri()).get();
 
     Path tablePath = new Path("/test");
-    Path metaPath = new Path(tablePath, ".meta");
     Path dataPath = new Path(tablePath, "test.tbl");
     FileSystem fs = sm.getFileSystem();
     fs.mkdirs(tablePath);
 
-    FileUtil.writeProto(fs, metaPath, meta.getProto());
-
     Appender appender = sm.getAppender(meta, schema, dataPath);
     appender.enableStats();
     appender.init();
@@ -105,14 +102,11 @@ public class TestRowFile {
     assertEquals(tupleNum, stat.getNumRows().longValue());
 
     FileStatus file = fs.getFileStatus(dataPath);
-    TableProto proto = (TableProto) FileUtil.loadProto(
-        cluster.getDefaultFileSystem(), metaPath, TableProto.getDefaultInstance());
-    meta = new TableMeta(proto);
     FileFragment fragment = new FileFragment("test.tbl", dataPath, 0, file.getLen());
 
     int tupleCnt = 0;
     start = System.currentTimeMillis();
-    Scanner scanner = sm.getScanner(meta, schema, fragment);
+    Scanner scanner = sm.getScanner(meta, schema, fragment, null);
     scanner.init();
     while ((tuple=scanner.next()) != null) {
       tupleCnt++;

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-core/src/main/java/org/apache/tajo/engine/codegen/EvalCodeGenerator.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/codegen/EvalCodeGenerator.java b/tajo-core/src/main/java/org/apache/tajo/engine/codegen/EvalCodeGenerator.java
index cc740e7..8b87ea9 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/codegen/EvalCodeGenerator.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/codegen/EvalCodeGenerator.java
@@ -130,7 +130,7 @@ public class EvalCodeGenerator extends SimpleEvalNodeVisitor<EvalCodeGenContext>
     }
   }
 
-  public EvalNode visitUnaryEval(EvalCodeGenContext context, Stack<EvalNode> stack, UnaryEval unary) {
+  public EvalNode visitUnaryEval(EvalCodeGenContext context, UnaryEval unary, Stack<EvalNode> stack) {
     stack.push(unary);
     if (unary.getType() == EvalType.CAST) {
       visitCast(context, stack, (CastEval) unary);
@@ -349,7 +349,7 @@ public class EvalCodeGenerator extends SimpleEvalNodeVisitor<EvalCodeGenContext>
     return cast;
   }
 
-  public EvalNode visitField(EvalCodeGenContext context, Stack<EvalNode> stack, FieldEval field) {
+  public EvalNode visitField(EvalCodeGenContext context, FieldEval field, Stack<EvalNode> stack) {
 
     if (field.getValueType().getType() == TajoDataTypes.Type.NULL_TYPE) {
       context.pushNullOfThreeValuedLogic();

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-core/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java b/tajo-core/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
index 5bbf3a9..19a27af 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
@@ -120,6 +120,8 @@ public class PhysicalPlannerImpl implements PhysicalPlanner {
     PhysicalExec leftExec;
     PhysicalExec rightExec;
 
+    //ctx.getEnforcer().getEnforceProperties().get
+
     switch (logicalNode.getType()) {
 
       case ROOT:

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/OperatorPushableScanExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/OperatorPushableScanExec.java b/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/OperatorPushableScanExec.java
new file mode 100644
index 0000000..66ae844
--- /dev/null
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/OperatorPushableScanExec.java
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.engine.planner.physical;
+
+import org.apache.tajo.catalog.Schema;
+import org.apache.tajo.plan.logical.LogicalNode;
+import org.apache.tajo.storage.Tuple;
+import org.apache.tajo.worker.TaskAttemptContext;
+
+import java.io.IOException;
+
+public class OperatorPushableScanExec extends PhysicalExec {
+  private final LogicalNode plan;
+  
+
+  public OperatorPushableScanExec(TaskAttemptContext context, Schema inSchema, Schema outSchema, LogicalNode plan) {
+    super(context, inSchema, outSchema);
+    this.plan = plan;
+  }
+
+  @Override
+  public Tuple next() throws IOException {
+    return null;
+  }
+
+  @Override
+  public void rescan() throws IOException {
+
+  }
+
+  @Override
+  public void close() throws IOException {
+
+  }
+
+  @Override
+  public float getProgress() {
+    return 0;
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/SeqScanExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/SeqScanExec.java b/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/SeqScanExec.java
index b49fa40..66ad005 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/SeqScanExec.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/SeqScanExec.java
@@ -171,9 +171,6 @@ public class SeqScanExec extends ScanExec {
       scanIt = new FilterScanIterator(scanner, qual);
 
     } else {
-      if (scanner.isSelectable()) { // TODO - isSelectable should be moved to FormatProperty
-        scanner.setFilter(qual);
-      }
       scanIt = new FullScanIterator(scanner);
     }
   }
@@ -236,10 +233,17 @@ public class SeqScanExec extends ScanExec {
       this.scanner = tablespace.getScanner(
           meta,
           plan.getPhysicalSchema(),
-          fragments[0],
+          FragmentConvertor.convert(context.getConf(), fragments[0]),
           projected);
     }
 
+    if (scanner.isSelectable()) { // TODO - isSelectable should be moved to FormatProperty
+      scanner.setFilter(qual);
+    }
+
+    if (plan.hasLimit()) {
+      scanner.setLimit(plan.getLimit());
+    }
     scanner.init();
   }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-core/src/main/java/org/apache/tajo/master/exec/QueryExecutor.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/master/exec/QueryExecutor.java b/tajo-core/src/main/java/org/apache/tajo/master/exec/QueryExecutor.java
index 39013df..624cf4b 100644
--- a/tajo-core/src/main/java/org/apache/tajo/master/exec/QueryExecutor.java
+++ b/tajo-core/src/main/java/org/apache/tajo/master/exec/QueryExecutor.java
@@ -257,6 +257,7 @@ public class QueryExecutor {
     if (plan.getRootBlock().hasNode(NodeType.LIMIT)) {
       LimitNode limitNode = plan.getRootBlock().getNode(NodeType.LIMIT);
       maxRow = (int) limitNode.getFetchFirstNum();
+      scanNode.setLimit(maxRow);
     }
     if (desc.getStats().getNumRows() == 0) {
       desc.getStats().setNumRows(TajoConstants.UNKNOWN_ROW_NUMBER);

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlanner.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlanner.java b/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlanner.java
index 4b17b0e..457b2ab 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlanner.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlanner.java
@@ -24,9 +24,6 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.fs.ContentSummary;
-import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.tajo.BuiltinStorages;
 import org.apache.tajo.OverridableConf;
@@ -35,18 +32,13 @@ import org.apache.tajo.SessionVars;
 import org.apache.tajo.algebra.*;
 import org.apache.tajo.algebra.WindowSpec;
 import org.apache.tajo.catalog.*;
-import org.apache.tajo.exception.UndefinedColumnException;
-import org.apache.tajo.exception.UndefinedTableException;
 import org.apache.tajo.catalog.partition.PartitionMethodDesc;
 import org.apache.tajo.catalog.proto.CatalogProtos;
 import org.apache.tajo.catalog.proto.CatalogProtos.IndexMethod;
 import org.apache.tajo.common.TajoDataTypes;
 import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.datum.NullDatum;
-import org.apache.tajo.exception.ExceptionUtil;
-import org.apache.tajo.exception.TajoException;
-import org.apache.tajo.exception.TajoInternalError;
-import org.apache.tajo.exception.NotImplementedException;
+import org.apache.tajo.exception.*;
 import org.apache.tajo.plan.LogicalPlan.QueryBlock;
 import org.apache.tajo.plan.algebra.BaseAlgebraVisitor;
 import org.apache.tajo.plan.expr.*;
@@ -1317,7 +1309,7 @@ public class LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContex
     QueryBlock block = context.queryBlock;
 
     ScanNode scanNode = block.getNodeFromExpr(expr);
-    updatePhysicalInfo(context, scanNode.getTableDesc());
+    updatePhysicalInfo(scanNode.getTableDesc());
 
     // Find expression which can be evaluated at this relation node.
     // Except for column references, additional expressions used in select list, where clause, order-by clauses
@@ -1376,24 +1368,16 @@ public class LogicalPlanner extends BaseAlgebraVisitor<LogicalPlanner.PlanContex
     return targets;
   }
 
-  private void updatePhysicalInfo(PlanContext planContext, TableDesc desc) {
-    if (desc.getUri() != null &&
-        !desc.getMeta().getStoreType().equals("SYSTEM") &&
-        !desc.getMeta().getStoreType().equals("FAKEFILE") && // FAKEFILE is used for test
-        PlannerUtil.isFileStorageType(desc.getMeta().getStoreType())) {
+  private void updatePhysicalInfo(TableDesc desc) {
+
+    // FAKEFILE is used for test{
+    if (!desc.getMeta().getStoreType().equals("SYSTEM") && !desc.getMeta().getStoreType().equals("FAKEFILE")) {
       try {
-        Path path = new Path(desc.getUri());
-        FileSystem fs = path.getFileSystem(planContext.queryContext.getConf());
-        FileStatus status = fs.getFileStatus(path);
-        if (desc.getStats() != null && (status.isDirectory() || status.isFile())) {
-          ContentSummary summary = fs.getContentSummary(path);
-          if (summary != null) {
-            long volume = summary.getLength();
-            desc.getStats().setNumBytes(volume);
-          }
+        if (desc.getStats() != null) {
+          desc.getStats().setNumBytes(storage.getTableVolumn(desc.getUri()));
         }
       } catch (Throwable t) {
-        LOG.warn(t, t);
+        LOG.warn(desc.getName() + " does not support Tablespace::getTableVolume().");
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AlgebraicUtil.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AlgebraicUtil.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AlgebraicUtil.java
index d06c1d3..19d5d16 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AlgebraicUtil.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AlgebraicUtil.java
@@ -156,7 +156,7 @@ public class AlgebraicUtil {
     }
 
     @Override
-    public EvalNode visitUnaryEval(Object context, Stack<EvalNode> stack, UnaryEval unaryEval) {
+    public EvalNode visitUnaryEval(Object context, UnaryEval unaryEval, Stack<EvalNode> stack) {
       stack.push(unaryEval);
       EvalNode child = visit(context, unaryEval.getChild(), stack);
       stack.pop();

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-plan/src/main/java/org/apache/tajo/plan/expr/EvalType.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/EvalType.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/EvalType.java
index 2c2a52f..35390a5 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/EvalType.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/EvalType.java
@@ -21,10 +21,11 @@ package org.apache.tajo.plan.expr;
 public enum EvalType {
   // Unary expression
   NOT(NotEval.class, "!"),
+  SIGNED(SignedEval.class),
 
   // Binary expression
-  AND(BinaryEval.class),
-  OR(BinaryEval.class),
+  AND(BinaryEval.class, "AND"),
+  OR(BinaryEval.class, "OR"),
   EQUAL(BinaryEval.class, "="),
   IS_NULL(IsNullEval.class),
   NOT_EQUAL(BinaryEval.class, "<>"),
@@ -49,19 +50,18 @@ public enum EvalType {
   FUNCTION(GeneralFunctionEval.class),
 
   // String operator or pattern matching predicates
-  LIKE(LikePredicateEval.class),
-  SIMILAR_TO(SimilarToPredicateEval.class),
-  REGEX(RegexPredicateEval.class),
+  LIKE(LikePredicateEval.class, "LIKE"),
+  SIMILAR_TO(SimilarToPredicateEval.class, "SIMILAR TO"),
+  REGEX(RegexPredicateEval.class, "REGEX"),
   CONCATENATE(BinaryEval.class, "||"),
 
   // Other predicates
   BETWEEN(BetweenPredicateEval.class),
   CASE(CaseWhenEval.class),
   IF_THEN(CaseWhenEval.IfThenEval.class),
-  IN(InEval.class),
+  IN(InEval.class, "IN"),
 
   // Value or Reference
-  SIGNED(SignedEval.class),
   CAST(CastEval.class),
   ROW_CONSTANT(RowConstantEval.class),
   FIELD(FieldEval.class),


[37/39] tajo git commit: Removed mysql storage.

Posted by hy...@apache.org.
Removed mysql storage.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/947736bf
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/947736bf
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/947736bf

Branch: refs/heads/TAJO-1730
Commit: 947736bf48df8f02047dd61a24a0113fa49f5648
Parents: a6380cc
Author: Hyunsik Choi <hy...@apache.org>
Authored: Wed Sep 2 19:33:29 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Wed Sep 2 19:33:29 2015 +0900

----------------------------------------------------------------------
 tajo-storage/pom.xml                            |   1 -
 tajo-storage/tajo-storage-mysql/pom.xml         | 257 -------------------
 .../storage/mysql/MySQLMetadataProvider.java    |  34 ---
 .../tajo/storage/mysql/MySQLTablespace.java     |  74 ------
 .../tajo/storage/mysql/MysqlJdbcScanner.java    |  40 ---
 .../tajo/storage/mysql/EmbedMySQLServer.java    | 117 ---------
 .../mysql/TestMySQLMetadataProvider.java        |  95 -------
 .../storage/mysql/TestMysqlJdbcTableSpace.java  |  65 -----
 .../dataset/TestMysqlJdbcTableSpace/.marker     |   0
 .../results/TestMysqlJdbcTableSpace/.marker     |   0
 .../src/test/resources/tpch/mysql/customer.sql  |  10 -
 .../src/test/resources/tpch/mysql/lineitem.sql  |  18 --
 .../src/test/resources/tpch/mysql/nation.sql    |   6 -
 .../src/test/resources/tpch/mysql/orders.sql    |  11 -
 .../src/test/resources/tpch/mysql/part.sql      |  11 -
 .../src/test/resources/tpch/mysql/partsupp.sql  |   7 -
 .../src/test/resources/tpch/mysql/region.sql    |   5 -
 .../src/test/resources/tpch/mysql/supplier.sql  |   9 -
 18 files changed, 760 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/947736bf/tajo-storage/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/pom.xml b/tajo-storage/pom.xml
index 52a5c40..24dff10 100644
--- a/tajo-storage/pom.xml
+++ b/tajo-storage/pom.xml
@@ -38,7 +38,6 @@
     <module>tajo-storage-hdfs</module>
     <module>tajo-storage-hbase</module>
     <module>tajo-storage-jdbc</module>
-    <module>tajo-storage-mysql</module>
     <module>tajo-storage-pgsql</module>
   </modules>
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/947736bf/tajo-storage/tajo-storage-mysql/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/pom.xml b/tajo-storage/tajo-storage-mysql/pom.xml
deleted file mode 100644
index 0484213..0000000
--- a/tajo-storage/tajo-storage-mysql/pom.xml
+++ /dev/null
@@ -1,257 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <parent>
-    <artifactId>tajo-project</artifactId>
-    <groupId>org.apache.tajo</groupId>
-    <version>0.12.0-SNAPSHOT</version>
-    <relativePath>../../tajo-project</relativePath>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-
-  <artifactId>tajo-storage-mysql</artifactId>
-  <packaging>jar</packaging>
-  <name>Tajo MySQL JDBC storage</name>
-  <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-  </properties>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <configuration>
-          <source>1.7</source>
-          <target>1.7</target>
-          <encoding>${project.build.sourceEncoding}</encoding>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.rat</groupId>
-        <artifactId>apache-rat-plugin</artifactId>
-        <configuration>
-          <excludes>
-            <exclude>src/test/resources/dataset/**</exclude>
-            <exclude>src/test/resources/queries/**</exclude>
-            <exclude>src/test/resources/results/**</exclude>
-            <exclude>src/test/resources/tpch/**</exclude>
-          </excludes>
-        </configuration>
-        <executions>
-          <execution>
-            <phase>verify</phase>
-            <goals>
-              <goal>check</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <systemProperties>
-            <tajo.test>TRUE</tajo.test>
-          </systemProperties>
-          <argLine>-Xms512m -Xmx1024m -XX:MaxPermSize=128m -Dfile.encoding=UTF-8</argLine>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <version>2.4</version>
-        <executions>
-          <execution>
-            <goals>
-              <goal>test-jar</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.tajo</groupId>
-      <artifactId>tajo-common</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.tajo</groupId>
-      <artifactId>tajo-catalog-common</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.tajo</groupId>
-      <artifactId>tajo-plan</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.tajo</groupId>
-      <artifactId>tajo-storage-common</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.tajo</groupId>
-      <artifactId>tajo-storage-hdfs</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.tajo</groupId>
-      <artifactId>tajo-storage-jdbc</artifactId>
-      <type>jar</type>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.tajo</groupId>
-      <artifactId>tajo-storage-jdbc</artifactId>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.tajo</groupId>
-      <artifactId>tajo-cluster-tests</artifactId>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-common</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-minicluster</artifactId>
-      <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>commons-el</groupId>
-          <artifactId>commons-el</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>tomcat</groupId>
-          <artifactId>jasper-runtime</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>tomcat</groupId>
-          <artifactId>jasper-compiler</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.mortbay.jetty</groupId>
-          <artifactId>jsp-2.1-jetty</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>com.sun.jersey.jersey-test-framework</groupId>
-          <artifactId>jersey-test-framework-grizzly2</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-hdfs</artifactId>
-      <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>commons-el</groupId>
-          <artifactId>commons-el</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>tomcat</groupId>
-          <artifactId>jasper-runtime</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>tomcat</groupId>
-          <artifactId>jasper-compiler</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.mortbay.jetty</groupId>
-          <artifactId>jsp-2.1-jetty</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>com.sun.jersey.jersey-test-framework</groupId>
-          <artifactId>jersey-test-framework-grizzly2</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>io.airlift</groupId>
-      <artifactId>testing-mysql-server</artifactId>
-      <version>0.1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-    </dependency>
-  </dependencies>
-
-  <profiles>
-    <profile>
-      <id>docs</id>
-      <activation>
-        <activeByDefault>false</activeByDefault>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-javadoc-plugin</artifactId>
-            <executions>
-              <execution>
-                <!-- build javadoc jars per jar for publishing to maven -->
-                <id>module-javadocs</id>
-                <phase>package</phase>
-                <goals>
-                  <goal>jar</goal>
-                </goals>
-                <configuration>
-                  <destDir>${project.build.directory}</destDir>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-  </profiles>
-
-  <reporting>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-report-plugin</artifactId>
-        <version>2.15</version>
-      </plugin>
-    </plugins>
-  </reporting>
-</project>

http://git-wip-us.apache.org/repos/asf/tajo/blob/947736bf/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLMetadataProvider.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLMetadataProvider.java b/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLMetadataProvider.java
deleted file mode 100644
index 33edb5c..0000000
--- a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLMetadataProvider.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.mysql;
-
-import org.apache.tajo.storage.jdbc.JdbcMetadataProviderBase;
-
-public class MySQLMetadataProvider extends JdbcMetadataProviderBase {
-
-
-  public MySQLMetadataProvider(MySQLTablespace space, String dbName) {
-    super(space, dbName);
-  }
-
-  @Override
-  protected String getJdbcDriverName() {
-    return "com.mysql.jdbc.Driver";
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/947736bf/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java b/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java
deleted file mode 100644
index 4a2171e..0000000
--- a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.mysql;
-
-import com.google.common.base.Preconditions;
-import net.minidev.json.JSONObject;
-import org.apache.tajo.catalog.*;
-import org.apache.tajo.exception.TajoInternalError;
-import org.apache.tajo.storage.*;
-import org.apache.tajo.storage.fragment.Fragment;
-import org.apache.tajo.storage.jdbc.JdbcFragment;
-import org.apache.tajo.storage.jdbc.JdbcTablespace;
-
-import javax.annotation.Nullable;
-import java.io.IOException;
-import java.net.URI;
-
-/**
- * <h3>URI Examples:</h3>
- * <ul>
- *   <li>jdbc:mysql//primaryhost,secondaryhost1,secondaryhost2/test?profileSQL=true</li>
- * </ul>
- */
-public class MySQLTablespace extends JdbcTablespace {
-  private final String database;
-
-  public MySQLTablespace(String name, URI uri, JSONObject config) {
-    super(name, uri, config);
-    database = ((JSONObject)config.get(TablespaceManager.TABLESPACE_SPEC_CONFIGS_KEY)).getAsString("database");
-  }
-
-  public MetadataProvider getMetadataProvider() {
-    return new MySQLMetadataProvider(this, database);
-  }
-
-  @Override
-  public Scanner getScanner(TableMeta meta,
-                            Schema schema,
-                            Fragment fragment,
-                            @Nullable Schema target) throws IOException {
-    if (!(fragment instanceof JdbcFragment)) {
-      throw new TajoInternalError("fragment must be JdbcFragment");
-    }
-
-    if (target == null) {
-      target = schema;
-    }
-
-    if (fragment.isEmpty()) {
-      Scanner scanner = new NullScanner(conf, schema, meta, fragment);
-      scanner.setTarget(target.toArray());
-
-      return scanner;
-    }
-
-    return new MySQLJdbcScanner(getDatabaseMetaData(), schema, meta, (JdbcFragment) fragment);
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/947736bf/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MysqlJdbcScanner.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MysqlJdbcScanner.java b/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MysqlJdbcScanner.java
deleted file mode 100644
index 836ecd9..0000000
--- a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MysqlJdbcScanner.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.mysql;
-
-import org.apache.tajo.catalog.Schema;
-import org.apache.tajo.catalog.TableMeta;
-import org.apache.tajo.exception.TajoRuntimeException;
-import org.apache.tajo.storage.VTuple;
-import org.apache.tajo.storage.jdbc.JdbcFragment;
-import org.apache.tajo.storage.jdbc.JdbcScanner;
-import org.apache.tajo.storage.jdbc.SQLBuilder;
-
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-
-public class MySQLJdbcScanner extends JdbcScanner {
-
-  public MySQLJdbcScanner(DatabaseMetaData dbMetaData,
-                          Schema tableSchema,
-                          TableMeta tableMeta,
-                          JdbcFragment fragment) {
-    super(dbMetaData, tableSchema, tableMeta, fragment);
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/947736bf/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/EmbedMySQLServer.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/EmbedMySQLServer.java b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/EmbedMySQLServer.java
deleted file mode 100644
index 4321895..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/EmbedMySQLServer.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.mysql;
-
-import io.airlift.testing.mysql.TestingMySqlServer;
-import net.minidev.json.JSONObject;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.tajo.conf.TajoConf;
-import org.apache.tajo.storage.TablespaceManager;
-import org.apache.tajo.util.JavaResourceUtil;
-
-import java.io.IOException;
-import java.net.URI;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.HashMap;
-import java.util.Map;
-
-public class EmbedMySQLServer {
-  private static final Log LOG = LogFactory.getLog(EmbedMySQLServer.class);
-
-  private static EmbedMySQLServer instance;
-
-  public static final String [] TPCH_TABLES = {
-      "customer", "lineitem", "nation", "orders", "part", "partsupp", "region", "supplier"
-  };
-
-  public static final String SPACENAME = "mysql_cluster";
-  public static final String DATABASE_NAME = "tpch";
-
-  private TestingMySqlServer server;
-
-  static {
-    try {
-      instance = new EmbedMySQLServer();
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public static EmbedMySQLServer getInstance() {
-    return instance;
-  }
-
-  private EmbedMySQLServer() throws Exception {
-    server = new TestingMySqlServer("testuser", "testpass",
-        "tpch"
-    );
-
-    loadTPCHTables();
-    registerTablespace();
-  }
-
-  private void loadTPCHTables() throws SQLException, IOException {
-    try (Connection connection = DriverManager.getConnection(server.getJdbcUrl())) {
-      connection.setCatalog("tpch");
-
-      try (Statement statement = connection.createStatement()) {
-        for (String tableName : TPCH_TABLES) {
-          String sql = JavaResourceUtil.readTextFromResource("tpch/" + tableName + ".sql");
-          statement.addBatch(sql);
-        }
-
-        try {
-          statement.executeBatch();
-        } catch (SQLException e) {
-          LOG.error(e);
-        }
-      }
-    }
-  }
-
-  private void registerTablespace() throws IOException {
-    JSONObject configElements = new JSONObject();
-    configElements.put("database", DATABASE_NAME);
-
-    Map<String, JSONObject> configMap = new HashMap<>();
-    configMap.put(TablespaceManager.TABLESPACE_SPEC_CONFIGS_KEY, configElements);
-    JSONObject config = new JSONObject(configMap);
-
-    MySQLTablespace mysqlTablespace = new MySQLTablespace(SPACENAME, URI.create(server.getJdbcUrl()), config);
-    mysqlTablespace.init(new TajoConf());
-
-    TablespaceManager.addTableSpaceForTest(mysqlTablespace);
-  }
-
-  public boolean isRunning() {
-    return server.isRunning();
-  }
-
-  public String getJdbcUrl() {
-    return server.getJdbcUrl();
-  }
-
-  public TestingMySqlServer getServer() {
-    return server;
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/947736bf/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMySQLMetadataProvider.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMySQLMetadataProvider.java b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMySQLMetadataProvider.java
deleted file mode 100644
index 21854f9..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMySQLMetadataProvider.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.mysql;
-
-import com.facebook.presto.hive.shaded.com.google.common.base.Function;
-import com.facebook.presto.hive.shaded.com.google.common.collect.Collections2;
-import com.facebook.presto.hive.shaded.com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import org.apache.tajo.catalog.MetadataProvider;
-import org.apache.tajo.catalog.TableDesc;
-import org.apache.tajo.storage.Tablespace;
-import org.apache.tajo.storage.TablespaceManager;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-public class TestMySQLMetadataProvider {
-  static final String jdbcUrl = EmbedMySQLServer.getInstance().getJdbcUrl();
-
-  @BeforeClass
-  public static void setUp() throws Exception {
-  }
-
-  @Test
-  public void testGetTablespaceName() throws Exception {
-    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
-    MetadataProvider provider = tablespace.getMetadataProvider();
-    assertEquals("mysql_cluster", provider.getTablespaceName());
-  }
-
-  @Test
-  public void testGetDatabaseName() throws Exception {
-    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
-    MetadataProvider provider = tablespace.getMetadataProvider();
-    assertEquals("tpch", provider.getDatabaseName());
-  }
-
-  @Test
-  public void testGetSchemas() throws Exception {
-    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
-    MetadataProvider provider = tablespace.getMetadataProvider();
-    assertTrue(provider.getSchemas().isEmpty());
-  }
-
-  //@Test
-  public void testGetTables() throws Exception {
-    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
-    MetadataProvider provider = tablespace.getMetadataProvider();
-
-    List<String> tables = Lists.newArrayList(provider.getTables(null, null));
-    Collection<String> uppercases = Collections2.transform(tables, new Function<String, String>() {
-      @Override
-      public String apply(String s) {
-        return s.toLowerCase();
-      }
-    });
-    Set<String> found = Sets.newHashSet(uppercases);
-    assertEquals(Sets.newHashSet(EmbedMySQLServer.TPCH_TABLES), found);
-  }
-
-  //@Test
-  public void testGetTableDescriptor() throws Exception {
-    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
-    MetadataProvider provider = tablespace.getMetadataProvider();
-
-    for (String tableName : EmbedMySQLServer.TPCH_TABLES) {
-      TableDesc table = provider.getTableDescriptor(null, tableName.toUpperCase());
-      assertEquals("tpch." + tableName.toUpperCase(), table.getName());
-      assertEquals(jdbcUrl + "&table=" + tableName.toUpperCase(), table.getUri().toASCIIString());
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/947736bf/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMysqlJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMysqlJdbcTableSpace.java b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMysqlJdbcTableSpace.java
deleted file mode 100644
index f940abc..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMysqlJdbcTableSpace.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.mysql;
-
-import com.google.common.collect.ImmutableSet;
-import io.airlift.testing.mysql.TestingMySqlServer;
-import org.apache.tajo.QueryTestCaseBase;
-import org.apache.tajo.storage.TablespaceManager;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.net.URI;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public class TestMySQLJdbcTableSpace {
-  static String jdbcUrl = EmbedMySQLServer.getInstance().getJdbcUrl();
-
-
-  @BeforeClass
-  public static void setUp() throws Exception {
-  }
-
-  @Test
-  public void testGeneral() {
-    TestingMySqlServer server = EmbedMySQLServer.getInstance().getServer();
-    assertTrue(server.isRunning());
-    assertTrue(server.isReadyForConnections());
-    assertEquals(server.getMySqlVersion(), "5.5.9");
-    assertEquals(server.getDatabases(), ImmutableSet.of("tpch"));
-    assertEquals(server.getUser(), "testuser");
-    assertEquals(server.getPassword(), "testpass");
-    assertEquals(server.getJdbcUrl().substring(0, 5), "jdbc:");
-    assertEquals(server.getPort(), URI.create(server.getJdbcUrl().substring(5)).getPort());
-  }
-
-  @Test
-  public void testTablespace() throws Exception {
-    assertTrue((TablespaceManager.getByName("mysql_cluster").get()) instanceof MySQLTablespace);
-    assertEquals("mysql_cluster", (TablespaceManager.getByName("mysql_cluster").get().getName()));
-
-    assertTrue((TablespaceManager.get(jdbcUrl).get()) instanceof MySQLTablespace);
-    assertTrue((TablespaceManager.get(jdbcUrl + "&table=tb1").get()) instanceof MySQLTablespace);
-
-    assertEquals(jdbcUrl, TablespaceManager.get(jdbcUrl).get().getUri().toASCIIString());
-    assertTrue(TablespaceManager.get(jdbcUrl).get().getMetadataProvider() instanceof MySQLMetadataProvider);
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/947736bf/tajo-storage/tajo-storage-mysql/src/test/resources/dataset/TestMysqlJdbcTableSpace/.marker
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/dataset/TestMysqlJdbcTableSpace/.marker b/tajo-storage/tajo-storage-mysql/src/test/resources/dataset/TestMysqlJdbcTableSpace/.marker
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/tajo/blob/947736bf/tajo-storage/tajo-storage-mysql/src/test/resources/results/TestMysqlJdbcTableSpace/.marker
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/results/TestMysqlJdbcTableSpace/.marker b/tajo-storage/tajo-storage-mysql/src/test/resources/results/TestMysqlJdbcTableSpace/.marker
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/tajo/blob/947736bf/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/customer.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/customer.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/customer.sql
deleted file mode 100644
index 35b1861..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/customer.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-CREATE TABLE CUSTOMER (
-  C_CUSTKEY     INTEGER NOT NULL,
-  C_NAME        VARCHAR(25) NOT NULL,
-  C_ADDRESS     VARCHAR(40) NOT NULL,
-  C_NATIONKEY   INTEGER NOT NULL,
-  C_PHONE       CHAR(15) NOT NULL,
-  C_ACCTBAL     DECIMAL(15,2)   NOT NULL,
-  C_MKTSEGMENT  CHAR(10) NOT NULL,
-  C_COMMENT     VARCHAR(117) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/947736bf/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/lineitem.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/lineitem.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/lineitem.sql
deleted file mode 100644
index a7f61bb..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/lineitem.sql
+++ /dev/null
@@ -1,18 +0,0 @@
-CREATE TABLE LINEITEM (
-  L_ORDERKEY    INTEGER NOT NULL,
-  L_PARTKEY     INTEGER NOT NULL,
-  L_SUPPKEY     INTEGER NOT NULL,
-  L_LINENUMBER  INTEGER NOT NULL,
-  L_QUANTITY    DECIMAL(15,2) NOT NULL,
-  L_EXTENDEDPRICE  DECIMAL(15,2) NOT NULL,
-  L_DISCOUNT    DECIMAL(15,2) NOT NULL,
-  L_TAX         DECIMAL(15,2) NOT NULL,
-  L_RETURNFLAG  CHAR(1) NOT NULL,
-  L_LINESTATUS  CHAR(1) NOT NULL,
-  L_SHIPDATE    DATE NOT NULL,
-  L_COMMITDATE  DATE NOT NULL,
-  L_RECEIPTDATE DATE NOT NULL,
-  L_SHIPINSTRUCT CHAR(25) NOT NULL,
-  L_SHIPMODE     CHAR(10) NOT NULL,
-  L_COMMENT      VARCHAR(44) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/947736bf/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/nation.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/nation.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/nation.sql
deleted file mode 100644
index f7ecda8..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/nation.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-CREATE TABLE NATION  (
-  N_NATIONKEY  INTEGER NOT NULL,
-  N_NAME       CHAR(25) NOT NULL,
-  N_REGIONKEY  INTEGER NOT NULL,
-  N_COMMENT    VARCHAR(152)
-);

http://git-wip-us.apache.org/repos/asf/tajo/blob/947736bf/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/orders.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/orders.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/orders.sql
deleted file mode 100644
index 220d576..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/orders.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-CREATE TABLE ORDERS  (
-  O_ORDERKEY       INTEGER NOT NULL,
-  O_CUSTKEY        INTEGER NOT NULL,
-  O_ORDERSTATUS    CHAR(1) NOT NULL,
-  O_TOTALPRICE     DECIMAL(15,2) NOT NULL,
-  O_ORDERDATE      DATE NOT NULL,
-  O_ORDERPRIORITY  CHAR(15) NOT NULL,
-  O_CLERK          CHAR(15) NOT NULL,
-  O_SHIPPRIORITY   INTEGER NOT NULL,
-  O_COMMENT        VARCHAR(79) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/947736bf/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/part.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/part.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/part.sql
deleted file mode 100644
index e66f73c..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/part.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-CREATE TABLE PART (
-  P_PARTKEY     INTEGER NOT NULL,
-  P_NAME        VARCHAR(55) NOT NULL,
-  P_MFGR        CHAR(25) NOT NULL,
-  P_BRAND       CHAR(10) NOT NULL,
-  P_TYPE        VARCHAR(25) NOT NULL,
-  P_SIZE        INTEGER NOT NULL,
-  P_CONTAINER   CHAR(10) NOT NULL,
-  P_RETAILPRICE DECIMAL(15,2) NOT NULL,
-  P_COMMENT     VARCHAR(23) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/947736bf/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/partsupp.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/partsupp.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/partsupp.sql
deleted file mode 100644
index 1f61331..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/partsupp.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE TABLE PARTSUPP (
-  PS_PARTKEY     INTEGER NOT NULL,
-  PS_SUPPKEY     INTEGER NOT NULL,
-  PS_AVAILQTY    INTEGER NOT NULL,
-  PS_SUPPLYCOST  DECIMAL(15,2)  NOT NULL,
-  PS_COMMENT     VARCHAR(199) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/947736bf/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/region.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/region.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/region.sql
deleted file mode 100644
index c47e26e..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/region.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-CREATE TABLE REGION  (
-  R_REGIONKEY  INTEGER NOT NULL,
-  R_NAME       CHAR(25) NOT NULL,
-  R_COMMENT    VARCHAR(152)
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/947736bf/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/supplier.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/supplier.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/supplier.sql
deleted file mode 100644
index a4d35d3..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/supplier.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-CREATE TABLE SUPPLIER (
-  S_SUPPKEY     INTEGER NOT NULL,
-  S_NAME        CHAR(25) NOT NULL,
-  S_ADDRESS     VARCHAR(40) NOT NULL,
-  S_NATIONKEY   INTEGER NOT NULL,
-  S_PHONE       CHAR(15) NOT NULL,
-  S_ACCTBAL     DECIMAL(15,2) NOT NULL,
-  S_COMMENT     VARCHAR(101) NOT NULL
-);
\ No newline at end of file


[21/39] tajo git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730

Posted by hy...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/825e25fd
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/825e25fd
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/825e25fd

Branch: refs/heads/TAJO-1730
Commit: 825e25fddabe0051fd97fa94e314256cef90f177
Parents: 57466e3 2a850cf
Author: Hyunsik Choi <hy...@apache.org>
Authored: Wed Aug 19 23:26:18 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Wed Aug 19 23:26:18 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |  37 +-
 pom.xml                                         |   1 +
 .../tajo/catalog/store/HCatalogStore.java       |  32 ++
 tajo-client-example/pom.xml                     | 217 ++++++++++++
 .../v2/example/TajoClientAsyncExample.java      |  70 ++++
 .../client/v2/example/TajoClientExample.java    |  65 ++++
 .../tajo/client/v2/LegacyClientDelegate.java    |   4 +-
 .../org/apache/tajo/client/v2/QueryFuture.java  |   4 +-
 .../org/apache/tajo/client/v2/TajoClient.java   |  12 +-
 .../java/org/apache/tajo/QueryTestCaseBase.java | 103 +++++-
 .../test/java/org/apache/tajo/TpchTestBase.java |   3 -
 .../apache/tajo/exception/ErrorMessages.java    |  15 +-
 .../apache/tajo/client/v2/TestTajoClientV2.java |   4 +-
 .../apache/tajo/engine/query/TestJoinQuery.java |   5 -
 .../tajo/engine/query/TestSelectQuery.java      |  10 +
 .../TestSelectQuery/nagative/operations.sql     |   1 +
 .../queries/TestSelectQuery/nagative/tables.sql |   1 +
 .../TestSelectQuery/positive/operations.sql     |   1 +
 .../java/org/apache/tajo/benchmark/TPCH.java    |   6 -
 tajo-dist/pom.xml                               |   1 +
 tajo-docs/src/main/sphinx/functions.rst         |  25 +-
 .../src/main/sphinx/functions/agg_func.rst      |  91 +++++
 .../functions/data_type_func_and_operators.rst  |  43 +++
 .../functions/datetime_func_and_operators.rst   |  18 +-
 .../src/main/sphinx/functions/json_func.rst     |   8 +-
 .../functions/math_func_and_operators.rst       |  14 +
 .../functions/network_func_and_operators.rst    |   8 +-
 .../functions/string_func_and_operators.rst     | 347 +++++++++++++++++--
 .../src/main/sphinx/functions/window_func.rst   |  47 +++
 .../src/main/sphinx/sql_language/joins.rst      |   2 +-
 .../main/sphinx/sql_language/sql_expression.rst |  14 +-
 tajo-project/pom.xml                            |   5 +
 .../tajo/storage/ByteBufInputChannel.java       |   2 +-
 .../apache/tajo/storage/FSDataInputChannel.java |   6 +-
 .../tajo/storage/json/JsonLineDeserializer.java |  15 +-
 .../tajo/storage/text/DelimitedLineReader.java  |   2 +-
 .../org/apache/tajo/storage/TestLineReader.java |   8 +-
 .../apache/tajo/storage/json/TestJsonSerDe.java |  32 ++
 .../testUnicodeWithControlChar.json             |   1 +
 39 files changed, 1177 insertions(+), 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/825e25fd/tajo-project/pom.xml
----------------------------------------------------------------------


[31/39] tajo git commit: Changed imports.

Posted by hy...@apache.org.
Changed imports.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/d3a016a9
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/d3a016a9
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/d3a016a9

Branch: refs/heads/TAJO-1730
Commit: d3a016a962743d0e1b036946cec4f50d084034fe
Parents: 0ca2802
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sat Aug 22 01:37:59 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sat Aug 22 01:37:59 2015 +0900

----------------------------------------------------------------------
 .../java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/d3a016a9/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java
index cd48ffd..aa0db26 100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java
@@ -1,6 +1,6 @@
 package org.apache.tajo.storage.pgsql;
 
-import com.facebook.presto.hive.shaded.com.google.common.collect.Sets;
+import com.google.common.collect.Sets;
 import org.apache.tajo.QueryTestCaseBase;
 import org.apache.tajo.catalog.TableDesc;
 import org.apache.tajo.client.TajoClient;


[23/39] tajo git commit: Completed initial implementations.

Posted by hy...@apache.org.
http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java
index 577176f..80305f4 100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java
@@ -18,70 +18,24 @@
 
 package org.apache.tajo.storage.pgsql;
 
-import io.airlift.testing.postgresql.TestingPostgreSqlServer;
-import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.storage.TablespaceManager;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.io.IOException;
-import java.net.URI;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.Statement;
-
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 public class TestPgSQLJdbcTableSpace {
-  @BeforeClass
-  public static void setUp() throws IOException {
-    String mysqlUri = "jdbc:mysql://host1:2171/db1";
-    PgSQLTablespace mysqlTablespace = new PgSQLTablespace("cluster2", URI.create(mysqlUri), null);
-    mysqlTablespace.init(new TajoConf());
-    TablespaceManager.addTableSpaceForTest(mysqlTablespace);
-
-    String pgsqlUri = "jdbc:postgres://host1:2615/db2";
-    PgSQLTablespace pgSQLTablespace = new PgSQLTablespace("cluster3", URI.create(pgsqlUri), null);
-    pgSQLTablespace.init(new TajoConf());
-    TablespaceManager.addTableSpaceForTest(pgSQLTablespace);
-  }
+  static String jdbcUrl = EmbedPgSQLServer.getInstance().getJdbcUrl();
 
   @Test
   public void testTablespaceHandler() throws Exception {
-    assertTrue((TablespaceManager.getByName("cluster2").get()) instanceof PgSQLTablespace);
-    assertEquals("cluster2", (TablespaceManager.getByName("cluster2").get().getName()));
-    assertTrue((TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get()) instanceof PgSQLTablespace);
-    assertEquals(URI.create("jdbc:mysql://host1:2171/db1"),
-        TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get().getUri());
-
-    assertTrue((TablespaceManager.getByName("cluster3").get()) instanceof PgSQLTablespace);
-    assertEquals("cluster3", (TablespaceManager.getByName("cluster3").get().getName()));
-    assertTrue((TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get()) instanceof PgSQLTablespace);
+    assertTrue((TablespaceManager.getByName("pgsql_cluster").get()) instanceof PgSQLTablespace);
+    assertEquals("pgsql_cluster", (TablespaceManager.getByName("pgsql_cluster").get().getName()));
 
-    assertEquals(URI.create("jdbc:postgres://host1:2615/db2"),
-        TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get().getUri());
-  }
-
-  @Test
-  public void test() throws Exception {
-    try (TestingPostgreSqlServer server = new TestingPostgreSqlServer("testuser", "testdb")) {
-      assertEquals(server.getUser(), "testuser");
-      assertEquals(server.getDatabase(), "testdb");
-      assertEquals(server.getJdbcUrl().substring(0, 5), "jdbc:");
-      assertEquals(server.getPort(), URI.create(server.getJdbcUrl().substring(5)).getPort());
+    assertTrue((TablespaceManager.get(jdbcUrl).get()) instanceof PgSQLTablespace);
+    assertTrue((TablespaceManager.get(jdbcUrl + "&table=tb1").get()) instanceof PgSQLTablespace);
 
-      try (Connection connection = DriverManager.getConnection(server.getJdbcUrl())) {
-        try (Statement statement = connection.createStatement()) {
-          statement.execute("CREATE TABLE test_table (c1 bigint PRIMARY KEY)");
-          statement.execute("INSERT INTO test_table (c1) VALUES (1)");
-          try (ResultSet resultSet = statement.executeQuery("SELECT count(*) FROM test_table")) {
-            assertTrue(resultSet.next());
-            assertEquals(resultSet.getLong(1), 1L);
-            assertFalse(resultSet.next());
-          }
-        }
-      }
-    }
+    assertEquals(jdbcUrl, TablespaceManager.get(jdbcUrl).get().getUri().toASCIIString());
+    assertTrue(TablespaceManager.get(jdbcUrl).get().getMetadataProvider() instanceof PgSQLMetadataProvider);
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLMetadataProvider.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLMetadataProvider.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLMetadataProvider.java
new file mode 100644
index 0000000..aac25f7
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLMetadataProvider.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.pgsql;
+
+import com.google.common.collect.Sets;
+import org.apache.tajo.catalog.MetadataProvider;
+import org.apache.tajo.catalog.TableDesc;
+import org.apache.tajo.storage.Tablespace;
+import org.apache.tajo.storage.TablespaceManager;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.util.Set;
+
+import static org.junit.Assert.*;
+
+public class TestPgSQLMetadataProvider {
+  static final String jdbcUrl = EmbedPgSQLServer.getInstance().getJdbcUrl();
+
+  @BeforeClass
+  public static void setUp() throws Exception {
+  }
+
+  @Test
+  public void testGetTablespaceName() throws Exception {
+    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
+    MetadataProvider provider = tablespace.getMetadataProvider();
+    assertEquals("pgsql_cluster", provider.getTablespaceName());
+  }
+
+  @Test
+  public void testGetDatabaseName() throws Exception {
+    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
+    MetadataProvider provider = tablespace.getMetadataProvider();
+    assertEquals("tpch", provider.getDatabaseName());
+  }
+
+  @Test
+  public void testGetSchemas() throws Exception {
+    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
+    MetadataProvider provider = tablespace.getMetadataProvider();
+    assertTrue(provider.getSchemas().isEmpty());
+  }
+
+  @Test
+  public void testGetTables() throws Exception {
+    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
+    MetadataProvider provider = tablespace.getMetadataProvider();
+
+    Set<String> found = Sets.newHashSet(provider.getTables(null, null));
+    assertEquals(Sets.newHashSet(EmbedPgSQLServer.TPCH_TABLES), found);
+  }
+
+  @Test
+  public void testGetTableDescriptor() throws Exception {
+    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
+    MetadataProvider provider = tablespace.getMetadataProvider();
+
+    for (String tableName : EmbedPgSQLServer.TPCH_TABLES) {
+      TableDesc table = provider.getTableDescriptor(null, tableName);
+      assertEquals("tpch." + tableName, table.getName());
+      assertEquals(jdbcUrl + "&table=" + tableName, table.getUri().toASCIIString());
+    }
+  }
+}


[36/39] tajo git commit: Completed.

Posted by hy...@apache.org.
Completed.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/a6380ccc
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/a6380ccc
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/a6380ccc

Branch: refs/heads/TAJO-1730
Commit: a6380ccc7627f1dbf8acb93836e2158fe43f92af
Parents: e3a9262
Author: Hyunsik Choi <hy...@apache.org>
Authored: Wed Sep 2 19:13:09 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Wed Sep 2 19:13:09 2015 +0900

----------------------------------------------------------------------
 .../storage/jdbc/JdbcMetadataProviderBase.java  |   2 +-
 .../apache/tajo/storage/jdbc/JdbcScanner.java   |  16 +-
 .../storage/jdbc/SQLExpressionGenerator.java    |  26 ++-
 .../dataset/TestMysqlJdbcTableSpace/.marker     |   0
 .../results/TestMysqlJdbcTableSpace/.marker     |   0
 tajo-storage/tajo-storage-pgsql/pom.xml         |   2 +-
 .../tajo/storage/pgsql/PgSQLTablespace.java     |  12 +-
 .../tajo/storage/pgsql/EmbedPgSQLServer.java    | 174 -----------------
 .../tajo/storage/pgsql/PgSQLTestServer.java     | 193 +++++++++++++++++++
 .../storage/pgsql/TestPgSQLEndPointTests.java   |  18 +-
 .../storage/pgsql/TestPgSQLJdbcTableSpace.java  |  12 +-
 .../pgsql/TestPgSQLMetadataProvider.java        |   6 +-
 .../tajo/storage/pgsql/TestPgSQLQueryTests.java |  40 +++-
 .../pgsql/TestPgSQLSimpleQueryTests.java        |   4 +-
 .../src/test/resources/pgsql/customer.sql       |  10 +
 .../src/test/resources/pgsql/datetime_types.sql |   5 +
 .../src/test/resources/pgsql/datetime_types.txt |   4 +
 .../src/test/resources/pgsql/lineitem.sql       |  18 ++
 .../src/test/resources/pgsql/nation.sql         |   6 +
 .../src/test/resources/pgsql/orders.sql         |  11 ++
 .../src/test/resources/pgsql/part.sql           |  11 ++
 .../src/test/resources/pgsql/partsupp.sql       |   7 +
 .../src/test/resources/pgsql/region.sql         |   5 +
 .../src/test/resources/pgsql/supplier.sql       |   9 +
 .../TestPgSQLQueryTests/testDateTimeTypes.sql   |   1 +
 .../testFixedLengthFields.sql                   |   1 +
 .../testProjectedColumns.sql                    |   1 +
 .../queries/TestPgSQLQueryTests/testTPCH_Q1.sql |  21 ++
 .../TestPgSQLQueryTests/testTPCH_Q2_Part.sql    |  18 ++
 .../testVariableLengthFields.sql                |   1 +
 .../testDateTimeTypes.result                    |   6 +
 .../testFixedLengthFields.result                |   5 +
 .../testProjectedColumns.result                 |   5 +
 .../TestPgSQLQueryTests/testSimpleFilter.result |   6 +-
 .../TestPgSQLQueryTests/testTPCH_Q1.result      |   4 +
 .../TestPgSQLQueryTests/testTPCH_Q2_Part.result |   3 +
 .../testVariableLengthFields.result             |   5 +
 .../testSelectAll.result                        |  10 +-
 .../testSelectLimit.result                      |   6 +-
 .../src/test/resources/tpch/pgsql/customer.sql  |  10 -
 .../src/test/resources/tpch/pgsql/lineitem.sql  |  18 --
 .../src/test/resources/tpch/pgsql/nation.sql    |   6 -
 .../src/test/resources/tpch/pgsql/orders.sql    |  11 --
 .../src/test/resources/tpch/pgsql/part.sql      |  11 --
 .../src/test/resources/tpch/pgsql/partsupp.sql  |   7 -
 .../src/test/resources/tpch/pgsql/region.sql    |   5 -
 .../src/test/resources/tpch/pgsql/supplier.sql  |   9 -
 47 files changed, 456 insertions(+), 305 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
index f623f14..d6ac46c 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
@@ -195,7 +195,7 @@ public abstract class JdbcMetadataProviderBase implements MetadataProvider {
         final String qualifier = resultForColumns.getString("TABLE_NAME");
         final String columnName = resultForColumns.getString("COLUMN_NAME");
         final TypeDesc type = convertDataType(resultForColumns);
-        final Column c = new Column(CatalogUtil.buildFQName(qualifier, columnName), type);
+        final Column c = new Column(CatalogUtil.buildFQName(databaseName, qualifier, columnName), type);
 
         columns.add(new Pair<>(ordinalPos, c));
       }

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcScanner.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcScanner.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcScanner.java
index 897f6c5..c08451d 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcScanner.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcScanner.java
@@ -26,6 +26,7 @@ import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.catalog.TableMeta;
 import org.apache.tajo.catalog.statistics.TableStats;
 import org.apache.tajo.datum.DatumFactory;
+import org.apache.tajo.datum.TimeDatum;
 import org.apache.tajo.exception.TajoInternalError;
 import org.apache.tajo.exception.TajoRuntimeException;
 import org.apache.tajo.exception.UnsupportedDataTypeException;
@@ -203,20 +204,23 @@ public abstract class JdbcScanner implements Scanner {
           tuple.put(column_idx, DatumFactory.createFloat8(resultSet.getDouble(resultIdx)));
           break;
         case CHAR:
+          tuple.put(column_idx, DatumFactory.createText(resultSet.getString(resultIdx)));
+          break;
         case VARCHAR:
         case TEXT:
-          tuple.put(column_idx, DatumFactory.createText(resultSet.getString(resultIdx)));
+          // TODO - trim is unnecessary in many cases, so we can use it for certain cases
+          tuple.put(column_idx, DatumFactory.createText(resultSet.getString(resultIdx).trim()));
           break;
         case DATE:
-          Date date = resultSet.getDate(resultIdx);
-          tuple.put(column_idx, DatumFactory.createDate(date.getYear(), date.getMonth(), date.getDay()));
+          final Date date = resultSet.getDate(resultIdx);
+          tuple.put(column_idx, DatumFactory.createDate(1900 + date.getYear(), 1 + date.getMonth(), date.getDate()));
           break;
         case TIME:
-          tuple.put(column_idx, DatumFactory.createTime(resultSet.getTime(resultIdx).getTime()));
+          tuple.put(column_idx, new TimeDatum(resultSet.getTime(resultIdx).getTime() * 1000));
           break;
         case TIMESTAMP:
           tuple.put(column_idx,
-              DatumFactory.createTimestamp(DateTimeUtil.javaTimeToJulianTime(resultSet.getTime(resultIdx).getTime())));
+              DatumFactory.createTimestmpDatumWithJavaMillis(resultSet.getTimestamp(resultIdx).getTime()));
           break;
         case BINARY:
         case VARBINARY:
@@ -303,7 +307,7 @@ public abstract class JdbcScanner implements Scanner {
       try {
         resultSet.close();
       } catch (SQLException e) {
-        LOG.warn(e);;
+        LOG.warn(e);
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLExpressionGenerator.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLExpressionGenerator.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLExpressionGenerator.java
index 76c687a..da07257 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLExpressionGenerator.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLExpressionGenerator.java
@@ -18,11 +18,13 @@
 
 package org.apache.tajo.storage.jdbc;
 
+import org.apache.tajo.catalog.CatalogUtil;
 import org.apache.tajo.common.TajoDataTypes.DataType;
 import org.apache.tajo.datum.Datum;
 import org.apache.tajo.exception.TajoRuntimeException;
 import org.apache.tajo.exception.UnsupportedDataTypeException;
 import org.apache.tajo.plan.expr.*;
+import org.apache.tajo.util.Pair;
 
 import java.sql.DatabaseMetaData;
 import java.sql.SQLException;
@@ -34,8 +36,12 @@ import java.util.Stack;
 public class SQLExpressionGenerator extends SimpleEvalNodeVisitor<SQLExpressionGenerator.Context> {
   final private DatabaseMetaData dbMetaData;
 
-  final private String DEFAULT_QUOTE_STR = "'";
-  private String QUOTE_STR;
+  private final String LITERAL_QUOTE = "'";
+  @SuppressWarnings("unused")
+  private final String DEFAULT_LITERAL_QUOTE = "'";
+  @SuppressWarnings("unused")
+  private String IDENTIFIER_QUOTE = "\"";
+  private final String DEFAULT_IDENTIFIER_QUOTE = "\"";
 
   public SQLExpressionGenerator(DatabaseMetaData dbMetaData) {
     this.dbMetaData = dbMetaData;
@@ -48,11 +54,11 @@ public class SQLExpressionGenerator extends SimpleEvalNodeVisitor<SQLExpressionG
       quoteStr = dbMetaData.getIdentifierQuoteString();
     } catch (SQLException e) {
     }
-    this.QUOTE_STR = quoteStr != null ? quoteStr : DEFAULT_QUOTE_STR;
+    this.IDENTIFIER_QUOTE = quoteStr != null ? quoteStr : DEFAULT_IDENTIFIER_QUOTE;
   }
 
   public String quote(String text) {
-    return QUOTE_STR + text + QUOTE_STR;
+    return LITERAL_QUOTE + text + LITERAL_QUOTE;
   }
 
   public String generate(EvalNode node) {
@@ -131,13 +137,21 @@ public class SQLExpressionGenerator extends SimpleEvalNodeVisitor<SQLExpressionG
 
   @Override
   protected EvalNode visitField(Context context, FieldEval field, Stack<EvalNode> stack) {
-    context.put(field.getName());
+    // strip the database name
+    String tableName;
+    if (CatalogUtil.isSimpleIdentifier(field.getQualifier())) {
+      tableName = field.getQualifier();
+    } else {
+      tableName = CatalogUtil.extractSimpleName(field.getQualifier());
+    }
+
+    context.put(CatalogUtil.buildFQName(tableName, field.getColumnName()));
     return field;
   }
 
   @Override
   protected EvalNode visitConst(Context context, ConstEval constant, Stack<EvalNode> stack) {
-    context.sb.append(convertLiteralToSQLRepr(constant.getValue()));
+    context.sb.append(convertLiteralToSQLRepr(constant.getValue())).append(" ");
     return constant;
   }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-mysql/src/test/resources/dataset/TestMysqlJdbcTableSpace/.marker
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/dataset/TestMysqlJdbcTableSpace/.marker b/tajo-storage/tajo-storage-mysql/src/test/resources/dataset/TestMysqlJdbcTableSpace/.marker
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-mysql/src/test/resources/results/TestMysqlJdbcTableSpace/.marker
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/results/TestMysqlJdbcTableSpace/.marker b/tajo-storage/tajo-storage-mysql/src/test/resources/results/TestMysqlJdbcTableSpace/.marker
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/pom.xml b/tajo-storage/tajo-storage-pgsql/pom.xml
index 074950c..7333706 100644
--- a/tajo-storage/tajo-storage-pgsql/pom.xml
+++ b/tajo-storage/tajo-storage-pgsql/pom.xml
@@ -55,7 +55,7 @@
             <exclude>src/test/resources/dataset/**</exclude>
             <exclude>src/test/resources/queries/**</exclude>
             <exclude>src/test/resources/results/**</exclude>
-            <exclude>src/test/resources/tpch/**</exclude>
+            <exclude>src/test/resources/pgsql/**</exclude>
           </excludes>
         </configuration>
         <executions>

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
index af314a1..4abb37b 100644
--- a/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
+++ b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
@@ -66,13 +66,13 @@ public class PgSQLTablespace extends JdbcTablespace {
       target = schema;
     }
 
+    Scanner scanner;
     if (fragment.isEmpty()) {
-      Scanner scanner = new NullScanner(conf, schema, meta, fragment);
-      scanner.setTarget(target.toArray());
-
-      return scanner;
+      scanner = new NullScanner(conf, schema, meta, fragment);
+    } else {
+      scanner = new PgSQLJdbcScanner(getDatabaseMetaData(), schema, meta, (JdbcFragment) fragment);
     }
-
-    return new PgSQLJdbcScanner(getDatabaseMetaData(), schema, meta, (JdbcFragment) fragment);
+    scanner.setTarget(target.toArray());
+    return scanner;
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java
deleted file mode 100644
index f9425ad..0000000
--- a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.pgsql;
-
-import io.airlift.testing.postgresql.TestingPostgreSqlServer;
-import net.minidev.json.JSONObject;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.fs.Path;
-import org.apache.tajo.conf.TajoConf;
-import org.apache.tajo.storage.TablespaceManager;
-import org.apache.tajo.util.CommonTestingUtil;
-import org.apache.tajo.util.FileUtil;
-import org.apache.tajo.util.JavaResourceUtil;
-
-import java.io.IOException;
-import java.net.URI;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.HashMap;
-import java.util.Map;
-
-public class EmbedPgSQLServer {
-  private static final Log LOG = LogFactory.getLog(EmbedPgSQLServer.class);
-
-  private static EmbedPgSQLServer instance;
-
-  public static final String [] TPCH_TABLES = {
-      "customer", "lineitem", "nation", "orders", "part", "partsupp", "region", "supplier"
-  };
-
-  public static final String SPACENAME = "pgsql_cluster";
-  public static final String DATABASE_NAME = "tpch";
-
-  private final TestingPostgreSqlServer server;
-
-  static {
-    try {
-      instance = new EmbedPgSQLServer();
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public static EmbedPgSQLServer getInstance() {
-    return instance;
-  }
-
-  private EmbedPgSQLServer() throws Exception {
-    server = new TestingPostgreSqlServer("testuser",
-        "tpch"
-    );
-
-    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
-      @Override
-      public void run() {
-        try {
-          server.close();
-        } catch (IOException e) {
-          e.printStackTrace();
-        }
-      }
-    }));
-
-    loadTPCHTables();
-    registerTablespace();
-  }
-
-  private void loadTPCHTables() throws SQLException, IOException {
-    Path testPath = CommonTestingUtil.getTestDir();
-
-    try (Connection connection = DriverManager.getConnection(getJdbcUrlForAdmin(), "postgres", null)) {
-      connection.setCatalog("tpch");
-
-      try (Statement statement = connection.createStatement()) {
-
-        for (String tableName : TPCH_TABLES) {
-          String sql = JavaResourceUtil.readTextFromResource("tpch/pgsql/" + tableName + ".sql");
-          statement.addBatch(sql);
-        }
-
-        statement.executeBatch();
-
-        for (String tableName : TPCH_TABLES) {
-          String csvTable = JavaResourceUtil.readTextFromResource("tpch/" + tableName + ".tbl");
-          String fixedCsvTable = fixExtraColumn(csvTable);
-          Path filePath = new Path(testPath, tableName + ".tbl");
-          FileUtil.writeTextToFile(fixedCsvTable, filePath);
-
-          String copyCommand =
-              "COPY " + tableName + " FROM '" + filePath.toUri().getPath() + "' WITH (FORMAT csv, DELIMITER '|');";
-          statement.executeUpdate(copyCommand);
-        }
-
-      } catch (Throwable t) {
-        t.printStackTrace();
-        throw t;
-      }
-    }
-  }
-
-  private String fixExtraColumn(String csvTable) {
-    final String [] lines = csvTable.split("\n");
-    final StringBuilder rewritten = new StringBuilder();
-
-    for (String l : lines) {
-      if (l.charAt(l.length() - 1) == '|') {
-        rewritten.append(l.substring(0, l.length() - 1));
-      } else {
-        rewritten.append(l.substring(0, l.length()));
-      }
-      rewritten.append("\n");
-    }
-
-    return rewritten.toString();
-  }
-
-  private void registerTablespace() throws IOException {
-    JSONObject configElements = new JSONObject();
-    configElements.put("database", DATABASE_NAME);
-
-    Map<String, JSONObject> configMap = new HashMap<>();
-    configMap.put(TablespaceManager.TABLESPACE_SPEC_CONFIGS_KEY, configElements);
-    JSONObject config = new JSONObject(configMap);
-
-    PgSQLTablespace tablespace = new PgSQLTablespace(SPACENAME, URI.create(getJdbcUrlForAdmin()), config);
-    tablespace.init(new TajoConf());
-
-    TablespaceManager.addTableSpaceForTest(tablespace);
-  }
-
-  /**
-   * get JDBC URL for a created user
-   *
-   * @return JDBC URL for the created user
-   */
-  public String getJdbcUrl() {
-    return server.getJdbcUrl() + "&connectTimeout=5&socketTimeout=5";
-  }
-
-  /**
-   * get JDBC URL for the Admin user
-   *
-   * @return JDBC URL for the Admin user
-   */
-  public String getJdbcUrlForAdmin() {
-    // replace 'user' by postgres (admin)
-    String url = server.getJdbcUrl().split("\\?")[0];
-    url += "?user=postgres&connectTimeout=5&socketTimeout=5";
-    return url;
-  }
-
-  public TestingPostgreSqlServer getServer() {
-    return server;
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/PgSQLTestServer.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/PgSQLTestServer.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/PgSQLTestServer.java
new file mode 100644
index 0000000..e5260f1
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/PgSQLTestServer.java
@@ -0,0 +1,193 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.pgsql;
+
+import io.airlift.testing.postgresql.TestingPostgreSqlServer;
+import net.minidev.json.JSONObject;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.fs.Path;
+import org.apache.tajo.conf.TajoConf;
+import org.apache.tajo.storage.TablespaceManager;
+import org.apache.tajo.util.CommonTestingUtil;
+import org.apache.tajo.util.FileUtil;
+import org.apache.tajo.util.JavaResourceUtil;
+
+import java.io.IOException;
+import java.net.URI;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+
+public class PgSQLTestServer {
+  private static final Log LOG = LogFactory.getLog(PgSQLTestServer.class);
+
+  private static PgSQLTestServer instance;
+
+  public static final String [] TPCH_TABLES = {
+      "customer", "lineitem", "nation", "orders", "part", "partsupp", "region", "supplier"
+  };
+
+  public static final String SPACENAME = "pgsql_cluster";
+  public static final String DATABASE_NAME = "tpch";
+
+  private final TestingPostgreSqlServer server;
+
+  static {
+    try {
+      instance = new PgSQLTestServer();
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  public static PgSQLTestServer getInstance() {
+    return instance;
+  }
+
+  private PgSQLTestServer() throws Exception {
+    server = new TestingPostgreSqlServer("testuser",
+        "tpch"
+    );
+
+    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
+      @Override
+      public void run() {
+        try {
+          server.close();
+        } catch (IOException e) {
+          e.printStackTrace();
+        }
+      }
+    }));
+
+    loadTPCHTables();
+    registerTablespace();
+  }
+
+  Path testPath = CommonTestingUtil.getTestDir();
+
+  private void loadTPCHTables() throws SQLException, IOException {
+
+
+    try (Connection connection = DriverManager.getConnection(getJdbcUrlForAdmin(), "postgres", null)) {
+      connection.setCatalog("tpch");
+
+      try (Statement statement = connection.createStatement()) {
+
+        for (String tableName : TPCH_TABLES) {
+          String sql = JavaResourceUtil.readTextFromResource("pgsql/" + tableName + ".sql");
+          statement.executeUpdate(sql);
+
+          // restore the table contents into a file stored in a local file system for PgSQL COPY command
+          String path = restoreTableContents(tableName);
+          String copyCommand = genLoadStatement(tableName, path);
+          statement.executeUpdate(copyCommand);
+        }
+
+        // load DATETIME_TYPES table
+        String sql = JavaResourceUtil.readTextFromResource("pgsql/datetime_types.sql");
+        statement.executeUpdate(sql);
+        Path filePath = new Path(testPath, "datetime_types.txt");
+        storeTableContents("pgsql/datetime_types.txt", filePath);
+        String copyCommand = genLoadStatement("datetime_types", filePath.toUri().getPath());
+        LOG.info(copyCommand);
+        statement.executeUpdate(copyCommand);
+
+      } catch (Throwable t) {
+        t.printStackTrace();
+        throw t;
+      }
+    }
+  }
+
+  private String genLoadStatement(String tableName, String path) {
+    return  "COPY " + tableName + " FROM '" + path + "' WITH (FORMAT csv, DELIMITER '|');";
+  }
+
+  private void storeTableContents(String resource, Path path) throws IOException {
+    String csvTable = JavaResourceUtil.readTextFromResource(resource);
+    String fixedCsvTable = fixExtraColumn(csvTable);
+    FileUtil.writeTextToFile(fixedCsvTable, path);
+  }
+
+  private String restoreTableContents(String tableName) throws IOException {
+    Path filePath = new Path(testPath, tableName + ".tbl");
+    storeTableContents("tpch/" + tableName + ".tbl", filePath);
+    return filePath.toUri().getPath();
+  }
+
+  private String fixExtraColumn(String csvTable) {
+    final String [] lines = csvTable.split("\n");
+    final StringBuilder rewritten = new StringBuilder();
+
+    for (String l : lines) {
+      if (l.charAt(l.length() - 1) == '|') {
+        rewritten.append(l.substring(0, l.length() - 1));
+      } else {
+        rewritten.append(l.substring(0, l.length()));
+      }
+      rewritten.append("\n");
+    }
+
+    return rewritten.toString();
+  }
+
+  private void registerTablespace() throws IOException {
+    JSONObject configElements = new JSONObject();
+    configElements.put("database", DATABASE_NAME);
+
+    Map<String, JSONObject> configMap = new HashMap<>();
+    configMap.put(TablespaceManager.TABLESPACE_SPEC_CONFIGS_KEY, configElements);
+    JSONObject config = new JSONObject(configMap);
+
+    PgSQLTablespace tablespace = new PgSQLTablespace(SPACENAME, URI.create(getJdbcUrlForAdmin()), config);
+    tablespace.init(new TajoConf());
+
+    TablespaceManager.addTableSpaceForTest(tablespace);
+  }
+
+  /**
+   * get JDBC URL for a created user
+   *
+   * @return JDBC URL for the created user
+   */
+  public String getJdbcUrl() {
+    return server.getJdbcUrl() + "&connectTimeout=5&socketTimeout=5";
+  }
+
+  /**
+   * get JDBC URL for the Admin user
+   *
+   * @return JDBC URL for the Admin user
+   */
+  public String getJdbcUrlForAdmin() {
+    // replace 'user' by postgres (admin)
+    String url = server.getJdbcUrl().split("\\?")[0];
+    url += "?user=postgres&connectTimeout=5&socketTimeout=5";
+    return url;
+  }
+
+  public TestingPostgreSqlServer getServer() {
+    return server;
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java
index 2b54a62..638a8e9 100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java
@@ -33,7 +33,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 public class TestPgSQLEndPointTests extends QueryTestCaseBase {
-  private static final String jdbcUrl = EmbedPgSQLServer.getInstance().getJdbcUrlForAdmin();
+  private static final String jdbcUrl = PgSQLTestServer.getInstance().getJdbcUrlForAdmin();
   private static TajoClient client;
 
 
@@ -48,23 +48,23 @@ public class TestPgSQLEndPointTests extends QueryTestCaseBase {
     client.close();
   }
 
-  @Test(timeout = 5000)
+  @Test(timeout = 1000)
   public void testGetAllDatabaseNames() {
     Set<String> retrieved = Sets.newHashSet(client.getAllDatabaseNames());
-    assertTrue(retrieved.contains(EmbedPgSQLServer.DATABASE_NAME));
+    assertTrue(retrieved.contains(PgSQLTestServer.DATABASE_NAME));
   }
 
-  @Test(timeout = 5000)
+  @Test(timeout = 1000)
   public void testGetTableList() {
     Set<String> retrieved = Sets.newHashSet(client.getTableList("tpch"));
-    assertEquals(Sets.newHashSet(EmbedPgSQLServer.TPCH_TABLES), retrieved);
+    assertEquals(Sets.newHashSet(PgSQLTestServer.TPCH_TABLES), retrieved);
   }
 
-  @Test(timeout = 5000)
+  @Test(timeout = 1000)
   public void testGetTable() throws UndefinedTableException {
-    for (String tableName: EmbedPgSQLServer.TPCH_TABLES) {
-      TableDesc retrieved = client.getTableDesc(EmbedPgSQLServer.DATABASE_NAME + "." + tableName);
-      assertEquals(EmbedPgSQLServer.DATABASE_NAME + "." + tableName, retrieved.getName());
+    for (String tableName: PgSQLTestServer.TPCH_TABLES) {
+      TableDesc retrieved = client.getTableDesc(PgSQLTestServer.DATABASE_NAME + "." + tableName);
+      assertEquals(PgSQLTestServer.DATABASE_NAME + "." + tableName, retrieved.getName());
       assertEquals(jdbcUrl + "&table=" + tableName, retrieved.getUri().toASCIIString());
     }
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java
index f3b2d26..2ccf09a 100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java
@@ -20,10 +20,8 @@ package org.apache.tajo.storage.pgsql;
 
 import org.apache.tajo.catalog.MetadataProvider;
 import org.apache.tajo.catalog.TableDesc;
-import org.apache.tajo.exception.NotImplementedException;
 import org.apache.tajo.exception.TajoException;
 import org.apache.tajo.exception.TajoRuntimeException;
-import org.apache.tajo.exception.UnsupportedException;
 import org.apache.tajo.storage.Tablespace;
 import org.apache.tajo.storage.TablespaceManager;
 import org.apache.tajo.storage.fragment.Fragment;
@@ -37,9 +35,9 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 public class TestPgSQLJdbcTableSpace {
-  static String jdbcUrl = EmbedPgSQLServer.getInstance().getJdbcUrlForAdmin();
+  static String jdbcUrl = PgSQLTestServer.getInstance().getJdbcUrlForAdmin();
 
-  @Test(timeout = 5000)
+  @Test(timeout = 1000)
   public void testTablespaceHandler() throws Exception {
     assertTrue((TablespaceManager.getByName("pgsql_cluster").get()) instanceof PgSQLTablespace);
     assertEquals("pgsql_cluster", (TablespaceManager.getByName("pgsql_cluster").get().getName()));
@@ -51,19 +49,19 @@ public class TestPgSQLJdbcTableSpace {
     assertTrue(TablespaceManager.get(jdbcUrl).get().getMetadataProvider() instanceof PgSQLMetadataProvider);
   }
 
-  @Test(timeout = 5000, expected = TajoRuntimeException.class)
+  @Test(timeout = 1000, expected = TajoRuntimeException.class)
   public void testCreateTable() throws IOException, TajoException {
     Tablespace space = TablespaceManager.getByName("pgsql_cluster").get();
     space.createTable(null, false);
   }
 
-  @Test(timeout = 5000, expected = TajoRuntimeException.class)
+  @Test(timeout = 1000, expected = TajoRuntimeException.class)
   public void testDropTable() throws IOException, TajoException {
     Tablespace space = TablespaceManager.getByName("pgsql_cluster").get();
     space.purgeTable(null);
   }
 
-  @Test(timeout = 5000)
+  @Test(timeout = 1000)
   public void testGetSplits() throws IOException, TajoException {
     Tablespace space = TablespaceManager.getByName("pgsql_cluster").get();
     MetadataProvider provider = space.getMetadataProvider();

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLMetadataProvider.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLMetadataProvider.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLMetadataProvider.java
index 7650f86..b7ebe1b 100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLMetadataProvider.java
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLMetadataProvider.java
@@ -31,7 +31,7 @@ import java.util.Set;
 import static org.junit.Assert.*;
 
 public class TestPgSQLMetadataProvider {
-  static final String jdbcUrl = EmbedPgSQLServer.getInstance().getJdbcUrlForAdmin();
+  static final String jdbcUrl = PgSQLTestServer.getInstance().getJdbcUrlForAdmin();
 
   @BeforeClass
   public static void setUp() throws Exception {
@@ -64,7 +64,7 @@ public class TestPgSQLMetadataProvider {
     MetadataProvider provider = tablespace.getMetadataProvider();
 
     Set<String> found = Sets.newHashSet(provider.getTables(null, null));
-    assertEquals(Sets.newHashSet(EmbedPgSQLServer.TPCH_TABLES), found);
+    assertEquals(Sets.newHashSet(PgSQLTestServer.TPCH_TABLES), found);
   }
 
   @Test
@@ -72,7 +72,7 @@ public class TestPgSQLMetadataProvider {
     Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
     MetadataProvider provider = tablespace.getMetadataProvider();
 
-    for (String tableName : EmbedPgSQLServer.TPCH_TABLES) {
+    for (String tableName : PgSQLTestServer.TPCH_TABLES) {
       TableDesc table = provider.getTableDescriptor(null, tableName);
       assertEquals("tpch." + tableName, table.getName());
       assertEquals(jdbcUrl + "&table=" + tableName, table.getUri().toASCIIString());

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLQueryTests.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLQueryTests.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLQueryTests.java
index 7bfb80e..4d22450 100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLQueryTests.java
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLQueryTests.java
@@ -23,10 +23,10 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 
 public class TestPgSQLQueryTests extends QueryTestCaseBase {
-  private static final String jdbcUrl = EmbedPgSQLServer.getInstance().getJdbcUrl();
+  private static final String jdbcUrl = PgSQLTestServer.getInstance().getJdbcUrl();
 
   public TestPgSQLQueryTests() {
-    super(EmbedPgSQLServer.DATABASE_NAME);
+    super(PgSQLTestServer.DATABASE_NAME);
   }
 
   @BeforeClass
@@ -39,4 +39,40 @@ public class TestPgSQLQueryTests extends QueryTestCaseBase {
   public void testSimpleFilter() throws Exception {
     runSimpleTests();
   }
+
+  @SimpleTest
+  @Test
+  public void testProjectedColumns() throws Exception {
+    runSimpleTests();
+  }
+
+  @SimpleTest
+  @Test
+  public void testFixedLengthFields() throws Exception {
+    runSimpleTests();
+  }
+
+  @SimpleTest
+  @Test
+  public void testVariableLengthFields() throws Exception {
+    runSimpleTests();
+  }
+
+  @SimpleTest
+  @Test
+  public void testDateTimeTypes() throws Exception {
+    runSimpleTests();
+  }
+
+  @SimpleTest
+  @Test
+  public void testTPCH_Q1() throws Exception {
+    runSimpleTests();
+  }
+
+  @SimpleTest
+  @Test
+  public void testTPCH_Q2_Part() throws Exception {
+    runSimpleTests();
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLSimpleQueryTests.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLSimpleQueryTests.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLSimpleQueryTests.java
index 2968831..91aba63 100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLSimpleQueryTests.java
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLSimpleQueryTests.java
@@ -23,10 +23,10 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 
 public class TestPgSQLSimpleQueryTests extends QueryTestCaseBase {
-  private static final String jdbcUrl = EmbedPgSQLServer.getInstance().getJdbcUrl();
+  private static final String jdbcUrl = PgSQLTestServer.getInstance().getJdbcUrl();
 
   public TestPgSQLSimpleQueryTests() {
-    super(EmbedPgSQLServer.DATABASE_NAME);
+    super(PgSQLTestServer.DATABASE_NAME);
   }
 
   @BeforeClass

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/customer.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/customer.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/customer.sql
new file mode 100644
index 0000000..35b1861
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/customer.sql
@@ -0,0 +1,10 @@
+CREATE TABLE CUSTOMER (
+  C_CUSTKEY     INTEGER NOT NULL,
+  C_NAME        VARCHAR(25) NOT NULL,
+  C_ADDRESS     VARCHAR(40) NOT NULL,
+  C_NATIONKEY   INTEGER NOT NULL,
+  C_PHONE       CHAR(15) NOT NULL,
+  C_ACCTBAL     DECIMAL(15,2)   NOT NULL,
+  C_MKTSEGMENT  CHAR(10) NOT NULL,
+  C_COMMENT     VARCHAR(117) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/datetime_types.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/datetime_types.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/datetime_types.sql
new file mode 100644
index 0000000..9cbbc2f
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/datetime_types.sql
@@ -0,0 +1,5 @@
+CREATE TABLE DATETIME_TYPES (
+  date_field DATE,
+  time_field TIME,
+  ts_field TIMESTAMP
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/datetime_types.txt
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/datetime_types.txt b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/datetime_types.txt
new file mode 100644
index 0000000..6c7d8ff
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/datetime_types.txt
@@ -0,0 +1,4 @@
+1980-04-01|01:50:27|1980-04-01 01:50:27
+1984-01-05|02:45:31|1984-01-05 02:45:31
+1984-01-15|14:12:58|1984-01-15 14:12:58
+2015-03-21|08:11:01|2015-03-21 08:11:01
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/lineitem.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/lineitem.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/lineitem.sql
new file mode 100644
index 0000000..a7f61bb
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/lineitem.sql
@@ -0,0 +1,18 @@
+CREATE TABLE LINEITEM (
+  L_ORDERKEY    INTEGER NOT NULL,
+  L_PARTKEY     INTEGER NOT NULL,
+  L_SUPPKEY     INTEGER NOT NULL,
+  L_LINENUMBER  INTEGER NOT NULL,
+  L_QUANTITY    DECIMAL(15,2) NOT NULL,
+  L_EXTENDEDPRICE  DECIMAL(15,2) NOT NULL,
+  L_DISCOUNT    DECIMAL(15,2) NOT NULL,
+  L_TAX         DECIMAL(15,2) NOT NULL,
+  L_RETURNFLAG  CHAR(1) NOT NULL,
+  L_LINESTATUS  CHAR(1) NOT NULL,
+  L_SHIPDATE    DATE NOT NULL,
+  L_COMMITDATE  DATE NOT NULL,
+  L_RECEIPTDATE DATE NOT NULL,
+  L_SHIPINSTRUCT CHAR(25) NOT NULL,
+  L_SHIPMODE     CHAR(10) NOT NULL,
+  L_COMMENT      VARCHAR(44) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/nation.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/nation.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/nation.sql
new file mode 100644
index 0000000..f7ecda8
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/nation.sql
@@ -0,0 +1,6 @@
+CREATE TABLE NATION  (
+  N_NATIONKEY  INTEGER NOT NULL,
+  N_NAME       CHAR(25) NOT NULL,
+  N_REGIONKEY  INTEGER NOT NULL,
+  N_COMMENT    VARCHAR(152)
+);

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/orders.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/orders.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/orders.sql
new file mode 100644
index 0000000..220d576
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/orders.sql
@@ -0,0 +1,11 @@
+CREATE TABLE ORDERS  (
+  O_ORDERKEY       INTEGER NOT NULL,
+  O_CUSTKEY        INTEGER NOT NULL,
+  O_ORDERSTATUS    CHAR(1) NOT NULL,
+  O_TOTALPRICE     DECIMAL(15,2) NOT NULL,
+  O_ORDERDATE      DATE NOT NULL,
+  O_ORDERPRIORITY  CHAR(15) NOT NULL,
+  O_CLERK          CHAR(15) NOT NULL,
+  O_SHIPPRIORITY   INTEGER NOT NULL,
+  O_COMMENT        VARCHAR(79) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/part.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/part.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/part.sql
new file mode 100644
index 0000000..e66f73c
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/part.sql
@@ -0,0 +1,11 @@
+CREATE TABLE PART (
+  P_PARTKEY     INTEGER NOT NULL,
+  P_NAME        VARCHAR(55) NOT NULL,
+  P_MFGR        CHAR(25) NOT NULL,
+  P_BRAND       CHAR(10) NOT NULL,
+  P_TYPE        VARCHAR(25) NOT NULL,
+  P_SIZE        INTEGER NOT NULL,
+  P_CONTAINER   CHAR(10) NOT NULL,
+  P_RETAILPRICE DECIMAL(15,2) NOT NULL,
+  P_COMMENT     VARCHAR(23) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/partsupp.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/partsupp.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/partsupp.sql
new file mode 100644
index 0000000..1f61331
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/partsupp.sql
@@ -0,0 +1,7 @@
+CREATE TABLE PARTSUPP (
+  PS_PARTKEY     INTEGER NOT NULL,
+  PS_SUPPKEY     INTEGER NOT NULL,
+  PS_AVAILQTY    INTEGER NOT NULL,
+  PS_SUPPLYCOST  DECIMAL(15,2)  NOT NULL,
+  PS_COMMENT     VARCHAR(199) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/region.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/region.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/region.sql
new file mode 100644
index 0000000..c47e26e
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/region.sql
@@ -0,0 +1,5 @@
+CREATE TABLE REGION  (
+  R_REGIONKEY  INTEGER NOT NULL,
+  R_NAME       CHAR(25) NOT NULL,
+  R_COMMENT    VARCHAR(152)
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/supplier.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/supplier.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/supplier.sql
new file mode 100644
index 0000000..a4d35d3
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/pgsql/supplier.sql
@@ -0,0 +1,9 @@
+CREATE TABLE SUPPLIER (
+  S_SUPPKEY     INTEGER NOT NULL,
+  S_NAME        CHAR(25) NOT NULL,
+  S_ADDRESS     VARCHAR(40) NOT NULL,
+  S_NATIONKEY   INTEGER NOT NULL,
+  S_PHONE       CHAR(15) NOT NULL,
+  S_ACCTBAL     DECIMAL(15,2) NOT NULL,
+  S_COMMENT     VARCHAR(101) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testDateTimeTypes.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testDateTimeTypes.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testDateTimeTypes.sql
new file mode 100644
index 0000000..37c5377
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testDateTimeTypes.sql
@@ -0,0 +1 @@
+SELECT * FROM DATETIME_TYPES WHERE date_field > DATE '1980-01-01';
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testFixedLengthFields.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testFixedLengthFields.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testFixedLengthFields.sql
new file mode 100644
index 0000000..fff0905
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testFixedLengthFields.sql
@@ -0,0 +1 @@
+SELECT L_SHIPINSTRUCT, L_SHIPMODE FROM LINEITEM WHERE L_ORDERKEY > 1 AND L_LINENUMBER > 0;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testProjectedColumns.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testProjectedColumns.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testProjectedColumns.sql
new file mode 100644
index 0000000..1c7512b
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testProjectedColumns.sql
@@ -0,0 +1 @@
+SELECT L_ORDERKEY, L_SHIPDATE FROM LINEITEM WHERE L_ORDERKEY > 1 AND L_LINENUMBER > 0;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testTPCH_Q1.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testTPCH_Q1.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testTPCH_Q1.sql
new file mode 100644
index 0000000..9e02d80
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testTPCH_Q1.sql
@@ -0,0 +1,21 @@
+select
+	l_returnflag,
+	l_linestatus,
+	sum(l_quantity) as sum_qty,
+	sum(l_extendedprice) as sum_base_price,
+	sum(l_extendedprice*(1-l_discount)) as sum_disc_price,
+	sum(l_extendedprice*(1-l_discount)*(1+l_tax)) as sum_charge,
+	avg(l_quantity) as avg_qty,
+	avg(l_extendedprice) as avg_price,
+	avg(l_discount) as avg_disc,
+	count(*) as count_order
+from
+	lineitem
+where
+	l_shipdate <= DATE '1998-09-01'
+group by
+	l_returnflag,
+	l_linestatus
+order by
+	l_returnflag,
+	l_linestatus;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testTPCH_Q2_Part.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testTPCH_Q2_Part.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testTPCH_Q2_Part.sql
new file mode 100644
index 0000000..ffaaf87
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testTPCH_Q2_Part.sql
@@ -0,0 +1,18 @@
+select
+  s_acctbal,
+  s_name,
+  n_name,
+  p_partkey,
+  p_mfgr,
+  s_address,
+  s_phone,
+  s_comment,
+  ps_supplycost,
+  r_name,
+  p_type,
+  p_size
+from
+  region join nation on n_regionkey = r_regionkey and r_name = 'AMERICA'
+  join supplier on s_nationkey = n_nationkey
+  join partsupp on s_suppkey = ps_suppkey
+  join part on p_partkey = ps_partkey and p_type like '%BRASS' and p_size = 15;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testVariableLengthFields.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testVariableLengthFields.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testVariableLengthFields.sql
new file mode 100644
index 0000000..d72da1c
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testVariableLengthFields.sql
@@ -0,0 +1 @@
+SELECT L_COMMENT FROM LINEITEM WHERE L_ORDERKEY > 1 AND L_LINENUMBER > 0;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testDateTimeTypes.result
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testDateTimeTypes.result b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testDateTimeTypes.result
new file mode 100644
index 0000000..cd68a38
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testDateTimeTypes.result
@@ -0,0 +1,6 @@
+date_field,time_field,ts_field
+-------------------------------
+1980-04-01,01:50:27,1980-04-01 01:50:27
+1984-01-05,02:45:31,1984-01-05 02:45:31
+1984-01-15,14:12:58,1984-01-15 14:12:58
+2015-03-21,08:11:01,2015-03-21 08:11:01

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testFixedLengthFields.result
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testFixedLengthFields.result b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testFixedLengthFields.result
new file mode 100644
index 0000000..ae8384d
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testFixedLengthFields.result
@@ -0,0 +1,5 @@
+l_shipinstruct,l_shipmode
+-------------------------------
+TAKE BACK RETURN,RAIL
+NONE,AIR
+TAKE BACK RETURN,RAIL

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testProjectedColumns.result
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testProjectedColumns.result b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testProjectedColumns.result
new file mode 100644
index 0000000..bb3f58d
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testProjectedColumns.result
@@ -0,0 +1,5 @@
+l_orderkey,l_shipdate
+-------------------------------
+2,1997-01-28
+3,1994-02-02
+3,1993-11-09

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testSimpleFilter.result
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testSimpleFilter.result b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testSimpleFilter.result
index a484704..2eb253e 100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testSimpleFilter.result
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testSimpleFilter.result
@@ -1,5 +1,5 @@
 l_orderkey,l_partkey,l_suppkey,l_linenumber,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag,l_linestatus,l_shipdate,l_commitdate,l_receiptdate,l_shipinstruct,l_shipmode,l_comment
 -------------------------------
-2,2,1191,1,38.0,44694.46,0.0,0.05,N,O,0096-12-02,0096-12-02,0096-12-31,TAKE BACK RETURN         ,RAIL      ,ven requests. deposits breach a
-3,2,1798,1,45.0,54058.05,0.06,0.0,R,F,0094-01-03,0093-12-02,0094-01-03,NONE                     ,AIR       ,ongside of the furiously brave acco
-3,3,6540,2,49.0,46796.47,0.1,0.0,R,F,0093-10-02,0093-11-01,0093-10-03,TAKE BACK RETURN         ,RAIL      , unusual accounts. eve
+2,2,1191,1,38.0,44694.46,0.0,0.05,N,O,1997-01-28,1997-01-14,1997-02-02,TAKE BACK RETURN,RAIL,ven requests. deposits breach a
+3,2,1798,1,45.0,54058.05,0.06,0.0,R,F,1994-02-02,1994-01-04,1994-02-23,NONE,AIR,ongside of the furiously brave acco
+3,3,6540,2,49.0,46796.47,0.1,0.0,R,F,1993-11-09,1993-12-20,1993-11-24,TAKE BACK RETURN,RAIL,unusual accounts. eve

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testTPCH_Q1.result
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testTPCH_Q1.result b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testTPCH_Q1.result
new file mode 100644
index 0000000..de3e82e
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testTPCH_Q1.result
@@ -0,0 +1,4 @@
+l_returnflag,l_linestatus,sum_qty,sum_base_price,sum_disc_price,sum_charge,avg_qty,avg_price,avg_disc,count_order
+-------------------------------
+N,O,91.0,111845.85,106860.6364,112012.469952,30.333333333333332,37281.95,0.04333333333333333,3
+R,F,94.0,100854.52,92931.39,92931.39,47.0,50427.26,0.08,2

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testTPCH_Q2_Part.result
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testTPCH_Q2_Part.result b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testTPCH_Q2_Part.result
new file mode 100644
index 0000000..64d8e12
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testTPCH_Q2_Part.result
@@ -0,0 +1,3 @@
+s_acctbal,s_name,n_name,p_partkey,p_mfgr,s_address,s_phone,s_comment,ps_supplycost,r_name,p_type,p_size
+-------------------------------
+4192.4,Supplier#000000003,ARGENTINA,2,Manufacturer#1,q1,G3Pj6OjIuUYfUoH18BFTKP5aU9bEV3,11-383-516-1199,blithely silent requests after the express dependencies are sl,1.01,AMERICA,LARGE BRUSHED BRASS,15

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testVariableLengthFields.result
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testVariableLengthFields.result b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testVariableLengthFields.result
new file mode 100644
index 0000000..531402c
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testVariableLengthFields.result
@@ -0,0 +1,5 @@
+l_comment
+-------------------------------
+ven requests. deposits breach a
+ongside of the furiously brave acco
+unusual accounts. eve

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectAll.result
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectAll.result b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectAll.result
index 6649940..dd34c54 100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectAll.result
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectAll.result
@@ -1,7 +1,7 @@
 l_orderkey,l_partkey,l_suppkey,l_linenumber,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag,l_linestatus,l_shipdate,l_commitdate,l_receiptdate,l_shipinstruct,l_shipmode,l_comment
 -------------------------------
-1,1,7706,1,17.0,21168.23,0.04,0.02,N,O,0096-02-03,0096-01-01,0096-02-05,DELIVER IN PERSON        ,TRUCK     ,egular courts above the
-1,1,7311,2,36.0,45983.16,0.09,0.06,N,O,0096-03-05,0096-01-03,0096-03-06,TAKE BACK RETURN         ,MAIL      ,ly final dependencies: slyly bold 
-2,2,1191,1,38.0,44694.46,0.0,0.05,N,O,0096-12-02,0096-12-02,0096-12-31,TAKE BACK RETURN         ,RAIL      ,ven requests. deposits breach a
-3,2,1798,1,45.0,54058.05,0.06,0.0,R,F,0094-01-03,0093-12-02,0094-01-03,NONE                     ,AIR       ,ongside of the furiously brave acco
-3,3,6540,2,49.0,46796.47,0.1,0.0,R,F,0093-10-02,0093-11-01,0093-10-03,TAKE BACK RETURN         ,RAIL      , unusual accounts. eve
+1,1,7706,1,17.0,21168.23,0.04,0.02,N,O,1996-03-13,1996-02-12,1996-03-22,DELIVER IN PERSON,TRUCK,egular courts above the
+1,1,7311,2,36.0,45983.16,0.09,0.06,N,O,1996-04-12,1996-02-28,1996-04-20,TAKE BACK RETURN,MAIL,ly final dependencies: slyly bold
+2,2,1191,1,38.0,44694.46,0.0,0.05,N,O,1997-01-28,1997-01-14,1997-02-02,TAKE BACK RETURN,RAIL,ven requests. deposits breach a
+3,2,1798,1,45.0,54058.05,0.06,0.0,R,F,1994-02-02,1994-01-04,1994-02-23,NONE,AIR,ongside of the furiously brave acco
+3,3,6540,2,49.0,46796.47,0.1,0.0,R,F,1993-11-09,1993-12-20,1993-11-24,TAKE BACK RETURN,RAIL,unusual accounts. eve

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectLimit.result
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectLimit.result b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectLimit.result
index 88116c8..a7f7d20 100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectLimit.result
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectLimit.result
@@ -1,5 +1,5 @@
 l_orderkey,l_partkey,l_suppkey,l_linenumber,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag,l_linestatus,l_shipdate,l_commitdate,l_receiptdate,l_shipinstruct,l_shipmode,l_comment
 -------------------------------
-1,1,7706,1,17.0,21168.23,0.04,0.02,N,O,0096-02-03,0096-01-01,0096-02-05,DELIVER IN PERSON        ,TRUCK     ,egular courts above the
-1,1,7311,2,36.0,45983.16,0.09,0.06,N,O,0096-03-05,0096-01-03,0096-03-06,TAKE BACK RETURN         ,MAIL      ,ly final dependencies: slyly bold 
-2,2,1191,1,38.0,44694.46,0.0,0.05,N,O,0096-12-02,0096-12-02,0096-12-31,TAKE BACK RETURN         ,RAIL      ,ven requests. deposits breach a
+1,1,7706,1,17.0,21168.23,0.04,0.02,N,O,1996-03-13,1996-02-12,1996-03-22,DELIVER IN PERSON,TRUCK,egular courts above the
+1,1,7311,2,36.0,45983.16,0.09,0.06,N,O,1996-04-12,1996-02-28,1996-04-20,TAKE BACK RETURN,MAIL,ly final dependencies: slyly bold
+2,2,1191,1,38.0,44694.46,0.0,0.05,N,O,1997-01-28,1997-01-14,1997-02-02,TAKE BACK RETURN,RAIL,ven requests. deposits breach a

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/customer.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/customer.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/customer.sql
deleted file mode 100644
index 35b1861..0000000
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/customer.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-CREATE TABLE CUSTOMER (
-  C_CUSTKEY     INTEGER NOT NULL,
-  C_NAME        VARCHAR(25) NOT NULL,
-  C_ADDRESS     VARCHAR(40) NOT NULL,
-  C_NATIONKEY   INTEGER NOT NULL,
-  C_PHONE       CHAR(15) NOT NULL,
-  C_ACCTBAL     DECIMAL(15,2)   NOT NULL,
-  C_MKTSEGMENT  CHAR(10) NOT NULL,
-  C_COMMENT     VARCHAR(117) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/lineitem.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/lineitem.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/lineitem.sql
deleted file mode 100644
index a7f61bb..0000000
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/lineitem.sql
+++ /dev/null
@@ -1,18 +0,0 @@
-CREATE TABLE LINEITEM (
-  L_ORDERKEY    INTEGER NOT NULL,
-  L_PARTKEY     INTEGER NOT NULL,
-  L_SUPPKEY     INTEGER NOT NULL,
-  L_LINENUMBER  INTEGER NOT NULL,
-  L_QUANTITY    DECIMAL(15,2) NOT NULL,
-  L_EXTENDEDPRICE  DECIMAL(15,2) NOT NULL,
-  L_DISCOUNT    DECIMAL(15,2) NOT NULL,
-  L_TAX         DECIMAL(15,2) NOT NULL,
-  L_RETURNFLAG  CHAR(1) NOT NULL,
-  L_LINESTATUS  CHAR(1) NOT NULL,
-  L_SHIPDATE    DATE NOT NULL,
-  L_COMMITDATE  DATE NOT NULL,
-  L_RECEIPTDATE DATE NOT NULL,
-  L_SHIPINSTRUCT CHAR(25) NOT NULL,
-  L_SHIPMODE     CHAR(10) NOT NULL,
-  L_COMMENT      VARCHAR(44) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/nation.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/nation.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/nation.sql
deleted file mode 100644
index f7ecda8..0000000
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/nation.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-CREATE TABLE NATION  (
-  N_NATIONKEY  INTEGER NOT NULL,
-  N_NAME       CHAR(25) NOT NULL,
-  N_REGIONKEY  INTEGER NOT NULL,
-  N_COMMENT    VARCHAR(152)
-);

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/orders.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/orders.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/orders.sql
deleted file mode 100644
index 220d576..0000000
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/orders.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-CREATE TABLE ORDERS  (
-  O_ORDERKEY       INTEGER NOT NULL,
-  O_CUSTKEY        INTEGER NOT NULL,
-  O_ORDERSTATUS    CHAR(1) NOT NULL,
-  O_TOTALPRICE     DECIMAL(15,2) NOT NULL,
-  O_ORDERDATE      DATE NOT NULL,
-  O_ORDERPRIORITY  CHAR(15) NOT NULL,
-  O_CLERK          CHAR(15) NOT NULL,
-  O_SHIPPRIORITY   INTEGER NOT NULL,
-  O_COMMENT        VARCHAR(79) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/part.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/part.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/part.sql
deleted file mode 100644
index e66f73c..0000000
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/part.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-CREATE TABLE PART (
-  P_PARTKEY     INTEGER NOT NULL,
-  P_NAME        VARCHAR(55) NOT NULL,
-  P_MFGR        CHAR(25) NOT NULL,
-  P_BRAND       CHAR(10) NOT NULL,
-  P_TYPE        VARCHAR(25) NOT NULL,
-  P_SIZE        INTEGER NOT NULL,
-  P_CONTAINER   CHAR(10) NOT NULL,
-  P_RETAILPRICE DECIMAL(15,2) NOT NULL,
-  P_COMMENT     VARCHAR(23) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/partsupp.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/partsupp.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/partsupp.sql
deleted file mode 100644
index 1f61331..0000000
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/partsupp.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE TABLE PARTSUPP (
-  PS_PARTKEY     INTEGER NOT NULL,
-  PS_SUPPKEY     INTEGER NOT NULL,
-  PS_AVAILQTY    INTEGER NOT NULL,
-  PS_SUPPLYCOST  DECIMAL(15,2)  NOT NULL,
-  PS_COMMENT     VARCHAR(199) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/region.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/region.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/region.sql
deleted file mode 100644
index c47e26e..0000000
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/region.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-CREATE TABLE REGION  (
-  R_REGIONKEY  INTEGER NOT NULL,
-  R_NAME       CHAR(25) NOT NULL,
-  R_COMMENT    VARCHAR(152)
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/a6380ccc/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/supplier.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/supplier.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/supplier.sql
deleted file mode 100644
index a4d35d3..0000000
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/supplier.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-CREATE TABLE SUPPLIER (
-  S_SUPPKEY     INTEGER NOT NULL,
-  S_NAME        CHAR(25) NOT NULL,
-  S_ADDRESS     VARCHAR(40) NOT NULL,
-  S_NATIONKEY   INTEGER NOT NULL,
-  S_PHONE       CHAR(15) NOT NULL,
-  S_ACCTBAL     DECIMAL(15,2) NOT NULL,
-  S_COMMENT     VARCHAR(101) NOT NULL
-);
\ No newline at end of file


[02/39] tajo git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730

Posted by hy...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/5ca1a4ab
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/5ca1a4ab
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/5ca1a4ab

Branch: refs/heads/TAJO-1730
Commit: 5ca1a4abcc85b0a5742ff98c282b62e5d39f3436
Parents: 4547994 f868c0e
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sun Aug 9 15:31:29 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sun Aug 9 15:31:29 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |  19 +
 .../org/apache/tajo/algebra/AlterTable.java     |  29 +-
 .../java/org/apache/tajo/algebra/Insert.java    |   6 +-
 .../tajo/catalog/AbstractCatalogClient.java     |  47 +-
 .../src/main/proto/CatalogProtocol.proto        |   1 +
 .../org/apache/tajo/catalog/CatalogService.java |   8 +-
 .../apache/tajo/catalog/MetadataProvider.java   |  39 ++
 .../org/apache/tajo/catalog/NestedPathUtil.java |  25 +-
 .../java/org/apache/tajo/catalog/Schema.java    |   4 +-
 .../org/apache/tajo/catalog/SchemaUtil.java     |  40 +-
 ...xistsAssumedPartitionDirectoryException.java |  28 -
 .../exception/AmbiguousFunctionException.java   |   6 +
 ...biguousPartitionDirectoryExistException.java |  30 +
 .../exception/AmbiguousTableException.java      |   9 +-
 .../catalog/exception/CatalogException.java     |   9 +-
 .../exception/DuplicateColumnException.java     |   5 +
 .../exception/DuplicateDatabaseException.java   |   6 +
 .../exception/DuplicateIndexException.java      |   5 +
 .../exception/DuplicatePartitionException.java  |   5 +
 .../exception/DuplicateTableException.java      |   5 +
 .../InsufficientPrivilegeException.java         |  29 +
 .../exception/NoPartitionedTableException.java  |  26 -
 .../exception/NoSuchPartitionException.java     |  37 --
 .../exception/NoSuchPartitionKeyException.java  |  29 -
 .../exception/UndefinedColumnException.java     |   5 +
 .../exception/UndefinedDatabaseException.java   |   5 +
 .../exception/UndefinedFunctionException.java   |   8 +-
 .../exception/UndefinedPartitionException.java  |   5 +
 .../UndefinedPartitionKeyException.java         |  30 +
 .../UndefinedPartitionMethodException.java      |  30 +
 .../exception/UndefinedTableException.java      |   5 +
 .../exception/UndefinedTablespaceException.java |   5 +
 .../src/main/proto/CatalogProtos.proto          |  12 +-
 .../org/apache/tajo/catalog/TestSchema.java     |   3 +-
 .../tajo/catalog/store/HiveCatalogStore.java    | 125 +++-
 .../tajo/catalog/store/HiveCatalogUtil.java     |   2 +-
 .../org/apache/tajo/catalog/CatalogServer.java  | 420 ++++++++++----
 .../tajo/catalog/LinkedMetadataManager.java     | 241 ++++++++
 .../InfoSchemaMetadataDictionary.java           |  16 +-
 .../tajo/catalog/store/AbstractDBStore.java     | 308 ++++++----
 .../apache/tajo/catalog/store/CatalogStore.java |   3 +
 .../org/apache/tajo/catalog/store/MemStore.java |  98 ++--
 .../catalog/store/XMLCatalogSchemaManager.java  |   8 +-
 .../src/main/resources/schemas/derby/derby.xml  |   9 +-
 .../main/resources/schemas/mariadb/mariadb.xml  |  10 +-
 .../src/main/resources/schemas/mysql/mysql.xml  |  10 +-
 .../main/resources/schemas/oracle/oracle.xml    |  11 +-
 .../resources/schemas/postgresql/postgresql.xml |  16 +-
 .../org/apache/tajo/catalog/TestCatalog.java    |  17 +-
 .../tajo/catalog/TestLinkedMetadataManager.java | 271 +++++++++
 .../org/apache/tajo/cli/tools/TajoAdmin.java    |   4 +-
 .../java/org/apache/tajo/cli/tsql/TajoCli.java  |   7 +-
 .../tsql/commands/ConnectDatabaseCommand.java   |   3 +-
 .../tajo/cli/tsql/commands/SetCommand.java      |   5 +-
 tajo-client/pom.xml                             |   4 +-
 .../apache/tajo/client/CatalogAdminClient.java  |  26 +-
 .../tajo/client/CatalogAdminClientImpl.java     |  91 ++-
 .../apache/tajo/client/ClientExceptionUtil.java | 106 ++++
 .../client/InvalidClientSessionException.java   |   9 +-
 .../org/apache/tajo/client/QueryClient.java     |  41 +-
 .../org/apache/tajo/client/QueryClientImpl.java |  83 ++-
 .../apache/tajo/client/SessionConnection.java   | 103 ++--
 .../org/apache/tajo/client/TajoClientImpl.java  |  46 +-
 .../org/apache/tajo/client/TajoClientUtil.java  |   2 +-
 .../apache/tajo/client/v2/ClientDelegate.java   |  41 ++
 .../tajo/client/v2/ClientDelegateFactory.java   |  42 ++
 .../org/apache/tajo/client/v2/ClientUtil.java   |  30 +
 .../apache/tajo/client/v2/FutureListener.java   |  25 +
 .../tajo/client/v2/LegacyClientDelegate.java    | 485 ++++++++++++++++
 .../org/apache/tajo/client/v2/QueryFuture.java  | 133 +++++
 .../org/apache/tajo/client/v2/QueryState.java   |  36 ++
 .../apache/tajo/client/v2/ServiceDiscovery.java |  28 +
 .../org/apache/tajo/client/v2/TajoClient.java   | 154 +++++
 .../v2/exception/ClientConnectionException.java |  28 +
 .../ClientUnableToConnectException.java         |  28 +
 .../org/apache/tajo/jdbc/FetchResultSet.java    |   2 +-
 .../java/org/apache/tajo/conf/TajoConf.java     |   4 +
 .../org/apache/tajo/datum/DatumFactory.java     |  80 +--
 .../exception/AmbiguousColumnException.java     |   9 +-
 .../apache/tajo/exception/ErrorMessages.java    |  11 +-
 .../NoSuchSessionVariableException.java         |  33 ++
 .../apache/tajo/exception/ReturnStateUtil.java  |   3 +-
 .../apache/tajo/exception/SQLExceptionUtil.java |  22 +-
 .../org/apache/tajo/exception/TajoError.java    |   7 +
 .../apache/tajo/exception/TajoException.java    |  11 +
 .../tajo/exception/TajoInternalError.java       |   6 +
 .../exception/UndefinedOperatorException.java   |   5 +
 .../tajo/exception/UnsupportedException.java    |   5 +
 .../java/org/apache/tajo/util/BytesUtils.java   |  19 +-
 .../java/org/apache/tajo/util/NumberUtil.java   | 565 +++++++++++++++++++
 tajo-common/src/main/proto/errors.proto         |   2 +
 tajo-core/pom.xml                               |   4 +-
 .../org/apache/tajo/engine/parser/SQLParser.g4  |   6 +-
 .../org/apache/tajo/benchmark/BenchmarkSet.java |   3 +-
 .../java/org/apache/tajo/benchmark/TPCH.java    |   5 +-
 .../apache/tajo/engine/parser/SQLAnalyzer.java  |  10 +-
 .../engine/planner/global/GlobalPlanner.java    | 107 ++--
 .../planner/physical/ColPartitionStoreExec.java |  44 +-
 .../org/apache/tajo/master/QueryManager.java    |  52 +-
 .../java/org/apache/tajo/master/TajoMaster.java |  46 +-
 .../tajo/master/TajoMasterClientService.java    |   5 +-
 .../tajo/master/exec/CreateTableExecutor.java   | 162 ++++++
 .../apache/tajo/master/exec/DDLExecutor.java    | 329 +++++------
 .../apache/tajo/master/exec/QueryExecutor.java  |   3 +-
 .../tajo/querymaster/DefaultTaskScheduler.java  |   9 +-
 .../java/org/apache/tajo/querymaster/Query.java |  42 +-
 .../java/org/apache/tajo/querymaster/Stage.java |  15 +
 .../apache/tajo/querymaster/TaskAttempt.java    |  18 +
 .../tajo/session/InvalidSessionException.java   |   7 +-
 .../apache/tajo/util/history/HistoryReader.java |  87 +--
 .../tajo/webapp/QueryExecutorServlet.java       |   2 +-
 .../java/org/apache/tajo/worker/TajoWorker.java |  54 +-
 .../apache/tajo/worker/TaskAttemptContext.java  |  19 +
 .../java/org/apache/tajo/worker/TaskImpl.java   |   4 +
 .../org/apache/tajo/worker/TaskManager.java     |   1 -
 tajo-core/src/main/proto/ResourceProtos.proto   |   1 +
 .../src/main/resources/webapps/admin/query.jsp  |   6 +-
 .../apache/tajo/LocalTajoTestingUtility.java    |   6 +-
 .../java/org/apache/tajo/QueryTestCaseBase.java |  10 +-
 .../org/apache/tajo/client/TestTajoClient.java  |  62 +-
 .../tajo/client/TestTajoClientFailures.java     |  16 +-
 .../apache/tajo/client/v2/TestTajoClientV2.java | 236 ++++++++
 .../engine/codegen/TestEvalCodeGenerator.java   |  23 +-
 .../apache/tajo/engine/eval/ExprTestBase.java   |  31 +-
 .../tajo/engine/eval/TestIntervalType.java      |   5 +-
 .../apache/tajo/engine/eval/TestPredicates.java |  39 +-
 .../tajo/engine/eval/TestSQLDateTimeTypes.java  |  11 +-
 .../tajo/engine/eval/TestSQLExpression.java     |  32 +-
 .../function/TestConditionalExpressions.java    |  11 +-
 .../engine/function/TestDateTimeFunctions.java  |  21 +-
 .../tajo/engine/function/TestJsonFunctions.java |   5 +-
 .../tajo/engine/function/TestMathFunctions.java |  49 +-
 .../function/TestPatternMatchingPredicates.java |  15 +-
 .../engine/function/TestPythonFunctions.java    |   5 +-
 .../TestStringOperatorsAndFunctions.java        |  77 ++-
 .../tajo/engine/parser/TestSQLAnalyzer.java     |  38 ++
 .../tajo/engine/query/TestAlterTable.java       |   3 +-
 .../apache/tajo/engine/query/TestIndexScan.java |   3 +-
 .../apache/tajo/engine/query/TestJoinQuery.java |   6 +-
 .../engine/query/TestSelectNestedRecord.java    |  40 +-
 .../tajo/engine/query/TestTablePartitions.java  | 130 ++++-
 .../java/org/apache/tajo/jdbc/TestTajoJdbc.java |  90 ---
 .../util/history/TestHistoryWriterReader.java   |  64 +++
 .../alter_table_add_partition2.sql              |   1 +
 .../alter_table_drop_partition2.sql             |   1 +
 .../TestSelectNestedRecord/sample0_ddl.sql      |   1 +
 .../TestSelectNestedRecord/testSelect0.sql      |   1 +
 .../default/alter_table_add_partition_5.sql     |   1 +
 .../default/alter_table_drop_partition_4.sql    |   1 +
 .../testInsertType1.result                      |   5 +
 .../testInsertType2.result                      |   5 +
 .../TestSelectNestedRecord/testSelect0.result   |   5 +
 .../testAlterTableAddDropPartition.result       |   2 +-
 .../testExecuteQueryAsync.result                |   7 +
 .../testExecuteQueryAsyncWithListener.result    |   2 +
 .../testExecuteQueryType1.result                |   7 +
 .../testExecuteQueryType2.result                |   4 +
 .../testExecuteQueryType3.result                |   4 +
 .../src/main/conf/catalog-site.xml.template     |   4 +-
 .../main/sphinx/sql_language/alter_table.rst    |   7 +-
 .../org/apache/tajo/jdbc/JdbcConnection.java    |  28 +-
 .../org/apache/tajo/jdbc/MetaDataTuple.java     |  17 +-
 .../org/apache/tajo/jdbc/TajoStatement.java     |  55 --
 .../org/apache/tajo/plan/LogicalPlanner.java    |  18 +-
 .../tajo/plan/expr/BasicEvalNodeVisitor.java    |   1 +
 .../tajo/plan/expr/SimpleEvalNodeVisitor.java   |   3 +-
 .../plan/function/stream/CSVLineSerializer.java |   1 -
 .../tajo/plan/logical/AlterTableNode.java       |  22 +-
 .../tajo/plan/nameresolver/NameResolver.java    |   6 +-
 .../plan/nameresolver/ResolverByLegacy.java     |   3 +-
 .../tajo/plan/nameresolver/ResolverByRels.java  |   4 +-
 .../nameresolver/ResolverByRelsAndSubExprs.java |   4 +-
 .../nameresolver/ResolverBySubExprsAndRels.java |   4 +-
 .../rewrite/rules/ProjectionPushDownRule.java   |  11 +-
 .../tajo/plan/serder/EvalNodeDeserializer.java  |   5 +-
 .../plan/serder/LogicalNodeDeserializer.java    |   3 +
 .../tajo/plan/verifier/VerificationState.java   |   6 +
 tajo-plan/src/main/proto/Plan.proto             |   2 +
 .../org/apache/tajo/storage/NullScanner.java    |   4 +-
 .../org/apache/tajo/storage/RowStoreUtil.java   |   2 +-
 .../org/apache/tajo/storage/Tablespace.java     |   3 +-
 .../apache/tajo/tuple/offheap/HeapTuple.java    |   2 -
 .../apache/tajo/tuple/offheap/UnSafeTuple.java  |   2 -
 .../tajo/storage/json/JsonLineDeserializer.java |  39 +-
 .../tajo/storage/json/JsonLineSerializer.java   | 148 ++---
 185 files changed, 5343 insertions(+), 1641 deletions(-)
----------------------------------------------------------------------



[33/39] tajo git commit: Basic pushdown to PostgreSQL has been completed.

Posted by hy...@apache.org.
http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-plan/src/main/java/org/apache/tajo/plan/expr/SimpleEvalNodeVisitor.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/SimpleEvalNodeVisitor.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/SimpleEvalNodeVisitor.java
index 9515fe8..6c49e32 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/SimpleEvalNodeVisitor.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/SimpleEvalNodeVisitor.java
@@ -20,7 +20,6 @@ package org.apache.tajo.plan.expr;
 
 import com.google.common.base.Preconditions;
 import org.apache.tajo.exception.TajoInternalError;
-import org.apache.tajo.exception.UnsupportedException;
 
 import java.util.Stack;
 
@@ -36,7 +35,7 @@ public abstract class SimpleEvalNodeVisitor<CONTEXT> {
     EvalNode result;
 
     if (evalNode instanceof UnaryEval) {
-      result = visitUnaryEval(context, stack, (UnaryEval) evalNode);
+      result = visitUnaryEval(context, (UnaryEval) evalNode, stack);
     } else if (evalNode instanceof BinaryEval) {
       result = visitBinaryEval(context, stack, (BinaryEval) evalNode);
     } else {
@@ -50,7 +49,7 @@ public abstract class SimpleEvalNodeVisitor<CONTEXT> {
         result = visitRowConstant(context, (RowConstantEval) evalNode, stack);
         break;
       case FIELD:
-        result = visitField(context, stack, (FieldEval) evalNode);
+        result = visitField(context, (FieldEval) evalNode, stack);
         break;
 
 
@@ -88,7 +87,7 @@ public abstract class SimpleEvalNodeVisitor<CONTEXT> {
     return result;
   }
 
-  protected EvalNode visitUnaryEval(CONTEXT context, Stack<EvalNode> stack, UnaryEval unaryEval) {
+  protected EvalNode visitUnaryEval(CONTEXT context, UnaryEval unaryEval, Stack<EvalNode> stack) {
     stack.push(unaryEval);
     visit(context, unaryEval.getChild(), stack);
     stack.pop();
@@ -126,7 +125,7 @@ public abstract class SimpleEvalNodeVisitor<CONTEXT> {
     return evalNode;
   }
 
-  protected EvalNode visitField(CONTEXT context, Stack<EvalNode> stack, FieldEval evalNode) {
+  protected EvalNode visitField(CONTEXT context, FieldEval evalNode, Stack<EvalNode> stack) {
     return evalNode;
   }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-plan/src/main/java/org/apache/tajo/plan/exprrewrite/rules/ConstantFolding.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/exprrewrite/rules/ConstantFolding.java b/tajo-plan/src/main/java/org/apache/tajo/plan/exprrewrite/rules/ConstantFolding.java
index eb546d1..b3fc019 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/exprrewrite/rules/ConstantFolding.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/exprrewrite/rules/ConstantFolding.java
@@ -64,7 +64,7 @@ public class ConstantFolding extends SimpleEvalNodeVisitor<LogicalPlanner.PlanCo
   }
 
   @Override
-  public EvalNode visitUnaryEval(LogicalPlanner.PlanContext context, Stack<EvalNode> stack, UnaryEval unaryEval) {
+  public EvalNode visitUnaryEval(LogicalPlanner.PlanContext context, UnaryEval unaryEval, Stack<EvalNode> stack) {
     stack.push(unaryEval);
     EvalNode child = visit(context, unaryEval.getChild(), stack);
     stack.pop();

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-plan/src/main/java/org/apache/tajo/plan/exprrewrite/rules/ConstantPropagation.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/exprrewrite/rules/ConstantPropagation.java b/tajo-plan/src/main/java/org/apache/tajo/plan/exprrewrite/rules/ConstantPropagation.java
index 6fe3b3e..24488bd 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/exprrewrite/rules/ConstantPropagation.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/exprrewrite/rules/ConstantPropagation.java
@@ -72,7 +72,7 @@ public class ConstantPropagation extends SimpleEvalNodeVisitor<LogicalPlanner.Pl
   }
 
   @Override
-  public EvalNode visitUnaryEval(LogicalPlanner.PlanContext context, Stack<EvalNode> stack, UnaryEval unaryEval) {
+  public EvalNode visitUnaryEval(LogicalPlanner.PlanContext context, UnaryEval unaryEval, Stack<EvalNode> stack) {
     stack.push(unaryEval);
 
     if (unaryEval.getChild().getType() == EvalType.FIELD) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ScanNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ScanNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ScanNode.java
index 8e369d6..f5e6b78 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ScanNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ScanNode.java
@@ -19,6 +19,7 @@
 package org.apache.tajo.plan.logical;
 
 import com.google.common.base.Objects;
+import com.google.common.base.Preconditions;
 import com.google.gson.annotations.Expose;
 import org.apache.tajo.catalog.CatalogUtil;
 import org.apache.tajo.catalog.Schema;
@@ -37,6 +38,7 @@ public class ScanNode extends RelationNode implements Projectable, SelectableNod
 	@Expose protected EvalNode qual;
 	@Expose protected Target[] targets;
   @Expose protected boolean broadcastTable;
+  @Expose protected long limit = -1; // -1 is infinite
 
   protected ScanNode(int pid, NodeType nodeType) {
     super(pid, nodeType);
@@ -150,6 +152,29 @@ public class ScanNode extends RelationNode implements Projectable, SelectableNod
 	  return this.targets;
 	}
 
+  /**
+   *
+   *
+   * @return
+   */
+  public boolean hasLimit() {
+    return limit > 0;
+  }
+
+  /**
+   * How many rows will be retrieved?
+   *
+   * @return The number of rows to be retrieved
+   */
+  public long getLimit() {
+    return limit;
+  }
+
+  public void setLimit(long num) {
+    Preconditions.checkArgument(num > 0, "The number of fetch rows in limit is negative");
+    this.limit = num;
+  }
+
   public TableDesc getTableDesc() {
     return tableDesc;
   }
@@ -249,9 +274,4 @@ public class ScanNode extends RelationNode implements Projectable, SelectableNod
 
     return planStr;
   }
-
-  public static boolean isScanNode(LogicalNode node) {
-    return node.getType() == NodeType.SCAN ||
-        node.getType() == NodeType.PARTITIONS_SCAN;
-  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/CommonConditionReduceRule.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/CommonConditionReduceRule.java b/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/CommonConditionReduceRule.java
index f66350a..5524256 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/CommonConditionReduceRule.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/CommonConditionReduceRule.java
@@ -111,7 +111,7 @@ public class CommonConditionReduceRule implements LogicalPlanRewriteRule {
     }
 
     @Override
-    protected EvalNode visitUnaryEval(Object context, Stack<EvalNode> stack, UnaryEval unaryEval) {
+    protected EvalNode visitUnaryEval(Object context, UnaryEval unaryEval, Stack<EvalNode> stack) {
       stack.push(unaryEval);
       EvalNode child = unaryEval.getChild();
       visit(context, child, stack);

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeSerializer.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeSerializer.java b/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeSerializer.java
index 7de0b05..fef1528 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeSerializer.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/serder/EvalNodeSerializer.java
@@ -102,9 +102,9 @@ public class EvalNodeSerializer
   }
 
   @Override
-  public EvalNode visitUnaryEval(EvalTreeProtoBuilderContext context, Stack<EvalNode> stack, UnaryEval unary) {
+  public EvalNode visitUnaryEval(EvalTreeProtoBuilderContext context, UnaryEval unary, Stack<EvalNode> stack) {
     // visiting and registering childs
-    super.visitUnaryEval(context, stack, unary);
+    super.visitUnaryEval(context, unary, stack);
     int [] childIds = registerGetChildIds(context, unary);
 
     // building itself
@@ -183,7 +183,7 @@ public class EvalNodeSerializer
   }
 
   @Override
-  public EvalNode visitField(EvalTreeProtoBuilderContext context, Stack<EvalNode> stack, FieldEval field) {
+  public EvalNode visitField(EvalTreeProtoBuilderContext context, FieldEval field, Stack<EvalNode> stack) {
     PlanProto.EvalNode.Builder builder = createEvalBuilder(context, field);
     builder.setField(field.getColumnRef().getProto());
     context.treeBuilder.addNodes(builder);

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java b/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java
index a9dca4c..6dd5a7f 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java
@@ -560,20 +560,6 @@ public class PlannerUtil {
     }
   }
 
-  /**
-   * fill targets with FieldEvals from a given schema
-   *
-   * @param schema  to be transformed to targets
-   * @param targets to be filled
-   */
-  public static void schemaToTargets(Schema schema, Target[] targets) {
-    FieldEval eval;
-    for (int i = 0; i < schema.size(); i++) {
-      eval = new FieldEval(schema.getColumn(i));
-      targets[i] = new Target(eval);
-    }
-  }
-
   public static Target[] schemaToTargets(Schema schema) {
     Target[] targets = new Target[schema.size()];
 
@@ -585,17 +571,6 @@ public class PlannerUtil {
     return targets;
   }
 
-  public static Target[] schemaToTargetsWithGeneratedFields(Schema schema) {
-    List<Target> targets = TUtil.newList();
-
-    FieldEval eval;
-    for (int i = 0; i < schema.size(); i++) {
-      eval = new FieldEval(schema.getColumn(i));
-      targets.add(new Target(eval));
-    }
-    return targets.toArray(new Target[targets.size()]);
-  }
-
   public static SortSpec[] schemaToSortSpecs(Schema schema) {
     return columnsToSortSpecs(schema.toArray());
   }
@@ -992,4 +967,14 @@ public class PlannerUtil {
     }
     return inSubqueries;
   }
+
+  public static int [] getTargetIds(Schema inputSchema, Column...targets) {
+    int [] targetIds = new int[targets.length];
+    for (int i = 0; i < targetIds.length; i++) {
+      targetIds[i] = inputSchema.getColumnId(targets[i].getQualifiedName());
+    }
+    Arrays.sort(targetIds);
+
+    return targetIds;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-plan/src/main/proto/Plan.proto
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/proto/Plan.proto b/tajo-plan/src/main/proto/Plan.proto
index da1e187..274e674 100644
--- a/tajo-plan/src/main/proto/Plan.proto
+++ b/tajo-plan/src/main/proto/Plan.proto
@@ -577,11 +577,12 @@ message EnforceProperty {
     SORTED_INPUT = 0;
     OUTPUT_DISTINCT = 1;
     GROUP_BY = 2;
-    JOIN = 3;
-    SORT = 4;
-    BROADCAST = 5;
-    COLUMN_PARTITION = 6;
+    JOIN    = 3;
+    SORT              = 4;
+    BROADCAST         = 5;
+    COLUMN_PARTITION  = 6;
     DISTINCT_GROUP_BY = 7;
+    STORAGE_PUSHDOWN  = 8;
   }
 
   // Identifies which field is filled in.
@@ -675,4 +676,8 @@ message DistinctGroupbyEnforcer {
   repeated SortSpecArray sortSpecArrays = 3;
   required bool isMultipleAggregation = 4 [default = false];
   optional MultipleAggregationStage multipleAggregationStage = 5;
+}
+
+message StoragePushdownEnforcer {
+  required int32 marker = 1;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/AbstractScanner.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/AbstractScanner.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/AbstractScanner.java
index c3dc959..cc8ad83 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/AbstractScanner.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/AbstractScanner.java
@@ -25,6 +25,7 @@ import org.apache.tajo.exception.NotImplementedException;
 import org.apache.tajo.exception.TajoRuntimeException;
 import org.apache.tajo.exception.UnsupportedException;
 import org.apache.tajo.plan.expr.EvalNode;
+import org.apache.tajo.plan.logical.LogicalNode;
 
 import java.io.IOException;
 
@@ -49,6 +50,11 @@ public abstract class AbstractScanner implements Scanner {
   }
 
   @Override
+  public void pushOperators(LogicalNode planPart) {
+    throw new TajoRuntimeException(new UnsupportedException());
+  }
+
+  @Override
   public boolean isProjectable() {
     throw new TajoRuntimeException(new NotImplementedException());
   }
@@ -69,6 +75,10 @@ public abstract class AbstractScanner implements Scanner {
   }
 
   @Override
+  public void setLimit(long num) {
+  }
+
+  @Override
   public boolean isSplittable() {
     throw new TajoRuntimeException(new NotImplementedException());
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/MergeScanner.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/MergeScanner.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/MergeScanner.java
index db64992..6b633bd 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/MergeScanner.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/MergeScanner.java
@@ -28,6 +28,7 @@ import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.exception.TajoRuntimeException;
 import org.apache.tajo.exception.UnsupportedException;
 import org.apache.tajo.plan.expr.EvalNode;
+import org.apache.tajo.plan.logical.LogicalNode;
 import org.apache.tajo.storage.fragment.Fragment;
 
 import java.io.IOException;
@@ -153,6 +154,11 @@ public class MergeScanner implements Scanner {
   }
 
   @Override
+  public void pushOperators(LogicalNode planPart) {
+    throw new TajoRuntimeException(new UnsupportedException());
+  }
+
+  @Override
   public boolean isProjectable() {
     return projectable;
   }
@@ -173,6 +179,11 @@ public class MergeScanner implements Scanner {
   }
 
   @Override
+  public void setLimit(long num) {
+    throw new TajoRuntimeException(new UnsupportedException());
+  }
+
+  @Override
   public Schema getSchema() {
     return schema;
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/NullScanner.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/NullScanner.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/NullScanner.java
index 9c025f7..a20adf7 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/NullScanner.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/NullScanner.java
@@ -26,6 +26,7 @@ import org.apache.tajo.catalog.statistics.TableStats;
 import org.apache.tajo.exception.TajoRuntimeException;
 import org.apache.tajo.exception.UnsupportedException;
 import org.apache.tajo.plan.expr.EvalNode;
+import org.apache.tajo.plan.logical.LogicalNode;
 import org.apache.tajo.storage.fragment.Fragment;
 
 import java.io.IOException;
@@ -73,6 +74,11 @@ public class NullScanner implements Scanner {
   }
 
   @Override
+  public void pushOperators(LogicalNode planPart) {
+    throw new TajoRuntimeException(new UnsupportedException());
+  }
+
+  @Override
   public boolean isProjectable() {
     return false;
   }
@@ -93,6 +99,11 @@ public class NullScanner implements Scanner {
   }
 
   @Override
+  public void setLimit(long num) {
+    throw new TajoRuntimeException(new UnsupportedException());
+  }
+
+  @Override
   public boolean isSplittable() {
     return true;
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/PlanPushable.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/PlanPushable.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/PlanPushable.java
new file mode 100644
index 0000000..7500e9a
--- /dev/null
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/PlanPushable.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage;
+
+import org.apache.tajo.catalog.Column;
+import org.apache.tajo.catalog.SchemaObject;
+import org.apache.tajo.catalog.statistics.TableStats;
+import org.apache.tajo.plan.expr.EvalNode;
+import org.apache.tajo.plan.logical.LogicalNode;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+/**
+ * Scanner Interface
+ */
+
+public interface PlanPushable {
+  void pushdown(LogicalNode pushed);
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Scanner.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Scanner.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Scanner.java
index 2fcb2fd..f421515 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Scanner.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Scanner.java
@@ -22,6 +22,7 @@ import org.apache.tajo.catalog.Column;
 import org.apache.tajo.catalog.SchemaObject;
 import org.apache.tajo.catalog.statistics.TableStats;
 import org.apache.tajo.plan.expr.EvalNode;
+import org.apache.tajo.plan.logical.LogicalNode;
 
 import java.io.Closeable;
 import java.io.IOException;
@@ -58,6 +59,11 @@ public interface Scanner extends SchemaObject, Closeable {
    */
   void close() throws IOException;
 
+  /**
+   *
+   * @param planPart
+   */
+  void pushOperators(LogicalNode planPart);
 
   /**
    * It returns if the projection is executed in the underlying scanner layer.
@@ -96,6 +102,15 @@ public interface Scanner extends SchemaObject, Closeable {
    */
   void setFilter(EvalNode filter);
 
+
+  /**
+   * This method does not guarantee that the scanner will retrieve the specified number of rows.
+   * This information is used for a hint.
+   *
+   * @param num The number of rows to be retrieved.
+   */
+  void setLimit(long num);
+
   /**
    * It returns if the file is splittable.
    *

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
index 83ae935..92d8b72 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
@@ -97,7 +97,7 @@ public abstract class Tablespace {
     return name + "=" + uri.toString();
   }
 
-  public abstract long getTableVolume(URI uri) throws IOException;
+  public abstract long getTableVolume(URI uri) throws UnsupportedException;
 
   /**
    * if {@link StorageProperty#isArbitraryPathAllowed} is true,
@@ -150,7 +150,7 @@ public abstract class Tablespace {
    * It is called by a Repartitioner for range shuffling when the SortRangeType of SortNode is USING_STORAGE_MANAGER.
    * In general Repartitioner determines the partition range using previous output statistics data.
    * In the special cases, such as HBase Repartitioner uses the result of this method.
-   *
+   *ã…‚                                               ã…‚
    * @param queryContext The current query context which contains query properties.
    * @param tableDesc The table description for the target data.
    * @param inputSchema The input schema
@@ -187,38 +187,18 @@ public abstract class Tablespace {
    * @param meta The table meta
    * @param schema The input schema
    * @param fragment The fragment for scanning
-   * @param target Columns which are selected.
-   * @return Scanner instance
-   * @throws java.io.IOException
-   */
-  public Scanner getScanner(TableMeta meta, Schema schema, FragmentProto fragment, Schema target) throws IOException {
-    return getScanner(meta, schema, FragmentConvertor.convert(conf, fragment), target);
-  }
-
-  /**
-   * Returns Scanner instance.
-   *
-   * @param meta The table meta
-   * @param schema The input schema
-   * @param fragment The fragment for scanning
-   * @return Scanner instance
-   * @throws java.io.IOException
-   */
-  public Scanner getScanner(TableMeta meta, Schema schema, Fragment fragment) throws IOException {
-    return getScanner(meta, schema, fragment, schema);
-  }
-
-  /**
-   * Returns Scanner instance.
-   *
-   * @param meta The table meta
-   * @param schema The input schema
-   * @param fragment The fragment for scanning
    * @param target The output schema
    * @return Scanner instance
    * @throws java.io.IOException
    */
-  public Scanner getScanner(TableMeta meta, Schema schema, Fragment fragment, Schema target) throws IOException {
+  public Scanner getScanner(TableMeta meta,
+                            Schema schema,
+                            Fragment fragment,
+                            @Nullable Schema target) throws IOException {
+    if (target == null) {
+      target = schema;
+    }
+
     if (fragment.isEmpty()) {
       Scanner scanner = new NullScanner(conf, schema, meta, fragment);
       scanner.setTarget(target.toArray());
@@ -255,7 +235,7 @@ public abstract class Tablespace {
    */
   public synchronized SeekableScanner getSeekableScanner(TableMeta meta, Schema schema, FragmentProto fragment,
                                                          Schema target) throws IOException {
-    return (SeekableScanner)this.getScanner(meta, schema, fragment, target);
+    return (SeekableScanner)this.getScanner(meta, schema, FragmentConvertor.convert(conf, fragment), target);
   }
 
   /**
@@ -405,4 +385,9 @@ public abstract class Tablespace {
   public MetadataProvider getMetadataProvider() {
     throw new TajoRuntimeException(new UnsupportedException("Linked Metadata Provider for " + name));
   }
+
+  @SuppressWarnings("unused")
+  public int markAccetablePlanPart(LogicalPlan plan) {
+    throw new TajoRuntimeException(new UnsupportedException());
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
index 17f03a0..e57dc3a 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,8 +33,9 @@ import org.apache.hadoop.fs.Path;
 import org.apache.tajo.TajoConstants;
 import org.apache.tajo.catalog.MetadataProvider;
 import org.apache.tajo.conf.TajoConf;
+import org.apache.tajo.exception.UnsupportedException;
 import org.apache.tajo.storage.fragment.Fragment;
-import org.apache.tajo.util.FileUtil;
+import org.apache.tajo.util.JavaResourceUtil;
 import org.apache.tajo.util.Pair;
 import org.apache.tajo.util.UriUtil;
 
@@ -75,13 +76,14 @@ public class TablespaceManager implements StorageService {
   protected static final Map<Class<?>, Constructor<?>> CONSTRUCTORS = Maps.newHashMap();
   protected static final Map<String, Class<? extends Tablespace>> TABLE_SPACE_HANDLERS = Maps.newHashMap();
 
-  public static final Class [] TABLESPACE_PARAM = new Class [] {String.class, URI.class, JSONObject.class};
+  public static final Class[] TABLESPACE_PARAM = new Class[]{String.class, URI.class, JSONObject.class};
 
   public static final String TABLESPACE_SPEC_CONFIGS_KEY = "configs";
 
   static {
     instance = new TablespaceManager();
   }
+
   /**
    * Singleton instance
    */
@@ -130,7 +132,7 @@ public class TablespaceManager implements StorageService {
   private JSONObject loadFromConfig(String fileName) {
     String json;
     try {
-      json = FileUtil.readTextFileFromResource(fileName);
+      json = JavaResourceUtil.readTextFromResource(fileName);
     } catch (IOException e) {
       throw new RuntimeException(e);
     }
@@ -182,7 +184,7 @@ public class TablespaceManager implements StorageService {
     String handlerClass = (String) storageDesc.get(KEY_STORAGE_HANDLER);
 
     return new Pair<String, Class<? extends Tablespace>>(
-        storageType,(Class<? extends Tablespace>) Class.forName(handlerClass));
+        storageType, (Class<? extends Tablespace>) Class.forName(handlerClass));
   }
 
   private void loadTableSpaces(JSONObject json, boolean override) {
@@ -339,7 +341,7 @@ public class TablespaceManager implements StorageService {
 
     // Find the longest matched one. For example, assume that the caller tries to find /x/y/z, and
     // there are /x and /x/y. In this case, /x/y will be chosen because it is more specific.
-    for (Map.Entry<URI, Tablespace> entry: TABLE_SPACES.headMap(URI.create(uri), true).entrySet()) {
+    for (Map.Entry<URI, Tablespace> entry : TABLE_SPACES.headMap(URI.create(uri), true).entrySet()) {
       if (uri.startsWith(entry.getKey().toString())) {
         lastOne = entry.getValue();
       }
@@ -401,6 +403,11 @@ public class TablespaceManager implements StorageService {
     return space.getTableUri(databaseName, tableName);
   }
 
+  @Override
+  public long getTableVolumn(URI tableUri) throws UnsupportedException {
+    return get(tableUri).get().getTableVolume(tableUri);
+  }
+
   public static Iterable<Tablespace> getAllTablespaces() {
     return TABLE_SPACES.values();
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/fragment/FragmentConvertor.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/fragment/FragmentConvertor.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/fragment/FragmentConvertor.java
index 07720c7..bd46551 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/fragment/FragmentConvertor.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/fragment/FragmentConvertor.java
@@ -23,6 +23,7 @@ import com.google.common.collect.Maps;
 import com.google.protobuf.ByteString;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.tajo.annotation.ThreadSafe;
+import org.apache.tajo.exception.TajoInternalError;
 
 import java.io.IOException;
 import java.lang.reflect.Constructor;
@@ -72,8 +73,8 @@ public class FragmentConvertor {
         CONSTRUCTOR_CACHE.put(clazz, constructor);
       }
       result = constructor.newInstance(new Object[]{fragment.getContents()});
-    } catch (Exception e) {
-      throw new RuntimeException(e);
+    } catch (Throwable e) {
+      throw new TajoInternalError(e);
     }
 
     return result;

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-common/src/main/resources/storage-default.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/resources/storage-default.xml b/tajo-storage/tajo-storage-common/src/main/resources/storage-default.xml
index dfdff85..35461fa 100644
--- a/tajo-storage/tajo-storage-common/src/main/resources/storage-default.xml
+++ b/tajo-storage/tajo-storage-common/src/main/resources/storage-default.xml
@@ -39,7 +39,7 @@
   <!--- Registered Scanner Handler -->
   <property>
     <name>tajo.storage.scanner-handler</name>
-    <value>text,json,raw,rcfile,row,parquet,orc,sequencefile,avro,hbase</value>
+    <value>text,json,raw,rcfile,row,parquet,orc,sequencefile,avro,hbase,jdbc</value>
   </property>
 
   <!--- Fragment Class Configurations -->
@@ -83,6 +83,10 @@
     <name>tajo.storage.fragment.hbase.class</name>
     <value>org.apache.tajo.storage.hbase.HBaseFragment</value>
   </property>
+  <property>
+    <name>tajo.storage.fragment.jdbc.class</name>
+    <value>org.apache.tajo.storage.jdbc.JdbcFragment</value>
+  </property>
 
   <!--- Scanner Handler -->
   <property>

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-common/src/test/resources/storage-default.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/test/resources/storage-default.xml b/tajo-storage/tajo-storage-common/src/test/resources/storage-default.xml
index f637da0..c57a67a 100644
--- a/tajo-storage/tajo-storage-common/src/test/resources/storage-default.xml
+++ b/tajo-storage/tajo-storage-common/src/test/resources/storage-default.xml
@@ -82,6 +82,10 @@
     <name>tajo.storage.fragment.hbase.class</name>
     <value>org.apache.tajo.storage.hbase.HBaseFragment</value>
   </property>
+  <property>
+    <name>tajo.storage.fragment.jdbc.class</name>
+    <value>org.apache.tajo.storage.jdbc.JdbcFragment</value>
+  </property>
 
   <!--- Scanner Handler -->
   <property>

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseScanner.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseScanner.java b/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseScanner.java
index 7fc6d2a..90f7aa0 100644
--- a/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseScanner.java
+++ b/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseScanner.java
@@ -38,6 +38,7 @@ import org.apache.tajo.datum.NullDatum;
 import org.apache.tajo.datum.TextDatum;
 import org.apache.tajo.exception.*;
 import org.apache.tajo.plan.expr.EvalNode;
+import org.apache.tajo.plan.logical.LogicalNode;
 import org.apache.tajo.storage.*;
 import org.apache.tajo.storage.fragment.Fragment;
 import org.apache.tajo.util.BytesUtils;
@@ -415,6 +416,11 @@ public class HBaseScanner implements Scanner {
   }
 
   @Override
+  public void pushOperators(LogicalNode planPart) {
+    throw new TajoRuntimeException(new UnsupportedException());
+  }
+
+  @Override
   public boolean isProjectable() {
     return true;
   }
@@ -438,6 +444,10 @@ public class HBaseScanner implements Scanner {
   }
 
   @Override
+  public void setLimit(long num) {
+  }
+
+  @Override
   public boolean isSplittable() {
     return true;
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java b/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java
index 330522b..0064be4 100644
--- a/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java
+++ b/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java
@@ -44,10 +44,7 @@ import org.apache.tajo.common.TajoDataTypes.Type;
 import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.datum.Datum;
 import org.apache.tajo.datum.TextDatum;
-import org.apache.tajo.exception.DataTypeMismatchException;
-import org.apache.tajo.exception.InvalidTablePropertyException;
-import org.apache.tajo.exception.MissingTablePropertyException;
-import org.apache.tajo.exception.TajoException;
+import org.apache.tajo.exception.*;
 import org.apache.tajo.plan.LogicalPlan;
 import org.apache.tajo.plan.expr.*;
 import org.apache.tajo.plan.logical.CreateTableNode;
@@ -102,8 +99,8 @@ public class HBaseTablespace extends Tablespace {
   }
 
   @Override
-  public long getTableVolume(URI uri) throws IOException {
-    return 0;
+  public long getTableVolume(URI uri) throws UnsupportedException {
+    throw new UnsupportedException();
   }
 
   @Override
@@ -738,8 +735,6 @@ public class HBaseTablespace extends Tablespace {
 
   public List<Set<EvalNode>> findIndexablePredicateSet(@Nullable EvalNode qual,
                                                        Column[] indexableColumns) throws IOException {
-    Preconditions.checkNotNull(qual);
-
     List<Set<EvalNode>> indexablePredicateList = new ArrayList<Set<EvalNode>>();
 
     // if a query statement has a search condition, try to find indexable predicates

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileScanner.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileScanner.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileScanner.java
index 8844fa5..33f1d04 100644
--- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileScanner.java
+++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileScanner.java
@@ -29,6 +29,9 @@ import org.apache.tajo.catalog.TableMeta;
 import org.apache.tajo.catalog.statistics.ColumnStats;
 import org.apache.tajo.catalog.statistics.TableStats;
 import org.apache.tajo.conf.TajoConf;
+import org.apache.tajo.exception.TajoRuntimeException;
+import org.apache.tajo.exception.UnsupportedException;
+import org.apache.tajo.plan.logical.LogicalNode;
 import org.apache.tajo.storage.fragment.FileFragment;
 import org.apache.tajo.storage.fragment.Fragment;
 
@@ -82,6 +85,11 @@ public abstract class FileScanner implements Scanner {
   }
 
   @Override
+  public void pushOperators(LogicalNode planPart) {
+    throw new TajoRuntimeException(new UnsupportedException());
+  }
+
+  @Override
   public void setTarget(Column[] targets) {
     if (inited) {
       throw new IllegalStateException("Should be called before init()");
@@ -89,6 +97,10 @@ public abstract class FileScanner implements Scanner {
     this.targets = targets;
   }
 
+  @Override
+  public void setLimit(long num) {
+  }
+
   public static FileSystem getFileSystem(TajoConf tajoConf, Path path) throws IOException {
     String tajoUser = tajoConf.getVar(TajoConf.ConfVars.USERNAME);
     FileSystem fs;

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
index bcc0c88..9f29c34 100644
--- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
+++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
@@ -35,6 +35,8 @@ import org.apache.tajo.*;
 import org.apache.tajo.catalog.*;
 import org.apache.tajo.catalog.statistics.TableStats;
 import org.apache.tajo.conf.TajoConf;
+import org.apache.tajo.exception.TajoInternalError;
+import org.apache.tajo.exception.UnsupportedException;
 import org.apache.tajo.plan.LogicalPlan;
 import org.apache.tajo.plan.expr.EvalNode;
 import org.apache.tajo.plan.logical.LogicalNode;
@@ -126,9 +128,14 @@ public class FileTablespace extends Tablespace {
   }
 
   @Override
-  public long getTableVolume(URI uri) throws IOException {
+  public long getTableVolume(URI uri) throws UnsupportedException {
     Path path = new Path(uri);
-    ContentSummary summary = fs.getContentSummary(path);
+    ContentSummary summary;
+    try {
+      summary = fs.getContentSummary(path);
+    } catch (IOException e) {
+      throw new TajoInternalError(e);
+    }
     return summary.getLength();
   }
 
@@ -146,7 +153,7 @@ public class FileTablespace extends Tablespace {
   public Scanner getFileScanner(TableMeta meta, Schema schema, Path path, FileStatus status)
       throws IOException {
     Fragment fragment = new FileFragment(path.getName(), path, 0, status.getLen());
-    return getScanner(meta, schema, fragment);
+    return getScanner(meta, schema, fragment, null);
   }
 
   public FileSystem getFileSystem() {

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/text/CSVLineDeserializer.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/text/CSVLineDeserializer.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/text/CSVLineDeserializer.java
index eabab22..76c9362 100644
--- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/text/CSVLineDeserializer.java
+++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/text/CSVLineDeserializer.java
@@ -25,6 +25,7 @@ import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.catalog.TableMeta;
 import org.apache.tajo.datum.Datum;
 import org.apache.tajo.datum.NullDatum;
+import org.apache.tajo.plan.util.PlannerUtil;
 import org.apache.tajo.storage.FieldSerializerDeserializer;
 import org.apache.tajo.storage.Tuple;
 
@@ -41,12 +42,7 @@ public class CSVLineDeserializer extends TextLineDeserializer {
 
   public CSVLineDeserializer(Schema schema, TableMeta meta, Column [] projected) {
     super(schema, meta);
-
-    targetColumnIndexes = new int[projected.length];
-    for (int i = 0; i < projected.length; i++) {
-      targetColumnIndexes[i] = schema.getColumnId(projected[i].getQualifiedName());
-    }
-    Arrays.sort(targetColumnIndexes);
+    targetColumnIndexes = PlannerUtil.getTargetIds(schema, projected);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestDelimitedTextFile.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestDelimitedTextFile.java b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestDelimitedTextFile.java
index 90bec65..5f8a4d1 100644
--- a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestDelimitedTextFile.java
+++ b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestDelimitedTextFile.java
@@ -106,7 +106,7 @@ public class TestDelimitedTextFile {
     TableMeta meta = CatalogUtil.newTableMeta("JSON");
     meta.putOption(StorageUtil.TEXT_ERROR_TOLERANCE_MAXNUM, "-1");
     FileFragment fragment =  getFileFragment("testErrorTolerance1.json");
-    Scanner scanner =  TablespaceManager.getLocalFs().getScanner(meta, schema, fragment);
+    Scanner scanner =  TablespaceManager.getLocalFs().getScanner(meta, schema, fragment, null);
     scanner.init();
 
     Tuple tuple;
@@ -128,7 +128,7 @@ public class TestDelimitedTextFile {
     TableMeta meta = CatalogUtil.newTableMeta("JSON");
     meta.putOption(StorageUtil.TEXT_ERROR_TOLERANCE_MAXNUM, "1");
     FileFragment fragment =  getFileFragment("testErrorTolerance1.json");
-    Scanner scanner =  TablespaceManager.getLocalFs().getScanner(meta, schema, fragment);
+    Scanner scanner =  TablespaceManager.getLocalFs().getScanner(meta, schema, fragment, null);
     scanner.init();
 
     assertNotNull(scanner.next());
@@ -150,7 +150,7 @@ public class TestDelimitedTextFile {
     TableMeta meta = CatalogUtil.newTableMeta("JSON");
     meta.putOption(StorageUtil.TEXT_ERROR_TOLERANCE_MAXNUM, "0");
     FileFragment fragment =  getFileFragment("testErrorTolerance2.json");
-    Scanner scanner =  TablespaceManager.getLocalFs().getScanner(meta, schema, fragment);
+    Scanner scanner =  TablespaceManager.getLocalFs().getScanner(meta, schema, fragment, null);
     scanner.init();
 
     try {
@@ -169,7 +169,7 @@ public class TestDelimitedTextFile {
     TableMeta meta = CatalogUtil.newTableMeta("JSON");
     meta.putOption(StorageUtil.TEXT_ERROR_TOLERANCE_MAXNUM, "1");
     FileFragment fragment = getFileFragment("testErrorTolerance3.json");
-    Scanner scanner = TablespaceManager.getLocalFs().getScanner(meta, schema, fragment);
+    Scanner scanner = TablespaceManager.getLocalFs().getScanner(meta, schema, fragment, null);
     scanner.init();
 
     try {
@@ -185,7 +185,7 @@ public class TestDelimitedTextFile {
     TableMeta meta = CatalogUtil.newTableMeta("JSON");
     meta.putOption(StorageConstants.TEXT_SKIP_HEADER_LINE, "2");
     FileFragment fragment = getFileFragment("testNormal.json");
-    Scanner scanner = TablespaceManager.getLocalFs().getScanner(meta, schema, fragment);
+    Scanner scanner = TablespaceManager.getLocalFs().getScanner(meta, schema, fragment, null);
 
     scanner.init();
 
@@ -212,7 +212,7 @@ public class TestDelimitedTextFile {
     meta.putOption(StorageConstants.TEXT_SKIP_HEADER_LINE, "1");
     meta.putOption(StorageConstants.TEXT_DELIMITER, ",");
     FileFragment fragment = getFileFragment("testSkip.txt");
-    Scanner scanner = TablespaceManager.getLocalFs().getScanner(meta, schema, fragment);
+    Scanner scanner = TablespaceManager.getLocalFs().getScanner(meta, schema, fragment, null);
     
     scanner.init();
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestLineReader.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestLineReader.java b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestLineReader.java
index 21fff58..b800ed2 100644
--- a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestLineReader.java
+++ b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestLineReader.java
@@ -38,6 +38,7 @@ import org.apache.tajo.storage.text.DelimitedLineReader;
 import org.apache.tajo.storage.text.DelimitedTextFile;
 import org.apache.tajo.util.CommonTestingUtil;
 import org.apache.tajo.util.FileUtil;
+import org.apache.tajo.util.JavaResourceUtil;
 import org.junit.Test;
 
 import java.io.File;
@@ -213,7 +214,7 @@ public class TestLineReader {
 
   @Test
   public void testByteBufLineReaderWithoutTerminating() throws IOException {
-    String path = FileUtil.getResourcePath("dataset/testLineText.txt").getFile();
+    String path = JavaResourceUtil.getResourceURL("dataset/testLineText.txt").getFile();
     File file = new File(path);
     String data = FileUtil.readTextFile(file);
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestStorages.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestStorages.java b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestStorages.java
index afe0f13..9c194b2 100644
--- a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestStorages.java
+++ b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestStorages.java
@@ -42,7 +42,7 @@ import org.apache.tajo.storage.fragment.FileFragment;
 import org.apache.tajo.storage.rcfile.RCFile;
 import org.apache.tajo.storage.sequencefile.SequenceFileScanner;
 import org.apache.tajo.util.CommonTestingUtil;
-import org.apache.tajo.util.FileUtil;
+import org.apache.tajo.util.JavaResourceUtil;
 import org.apache.tajo.util.KeyValueSet;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -342,7 +342,7 @@ public class TestStorages {
     TableMeta meta = CatalogUtil.newTableMeta(storeType, options);
     meta.setOptions(CatalogUtil.newDefaultProperty(storeType));
     if (storeType.equalsIgnoreCase("AVRO")) {
-      String path = FileUtil.getResourcePath("dataset/testVariousTypes.avsc").toString();
+      String path = JavaResourceUtil.getResourceURL("dataset/testVariousTypes.avsc").toString();
       meta.putOption(StorageConstants.AVRO_SCHEMA_URL, path);
     }
 
@@ -379,7 +379,7 @@ public class TestStorages {
 
     FileStatus status = fs.getFileStatus(tablePath);
     FileFragment fragment = new FileFragment("table", tablePath, 0, status.getLen());
-    Scanner scanner =  sm.getScanner(meta, schema, fragment);
+    Scanner scanner =  sm.getScanner(meta, schema, fragment, null);
     scanner.init();
 
     Tuple retrieved;
@@ -468,7 +468,7 @@ public class TestStorages {
 
     FileStatus status = fs.getFileStatus(tablePath);
     FileFragment fragment = new FileFragment("table", tablePath, 0, status.getLen());
-    Scanner scanner = TablespaceManager.getLocalFs().getScanner(meta, schema, fragment);
+    Scanner scanner = TablespaceManager.getLocalFs().getScanner(meta, schema, fragment, null);
     scanner.init();
 
     Tuple retrieved;
@@ -543,7 +543,7 @@ public class TestStorages {
     assertEquals(appender.getStats().getNumBytes().longValue(), status.getLen());
 
     FileFragment fragment = new FileFragment("table", tablePath, 0, status.getLen());
-    Scanner scanner =  TablespaceManager.getLocalFs().getScanner(meta, schema, fragment);
+    Scanner scanner =  TablespaceManager.getLocalFs().getScanner(meta, schema, fragment, null);
     scanner.init();
 
     Tuple retrieved;
@@ -612,7 +612,7 @@ public class TestStorages {
     assertEquals(appender.getStats().getNumBytes().longValue(), status.getLen());
 
     FileFragment fragment = new FileFragment("table", tablePath, 0, status.getLen());
-    Scanner scanner =  TablespaceManager.getLocalFs().getScanner(meta, schema, fragment);
+    Scanner scanner =  TablespaceManager.getLocalFs().getScanner(meta, schema, fragment, null);
     scanner.init();
 
     Tuple retrieved;
@@ -681,7 +681,7 @@ public class TestStorages {
     assertEquals(appender.getStats().getNumBytes().longValue(), status.getLen());
 
     FileFragment fragment = new FileFragment("table", tablePath, 0, status.getLen());
-    Scanner scanner =  TablespaceManager.getLocalFs().getScanner(meta, schema, fragment);
+    Scanner scanner =  TablespaceManager.getLocalFs().getScanner(meta, schema, fragment, null);
     scanner.init();
 
     assertTrue(scanner instanceof SequenceFileScanner);
@@ -755,7 +755,7 @@ public class TestStorages {
     assertEquals(appender.getStats().getNumBytes().longValue(), status.getLen());
 
     FileFragment fragment = new FileFragment("table", tablePath, 0, status.getLen());
-    Scanner scanner = TablespaceManager.getLocalFs().getScanner(meta, schema, fragment);
+    Scanner scanner = TablespaceManager.getLocalFs().getScanner(meta, schema, fragment, null);
     scanner.init();
 
     assertTrue(scanner instanceof SequenceFileScanner);
@@ -800,7 +800,7 @@ public class TestStorages {
 
       FileStatus status = fs.getFileStatus(tablePath);
       FileFragment fragment = new FileFragment("table", tablePath, 0, status.getLen());
-      Scanner scanner = TablespaceManager.getLocalFs().getScanner(meta, schema, fragment);
+      Scanner scanner = TablespaceManager.getLocalFs().getScanner(meta, schema, fragment, null);
       scanner.init();
 
       Tuple retrieved;
@@ -936,7 +936,7 @@ public class TestStorages {
 
     FileStatus status = fs.getFileStatus(tablePath);
     FileFragment fragment = new FileFragment("table", tablePath, 0, status.getLen());
-    Scanner scanner = sm.getScanner(meta, schema, fragment);
+    Scanner scanner = sm.getScanner(meta, schema, fragment, null);
     scanner.init();
 
     Tuple retrieved;
@@ -997,7 +997,7 @@ public class TestStorages {
     inSchema.addColumn("col5", Type.INT8);
 
     FileFragment fragment = new FileFragment("table", tablePath, 0, status.getLen());
-    Scanner scanner = TablespaceManager.getLocalFs().getScanner(meta, inSchema, fragment);
+    Scanner scanner = TablespaceManager.getLocalFs().getScanner(meta, inSchema, fragment, null);
 
     Schema target = new Schema();
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/avro/TestAvroUtil.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/avro/TestAvroUtil.java b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/avro/TestAvroUtil.java
index 341cc07..960448c 100644
--- a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/avro/TestAvroUtil.java
+++ b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/avro/TestAvroUtil.java
@@ -25,6 +25,7 @@ import org.apache.tajo.catalog.TableMeta;
 import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.storage.StorageConstants;
 import org.apache.tajo.util.FileUtil;
+import org.apache.tajo.util.JavaResourceUtil;
 import org.apache.tajo.util.NetUtils;
 import org.junit.Before;
 import org.junit.Test;
@@ -46,7 +47,7 @@ public class TestAvroUtil {
 
   @Before
   public void setUp() throws Exception {
-    schemaUrl = FileUtil.getResourcePath("dataset/testVariousTypes.avsc");
+    schemaUrl = JavaResourceUtil.getResourceURL("dataset/testVariousTypes.avsc");
     assertNotNull(schemaUrl);
 
     File file = new File(schemaUrl.getPath());

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/json/TestJsonSerDe.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/json/TestJsonSerDe.java b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/json/TestJsonSerDe.java
index 88d7536..75e59da 100644
--- a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/json/TestJsonSerDe.java
+++ b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/json/TestJsonSerDe.java
@@ -69,7 +69,7 @@ public class TestJsonSerDe {
     FileSystem fs = FileSystem.getLocal(conf);
     FileStatus status = fs.getFileStatus(tablePath);
     FileFragment fragment = new FileFragment("table", tablePath, 0, status.getLen());
-    Scanner scanner =  TablespaceManager.getLocalFs().getScanner(meta, schema, fragment);
+    Scanner scanner =  TablespaceManager.getLocalFs().getScanner(meta, schema, fragment, null);
     scanner.init();
 
     Tuple tuple = scanner.next();
@@ -108,7 +108,7 @@ public class TestJsonSerDe {
     schema.addColumn("col1", TajoDataTypes.Type.TEXT);
     schema.addColumn("col2", TajoDataTypes.Type.TEXT);
     schema.addColumn("col3", TajoDataTypes.Type.TEXT);
-    Scanner scanner =  TablespaceManager.getLocalFs().getScanner(meta, schema, fragment);
+    Scanner scanner =  TablespaceManager.getLocalFs().getScanner(meta, schema, fragment, null);
     scanner.init();
 
     Tuple tuple = scanner.next();

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/ConnectionInfo.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/ConnectionInfo.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/ConnectionInfo.java
index 9a42b0d..57b0825 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/ConnectionInfo.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/ConnectionInfo.java
@@ -1,4 +1,4 @@
-/*
+/**
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcFragment.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcFragment.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcFragment.java
index 2fc42b7..e8a18fc 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcFragment.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcFragment.java
@@ -60,20 +60,8 @@ public class JdbcFragment implements Fragment, Comparable<JdbcFragment>, Cloneab
     return inputSourceId;
   }
 
-  @Override
-  public CatalogProtos.FragmentProto getProto() {
-    JdbcFragmentProto.Builder builder = JdbcFragmentProto.newBuilder();
-    builder.setInputSourceId(this.inputSourceId);
-    builder.setUri(this.uri);
-    if(hostNames != null) {
-      builder.addAllHosts(TUtil.newList(hostNames));
-    }
-
-    CatalogProtos.FragmentProto.Builder fragmentBuilder = CatalogProtos.FragmentProto.newBuilder();
-    fragmentBuilder.setId(this.inputSourceId);
-    fragmentBuilder.setStoreType(BuiltinStorages.TEXT);
-    fragmentBuilder.setContents(builder.buildPartial().toByteString());
-    return fragmentBuilder.build();
+  public String getUri() {
+    return uri;
   }
 
   @Override
@@ -97,6 +85,22 @@ public class JdbcFragment implements Fragment, Comparable<JdbcFragment>, Cloneab
   }
 
   @Override
+  public CatalogProtos.FragmentProto getProto() {
+    JdbcFragmentProto.Builder builder = JdbcFragmentProto.newBuilder();
+    builder.setInputSourceId(this.inputSourceId);
+    builder.setUri(this.uri);
+    if(hostNames != null) {
+      builder.addAllHosts(TUtil.newList(hostNames));
+    }
+
+    CatalogProtos.FragmentProto.Builder fragmentBuilder = CatalogProtos.FragmentProto.newBuilder();
+    fragmentBuilder.setId(this.inputSourceId);
+    fragmentBuilder.setStoreType("JDBC");
+    fragmentBuilder.setContents(builder.buildPartial().toByteString());
+    return fragmentBuilder.build();
+  }
+
+  @Override
   public int compareTo(JdbcFragment o) {
     return this.uri.compareTo(o.uri);
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
index 7f63c66..f623f14 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
@@ -24,6 +24,7 @@ import com.google.common.collect.Lists;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.tajo.catalog.*;
+import org.apache.tajo.catalog.statistics.TableStats;
 import org.apache.tajo.common.TajoDataTypes.Type;
 import org.apache.tajo.exception.*;
 import org.apache.tajo.util.KeyValueSet;
@@ -187,7 +188,7 @@ public abstract class JdbcMetadataProviderBase implements MetadataProvider {
       // get columns
       resultForColumns = connection.getMetaData().getColumns(databaseName, schemaName, tableName, null);
 
-      List<Pair<Integer, Column>> columns = Lists.newArrayList();
+      final List<Pair<Integer, Column>> columns = Lists.newArrayList();
 
       while(resultForColumns.next()) {
         final int ordinalPos = resultForColumns.getInt("ORDINAL_POSITION");
@@ -208,19 +209,27 @@ public abstract class JdbcMetadataProviderBase implements MetadataProvider {
       });
 
       // transform the pair list into collection for columns
-      Schema schema = new Schema(Collections2.transform(columns, new Function<Pair<Integer,Column>, Column>() {
+      final Schema schema = new Schema(Collections2.transform(columns, new Function<Pair<Integer,Column>, Column>() {
         @Override
         public Column apply(@Nullable Pair<Integer, Column> columnPair) {
           return columnPair.getSecond();
         }
       }));
 
-      return new TableDesc(
+
+      // fill the table stats
+      final TableStats stats = new TableStats();
+      stats.setNumRows(-1); // unknown
+
+      final TableDesc table = new TableDesc(
           CatalogUtil.buildFQName(databaseName, name),
           schema,
           new TableMeta("rowstore", new KeyValueSet()),
           space.getTableUri(databaseName, name)
       );
+      table.setStats(stats);
+
+      return table;
 
     } catch (SQLException e) {
       throw new TajoInternalError(e);

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcScanner.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcScanner.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcScanner.java
new file mode 100644
index 0000000..897f6c5
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcScanner.java
@@ -0,0 +1,310 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+import com.google.common.base.Preconditions;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.tajo.catalog.Column;
+import org.apache.tajo.catalog.Schema;
+import org.apache.tajo.catalog.TableMeta;
+import org.apache.tajo.catalog.statistics.TableStats;
+import org.apache.tajo.datum.DatumFactory;
+import org.apache.tajo.exception.TajoInternalError;
+import org.apache.tajo.exception.TajoRuntimeException;
+import org.apache.tajo.exception.UnsupportedDataTypeException;
+import org.apache.tajo.exception.UnsupportedException;
+import org.apache.tajo.plan.expr.EvalNode;
+import org.apache.tajo.plan.logical.LogicalNode;
+import org.apache.tajo.storage.Scanner;
+import org.apache.tajo.storage.Tuple;
+import org.apache.tajo.storage.VTuple;
+import org.apache.tajo.util.datetime.DateTimeUtil;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.sql.*;
+import java.util.Iterator;
+
+public abstract class JdbcScanner implements Scanner {
+  private static final Log LOG = LogFactory.getLog(JdbcScanner.class);
+
+  protected final DatabaseMetaData dbMetaData;
+  protected final String tableName;
+  protected final Schema schema;
+  protected final TableMeta tableMeta;
+  protected final JdbcFragment fragment;
+  protected final TableStats stats;
+  protected final SQLBuilder builder;
+
+  protected Column [] targets;
+  protected EvalNode filter;
+  protected Long limit;
+  protected LogicalNode planPart;
+  protected VTuple outTuple;
+  protected String generatedSql;
+  protected ResultSetIterator iter;
+
+  public JdbcScanner(final DatabaseMetaData dbMetaData,
+                     final Schema tableSchema,
+                     final TableMeta tableMeta,
+                     final JdbcFragment fragment) {
+
+    Preconditions.checkNotNull(dbMetaData);
+    Preconditions.checkNotNull(tableSchema);
+    Preconditions.checkNotNull(tableMeta);
+    Preconditions.checkNotNull(fragment);
+
+    this.dbMetaData = dbMetaData;
+    this.tableName = ConnectionInfo.fromURI(fragment.getUri()).tableName;
+    this.schema = tableSchema;
+    this.tableMeta = tableMeta;
+    this.fragment = fragment;
+    this.stats = new TableStats();
+    builder = getSQLBuilder(getSQLExprBuilder());
+  }
+
+  @Override
+  public void init() throws IOException {
+    if (targets == null) {
+      targets = schema.toArray();
+    }
+    outTuple = new VTuple(targets.length);
+
+    if (planPart == null) {
+      generatedSql = builder.build(tableName, targets, filter, limit);
+    } else {
+      generatedSql = builder.build(planPart);
+    }
+  }
+
+  @Override
+  public Tuple next() throws IOException {
+    if (iter == null) {
+      iter = executeQueryAndGetIter();
+    }
+
+    if (iter.hasNext()) {
+      return iter.next();
+    } else {
+      return null;
+    }
+  }
+
+  @Override
+  public void reset() throws IOException {
+    if (iter != null) {
+      iter.rewind();
+    }
+  }
+
+  @Override
+  public void close() throws IOException {
+    if (iter != null) {
+      iter.close();
+    }
+  }
+
+  @Override
+  public void pushOperators(LogicalNode planPart) {
+    this.planPart = planPart;
+  }
+
+
+  @Override
+  public boolean isProjectable() {
+    return true;
+  }
+
+  @Override
+  public void setTarget(Column [] targets) {
+    this.targets = targets;
+  }
+
+  @Override
+  public boolean isSelectable() {
+    return true;
+  }
+
+  @Override
+  public void setFilter(EvalNode filter) {
+    this.filter = filter;
+  }
+
+  @Override
+  public void setLimit(long num) {
+    this.limit = num;
+  }
+
+  @Override
+  public boolean isSplittable() {
+    return false;
+  }
+
+  @Override
+  public float getProgress() {
+    return 0;
+  }
+
+  @Override
+  public TableStats getInputStats() {
+    return stats;
+  }
+
+  @Override
+  public Schema getSchema() {
+    return schema;
+  }
+
+  protected SQLBuilder getSQLBuilder(SQLExpressionGenerator exprBuilder) {
+    return new SQLBuilder(dbMetaData, getSQLExprBuilder());
+  }
+  protected SQLExpressionGenerator getSQLExprBuilder() {
+    return new SQLExpressionGenerator(dbMetaData);
+  }
+
+  protected void convertTuple(ResultSet resultSet, VTuple tuple) {
+    try {
+      for (int column_idx = 0; column_idx < targets.length; column_idx++) {
+        final Column c = targets[column_idx];
+        final int resultIdx = column_idx + 1;
+
+        switch (c.getDataType().getType()) {
+        case INT1:
+        case INT2:
+          tuple.put(column_idx, DatumFactory.createInt2(resultSet.getShort(resultIdx)));
+          break;
+        case INT4:
+          tuple.put(column_idx, DatumFactory.createInt4(resultSet.getInt(resultIdx)));
+          break;
+        case INT8:
+          tuple.put(column_idx, DatumFactory.createInt8(resultSet.getLong(resultIdx)));
+          break;
+        case FLOAT4:
+          tuple.put(column_idx, DatumFactory.createFloat4(resultSet.getFloat(resultIdx)));
+          break;
+        case FLOAT8:
+          tuple.put(column_idx, DatumFactory.createFloat8(resultSet.getDouble(resultIdx)));
+          break;
+        case CHAR:
+        case VARCHAR:
+        case TEXT:
+          tuple.put(column_idx, DatumFactory.createText(resultSet.getString(resultIdx)));
+          break;
+        case DATE:
+          Date date = resultSet.getDate(resultIdx);
+          tuple.put(column_idx, DatumFactory.createDate(date.getYear(), date.getMonth(), date.getDay()));
+          break;
+        case TIME:
+          tuple.put(column_idx, DatumFactory.createTime(resultSet.getTime(resultIdx).getTime()));
+          break;
+        case TIMESTAMP:
+          tuple.put(column_idx,
+              DatumFactory.createTimestamp(DateTimeUtil.javaTimeToJulianTime(resultSet.getTime(resultIdx).getTime())));
+          break;
+        case BINARY:
+        case VARBINARY:
+        case BLOB:
+          tuple.put(column_idx,
+              DatumFactory.createBlob(resultSet.getBytes(resultIdx)));
+          break;
+        default:
+          throw new TajoInternalError(new UnsupportedDataTypeException(c.getDataType().getType().name()));
+        }
+      }
+    } catch (SQLException s) {
+      throw new TajoInternalError(s);
+    }
+  }
+
+  private ResultSetIterator executeQueryAndGetIter() {
+    try {
+      LOG.info("Executed SQL Statement: " + generatedSql);
+      Connection conn = DriverManager.getConnection(fragment.uri);
+      Statement statement = conn.createStatement();
+      ResultSet resultset = statement.executeQuery(generatedSql);
+      return new ResultSetIterator((resultset));
+    } catch (SQLException s) {
+      throw new TajoInternalError(s);
+    }
+  }
+
+  public class ResultSetIterator implements Iterator<Tuple>, Closeable {
+
+    private final ResultSet resultSet;
+
+    private boolean didNext = false;
+    private boolean hasNext = false;
+
+    public ResultSetIterator(ResultSet resultSet) {
+      this.resultSet = resultSet;
+    }
+
+    @Override
+    public boolean hasNext() {
+      if (!didNext) {
+
+        try {
+          hasNext = resultSet.next();
+        } catch (SQLException e) {
+          throw new RuntimeException(e);
+        }
+
+        didNext = true;
+      }
+      return hasNext;
+    }
+
+    @Override
+    public Tuple next() {
+      if (!didNext) {
+        try {
+          resultSet.next();
+        } catch (SQLException e) {
+          throw new RuntimeException(e);
+        }
+      }
+      didNext = false;
+      convertTuple(resultSet, outTuple);
+      return outTuple;
+    }
+
+    @Override
+    public void remove() {
+      throw new TajoRuntimeException(new UnsupportedException());
+    }
+
+    public void rewind() {
+      try {
+        resultSet.isBeforeFirst();
+      } catch (SQLException e) {
+        throw new TajoInternalError(e);
+      }
+    }
+
+    @Override
+    public void close() throws IOException {
+      try {
+        resultSet.close();
+      } catch (SQLException e) {
+        LOG.warn(e);;
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
index 04709b0..d3ec273 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
@@ -25,20 +25,22 @@ import org.apache.tajo.ExecutionBlockId;
 import org.apache.tajo.OverridableConf;
 import org.apache.tajo.catalog.*;
 import org.apache.tajo.exception.NotImplementedException;
+import org.apache.tajo.exception.TajoInternalError;
 import org.apache.tajo.exception.TajoRuntimeException;
 import org.apache.tajo.exception.UnsupportedException;
 import org.apache.tajo.plan.LogicalPlan;
 import org.apache.tajo.plan.expr.EvalNode;
 import org.apache.tajo.plan.logical.LogicalNode;
-import org.apache.tajo.storage.FormatProperty;
-import org.apache.tajo.storage.StorageProperty;
-import org.apache.tajo.storage.Tablespace;
-import org.apache.tajo.storage.TupleRange;
+import org.apache.tajo.storage.*;
 import org.apache.tajo.storage.fragment.Fragment;
 
 import javax.annotation.Nullable;
 import java.io.IOException;
 import java.net.URI;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.DriverManager;
+import java.sql.SQLException;
 import java.util.List;
 
 /**
@@ -52,6 +54,7 @@ public abstract class JdbcTablespace extends Tablespace {
   static final StorageProperty STORAGE_PROPERTY = new StorageProperty("rowstore", false, true, false, true);
   static final FormatProperty  FORMAT_PROPERTY = new FormatProperty(false, false, false);
 
+  private Connection conn;
 
   public JdbcTablespace(String name, URI uri, JSONObject config) {
     super(name, uri, config);
@@ -59,11 +62,16 @@ public abstract class JdbcTablespace extends Tablespace {
 
   @Override
   protected void storageInit() throws IOException {
+    try {
+      this.conn = DriverManager.getConnection(uri.toASCIIString());
+    } catch (SQLException e) {
+      throw new IOException(e);
+    }
   }
 
   @Override
-  public long getTableVolume(URI uri) throws IOException {
-    return 0;
+  public long getTableVolume(URI uri) throws UnsupportedException {
+    throw new UnsupportedException();
   }
 
   @Override
@@ -138,4 +146,18 @@ public abstract class JdbcTablespace extends Tablespace {
   }
 
   public abstract MetadataProvider getMetadataProvider();
+
+  @Override
+  public abstract Scanner getScanner(TableMeta meta,
+                            Schema schema,
+                            Fragment fragment,
+                            @Nullable Schema target) throws IOException;
+
+  public DatabaseMetaData getDatabaseMetaData() {
+    try {
+      return conn.getMetaData();
+    } catch (SQLException e) {
+      throw new TajoInternalError(e);
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLBuilder.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLBuilder.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLBuilder.java
new file mode 100644
index 0000000..57a4bba
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLBuilder.java
@@ -0,0 +1,172 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+import com.google.common.base.Function;
+import org.apache.tajo.catalog.Column;
+import org.apache.tajo.exception.TajoRuntimeException;
+import org.apache.tajo.exception.UnsupportedException;
+import org.apache.tajo.plan.Target;
+import org.apache.tajo.plan.expr.EvalNode;
+import org.apache.tajo.plan.logical.*;
+import org.apache.tajo.util.StringUtils;
+
+import javax.annotation.Nullable;
+import java.sql.DatabaseMetaData;
+import java.util.Stack;
+
+/**
+ * Generator to build a SQL statement from a plan fragment
+ */
+public class SQLBuilder {
+  @SuppressWarnings("unused")
+  private final DatabaseMetaData dbMetaData;
+  private final SQLExpressionGenerator sqlExprGen;
+
+  public static class SQLBuilderContext {
+    StringBuilder sb;
+  }
+
+  public SQLBuilder(DatabaseMetaData dbMetaData, SQLExpressionGenerator exprGen) {
+    this.dbMetaData = dbMetaData;
+    this.sqlExprGen = exprGen;
+  }
+
+  public String build(String tableName, Column [] targets, @Nullable EvalNode filter, @Nullable Long limit) {
+
+    StringBuilder selectClause = new StringBuilder("SELECT ");
+    selectClause.append(StringUtils.join(targets, ",", new Function<Column, String>() {
+      @Override
+      public String apply(@Nullable Column input) {
+        return input.getSimpleName();
+      }
+    })).append(" ");
+
+    StringBuilder fromClause = new StringBuilder("FROM ");
+    fromClause.append(tableName).append(" ");
+
+    StringBuilder whereClause = null;
+    if (filter != null) {
+      whereClause = new StringBuilder("WHERE ");
+      whereClause.append(sqlExprGen.generate(filter)).append(" ");
+    }
+
+    StringBuilder limitClause = null;
+    if (limit != null) {
+      limitClause = new StringBuilder("LIMIT ");
+      limitClause.append(limit).append(" ");
+    }
+
+    return generateSelectStmt(selectClause, fromClause, whereClause, limitClause);
+  }
+
+  public String generateSelectStmt(StringBuilder selectClause,
+                                   StringBuilder fromClause,
+                                   @Nullable StringBuilder whereClause,
+                                   @Nullable StringBuilder limitClause) {
+    return
+        selectClause.toString() +
+        fromClause.toString() +
+        (whereClause != null ? whereClause.toString() : "") +
+        (limitClause != null ? limitClause.toString() : "");
+  }
+
+  public String build(LogicalNode planPart) {
+    SQLBuilderContext context = new SQLBuilderContext();
+    visit(context, planPart, new Stack<LogicalNode>());
+    return context.sb.toString();
+  }
+
+  public void visit(SQLBuilderContext context, LogicalNode node, Stack<LogicalNode> stack) {
+    stack.push(node);
+
+    switch (node.getType()) {
+    case SCAN:
+      visitScan(context, (ScanNode) node, stack);
+      break;
+
+    case GROUP_BY:
+      visitGroupBy(context, (GroupbyNode) node, stack);
+      break;
+
+    case SELECTION:
+      visitFilter(context, (SelectionNode) node, stack);
+      break;
+
+    case PROJECTION:
+      visitProjection(context, (ProjectionNode) node, stack);
+      break;
+
+    case TABLE_SUBQUERY:
+      visitDerivedSubquery(context, (TableSubQueryNode) node, stack);
+      break;
+
+    default:
+      throw new TajoRuntimeException(new UnsupportedException("plan node '" + node.getType().name() + "'"));
+    }
+
+    stack.pop();
+  }
+
+  public void visitDerivedSubquery(SQLBuilderContext ctx, TableSubQueryNode derivedSubquery, Stack<LogicalNode> stack) {
+    ctx.sb.append(" (");
+    visit(ctx, derivedSubquery.getSubQuery(), stack);
+    ctx.sb.append(" ) ").append(derivedSubquery.getTableName());
+  }
+
+  public void visitProjection(SQLBuilderContext ctx, ProjectionNode projection, Stack<LogicalNode> stack) {
+
+    visit(ctx, projection.getChild(), stack);
+  }
+
+  public void visitGroupBy(SQLBuilderContext ctx, GroupbyNode groupby, Stack<LogicalNode> stack) {
+    visit(ctx, groupby.getChild(), stack);
+    ctx.sb.append("GROUP BY ").append(StringUtils.join(groupby.getGroupingColumns(), ",", 0)).append(" ");
+  }
+
+  public void visitFilter(SQLBuilderContext ctx, SelectionNode filter, Stack<LogicalNode> stack) {
+    visit(ctx, filter.getChild(), stack);
+    ctx.sb.append("WHERE " + sqlExprGen.generate(filter.getQual()));
+  }
+
+  public void visitScan(SQLBuilderContext ctx, ScanNode scan, Stack<LogicalNode> stack) {
+
+    StringBuilder selectClause = new StringBuilder("SELECT ");
+    selectClause.append(StringUtils.join(scan.getTargets(), ",", new Function<Target, String>() {
+      @Override
+      public String apply(@Nullable Target t) {
+        StringBuilder sb = new StringBuilder(sqlExprGen.generate(t.getEvalTree()));
+        if (t.hasAlias()) {
+          sb.append(" AS ").append(t.getAlias());
+        }
+        return sb.toString();
+      }
+    }));
+
+    ctx.sb.append("FROM ").append(scan.getTableName()).append(" ");
+
+    if (scan.hasAlias()) {
+      ctx.sb.append("AS ").append(scan.getAlias()).append(" ");
+    }
+
+    if (scan.hasQual()) {
+      ctx.sb.append("WHERE " + sqlExprGen.generate(scan.getQual()));
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLExpressionGenerator.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLExpressionGenerator.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLExpressionGenerator.java
new file mode 100644
index 0000000..76c687a
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLExpressionGenerator.java
@@ -0,0 +1,216 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+import org.apache.tajo.common.TajoDataTypes.DataType;
+import org.apache.tajo.datum.Datum;
+import org.apache.tajo.exception.TajoRuntimeException;
+import org.apache.tajo.exception.UnsupportedDataTypeException;
+import org.apache.tajo.plan.expr.*;
+
+import java.sql.DatabaseMetaData;
+import java.sql.SQLException;
+import java.util.Stack;
+
+/**
+ * A generator to build a SQL representation from a sql expression
+ */
+public class SQLExpressionGenerator extends SimpleEvalNodeVisitor<SQLExpressionGenerator.Context> {
+  final private DatabaseMetaData dbMetaData;
+
+  final private String DEFAULT_QUOTE_STR = "'";
+  private String QUOTE_STR;
+
+  public SQLExpressionGenerator(DatabaseMetaData dbMetaData) {
+    this.dbMetaData = dbMetaData;
+    initDatabaseDependentSQLRepr();
+  }
+
+  private void initDatabaseDependentSQLRepr() {
+    String quoteStr = null;
+    try {
+      quoteStr = dbMetaData.getIdentifierQuoteString();
+    } catch (SQLException e) {
+    }
+    this.QUOTE_STR = quoteStr != null ? quoteStr : DEFAULT_QUOTE_STR;
+  }
+
+  public String quote(String text) {
+    return QUOTE_STR + text + QUOTE_STR;
+  }
+
+  public String generate(EvalNode node) {
+    Context context = new Context();
+    visit(context, node, new Stack<EvalNode>());
+    return context.sb.toString();
+  }
+
+  public static class Context {
+    StringBuilder sb = new StringBuilder();
+
+    public void put(String text) {
+      sb.append(" ").append(text).append(" ");
+    }
+  }
+
+  protected EvalNode visitBinaryEval(Context context, Stack<EvalNode> stack, BinaryEval binaryEval) {
+    stack.push(binaryEval);
+    visit(context, binaryEval.getLeftExpr(), stack);
+    context.sb.append(convertBinOperatorToSQLRepr(binaryEval.getType())).append(" ");
+    visit(context, binaryEval.getRightExpr(), stack);
+    stack.pop();
+    return binaryEval;
+  }
+
+  protected EvalNode visitUnaryEval(Context context, UnaryEval unary, Stack<EvalNode> stack) {
+
+    switch (unary.getType()) {
+    case NOT:
+      context.sb.append("NOT ");
+      super.visitUnaryEval(context, unary, stack);
+      break;
+    case SIGNED:
+      SignedEval signed = (SignedEval) unary;
+      if (signed.isNegative()) {
+        context.sb.append("-");
+      }
+      super.visitUnaryEval(context, unary, stack);
+      break;
+    case IS_NULL:
+      super.visitUnaryEval(context, unary, stack);
+
+      IsNullEval isNull = (IsNullEval) unary;
+      if (isNull.isNot()) {
+        context.sb.append("IS NOT NULL ");
+      } else {
+        context.sb.append("IS NULL ");
+      }
+      break;
+
+    case CAST:
+      super.visitUnaryEval(context, unary, stack);
+      context.sb.append(" AS ").append(convertTajoTypeToSQLType(unary.getValueType()));
+    }
+    return unary;
+  }
+
+  protected EvalNode visitRowConstant(Context context, RowConstantEval row, Stack<EvalNode> stack) {
+    StringBuilder sb = new StringBuilder("(");
+
+    boolean first = true;
+    for (Datum d : row.getValues()) {
+      if (!first) {
+        sb.append(",");
+        first = false;
+      }
+      sb.append(convertLiteralToSQLRepr(d));
+    }
+
+    sb.append(")");
+
+    context.put(sb.toString());
+
+    return row;
+  }
+
+  @Override
+  protected EvalNode visitField(Context context, FieldEval field, Stack<EvalNode> stack) {
+    context.put(field.getName());
+    return field;
+  }
+
+  @Override
+  protected EvalNode visitConst(Context context, ConstEval constant, Stack<EvalNode> stack) {
+    context.sb.append(convertLiteralToSQLRepr(constant.getValue()));
+    return constant;
+  }
+
+  /**
+   * convert Tajo literal into SQL representation
+   *
+   * @param d Datum
+   */
+  public String convertLiteralToSQLRepr(Datum d) {
+    switch (d.type()) {
+    case INT1:
+    case INT2:
+    case INT4:
+    case INT8:
+    case FLOAT4:
+    case FLOAT8:
+    case NUMERIC:
+      return d.asChars();
+
+    case TEXT:
+    case VARCHAR:
+    case CHAR:
+      return quote(d.asChars());
+
+    case DATE:
+      return "DATE " + quote(d.asChars());
+
+    case TIME:
+      return "TIME " + quote(d.asChars());
+
+    case TIMESTAMP:
+      return "TIMESTAMP " + quote(d.asChars());
+
+    case NULL_TYPE:
+      return "NULL";
+
+    default:
+      throw new TajoRuntimeException(new UnsupportedDataTypeException(d.type().name()));
+    }
+  }
+
+  /**
+   * Convert Tajo DataType into SQL DataType
+   *
+   * @param dataType Tajo DataType
+   * @return SQL DataType
+   */
+  public String convertTajoTypeToSQLType(DataType dataType) {
+    switch (dataType.getType()) {
+    case INT1:
+      return "TINYINT";
+    case INT2:
+      return "SMALLINT";
+    case INT4:
+      return "INTEGER";
+    case INT8:
+      return "BIGINT";
+    case FLOAT4:
+      return "FLOAT";
+    case FLOAT8:
+      return "DOUBLE";
+    default:
+      return dataType.getType().name();
+    }
+  }
+
+  /**
+   * Convert EvalType the operator notation into SQL notation
+   *
+   * @param op EvalType
+   * @return SQL representation
+   */
+  public String convertBinOperatorToSQLRepr(EvalType op) {
+    return op.getOperatorName();
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-jdbc/src/main/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java b/tajo-storage/tajo-storage-jdbc/src/main/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java
deleted file mode 100644
index 9eee00a..0000000
--- a/tajo-storage/tajo-storage-jdbc/src/main/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.jdbc;
-
-public abstract class JdbcTablespaceTestBase {
-
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java b/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java
index d3a0c6a..4a2171e 100644
--- a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java
+++ b/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java
@@ -18,11 +18,17 @@
 
 package org.apache.tajo.storage.mysql;
 
+import com.google.common.base.Preconditions;
 import net.minidev.json.JSONObject;
 import org.apache.tajo.catalog.*;
+import org.apache.tajo.exception.TajoInternalError;
 import org.apache.tajo.storage.*;
+import org.apache.tajo.storage.fragment.Fragment;
+import org.apache.tajo.storage.jdbc.JdbcFragment;
 import org.apache.tajo.storage.jdbc.JdbcTablespace;
 
+import javax.annotation.Nullable;
+import java.io.IOException;
 import java.net.URI;
 
 /**
@@ -42,4 +48,27 @@ public class MySQLTablespace extends JdbcTablespace {
   public MetadataProvider getMetadataProvider() {
     return new MySQLMetadataProvider(this, database);
   }
+
+  @Override
+  public Scanner getScanner(TableMeta meta,
+                            Schema schema,
+                            Fragment fragment,
+                            @Nullable Schema target) throws IOException {
+    if (!(fragment instanceof JdbcFragment)) {
+      throw new TajoInternalError("fragment must be JdbcFragment");
+    }
+
+    if (target == null) {
+      target = schema;
+    }
+
+    if (fragment.isEmpty()) {
+      Scanner scanner = new NullScanner(conf, schema, meta, fragment);
+      scanner.setTarget(target.toArray());
+
+      return scanner;
+    }
+
+    return new MySQLJdbcScanner(getDatabaseMetaData(), schema, meta, (JdbcFragment) fragment);
+  }
 }


[20/39] tajo git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730

Posted by hy...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/57466e36
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/57466e36
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/57466e36

Branch: refs/heads/TAJO-1730
Commit: 57466e36955d0545205944ec8cddec215d8ed59e
Parents: 0c8a9f7 39cb27d
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sun Aug 16 21:34:23 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sun Aug 16 21:34:23 2015 +0900

----------------------------------------------------------------------
 tajo-algebra/pom.xml                                | 2 +-
 tajo-catalog/pom.xml                                | 2 +-
 tajo-catalog/tajo-catalog-client/pom.xml            | 2 +-
 tajo-catalog/tajo-catalog-common/pom.xml            | 2 +-
 tajo-catalog/tajo-catalog-drivers/pom.xml           | 2 +-
 tajo-catalog/tajo-catalog-drivers/tajo-hive/pom.xml | 2 +-
 tajo-catalog/tajo-catalog-server/pom.xml            | 2 +-
 tajo-cli/pom.xml                                    | 2 +-
 tajo-client/pom.xml                                 | 2 +-
 tajo-cluster-tests/pom.xml                          | 2 +-
 tajo-common/pom.xml                                 | 2 +-
 tajo-core-tests/pom.xml                             | 2 +-
 tajo-core/pom.xml                                   | 2 +-
 tajo-dist/pom.xml                                   | 2 +-
 tajo-docs/pom.xml                                   | 2 +-
 tajo-jdbc/pom.xml                                   | 2 +-
 tajo-maven-plugins/pom.xml                          | 2 +-
 tajo-metrics/pom.xml                                | 2 +-
 tajo-plan/pom.xml                                   | 2 +-
 tajo-project/pom.xml                                | 4 ++--
 tajo-pullserver/pom.xml                             | 2 +-
 tajo-rpc/pom.xml                                    | 2 +-
 tajo-rpc/tajo-rpc-common/pom.xml                    | 2 +-
 tajo-rpc/tajo-rpc-protobuf/pom.xml                  | 2 +-
 tajo-rpc/tajo-ws-rs/pom.xml                         | 2 +-
 tajo-storage/pom.xml                                | 2 +-
 tajo-storage/tajo-storage-common/pom.xml            | 2 +-
 tajo-storage/tajo-storage-hbase/pom.xml             | 2 +-
 tajo-storage/tajo-storage-hdfs/pom.xml              | 2 +-
 tajo-thirdparty/asm/pom.xml                         | 2 +-
 30 files changed, 31 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/57466e36/tajo-core-tests/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/57466e36/tajo-project/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/57466e36/tajo-storage/pom.xml
----------------------------------------------------------------------


[26/39] tajo git commit: Clean up TablespaceManager and Tablespace.

Posted by hy...@apache.org.
Clean up TablespaceManager and Tablespace.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/bf15ce7a
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/bf15ce7a
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/bf15ce7a

Branch: refs/heads/TAJO-1730
Commit: bf15ce7ad3cf4b30041c34771e15fe38af99cd50
Parents: 2cf88d0
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sat Aug 22 00:09:35 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sat Aug 22 00:09:35 2015 +0900

----------------------------------------------------------------------
 .../apache/tajo/exception/ExceptionUtil.java    |  23 ++
 .../tajo/exception/NotImplementedException.java |   3 +-
 .../tajo/exception/UnsupportedException.java    |   2 +-
 .../tajo/engine/query/TestHBaseTable.java       |  10 +-
 .../apache/tajo/querymaster/Repartitioner.java  |   8 +-
 .../java/org/apache/tajo/querymaster/Stage.java |   2 +-
 .../org/apache/tajo/storage/Tablespace.java     |  24 +-
 .../tajo/storage/hbase/HBaseTablespace.java     |  26 +-
 .../tajo/storage/hbase/TestHBaseTableSpace.java |   9 +-
 .../org/apache/tajo/storage/FileTablespace.java |   8 +-
 tajo-storage/tajo-storage-jdbc/pom.xml          |   2 +-
 .../tajo/storage/jdbc/ConnectionInfo.java       | 112 +++++++++
 .../apache/tajo/storage/jdbc/JdbcFragment.java  |  58 +++++
 .../storage/jdbc/JdbcMetadataProviderBase.java  | 244 +++++++++++++++++++
 .../tajo/storage/jdbc/JdbcTablespace.java       | 146 +++++++++++
 .../tajo/storage/mysql/ConnectionInfo.java      | 112 ---------
 .../storage/mysql/JdbcMetadataProviderBase.java | 244 -------------------
 .../tajo/storage/mysql/JdbcTablespace.java      | 139 -----------
 .../src/main/proto/JdbcFragmentProtos.proto     |  29 +++
 .../src/main/proto/StorageFragmentProtos.proto  |  36 ---
 .../storage/jdbc/JdbcTablespaceTestBase.java    |  23 ++
 .../tajo/storage/jdbc/TestConnectionInfo.java   |  50 ++++
 .../storage/mysql/JdbcTablespaceTestBase.java   |  43 ----
 .../tajo/storage/mysql/TestConnectionInfo.java  |  50 ----
 .../storage/mysql/MySQLMetadataProvider.java    |   2 +
 .../tajo/storage/mysql/MySQLTablespace.java     |   1 +
 .../storage/pgsql/PgSQLMetadataProvider.java    |   2 +-
 .../tajo/storage/pgsql/PgSQLTablespace.java     |   2 +-
 .../tajo/storage/pgsql/EmbedPgSQLServer.java    |  18 ++
 .../storage/pgsql/TestPgSQLJdbcTableSpace.java  |  34 +++
 .../src/test/resources/tpch/customer.sql        |  10 +
 .../src/test/resources/tpch/lineitem.sql        |  18 ++
 .../src/test/resources/tpch/nation.sql          |   6 +
 .../src/test/resources/tpch/orders.sql          |  11 +
 .../src/test/resources/tpch/part.sql            |  11 +
 .../src/test/resources/tpch/partsupp.sql        |   7 +
 .../src/test/resources/tpch/region.sql          |   5 +
 .../src/test/resources/tpch/supplier.sql        |   9 +
 38 files changed, 867 insertions(+), 672 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-common/src/main/java/org/apache/tajo/exception/ExceptionUtil.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/exception/ExceptionUtil.java b/tajo-common/src/main/java/org/apache/tajo/exception/ExceptionUtil.java
index 2fd49ac..6e8cfeb 100644
--- a/tajo-common/src/main/java/org/apache/tajo/exception/ExceptionUtil.java
+++ b/tajo-common/src/main/java/org/apache/tajo/exception/ExceptionUtil.java
@@ -189,4 +189,27 @@ public class ExceptionUtil {
   public static UnsupportedException makeNotSupported(String feature) {
     return new UnsupportedException(feature);
   }
+
+  /**
+   * Return the string about the exception line ; e.g.,)
+   * <code>Line 195 in JdbcTablespace.java</code>
+   *
+   * @return A string representing the line number and source file name at which the exception occurs.
+   */
+  @SuppressWarnings("unused")
+  public static String getExceptionLine() {
+    StackTraceElement stack = Thread.currentThread().getStackTrace()[3];
+    return "Line " + stack.getLineNumber() + " in " + stack.getFileName();
+  }
+
+  /**
+   * Return the string about the exception point; e.g.,)
+   * <code>org.apache.tajo.storage.mysql.JdbcTablespace::createTable</code>
+   *
+   * @return A string representing the class and method names at which the exception occurs.
+   */
+  public static String getExceptionPoint() {
+    StackTraceElement stack = Thread.currentThread().getStackTrace()[3];
+    return stack.getClassName() + "::" + stack.getMethodName();
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-common/src/main/java/org/apache/tajo/exception/NotImplementedException.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/exception/NotImplementedException.java b/tajo-common/src/main/java/org/apache/tajo/exception/NotImplementedException.java
index 3ba6739..95f3a5b 100644
--- a/tajo-common/src/main/java/org/apache/tajo/exception/NotImplementedException.java
+++ b/tajo-common/src/main/java/org/apache/tajo/exception/NotImplementedException.java
@@ -25,8 +25,7 @@ public class NotImplementedException extends TajoException {
   private static final long serialVersionUID = -5467580471721530536L;
 
   public NotImplementedException() {
-    super(Errors.ResultCode.NOT_IMPLEMENTED,
-        Thread.currentThread().getStackTrace()[1].getClassName());
+    super(Errors.ResultCode.NOT_IMPLEMENTED, ExceptionUtil.getExceptionPoint());
   }
 
   public NotImplementedException(ReturnState state) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-common/src/main/java/org/apache/tajo/exception/UnsupportedException.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/exception/UnsupportedException.java b/tajo-common/src/main/java/org/apache/tajo/exception/UnsupportedException.java
index 6b98d9c..755074b 100644
--- a/tajo-common/src/main/java/org/apache/tajo/exception/UnsupportedException.java
+++ b/tajo-common/src/main/java/org/apache/tajo/exception/UnsupportedException.java
@@ -29,7 +29,7 @@ public class UnsupportedException extends TajoException {
   }
 
   public UnsupportedException() {
-    super(Errors.ResultCode.FEATURE_NOT_SUPPORTED, Thread.currentThread().getStackTrace()[1].getClassName());
+    super(Errors.ResultCode.FEATURE_NOT_SUPPORTED, ExceptionUtil.getExceptionPoint());
   }
 
   public UnsupportedException(String featureName) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/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 801998f..ee00f9c 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
@@ -484,7 +484,7 @@ public class TestHBaseTable extends QueryTestCaseBase {
         new ConstEval(new TextDatum("021")));
     scanNode.setQual(evalNodeEq);
     Tablespace tablespace = TablespaceManager.getByName("cluster1").get();
-    List<Fragment> fragments = tablespace.getSplits("hbase_mapped_table", tableDesc, scanNode);
+    List<Fragment> fragments = tablespace.getSplits("hbase_mapped_table", tableDesc, scanNode.getQual());
     assertEquals(1, fragments.size());
     assertEquals("021", new String(((HBaseFragment)fragments.get(0)).getStartRow()));
     assertEquals("021" + postFix, new String(((HBaseFragment)fragments.get(0)).getStopRow()));
@@ -497,7 +497,7 @@ public class TestHBaseTable extends QueryTestCaseBase {
     EvalNode evalNodeA = new BinaryEval(EvalType.AND, evalNode1, evalNode2);
     scanNode.setQual(evalNodeA);
 
-    fragments = tablespace.getSplits("hbase_mapped_table", tableDesc, scanNode);
+    fragments = tablespace.getSplits("hbase_mapped_table", tableDesc, scanNode.getQual());
     assertEquals(2, fragments.size());
     HBaseFragment fragment1 = (HBaseFragment) fragments.get(0);
     assertEquals("020", new String(fragment1.getStartRow()));
@@ -512,7 +512,7 @@ public class TestHBaseTable extends QueryTestCaseBase {
         new ConstEval(new TextDatum("075")));
     EvalNode evalNodeB = new BinaryEval(EvalType.OR, evalNodeA, evalNode3);
     scanNode.setQual(evalNodeB);
-    fragments = tablespace.getSplits("hbase_mapped_table", tableDesc, scanNode);
+    fragments = tablespace.getSplits("hbase_mapped_table", tableDesc, scanNode.getQual());
     assertEquals(3, fragments.size());
     fragment1 = (HBaseFragment) fragments.get(0);
     assertEquals("020", new String(fragment1.getStartRow()));
@@ -535,7 +535,7 @@ public class TestHBaseTable extends QueryTestCaseBase {
     EvalNode evalNodeC = new BinaryEval(EvalType.AND, evalNode4, evalNode5);
     EvalNode evalNodeD = new BinaryEval(EvalType.OR, evalNodeA, evalNodeC);
     scanNode.setQual(evalNodeD);
-    fragments = tablespace.getSplits("hbase_mapped_table", tableDesc, scanNode);
+    fragments = tablespace.getSplits("hbase_mapped_table", tableDesc, scanNode.getQual());
     assertEquals(3, fragments.size());
 
     fragment1 = (HBaseFragment) fragments.get(0);
@@ -558,7 +558,7 @@ public class TestHBaseTable extends QueryTestCaseBase {
     evalNodeC = new BinaryEval(EvalType.AND, evalNode4, evalNode5);
     evalNodeD = new BinaryEval(EvalType.OR, evalNodeA, evalNodeC);
     scanNode.setQual(evalNodeD);
-    fragments = tablespace.getSplits("hbase_mapped_table", tableDesc, scanNode);
+    fragments = tablespace.getSplits("hbase_mapped_table", tableDesc, scanNode.getQual());
     assertEquals(2, fragments.size());
 
     fragment1 = (HBaseFragment) fragments.get(0);

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-core/src/main/java/org/apache/tajo/querymaster/Repartitioner.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/querymaster/Repartitioner.java b/tajo-core/src/main/java/org/apache/tajo/querymaster/Repartitioner.java
index 0d5880e..fa717fd 100644
--- a/tajo-core/src/main/java/org/apache/tajo/querymaster/Repartitioner.java
+++ b/tajo-core/src/main/java/org/apache/tajo/querymaster/Repartitioner.java
@@ -113,7 +113,7 @@ public class Repartitioner {
         // So, we need to handle FileFragment by its size.
         // If we don't check its size, it can cause IndexOutOfBoundsException.
         Tablespace space = TablespaceManager.get(tableDesc.getUri()).get();
-        List<Fragment> fileFragments = space.getSplits(scans[i].getCanonicalName(), tableDesc);
+        List<Fragment> fileFragments = space.getSplits(scans[i].getCanonicalName(), tableDesc, null);
         if (fileFragments.size() > 0) {
           fragments[i] = fileFragments.get(0);
         } else {
@@ -389,8 +389,8 @@ public class Repartitioner {
 
         } else {
 
-          Collection<Fragment> scanFragments = space.getSplits(eachScan.getCanonicalName(),
-              tableDesc, eachScan);
+          Collection<Fragment> scanFragments =
+              space.getSplits(eachScan.getCanonicalName(), tableDesc, eachScan.getQual());
           if (scanFragments != null) {
             rightFragments.addAll(scanFragments);
           }
@@ -512,7 +512,7 @@ public class Repartitioner {
         // set null to inputPaths in getFragmentsFromPartitionedTable()
         scanFragments = getFragmentsFromPartitionedTable(space, scan, desc);
       } else {
-        scanFragments = space.getSplits(scan.getCanonicalName(), desc, scan);
+        scanFragments = space.getSplits(scan.getCanonicalName(), desc, scan.getQual());
       }
 
       if (scanFragments != null) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-core/src/main/java/org/apache/tajo/querymaster/Stage.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/querymaster/Stage.java b/tajo-core/src/main/java/org/apache/tajo/querymaster/Stage.java
index cf5cdbd..d26cea3 100644
--- a/tajo-core/src/main/java/org/apache/tajo/querymaster/Stage.java
+++ b/tajo-core/src/main/java/org/apache/tajo/querymaster/Stage.java
@@ -1097,7 +1097,7 @@ public class Stage implements EventHandler<StageEvent> {
         // After calling this method, partition paths are removed from the physical plan.
         fragments = Repartitioner.getFragmentsFromPartitionedTable((FileTablespace) tablespace, scan, table);
       } else {
-        fragments = tablespace.getSplits(scan.getCanonicalName(), table, scan);
+        fragments = tablespace.getSplits(scan.getCanonicalName(), table, scan.getQual());
       }
 
       Stage.scheduleFragments(stage, fragments);

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
index ae749e6..ff7ee47 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
@@ -30,11 +30,13 @@ import org.apache.tajo.exception.TajoException;
 import org.apache.tajo.exception.TajoRuntimeException;
 import org.apache.tajo.exception.UnsupportedException;
 import org.apache.tajo.plan.LogicalPlan;
+import org.apache.tajo.plan.expr.EvalNode;
 import org.apache.tajo.plan.logical.LogicalNode;
 import org.apache.tajo.plan.logical.ScanNode;
 import org.apache.tajo.storage.fragment.Fragment;
 import org.apache.tajo.storage.fragment.FragmentConvertor;
 
+import javax.annotation.Nullable;
 import java.io.IOException;
 import java.net.URI;
 import java.util.*;
@@ -120,14 +122,15 @@ public abstract class Tablespace {
   /**
    * Returns the splits that will serve as input for the scan tasks. The
    * number of splits matches the number of regions in a table.
-   * @param fragmentId The table name or previous ExecutionBlockId
+   * @param inputSourceId Input source identifier, which can be either relation name or execution block id
    * @param tableDesc The table description for the target data.
-   * @param scanNode The logical node for scanning.
+   * @param filterCondition filter condition which can prune splits if possible
    * @return The list of input fragments.
    * @throws java.io.IOException
    */
-  public abstract List<Fragment> getSplits(String fragmentId, TableDesc tableDesc,
-                                           ScanNode scanNode) throws IOException, TajoException;
+  public abstract List<Fragment> getSplits(String inputSourceId,
+                                           TableDesc tableDesc,
+                                           @Nullable EvalNode filterCondition) throws IOException, TajoException;
 
   /**
    * It returns the splits that will serve as input for the non-forward query scanner such as 'select * from table1'.
@@ -191,19 +194,6 @@ public abstract class Tablespace {
   }
 
   /**
-   * Returns the splits that will serve as input for the scan tasks. The
-   * number of splits matches the number of regions in a table.
-   *
-   * @param fragmentId The table name or previous ExecutionBlockId
-   * @param tableDesc The table description for the target data.
-   * @return The list of input fragments.
-   * @throws java.io.IOException
-   */
-  public List<Fragment> getSplits(String fragmentId, TableDesc tableDesc) throws IOException, TajoException {
-    return getSplits(fragmentId, tableDesc, null);
-  }
-
-  /**
    * Returns Scanner instance.
    *
    * @param meta The table meta

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java b/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java
index 6d0572b..66245a8 100644
--- a/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java
+++ b/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java
@@ -18,6 +18,7 @@
 
 package org.apache.tajo.storage.hbase;
 
+import com.google.common.base.Preconditions;
 import com.google.common.collect.Sets;
 import net.minidev.json.JSONObject;
 import org.apache.commons.logging.Log;
@@ -59,6 +60,7 @@ import org.apache.tajo.storage.*;
 import org.apache.tajo.storage.fragment.Fragment;
 import org.apache.tajo.util.*;
 
+import javax.annotation.Nullable;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
@@ -418,12 +420,14 @@ public class HBaseTablespace extends Tablespace {
   }
 
   @Override
-  public List<Fragment> getSplits(String fragmentId, TableDesc tableDesc, ScanNode scanNode)
+  public List<Fragment> getSplits(String inputSourceId,
+                                  TableDesc tableDesc,
+                                  @Nullable EvalNode filterCondition)
       throws IOException, TajoException {
 
     ColumnMapping columnMapping = new ColumnMapping(tableDesc.getSchema(), tableDesc.getMeta().getOptions());
 
-    List<IndexPredication> indexPredications = getIndexPredications(columnMapping, tableDesc, scanNode);
+    List<IndexPredication> indexPredications = getIndexPredications(columnMapping, tableDesc, filterCondition);
     HTable htable = null;
     HBaseAdmin hAdmin = null;
 
@@ -439,7 +443,7 @@ public class HBaseTablespace extends Tablespace {
         List<Fragment> fragments = new ArrayList<Fragment>(1);
         Fragment fragment = new HBaseFragment(
             tableDesc.getUri(),
-            fragmentId, htable.getName().getNameAsString(),
+            inputSourceId, htable.getName().getNameAsString(),
             HConstants.EMPTY_BYTE_ARRAY,
             HConstants.EMPTY_BYTE_ARRAY,
             regLoc.getHostname());
@@ -517,7 +521,7 @@ public class HBaseTablespace extends Tablespace {
               }
             } else {
               HBaseFragment fragment = new HBaseFragment(tableDesc.getUri(),
-                  fragmentId,
+                  inputSourceId,
                   htable.getName().getNameAsString(),
                   fragmentStart,
                   fragmentStop,
@@ -790,14 +794,15 @@ public class HBaseTablespace extends Tablespace {
   }
 
   public List<IndexPredication> getIndexPredications(ColumnMapping columnMapping,
-                                                     TableDesc tableDesc, ScanNode scanNode)
+                                                     TableDesc tableDesc,
+                                                     @Nullable EvalNode filterCondition)
       throws IOException, MissingTablePropertyException, InvalidTablePropertyException {
 
     List<IndexPredication> indexPredications = new ArrayList<IndexPredication>();
     Column[] indexableColumns = getIndexableColumns(tableDesc);
     if (indexableColumns != null && indexableColumns.length == 1) {
       // Currently supports only single index column.
-      List<Set<EvalNode>> indexablePredicateList = findIndexablePredicateSet(scanNode, indexableColumns);
+      List<Set<EvalNode>> indexablePredicateList = findIndexablePredicateSet(filterCondition, indexableColumns);
       for (Set<EvalNode> eachEvalSet: indexablePredicateList) {
         Pair<Datum, Datum> indexPredicationValues = getIndexablePredicateValue(columnMapping, eachEvalSet);
         if (indexPredicationValues != null) {
@@ -814,12 +819,15 @@ public class HBaseTablespace extends Tablespace {
     return indexPredications;
   }
 
-  public List<Set<EvalNode>> findIndexablePredicateSet(ScanNode scanNode, Column[] indexableColumns) throws IOException {
+  public List<Set<EvalNode>> findIndexablePredicateSet(@Nullable EvalNode qual,
+                                                       Column[] indexableColumns) throws IOException {
+    Preconditions.checkNotNull(qual);
+
     List<Set<EvalNode>> indexablePredicateList = new ArrayList<Set<EvalNode>>();
 
     // if a query statement has a search condition, try to find indexable predicates
-    if (indexableColumns != null && scanNode.getQual() != null) {
-      EvalNode[] disjunctiveForms = AlgebraicUtil.toDisjunctiveNormalFormArray(scanNode.getQual());
+    if (indexableColumns != null && qual != null) {
+      EvalNode[] disjunctiveForms = AlgebraicUtil.toDisjunctiveNormalFormArray(qual);
 
       // add qualifier to schema for qual
       for (Column column : indexableColumns) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-hbase/src/test/java/org/apache/tajo/storage/hbase/TestHBaseTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hbase/src/test/java/org/apache/tajo/storage/hbase/TestHBaseTableSpace.java b/tajo-storage/tajo-storage-hbase/src/test/java/org/apache/tajo/storage/hbase/TestHBaseTableSpace.java
index 3af1d8d..56ca9be 100644
--- a/tajo-storage/tajo-storage-hbase/src/test/java/org/apache/tajo/storage/hbase/TestHBaseTableSpace.java
+++ b/tajo-storage/tajo-storage-hbase/src/test/java/org/apache/tajo/storage/hbase/TestHBaseTableSpace.java
@@ -74,7 +74,8 @@ public class TestHBaseTableSpace {
     scanNode.setQual(evalNodeA);
 
     HBaseTablespace storageManager = (HBaseTablespace) TablespaceManager.getByName("cluster1").get();
-    List<Set<EvalNode>> indexEvals = storageManager.findIndexablePredicateSet(scanNode, new Column[]{rowkeyColumn});
+    List<Set<EvalNode>> indexEvals =
+        storageManager.findIndexablePredicateSet(scanNode.getQual(), new Column[]{rowkeyColumn});
     assertNotNull(indexEvals);
     assertEquals(1, indexEvals.size());
     Pair<Datum, Datum> indexPredicateValue = storageManager.getIndexablePredicateValue(null, indexEvals.get(0));
@@ -85,7 +86,7 @@ public class TestHBaseTableSpace {
     EvalNode evalNode3 = new BinaryEval(EvalType.EQUAL, new FieldEval(rowkeyColumn),new ConstEval(new TextDatum("075")));
     EvalNode evalNodeB = new BinaryEval(EvalType.OR, evalNodeA, evalNode3);
     scanNode.setQual(evalNodeB);
-    indexEvals = storageManager.findIndexablePredicateSet(scanNode, new Column[]{rowkeyColumn});
+    indexEvals = storageManager.findIndexablePredicateSet(scanNode.getQual(), new Column[]{rowkeyColumn});
     assertEquals(2, indexEvals.size());
     indexPredicateValue = storageManager.getIndexablePredicateValue(null, indexEvals.get(0));
     assertEquals("020", indexPredicateValue.getFirst().asChars());
@@ -101,7 +102,7 @@ public class TestHBaseTableSpace {
     EvalNode evalNodeC = new BinaryEval(EvalType.AND, evalNode4, evalNode5);
     EvalNode evalNodeD = new BinaryEval(EvalType.OR, evalNodeA, evalNodeC);
     scanNode.setQual(evalNodeD);
-    indexEvals = storageManager.findIndexablePredicateSet(scanNode, new Column[]{rowkeyColumn});
+    indexEvals = storageManager.findIndexablePredicateSet(scanNode.getQual(), new Column[]{rowkeyColumn});
     assertEquals(2, indexEvals.size());
 
     indexPredicateValue = storageManager.getIndexablePredicateValue(null, indexEvals.get(0));
@@ -120,7 +121,7 @@ public class TestHBaseTableSpace {
     evalNodeD = new BinaryEval(EvalType.AND, evalNodeC, evalNode6);
     EvalNode evalNodeE = new BinaryEval(EvalType.OR, evalNodeA, evalNodeD);
     scanNode.setQual(evalNodeE);
-    indexEvals = storageManager.findIndexablePredicateSet(scanNode, new Column[]{rowkeyColumn});
+    indexEvals = storageManager.findIndexablePredicateSet(scanNode.getQual(), new Column[]{rowkeyColumn});
     assertEquals(2, indexEvals.size());
 
     indexPredicateValue = storageManager.getIndexablePredicateValue(null, indexEvals.get(0));

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
index 868b1c3..ec56d90 100644
--- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
+++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
@@ -36,6 +36,7 @@ import org.apache.tajo.catalog.*;
 import org.apache.tajo.catalog.statistics.TableStats;
 import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.plan.LogicalPlan;
+import org.apache.tajo.plan.expr.EvalNode;
 import org.apache.tajo.plan.logical.LogicalNode;
 import org.apache.tajo.plan.logical.NodeType;
 import org.apache.tajo.plan.logical.ScanNode;
@@ -44,6 +45,7 @@ import org.apache.tajo.storage.fragment.Fragment;
 import org.apache.tajo.util.Bytes;
 import org.apache.tajo.util.TUtil;
 
+import javax.annotation.Nullable;
 import java.io.IOException;
 import java.net.URI;
 import java.text.NumberFormat;
@@ -635,8 +637,10 @@ public class FileTablespace extends Tablespace {
   }
 
   @Override
-  public List<Fragment> getSplits(String tableName, TableDesc table, ScanNode scanNode) throws IOException {
-    return getSplits(tableName, table.getMeta(), table.getSchema(), new Path(table.getUri()));
+  public List<Fragment> getSplits(String inputSourceId,
+                                  TableDesc table,
+                                  @Nullable EvalNode filterCondition) throws IOException {
+    return getSplits(inputSourceId, table.getMeta(), table.getSchema(), new Path(table.getUri()));
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-jdbc/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/pom.xml b/tajo-storage/tajo-storage-jdbc/pom.xml
index 24a518d..35000a4 100644
--- a/tajo-storage/tajo-storage-jdbc/pom.xml
+++ b/tajo-storage/tajo-storage-jdbc/pom.xml
@@ -130,7 +130,7 @@
                 <argument>--proto_path=../../tajo-common/src/main/proto</argument>
                 <argument>--proto_path=../../tajo-catalog/tajo-catalog-common/src/main/proto</argument>
                 <argument>--java_out=target/generated-sources/proto</argument>
-                <argument>src/main/proto/StorageFragmentProtos.proto</argument>
+                <argument>src/main/proto/JdbcFragmentProtos.proto</argument>
               </arguments>
             </configuration>
             <goals>

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/ConnectionInfo.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/ConnectionInfo.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/ConnectionInfo.java
new file mode 100644
index 0000000..9a42b0d
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/ConnectionInfo.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+import org.apache.tajo.exception.TajoInternalError;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ConnectionInfo {
+  String scheme;
+  String dbName;
+  String tableName;
+  String user;
+  String password;
+  Map<String, String> params;
+
+  public String scheme() {
+    return scheme;
+  }
+
+  public String database() {
+    return dbName;
+  }
+
+  public String table() {
+    return tableName;
+  }
+
+  public String user() {
+    return user;
+  }
+
+  public String password() {
+    return password;
+  }
+
+  public static ConnectionInfo fromURI(String originalUri) {
+    return fromURI(URI.create(originalUri));
+  }
+
+  public static ConnectionInfo fromURI(URI originalUri) {
+    final String uriStr = originalUri.toASCIIString();
+    URI uri = originalUri;
+
+    final ConnectionInfo connInfo = new ConnectionInfo();
+    connInfo.scheme = uriStr.substring(0, uriStr.indexOf("://"));
+
+    if (connInfo.scheme.split(":").length > 1) {
+      int idx = uriStr.indexOf(':');
+      uri = URI.create(uriStr.substring(idx + 1));
+    }
+
+    String path = uri.getPath();
+    if (path != null && !path.isEmpty()) {
+      String [] pathElements = path.substring(1).split("/");
+      if (pathElements.length != 1) {
+        throw new TajoInternalError("Invalid JDBC path: " + path);
+      }
+      connInfo.dbName = pathElements[0];
+    }
+
+    Map<String, String> params = new HashMap<>();
+
+    int paramIndex = uriStr.indexOf("?");
+    if (paramIndex > 0) {
+      String parameterPart = uriStr.substring(paramIndex+1, uriStr.length());
+
+      String [] eachParam = parameterPart.split("&");
+
+      for (String each: eachParam) {
+        String [] keyValues = each.split("=");
+        if (keyValues.length != 2) {
+          throw new TajoInternalError("Invalid URI Parameters: " + parameterPart);
+        }
+        params.put(keyValues[0], keyValues[1]);
+      }
+    }
+
+    if (params.containsKey("table")) {
+      connInfo.tableName = params.remove("table");
+    }
+
+    if (params.containsKey("user")) {
+      connInfo.user = params.remove("user");
+    }
+    if (params.containsKey("password")) {
+      connInfo.password = params.remove("password");
+    }
+
+    connInfo.params = params;
+
+    return connInfo;
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcFragment.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcFragment.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcFragment.java
new file mode 100644
index 0000000..960267a
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcFragment.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+import org.apache.tajo.catalog.proto.CatalogProtos;
+import org.apache.tajo.storage.fragment.Fragment;
+
+public class JdbcFragment implements Fragment, Cloneable {
+  String inputSourceId;
+
+  String [] hostNames;
+
+  @Override
+  public String getTableName() {
+    return inputSourceId;
+  }
+
+  @Override
+  public CatalogProtos.FragmentProto getProto() {
+    return null;
+  }
+
+  @Override
+  public long getLength() {
+    return 0;
+  }
+
+  @Override
+  public String getKey() {
+    return null;
+  }
+
+  @Override
+  public String[] getHosts() {
+    return hostNames;
+  }
+
+  @Override
+  public boolean isEmpty() {
+    return false;
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
new file mode 100644
index 0000000..7f63c66
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
@@ -0,0 +1,244 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.tajo.catalog.*;
+import org.apache.tajo.common.TajoDataTypes.Type;
+import org.apache.tajo.exception.*;
+import org.apache.tajo.util.KeyValueSet;
+import org.apache.tajo.util.Pair;
+
+import javax.annotation.Nullable;
+import java.net.URI;
+import java.sql.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import static org.apache.tajo.catalog.CatalogUtil.newSimpleDataType;
+
+public abstract class JdbcMetadataProviderBase implements MetadataProvider {
+  protected static final Log LOG = LogFactory.getLog(JdbcMetadataProviderBase.class);
+
+  protected final JdbcTablespace space;
+  protected final String databaseName;
+
+  protected final String jdbcUri;
+  protected final String username;
+  protected final String password;
+
+  protected final Connection connection;
+
+  public JdbcMetadataProviderBase(JdbcTablespace space, String dbName) {
+    this.space = space;
+    this.databaseName = dbName;
+
+    ConnectionInfo connInfo = ConnectionInfo.fromURI(space.getUri());
+    this.jdbcUri  = space.getUri().toASCIIString();
+    this.username = connInfo.user();
+    this.password = connInfo.password();
+
+    try {
+      Class.forName(getJdbcDriverName()).newInstance();
+      LOG.info(getJdbcDriverName() + " is loaded...");
+    } catch (Exception e) {
+      throw new TajoInternalError(e);
+    }
+
+    try {
+      connection = DriverManager.getConnection(jdbcUri, this.username, this.password);
+    } catch (SQLException e) {
+      throw new TajoInternalError(e);
+    }
+  }
+
+  @Override
+  public String getTablespaceName() {
+    return space.getName();
+  }
+
+  @Override
+  public URI getTablespaceUri() {
+    return space.getUri();
+  }
+
+  @Override
+  public String getDatabaseName() {
+    return databaseName;
+  }
+
+  @Override
+  public Collection<String> getSchemas() {
+    return Collections.EMPTY_SET;
+  }
+
+  @Override
+  public Collection<String> getTables(@Nullable String schemaPattern, @Nullable String tablePattern) {
+    ResultSet res = null;
+    List<String> tableNames = Lists.newArrayList();
+    try {
+      res = connection.getMetaData().getTables(databaseName, schemaPattern, tablePattern, null);
+      while(res.next()) {
+        tableNames.add(res.getString("TABLE_NAME"));
+      }
+    } catch (SQLException e) {
+      throw new TajoInternalError(e);
+    } finally {
+      try {
+        if (res != null) {
+          res.close();
+        }
+      } catch (SQLException e) {
+        LOG.warn(e);
+      }
+    }
+
+    return tableNames;
+  }
+
+  private TypeDesc convertDataType(ResultSet res) throws SQLException {
+    final int typeId = res.getInt("DATA_TYPE");
+
+    switch (typeId ) {
+    case Types.BOOLEAN:
+      return new TypeDesc(newSimpleDataType(Type.BOOLEAN));
+
+    case Types.TINYINT:
+    case Types.SMALLINT:
+    case Types.INTEGER:
+      return new TypeDesc(newSimpleDataType(Type.INT4));
+
+    case Types.BIGINT:
+      return new TypeDesc(newSimpleDataType(Type.INT8));
+
+    case Types.FLOAT:
+      return new TypeDesc(newSimpleDataType(Type.FLOAT4));
+
+    case Types.NUMERIC:
+    case Types.DECIMAL:
+    case Types.DOUBLE:
+      return new TypeDesc(newSimpleDataType(Type.FLOAT8));
+
+    case Types.DATE:
+      return new TypeDesc(newSimpleDataType(Type.DATE));
+
+    case Types.TIME:
+      return new TypeDesc(newSimpleDataType(Type.TIME));
+
+    case Types.TIMESTAMP:
+      return new TypeDesc(newSimpleDataType(Type.TIMESTAMP));
+
+    case Types.CHAR:
+    case Types.NCHAR:
+    case Types.VARCHAR:
+    case Types.NVARCHAR:
+    case Types.CLOB:
+    case Types.NCLOB:
+    case Types.LONGVARCHAR:
+    case Types.LONGNVARCHAR:
+      return new TypeDesc(newSimpleDataType(Type.TEXT));
+
+    case Types.BINARY:
+    case Types.VARBINARY:
+    case Types.BLOB:
+      return new TypeDesc(newSimpleDataType(Type.BLOB));
+
+    default:
+      throw SQLExceptionUtil.toSQLException(new UnsupportedDataTypeException(typeId + ""));
+    }
+  }
+
+  @Override
+  public TableDesc getTableDescriptor(String schemaName, String tableName) throws UndefinedTablespaceException {
+    ResultSet resultForTable = null;
+    ResultSet resultForColumns = null;
+    try {
+
+      // get table name
+      resultForTable = connection.getMetaData().getTables(databaseName, schemaName, tableName, null);
+
+      if (!resultForTable.next()) {
+        throw new UndefinedTablespaceException(tableName);
+      }
+      final String name = resultForTable.getString("TABLE_NAME");
+
+      // get columns
+      resultForColumns = connection.getMetaData().getColumns(databaseName, schemaName, tableName, null);
+
+      List<Pair<Integer, Column>> columns = Lists.newArrayList();
+
+      while(resultForColumns.next()) {
+        final int ordinalPos = resultForColumns.getInt("ORDINAL_POSITION");
+        final String qualifier = resultForColumns.getString("TABLE_NAME");
+        final String columnName = resultForColumns.getString("COLUMN_NAME");
+        final TypeDesc type = convertDataType(resultForColumns);
+        final Column c = new Column(CatalogUtil.buildFQName(qualifier, columnName), type);
+
+        columns.add(new Pair<>(ordinalPos, c));
+      }
+
+      // sort columns in an order of ordinal position
+      Collections.sort(columns, new Comparator<Pair<Integer, Column>>() {
+        @Override
+        public int compare(Pair<Integer, Column> o1, Pair<Integer, Column> o2) {
+          return o1.getFirst() - o2.getFirst();
+        }
+      });
+
+      // transform the pair list into collection for columns
+      Schema schema = new Schema(Collections2.transform(columns, new Function<Pair<Integer,Column>, Column>() {
+        @Override
+        public Column apply(@Nullable Pair<Integer, Column> columnPair) {
+          return columnPair.getSecond();
+        }
+      }));
+
+      return new TableDesc(
+          CatalogUtil.buildFQName(databaseName, name),
+          schema,
+          new TableMeta("rowstore", new KeyValueSet()),
+          space.getTableUri(databaseName, name)
+      );
+
+    } catch (SQLException e) {
+      throw new TajoInternalError(e);
+    } finally {
+      try {
+        if (resultForTable != null) {
+          resultForTable.close();
+        }
+
+        if (resultForColumns != null) {
+          resultForColumns.close();
+        }
+
+      } catch (SQLException e) {
+        LOG.warn(e);
+      }
+    }
+  }
+
+  protected abstract String getJdbcDriverName();
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
new file mode 100644
index 0000000..f66c5dc
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+import net.minidev.json.JSONObject;
+import org.apache.hadoop.fs.Path;
+import org.apache.tajo.ExecutionBlockId;
+import org.apache.tajo.OverridableConf;
+import org.apache.tajo.catalog.*;
+import org.apache.tajo.exception.NotImplementedException;
+import org.apache.tajo.exception.TajoRuntimeException;
+import org.apache.tajo.exception.UnsupportedException;
+import org.apache.tajo.plan.LogicalPlan;
+import org.apache.tajo.plan.expr.EvalNode;
+import org.apache.tajo.plan.logical.LogicalNode;
+import org.apache.tajo.plan.logical.ScanNode;
+import org.apache.tajo.storage.FormatProperty;
+import org.apache.tajo.storage.StorageProperty;
+import org.apache.tajo.storage.Tablespace;
+import org.apache.tajo.storage.TupleRange;
+import org.apache.tajo.storage.fragment.Fragment;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.net.URI;
+import java.util.List;
+
+/**
+ * <h3>URI Examples:</h3>
+ * <ul>
+ *   <li>jdbc:mysql//primaryhost,secondaryhost1,secondaryhost2/test?profileSQL=true</li>
+ * </ul>
+ */
+public abstract class JdbcTablespace extends Tablespace {
+
+  static final StorageProperty STORAGE_PROPERTY = new StorageProperty("rowstore", false, true, false, true);
+  static final FormatProperty  FORMAT_PROPERTY = new FormatProperty(false, false, false);
+
+
+  public JdbcTablespace(String name, URI uri, JSONObject config) {
+    super(name, uri, config);
+  }
+
+  @Override
+  protected void storageInit() throws IOException {
+  }
+
+  @Override
+  public long getTableVolume(URI uri) throws IOException {
+    return 0;
+  }
+
+  @Override
+  public URI getTableUri(String databaseName, String tableName) {
+    return URI.create(getUri() + "&table=" + tableName);
+  }
+
+  @Override
+  public List<Fragment> getSplits(String inputSourceId,
+                                  TableDesc tableDesc,
+                                  @Nullable EvalNode filterCondition) throws IOException {
+    return null;
+  }
+
+  @Override
+  public List<Fragment> getNonForwardSplit(TableDesc tableDesc, int currentPage, int numFragments) throws IOException {
+    return null;
+  }
+
+  @Override
+  public StorageProperty getProperty() {
+    return STORAGE_PROPERTY;
+  }
+
+  @Override
+  public FormatProperty getFormatProperty(TableMeta meta) {
+    return FORMAT_PROPERTY;
+  }
+
+  @Override
+  public void close() {
+  }
+
+  @Override
+  public TupleRange[] getInsertSortRanges(OverridableConf queryContext,
+                                          TableDesc tableDesc,
+                                          Schema inputSchema,
+                                          SortSpec[] sortSpecs,
+                                          TupleRange dataRange) throws IOException {
+    throw new TajoRuntimeException(new NotImplementedException());
+  }
+
+  @Override
+  public void verifySchemaToWrite(TableDesc tableDesc, Schema outSchema) {
+    throw new TajoRuntimeException(new NotImplementedException());
+  }
+
+  @Override
+  public void createTable(TableDesc tableDesc, boolean ifNotExists) throws IOException {
+    throw new TajoRuntimeException(new NotImplementedException());
+  }
+
+  @Override
+  public void purgeTable(TableDesc tableDesc) throws IOException {
+    throw new TajoRuntimeException(new NotImplementedException());
+  }
+
+  @Override
+  public void prepareTable(LogicalNode node) throws IOException {
+    throw new TajoRuntimeException(new NotImplementedException());
+  }
+
+  @Override
+  public Path commitTable(OverridableConf queryContext, ExecutionBlockId finalEbId, LogicalPlan plan, Schema schema,
+                          TableDesc tableDesc) throws IOException {
+    throw new TajoRuntimeException(new NotImplementedException());
+  }
+
+  @Override
+  public void rollbackTable(LogicalNode node) throws IOException {
+    throw new TajoRuntimeException(new NotImplementedException());
+  }
+
+  @Override
+  public URI getStagingUri(OverridableConf context, String queryId, TableMeta meta) throws IOException {
+    throw new TajoRuntimeException(new UnsupportedException());
+  }
+
+  public abstract MetadataProvider getMetadataProvider();
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/ConnectionInfo.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/ConnectionInfo.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/ConnectionInfo.java
deleted file mode 100644
index 520e221..0000000
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/ConnectionInfo.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.mysql;
-
-import org.apache.tajo.exception.TajoInternalError;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
-public class ConnectionInfo {
-  String scheme;
-  String dbName;
-  String tableName;
-  String user;
-  String password;
-  Map<String, String> params;
-
-  public String scheme() {
-    return scheme;
-  }
-
-  public String database() {
-    return dbName;
-  }
-
-  public String table() {
-    return tableName;
-  }
-
-  public String user() {
-    return user;
-  }
-
-  public String password() {
-    return password;
-  }
-
-  public static ConnectionInfo fromURI(String originalUri) {
-    return fromURI(URI.create(originalUri));
-  }
-
-  public static ConnectionInfo fromURI(URI originalUri) {
-    final String uriStr = originalUri.toASCIIString();
-    URI uri = originalUri;
-
-    final ConnectionInfo connInfo = new ConnectionInfo();
-    connInfo.scheme = uriStr.substring(0, uriStr.indexOf("://"));
-
-    if (connInfo.scheme.split(":").length > 1) {
-      int idx = uriStr.indexOf(':');
-      uri = URI.create(uriStr.substring(idx + 1));
-    }
-
-    String path = uri.getPath();
-    if (path != null && !path.isEmpty()) {
-      String [] pathElements = path.substring(1).split("/");
-      if (pathElements.length != 1) {
-        throw new TajoInternalError("Invalid JDBC path: " + path);
-      }
-      connInfo.dbName = pathElements[0];
-    }
-
-    Map<String, String> params = new HashMap<>();
-
-    int paramIndex = uriStr.indexOf("?");
-    if (paramIndex > 0) {
-      String parameterPart = uriStr.substring(paramIndex+1, uriStr.length());
-
-      String [] eachParam = parameterPart.split("&");
-
-      for (String each: eachParam) {
-        String [] keyValues = each.split("=");
-        if (keyValues.length != 2) {
-          throw new TajoInternalError("Invalid URI Parameters: " + parameterPart);
-        }
-        params.put(keyValues[0], keyValues[1]);
-      }
-    }
-
-    if (params.containsKey("table")) {
-      connInfo.tableName = params.remove("table");
-    }
-
-    if (params.containsKey("user")) {
-      connInfo.user = params.remove("user");
-    }
-    if (params.containsKey("password")) {
-      connInfo.password = params.remove("password");
-    }
-
-    connInfo.params = params;
-
-    return connInfo;
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/JdbcMetadataProviderBase.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/JdbcMetadataProviderBase.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/JdbcMetadataProviderBase.java
deleted file mode 100644
index 89de790..0000000
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/JdbcMetadataProviderBase.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.mysql;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.Lists;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.tajo.catalog.*;
-import org.apache.tajo.common.TajoDataTypes.Type;
-import org.apache.tajo.exception.*;
-import org.apache.tajo.util.KeyValueSet;
-import org.apache.tajo.util.Pair;
-
-import javax.annotation.Nullable;
-import java.net.URI;
-import java.sql.*;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import static org.apache.tajo.catalog.CatalogUtil.newSimpleDataType;
-
-public abstract class JdbcMetadataProviderBase implements MetadataProvider {
-  protected static final Log LOG = LogFactory.getLog(JdbcMetadataProviderBase.class);
-
-  protected final JdbcTablespace space;
-  protected final String databaseName;
-
-  protected final String jdbcUri;
-  protected final String username;
-  protected final String password;
-
-  protected final Connection connection;
-
-  public JdbcMetadataProviderBase(JdbcTablespace space, String dbName) {
-    this.space = space;
-    this.databaseName = dbName;
-
-    ConnectionInfo connInfo = ConnectionInfo.fromURI(space.getUri());
-    this.jdbcUri  = space.getUri().toASCIIString();
-    this.username = connInfo.user();
-    this.password = connInfo.password();
-
-    try {
-      Class.forName(getJdbcDriverName()).newInstance();
-      LOG.info(getJdbcDriverName() + " is loaded...");
-    } catch (Exception e) {
-      throw new TajoInternalError(e);
-    }
-
-    try {
-      connection = DriverManager.getConnection(jdbcUri, this.username, this.password);
-    } catch (SQLException e) {
-      throw new TajoInternalError(e);
-    }
-  }
-
-  @Override
-  public String getTablespaceName() {
-    return space.getName();
-  }
-
-  @Override
-  public URI getTablespaceUri() {
-    return space.getUri();
-  }
-
-  @Override
-  public String getDatabaseName() {
-    return databaseName;
-  }
-
-  @Override
-  public Collection<String> getSchemas() {
-    return Collections.EMPTY_SET;
-  }
-
-  @Override
-  public Collection<String> getTables(@Nullable String schemaPattern, @Nullable String tablePattern) {
-    ResultSet res = null;
-    List<String> tableNames = Lists.newArrayList();
-    try {
-      res = connection.getMetaData().getTables(databaseName, schemaPattern, tablePattern, null);
-      while(res.next()) {
-        tableNames.add(res.getString("TABLE_NAME"));
-      }
-    } catch (SQLException e) {
-      throw new TajoInternalError(e);
-    } finally {
-      try {
-        if (res != null) {
-          res.close();
-        }
-      } catch (SQLException e) {
-        LOG.warn(e);
-      }
-    }
-
-    return tableNames;
-  }
-
-  private TypeDesc convertDataType(ResultSet res) throws SQLException {
-    final int typeId = res.getInt("DATA_TYPE");
-
-    switch (typeId ) {
-    case Types.BOOLEAN:
-      return new TypeDesc(newSimpleDataType(Type.BOOLEAN));
-
-    case Types.TINYINT:
-    case Types.SMALLINT:
-    case Types.INTEGER:
-      return new TypeDesc(newSimpleDataType(Type.INT4));
-
-    case Types.BIGINT:
-      return new TypeDesc(newSimpleDataType(Type.INT8));
-
-    case Types.FLOAT:
-      return new TypeDesc(newSimpleDataType(Type.FLOAT4));
-
-    case Types.NUMERIC:
-    case Types.DECIMAL:
-    case Types.DOUBLE:
-      return new TypeDesc(newSimpleDataType(Type.FLOAT8));
-
-    case Types.DATE:
-      return new TypeDesc(newSimpleDataType(Type.DATE));
-
-    case Types.TIME:
-      return new TypeDesc(newSimpleDataType(Type.TIME));
-
-    case Types.TIMESTAMP:
-      return new TypeDesc(newSimpleDataType(Type.TIMESTAMP));
-
-    case Types.CHAR:
-    case Types.NCHAR:
-    case Types.VARCHAR:
-    case Types.NVARCHAR:
-    case Types.CLOB:
-    case Types.NCLOB:
-    case Types.LONGVARCHAR:
-    case Types.LONGNVARCHAR:
-      return new TypeDesc(newSimpleDataType(Type.TEXT));
-
-    case Types.BINARY:
-    case Types.VARBINARY:
-    case Types.BLOB:
-      return new TypeDesc(newSimpleDataType(Type.BLOB));
-
-    default:
-      throw SQLExceptionUtil.toSQLException(new UnsupportedDataTypeException(typeId + ""));
-    }
-  }
-
-  @Override
-  public TableDesc getTableDescriptor(String schemaName, String tableName) throws UndefinedTablespaceException {
-    ResultSet resultForTable = null;
-    ResultSet resultForColumns = null;
-    try {
-
-      // get table name
-      resultForTable = connection.getMetaData().getTables(databaseName, schemaName, tableName, null);
-
-      if (!resultForTable.next()) {
-        throw new UndefinedTablespaceException(tableName);
-      }
-      final String name = resultForTable.getString("TABLE_NAME");
-
-      // get columns
-      resultForColumns = connection.getMetaData().getColumns(databaseName, schemaName, tableName, null);
-
-      List<Pair<Integer, Column>> columns = Lists.newArrayList();
-
-      while(resultForColumns.next()) {
-        final int ordinalPos = resultForColumns.getInt("ORDINAL_POSITION");
-        final String qualifier = resultForColumns.getString("TABLE_NAME");
-        final String columnName = resultForColumns.getString("COLUMN_NAME");
-        final TypeDesc type = convertDataType(resultForColumns);
-        final Column c = new Column(CatalogUtil.buildFQName(qualifier, columnName), type);
-
-        columns.add(new Pair<>(ordinalPos, c));
-      }
-
-      // sort columns in an order of ordinal position
-      Collections.sort(columns, new Comparator<Pair<Integer, Column>>() {
-        @Override
-        public int compare(Pair<Integer, Column> o1, Pair<Integer, Column> o2) {
-          return o1.getFirst() - o2.getFirst();
-        }
-      });
-
-      // transform the pair list into collection for columns
-      Schema schema = new Schema(Collections2.transform(columns, new Function<Pair<Integer,Column>, Column>() {
-        @Override
-        public Column apply(@Nullable Pair<Integer, Column> columnPair) {
-          return columnPair.getSecond();
-        }
-      }));
-
-      return new TableDesc(
-          CatalogUtil.buildFQName(databaseName, name),
-          schema,
-          new TableMeta("rowstore", new KeyValueSet()),
-          space.getTableUri(databaseName, name)
-      );
-
-    } catch (SQLException e) {
-      throw new TajoInternalError(e);
-    } finally {
-      try {
-        if (resultForTable != null) {
-          resultForTable.close();
-        }
-
-        if (resultForColumns != null) {
-          resultForColumns.close();
-        }
-
-      } catch (SQLException e) {
-        LOG.warn(e);
-      }
-    }
-  }
-
-  protected abstract String getJdbcDriverName();
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/JdbcTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/JdbcTablespace.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/JdbcTablespace.java
deleted file mode 100644
index 555a6ae..0000000
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/JdbcTablespace.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.mysql;
-
-import net.minidev.json.JSONObject;
-import org.apache.hadoop.fs.Path;
-import org.apache.tajo.ExecutionBlockId;
-import org.apache.tajo.OverridableConf;
-import org.apache.tajo.catalog.*;
-import org.apache.tajo.plan.LogicalPlan;
-import org.apache.tajo.plan.logical.LogicalNode;
-import org.apache.tajo.plan.logical.ScanNode;
-import org.apache.tajo.storage.FormatProperty;
-import org.apache.tajo.storage.StorageProperty;
-import org.apache.tajo.storage.Tablespace;
-import org.apache.tajo.storage.TupleRange;
-import org.apache.tajo.storage.fragment.Fragment;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.List;
-
-/**
- * <h3>URI Examples:</h3>
- * <ul>
- *   <li>jdbc:mysql//primaryhost,secondaryhost1,secondaryhost2/test?profileSQL=true</li>
- * </ul>
- */
-public abstract class JdbcTablespace extends Tablespace {
-
-  static final StorageProperty STORAGE_PROPERTY = new StorageProperty("rowstore", false, true, false, true);
-
-
-  public JdbcTablespace(String name, URI uri, JSONObject config) {
-    super(name, uri, config);
-  }
-
-  @Override
-  protected void storageInit() throws IOException {
-
-  }
-
-  @Override
-  public long getTableVolume(URI uri) throws IOException {
-    return 0;
-  }
-
-  @Override
-  public URI getTableUri(String databaseName, String tableName) {
-    return URI.create(getUri() + "&table=" + tableName);
-  }
-
-  @Override
-  public List<Fragment> getSplits(String fragmentId, TableDesc tableDesc, ScanNode scanNode) throws IOException {
-    return null;
-  }
-
-  @Override
-  public List<Fragment> getNonForwardSplit(TableDesc tableDesc, int currentPage, int numFragments) throws IOException {
-    return null;
-  }
-
-  @Override
-  public StorageProperty getProperty() {
-    return STORAGE_PROPERTY;
-  }
-
-  @Override
-  public FormatProperty getFormatProperty(TableMeta meta) {
-    return null;
-  }
-
-  @Override
-  public void close() {
-
-  }
-
-  @Override
-  public TupleRange[] getInsertSortRanges(OverridableConf queryContext,
-                                          TableDesc tableDesc,
-                                          Schema inputSchema,
-                                          SortSpec[] sortSpecs,
-                                          TupleRange dataRange) throws IOException {
-    return new TupleRange[0];
-  }
-
-  @Override
-  public void verifySchemaToWrite(TableDesc tableDesc, Schema outSchema) {
-
-  }
-
-  @Override
-  public void createTable(TableDesc tableDesc, boolean ifNotExists) throws IOException {
-  }
-
-  @Override
-  public void purgeTable(TableDesc tableDesc) throws IOException {
-
-  }
-
-  @Override
-  public void prepareTable(LogicalNode node) throws IOException {
-
-  }
-
-  @Override
-  public Path commitTable(OverridableConf queryContext, ExecutionBlockId finalEbId, LogicalPlan plan, Schema schema,
-                          TableDesc tableDesc) throws IOException {
-    return null;
-  }
-
-  @Override
-  public void rollbackTable(LogicalNode node) throws IOException {
-
-  }
-
-  @Override
-  public URI getStagingUri(OverridableConf context, String queryId, TableMeta meta) throws IOException {
-    return null;
-  }
-
-  public abstract MetadataProvider getMetadataProvider();
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-jdbc/src/main/proto/JdbcFragmentProtos.proto
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/proto/JdbcFragmentProtos.proto b/tajo-storage/tajo-storage-jdbc/src/main/proto/JdbcFragmentProtos.proto
new file mode 100644
index 0000000..a09c8f1
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/main/proto/JdbcFragmentProtos.proto
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+option java_package = "org.apache.tajo.storage.jdbc";
+option java_outer_classname = "JdbcFragmentProtos";
+option optimize_for = SPEED;
+option java_generic_services = false;
+option java_generate_equals_and_hash = true;
+
+import "CatalogProtos.proto";
+
+message JdbcFragmentProto {
+  required string uri = 1;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-jdbc/src/main/proto/StorageFragmentProtos.proto
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/proto/StorageFragmentProtos.proto b/tajo-storage/tajo-storage-jdbc/src/main/proto/StorageFragmentProtos.proto
deleted file mode 100644
index 33d45b3..0000000
--- a/tajo-storage/tajo-storage-jdbc/src/main/proto/StorageFragmentProtos.proto
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-option java_package = "org.apache.tajo.storage.hbase";
-option java_outer_classname = "StorageFragmentProtos";
-option optimize_for = SPEED;
-option java_generic_services = false;
-option java_generate_equals_and_hash = true;
-
-import "CatalogProtos.proto";
-
-message HBaseFragmentProto {
-  required string uri = 1;
-  required string tableName = 2;
-  required string hbaseTableName = 3;
-  required bytes startRow = 4;
-  required bytes stopRow = 5;
-  required bool last = 6;
-  required int64 length = 7;
-  optional string regionLocation = 8;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-jdbc/src/main/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java b/tajo-storage/tajo-storage-jdbc/src/main/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java
new file mode 100644
index 0000000..9eee00a
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/main/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+public abstract class JdbcTablespaceTestBase {
+
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-jdbc/src/main/test/java/org/apache/tajo/storage/jdbc/TestConnectionInfo.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/test/java/org/apache/tajo/storage/jdbc/TestConnectionInfo.java b/tajo-storage/tajo-storage-jdbc/src/main/test/java/org/apache/tajo/storage/jdbc/TestConnectionInfo.java
new file mode 100644
index 0000000..1ccd322
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/main/test/java/org/apache/tajo/storage/jdbc/TestConnectionInfo.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+public class TestConnectionInfo {
+  @Test
+  public final void testGetConnectionInfoType1() {
+    ConnectionInfo c1 = ConnectionInfo.fromURI("jdbc:mysql://localhost:55840?user=testuser&password=testpass");
+    assertEquals("jdbc:mysql", c1.scheme);
+    assertEquals("testuser", c1.user);
+    assertEquals("testpass", c1.password);
+    assertNull(c1.dbName);
+    assertNull(c1.tableName);
+    assertEquals(0, c1.params.size());
+  }
+
+  @Test
+  public final void testGetConnectionInfoType2() {
+    ConnectionInfo c1 = ConnectionInfo.fromURI(
+        "jdbc:mysql://localhost:55840/db1?table=tb1&user=testuser&password=testpass&TZ=GMT+9");
+    assertEquals("jdbc:mysql", c1.scheme);
+    assertEquals("testuser", c1.user);
+    assertEquals("testpass", c1.password);
+    assertEquals("db1", c1.dbName);
+    assertEquals("tb1", c1.tableName);
+    assertEquals(1, c1.params.size());
+    assertEquals("GMT+9", c1.params.get("TZ"));
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/mysql/JdbcTablespaceTestBase.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/mysql/JdbcTablespaceTestBase.java b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/mysql/JdbcTablespaceTestBase.java
deleted file mode 100644
index 1e4343d..0000000
--- a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/mysql/JdbcTablespaceTestBase.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.mysql;
-
-import org.apache.tajo.util.FileUtil;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-import java.io.IOException;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-public abstract class JdbcTablespaceTestBase {
-
-  @BeforeClass
-  public static void setUp() throws Exception {
-  }
-
-  @AfterClass
-  public static void tearDown() {
-  }
-
-  protected void prepareDefaultTables(Statement statement) throws IOException, SQLException {
-    statement.addBatch(FileUtil.readTextFileFromResource("table_ddl/all_types"));
-    statement.executeBatch();
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/mysql/TestConnectionInfo.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/mysql/TestConnectionInfo.java b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/mysql/TestConnectionInfo.java
deleted file mode 100644
index 9da73d9..0000000
--- a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/mysql/TestConnectionInfo.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.mysql;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-public class TestConnectionInfo {
-  @Test
-  public final void testGetConnectionInfoType1() {
-    ConnectionInfo c1 = ConnectionInfo.fromURI("jdbc:mysql://localhost:55840?user=testuser&password=testpass");
-    assertEquals("jdbc:mysql", c1.scheme);
-    assertEquals("testuser", c1.user);
-    assertEquals("testpass", c1.password);
-    assertNull(c1.dbName);
-    assertNull(c1.tableName);
-    assertEquals(0, c1.params.size());
-  }
-
-  @Test
-  public final void testGetConnectionInfoType2() {
-    ConnectionInfo c1 = ConnectionInfo.fromURI(
-        "jdbc:mysql://localhost:55840/db1?table=tb1&user=testuser&password=testpass&TZ=GMT+9");
-    assertEquals("jdbc:mysql", c1.scheme);
-    assertEquals("testuser", c1.user);
-    assertEquals("testpass", c1.password);
-    assertEquals("db1", c1.dbName);
-    assertEquals("tb1", c1.tableName);
-    assertEquals(1, c1.params.size());
-    assertEquals("GMT+9", c1.params.get("TZ"));
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLMetadataProvider.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLMetadataProvider.java b/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLMetadataProvider.java
index 2d94460..33edb5c 100644
--- a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLMetadataProvider.java
+++ b/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLMetadataProvider.java
@@ -18,6 +18,8 @@
 
 package org.apache.tajo.storage.mysql;
 
+import org.apache.tajo.storage.jdbc.JdbcMetadataProviderBase;
+
 public class MySQLMetadataProvider extends JdbcMetadataProviderBase {
 
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java b/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java
index 95d860d..d3a0c6a 100644
--- a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java
+++ b/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java
@@ -21,6 +21,7 @@ package org.apache.tajo.storage.mysql;
 import net.minidev.json.JSONObject;
 import org.apache.tajo.catalog.*;
 import org.apache.tajo.storage.*;
+import org.apache.tajo.storage.jdbc.JdbcTablespace;
 
 import java.net.URI;
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLMetadataProvider.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLMetadataProvider.java b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLMetadataProvider.java
index abb9bab..069ffe3 100644
--- a/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLMetadataProvider.java
+++ b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLMetadataProvider.java
@@ -18,7 +18,7 @@
 
 package org.apache.tajo.storage.pgsql;
 
-import org.apache.tajo.storage.mysql.JdbcMetadataProviderBase;
+import org.apache.tajo.storage.jdbc.JdbcMetadataProviderBase;
 
 import javax.annotation.Nullable;
 import java.util.Collection;

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
index 2237cce..8ab290c 100644
--- a/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
+++ b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
@@ -21,7 +21,7 @@ package org.apache.tajo.storage.pgsql;
 import net.minidev.json.JSONObject;
 import org.apache.tajo.catalog.MetadataProvider;
 import org.apache.tajo.storage.TablespaceManager;
-import org.apache.tajo.storage.mysql.JdbcTablespace;
+import org.apache.tajo.storage.jdbc.JdbcTablespace;
 
 import java.net.URI;
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java
index dfdfc74..bb4f5e7 100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.tajo.storage.pgsql;
 
 import io.airlift.testing.postgresql.TestingPostgreSqlServer;

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java
index 80305f4..179eb33 100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java
@@ -18,10 +18,22 @@
 
 package org.apache.tajo.storage.pgsql;
 
+import org.apache.tajo.catalog.MetadataProvider;
+import org.apache.tajo.catalog.TableDesc;
+import org.apache.tajo.exception.NotImplementedException;
+import org.apache.tajo.exception.TajoException;
+import org.apache.tajo.exception.TajoRuntimeException;
+import org.apache.tajo.exception.UnsupportedException;
+import org.apache.tajo.storage.Tablespace;
 import org.apache.tajo.storage.TablespaceManager;
+import org.apache.tajo.storage.fragment.Fragment;
 import org.junit.Test;
 
+import java.io.IOException;
+import java.util.List;
+
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 public class TestPgSQLJdbcTableSpace {
@@ -38,4 +50,26 @@ public class TestPgSQLJdbcTableSpace {
     assertEquals(jdbcUrl, TablespaceManager.get(jdbcUrl).get().getUri().toASCIIString());
     assertTrue(TablespaceManager.get(jdbcUrl).get().getMetadataProvider() instanceof PgSQLMetadataProvider);
   }
+
+  @Test(expected = TajoRuntimeException.class)
+  public void testCreateTable() throws IOException, TajoException {
+    Tablespace space = TablespaceManager.getByName("pgsql_cluster").get();
+    space.createTable(null, false);
+  }
+
+  @Test(expected = TajoRuntimeException.class)
+  public void testDropTable() throws IOException, TajoException {
+    Tablespace space = TablespaceManager.getByName("pgsql_cluster").get();
+    space.purgeTable(null);
+  }
+
+  @Test
+  public void testGetSplits() throws IOException, TajoException {
+    Tablespace space = TablespaceManager.getByName("pgsql_cluster").get();
+    MetadataProvider provider = space.getMetadataProvider();
+    TableDesc table = provider.getTableDescriptor(null, "lineitem");
+    List<Fragment> fragments = space.getSplits("lineitem", table, null);
+    assertNotNull(fragments);
+    assertEquals(1, fragments.size());
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/customer.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/customer.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/customer.sql
new file mode 100644
index 0000000..35b1861
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/customer.sql
@@ -0,0 +1,10 @@
+CREATE TABLE CUSTOMER (
+  C_CUSTKEY     INTEGER NOT NULL,
+  C_NAME        VARCHAR(25) NOT NULL,
+  C_ADDRESS     VARCHAR(40) NOT NULL,
+  C_NATIONKEY   INTEGER NOT NULL,
+  C_PHONE       CHAR(15) NOT NULL,
+  C_ACCTBAL     DECIMAL(15,2)   NOT NULL,
+  C_MKTSEGMENT  CHAR(10) NOT NULL,
+  C_COMMENT     VARCHAR(117) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/lineitem.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/lineitem.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/lineitem.sql
new file mode 100644
index 0000000..a7f61bb
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/lineitem.sql
@@ -0,0 +1,18 @@
+CREATE TABLE LINEITEM (
+  L_ORDERKEY    INTEGER NOT NULL,
+  L_PARTKEY     INTEGER NOT NULL,
+  L_SUPPKEY     INTEGER NOT NULL,
+  L_LINENUMBER  INTEGER NOT NULL,
+  L_QUANTITY    DECIMAL(15,2) NOT NULL,
+  L_EXTENDEDPRICE  DECIMAL(15,2) NOT NULL,
+  L_DISCOUNT    DECIMAL(15,2) NOT NULL,
+  L_TAX         DECIMAL(15,2) NOT NULL,
+  L_RETURNFLAG  CHAR(1) NOT NULL,
+  L_LINESTATUS  CHAR(1) NOT NULL,
+  L_SHIPDATE    DATE NOT NULL,
+  L_COMMITDATE  DATE NOT NULL,
+  L_RECEIPTDATE DATE NOT NULL,
+  L_SHIPINSTRUCT CHAR(25) NOT NULL,
+  L_SHIPMODE     CHAR(10) NOT NULL,
+  L_COMMENT      VARCHAR(44) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/nation.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/nation.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/nation.sql
new file mode 100644
index 0000000..f7ecda8
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/nation.sql
@@ -0,0 +1,6 @@
+CREATE TABLE NATION  (
+  N_NATIONKEY  INTEGER NOT NULL,
+  N_NAME       CHAR(25) NOT NULL,
+  N_REGIONKEY  INTEGER NOT NULL,
+  N_COMMENT    VARCHAR(152)
+);

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/orders.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/orders.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/orders.sql
new file mode 100644
index 0000000..220d576
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/orders.sql
@@ -0,0 +1,11 @@
+CREATE TABLE ORDERS  (
+  O_ORDERKEY       INTEGER NOT NULL,
+  O_CUSTKEY        INTEGER NOT NULL,
+  O_ORDERSTATUS    CHAR(1) NOT NULL,
+  O_TOTALPRICE     DECIMAL(15,2) NOT NULL,
+  O_ORDERDATE      DATE NOT NULL,
+  O_ORDERPRIORITY  CHAR(15) NOT NULL,
+  O_CLERK          CHAR(15) NOT NULL,
+  O_SHIPPRIORITY   INTEGER NOT NULL,
+  O_COMMENT        VARCHAR(79) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/part.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/part.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/part.sql
new file mode 100644
index 0000000..e66f73c
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/part.sql
@@ -0,0 +1,11 @@
+CREATE TABLE PART (
+  P_PARTKEY     INTEGER NOT NULL,
+  P_NAME        VARCHAR(55) NOT NULL,
+  P_MFGR        CHAR(25) NOT NULL,
+  P_BRAND       CHAR(10) NOT NULL,
+  P_TYPE        VARCHAR(25) NOT NULL,
+  P_SIZE        INTEGER NOT NULL,
+  P_CONTAINER   CHAR(10) NOT NULL,
+  P_RETAILPRICE DECIMAL(15,2) NOT NULL,
+  P_COMMENT     VARCHAR(23) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/partsupp.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/partsupp.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/partsupp.sql
new file mode 100644
index 0000000..1f61331
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/partsupp.sql
@@ -0,0 +1,7 @@
+CREATE TABLE PARTSUPP (
+  PS_PARTKEY     INTEGER NOT NULL,
+  PS_SUPPKEY     INTEGER NOT NULL,
+  PS_AVAILQTY    INTEGER NOT NULL,
+  PS_SUPPLYCOST  DECIMAL(15,2)  NOT NULL,
+  PS_COMMENT     VARCHAR(199) NOT NULL
+);
\ No newline at end of file


[12/39] tajo git commit: Fixed wrong imports.

Posted by hy...@apache.org.
Fixed wrong imports.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/953e625b
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/953e625b
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/953e625b

Branch: refs/heads/TAJO-1730
Commit: 953e625b212648bdbcf750aa1b1efe4d6697a36d
Parents: f476bbd
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sat Aug 15 00:32:59 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sat Aug 15 00:32:59 2015 +0900

----------------------------------------------------------------------
 tajo-storage/tajo-storage-jdbc/pom.xml          | 128 -------------------
 .../storage/jdbc/JdbcMetadataProviderBase.java  |   8 +-
 .../storage/jdbc/JdbcTablespaceTestBase.java    |  22 ++++
 3 files changed, 26 insertions(+), 132 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/953e625b/tajo-storage/tajo-storage-jdbc/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/pom.xml b/tajo-storage/tajo-storage-jdbc/pom.xml
index 7882fb4..11c827a 100644
--- a/tajo-storage/tajo-storage-jdbc/pom.xml
+++ b/tajo-storage/tajo-storage-jdbc/pom.xml
@@ -188,116 +188,8 @@
       <artifactId>tajo-storage-common</artifactId>
       <scope>provided</scope>
     </dependency>
-    <dependency>
-      <groupId>org.apache.tajo</groupId>
-      <artifactId>tajo-storage-hdfs</artifactId>
-      <scope>provided</scope>
-    </dependency>
 
     <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-common</artifactId>
-      <scope>provided</scope>
-      <exclusions>
-        <exclusion>
-          <artifactId>zookeeper</artifactId>
-          <groupId>org.apache.zookeeper</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>slf4j-api</artifactId>
-          <groupId>org.slf4j</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>jersey-json</artifactId>
-          <groupId>com.sun.jersey</groupId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-hdfs</artifactId>
-      <scope>provided</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>commons-el</groupId>
-          <artifactId>commons-el</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>tomcat</groupId>
-          <artifactId>jasper-runtime</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>tomcat</groupId>
-          <artifactId>jasper-compiler</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.mortbay.jetty</groupId>
-          <artifactId>jsp-2.1-jetty</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>com.sun.jersey.jersey-test-framework</groupId>
-          <artifactId>jersey-test-framework-grizzly2</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-minicluster</artifactId>
-      <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>commons-el</groupId>
-          <artifactId>commons-el</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>tomcat</groupId>
-          <artifactId>jasper-runtime</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>tomcat</groupId>
-          <artifactId>jasper-compiler</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.mortbay.jetty</groupId>
-          <artifactId>jsp-2.1-jetty</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>com.sun.jersey.jersey-test-framework</groupId>
-          <artifactId>jersey-test-framework-grizzly2</artifactId>
-        </exclusion>
-        <exclusion>
-          <artifactId>hadoop-yarn-server-tests</artifactId>
-          <groupId>org.apache.hadoop</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>hadoop-mapreduce-client-jobclient</artifactId>
-          <groupId>org.apache.hadoop</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>hadoop-mapreduce-client-app</artifactId>
-          <groupId>org.apache.hadoop</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>hadoop-yarn-api</artifactId>
-          <groupId>org.apache.hadoop</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>hadoop-mapreduce-client-hs</artifactId>
-          <groupId>org.apache.hadoop</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>hadoop-mapreduce-client-core</artifactId>
-          <groupId>org.apache.hadoop</groupId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-mapreduce-client-core</artifactId>
-      <version>${hadoop.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
       <groupId>com.google.protobuf</groupId>
       <artifactId>protobuf-java</artifactId>
     </dependency>
@@ -306,26 +198,6 @@
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>io.airlift</groupId>
-      <artifactId>testing-mysql-server</artifactId>
-      <version>0.1</version>
-      <scope>test</scope>
-    </dependency>
-    <!--
-    <dependency>
-      <groupId>io.airlift</groupId>
-      <artifactId>testing-postgresql-server</artifactId>
-      <version>0.3</version>
-      <scope>test</scope>
-    </dependency>
-    -->
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-      <version>15.0</version>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
   <profiles>

http://git-wip-us.apache.org/repos/asf/tajo/blob/953e625b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
index 87da6c7..b3e9474 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
@@ -18,9 +18,9 @@
 
 package org.apache.tajo.storage.jdbc;
 
-import com.facebook.presto.hive.shaded.com.google.common.base.Function;
-import com.facebook.presto.hive.shaded.com.google.common.collect.Collections2;
-import com.facebook.presto.hive.shaded.com.google.common.collect.Lists;
+import com.google.common.base.Function;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.tajo.catalog.*;
@@ -208,7 +208,7 @@ public abstract class JdbcMetadataProviderBase implements MetadataProvider {
       });
 
       // transform the pair list into collection for columns
-      Schema schema = new Schema(Collections2.transform(columns, new Function<Pair<Integer, Column>, Column>() {
+      Schema schema = new Schema(Collections2.transform(columns, new Function<Pair<Integer,Column>, Column>() {
         @Override
         public Column apply(@Nullable Pair<Integer, Column> columnPair) {
           return columnPair.getSecond();

http://git-wip-us.apache.org/repos/asf/tajo/blob/953e625b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java
new file mode 100644
index 0000000..5dfe4c3
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+public class JdbcTablespaceTestBase {
+}


[10/39] tajo git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730

Posted by hy...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/77dfbbdf
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/77dfbbdf
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/77dfbbdf

Branch: refs/heads/TAJO-1730
Commit: 77dfbbdfc1d4e12768ae418f96e93e27efe14fd6
Parents: fe0b8a7 a410688
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sat Aug 15 00:02:28 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sat Aug 15 00:02:28 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |    5 +
 pom.xml                                         |    2 +
 .../org/apache/tajo/algebra/CommonSubquery.java |   60 +
 .../apache/tajo/algebra/ExistsPredicate.java    |    6 +-
 .../java/org/apache/tajo/algebra/OpType.java    |    2 +-
 .../java/org/apache/tajo/algebra/Relation.java  |    8 +-
 .../org/apache/tajo/algebra/RelationList.java   |    3 +-
 .../tajo/algebra/SimpleTableSubQuery.java       |   36 -
 .../tajo/algebra/SimpleTableSubquery.java       |   28 +
 .../tajo/algebra/TablePrimarySubQuery.java      |   54 +-
 tajo-cluster-tests/pom.xml                      |  302 ++++
 .../org/apache/tajo/BackendTestingUtil.java     |   71 +
 .../org/apache/tajo/HBaseTestClusterUtil.java   |  184 +++
 .../java/org/apache/tajo/IntegrationTest.java   |   22 +
 .../apache/tajo/LocalTajoTestingUtility.java    |  169 +++
 .../test/java/org/apache/tajo/NamedTest.java    |   27 +
 .../java/org/apache/tajo/QueryTestCaseBase.java | 1030 +++++++++++++
 .../org/apache/tajo/TajoTestingCluster.java     |  778 ++++++++++
 .../test/java/org/apache/tajo/TpchTestBase.java |  113 ++
 tajo-core-tests/pom.xml                         |  356 +++++
 tajo-core-tests/src/test/java/log4j.properties  |   28 +
 .../org/apache/tajo/TestQueryIdFactory.java     |   58 +
 .../test/java/org/apache/tajo/TestTajoIds.java  |  168 +++
 .../org/apache/tajo/benchmark/TestTPCH.java     |   68 +
 .../apache/tajo/cli/tools/TestDDLBuilder.java   |  133 ++
 .../org/apache/tajo/cli/tools/TestTajoDump.java |  124 ++
 .../cli/tsql/TestDefaultCliOutputFormatter.java |  179 +++
 .../apache/tajo/cli/tsql/TestSimpleParser.java  |  286 ++++
 .../org/apache/tajo/cli/tsql/TestTajoCli.java   |  472 ++++++
 .../tajo/cli/tsql/TestTajoCliNegatives.java     |  146 ++
 .../commands/TestExecExternalShellCommand.java  |   45 +
 .../tajo/cli/tsql/commands/TestHdfsCommand.java |   47 +
 .../TestCatalogAdminClientExceptions.java       |  102 ++
 .../tajo/client/TestQueryClientExceptions.java  |  121 ++
 .../org/apache/tajo/client/TestTajoClient.java  |  775 ++++++++++
 .../apache/tajo/client/v2/TestTajoClientV2.java |  274 ++++
 .../tajo/cluster/TestWorkerConnectionInfo.java  |   36 +
 .../engine/codegen/TestEvalCodeGenerator.java   |  310 ++++
 .../engine/codegen/TestGeneratorAdapter.java    |   41 +
 .../apache/tajo/engine/eval/ExprTestBase.java   |  341 +++++
 .../apache/tajo/engine/eval/TestEvalTree.java   |  424 ++++++
 .../tajo/engine/eval/TestEvalTreeUtil.java      |  374 +++++
 .../tajo/engine/eval/TestIntervalType.java      |  124 ++
 .../apache/tajo/engine/eval/TestPredicates.java |  405 +++++
 .../tajo/engine/eval/TestSQLDateTimeTypes.java  |   50 +
 .../tajo/engine/eval/TestSQLExpression.java     | 1001 +++++++++++++
 .../tajo/engine/function/TestAggFunction.java   |   65 +
 .../engine/function/TestBuiltinFunctions.java   |  824 ++++++++++
 .../function/TestConditionalExpressions.java    |  242 +++
 .../engine/function/TestDateTimeFunctions.java  |  483 ++++++
 .../engine/function/TestFunctionLoader.java     |   45 +
 .../engine/function/TestGeneralFunction.java    |   49 +
 .../tajo/engine/function/TestJsonFunctions.java |   66 +
 .../tajo/engine/function/TestMathFunctions.java |  470 ++++++
 .../function/TestPatternMatchingPredicates.java |  139 ++
 .../engine/function/TestPythonFunctions.java    |   43 +
 .../TestStringOperatorsAndFunctions.java        |  615 ++++++++
 .../tajo/engine/parser/TestSQLAnalyzer.java     |  804 ++++++++++
 .../engine/planner/TestJoinOrderAlgorithm.java  |  184 +++
 .../engine/planner/TestLogicalOptimizer.java    |  272 ++++
 .../tajo/engine/planner/TestLogicalPlan.java    |   86 ++
 .../tajo/engine/planner/TestLogicalPlanner.java | 1360 +++++++++++++++++
 .../tajo/engine/planner/TestPlannerUtil.java    |  387 +++++
 .../engine/planner/TestQueryValidation.java     |   65 +
 .../planner/TestUniformRangePartition.java      | 1143 ++++++++++++++
 .../engine/planner/global/TestMasterPlan.java   |   53 +
 .../planner/physical/TestBNLJoinExec.java       |  224 +++
 .../planner/physical/TestExternalSortExec.java  |  187 +++
 .../physical/TestFullOuterHashJoinExec.java     |  414 +++++
 .../physical/TestFullOuterMergeJoinExec.java    |  537 +++++++
 .../planner/physical/TestHashAntiJoinExec.java  |  215 +++
 .../planner/physical/TestHashJoinExec.java      |  281 ++++
 .../planner/physical/TestHashPartitioner.java   |  117 ++
 .../planner/physical/TestHashSemiJoinExec.java  |  220 +++
 .../physical/TestLeftOuterHashJoinExec.java     |  440 ++++++
 .../planner/physical/TestMergeJoinExec.java     |  197 +++
 .../engine/planner/physical/TestNLJoinExec.java |  208 +++
 .../planner/physical/TestPhysicalPlanner.java   | 1144 ++++++++++++++
 .../physical/TestProgressExternalSortExec.java  |  229 +++
 .../physical/TestRightOuterHashJoinExec.java    |  351 +++++
 .../physical/TestRightOuterMergeJoinExec.java   |  531 +++++++
 .../engine/planner/physical/TestSortExec.java   |  179 +++
 .../planner/physical/TestSortIntersectExec.java |  293 ++++
 .../planner/physical/TestTupleSorter.java       |  127 ++
 .../tajo/engine/query/TestAlterTable.java       |  114 ++
 .../tajo/engine/query/TestAlterTablespace.java  |   59 +
 .../apache/tajo/engine/query/TestCTASQuery.java |  281 ++++
 .../tajo/engine/query/TestCaseByCases.java      |  183 +++
 .../tajo/engine/query/TestCreateDatabase.java   |   75 +
 .../tajo/engine/query/TestCreateIndex.java      |  112 ++
 .../tajo/engine/query/TestCreateTable.java      |  643 ++++++++
 .../apache/tajo/engine/query/TestDropTable.java |   38 +
 .../tajo/engine/query/TestGroupByQuery.java     |  870 +++++++++++
 .../tajo/engine/query/TestHBaseTable.java       | 1408 +++++++++++++++++
 .../tajo/engine/query/TestInSubquery.java       |  177 +++
 .../apache/tajo/engine/query/TestIndexScan.java |  145 ++
 .../tajo/engine/query/TestInnerJoinQuery.java   |  335 +++++
 .../engine/query/TestInnerJoinWithSubQuery.java |  132 ++
 .../tajo/engine/query/TestInsertQuery.java      |  882 +++++++++++
 .../query/TestJoinOnPartitionedTables.java      |  341 +++++
 .../apache/tajo/engine/query/TestJoinQuery.java |  315 ++++
 .../engine/query/TestMultipleJoinTypes.java     |  106 ++
 .../apache/tajo/engine/query/TestNetTypes.java  |  102 ++
 .../tajo/engine/query/TestNullValues.java       |  322 ++++
 .../tajo/engine/query/TestOuterJoinQuery.java   |  457 ++++++
 .../engine/query/TestOuterJoinWithSubQuery.java |  143 ++
 .../engine/query/TestSelectNestedRecord.java    |  119 ++
 .../tajo/engine/query/TestSelectQuery.java      |  778 ++++++++++
 .../tajo/engine/query/TestSetSessionQuery.java  |   80 +
 .../apache/tajo/engine/query/TestSortQuery.java |  377 +++++
 .../tajo/engine/query/TestTablePartitions.java  | 1301 ++++++++++++++++
 .../tajo/engine/query/TestTableSubQuery.java    |   81 +
 .../tajo/engine/query/TestTruncateTable.java    |   96 ++
 .../tajo/engine/query/TestUnionQuery.java       |  693 +++++++++
 .../tajo/engine/query/TestWindowQuery.java      |  465 ++++++
 .../apache/tajo/engine/util/TestTableCache.java |  109 ++
 .../apache/tajo/engine/util/TestTupleUtil.java  |  188 +++
 .../apache/tajo/ha/TestHAServiceHDFSImpl.java   |  160 ++
 .../org/apache/tajo/jdbc/TestResultSet.java     |  224 +++
 .../java/org/apache/tajo/jdbc/TestSQLState.java |   91 ++
 .../tajo/jdbc/TestTajoDatabaseMetaData.java     |  504 +++++++
 .../java/org/apache/tajo/jdbc/TestTajoJdbc.java |  608 ++++++++
 .../tajo/master/TestExecutionBlockCursor.java   |  135 ++
 .../TestNonForwardQueryResultSystemScanner.java |   41 +
 .../apache/tajo/master/TestRepartitioner.java   |  511 +++++++
 .../tajo/master/rule/TestMasterRules.java       |  156 ++
 .../master/scheduler/TestSimpleScheduler.java   |  301 ++++
 .../tajo/querymaster/TestIntermediateEntry.java |   53 +
 .../apache/tajo/querymaster/TestKillQuery.java  |  312 ++++
 .../tajo/querymaster/TestQueryProgress.java     |   77 +
 .../apache/tajo/querymaster/TestQueryState.java |   99 ++
 .../tajo/querymaster/TestTaskStatusUpdate.java  |  191 +++
 .../org/apache/tajo/resource/TestResources.java |   48 +
 .../apache/tajo/storage/TestFileFragment.java   |   93 ++
 .../org/apache/tajo/storage/TestRowFile.java    |  146 ++
 .../java/org/apache/tajo/util/TestJSPUtil.java  |  113 ++
 .../util/history/TestHistoryWriterReader.java   |  313 ++++
 .../tajo/util/metrics/TestMetricsFilter.java    |   52 +
 .../tajo/util/metrics/TestSystemMetrics.java    |  143 ++
 .../apache/tajo/worker/MockExecutionBlock.java  |   42 +
 .../tajo/worker/MockNodeResourceManager.java    |   88 ++
 .../tajo/worker/MockNodeStatusUpdater.java      |   97 ++
 .../apache/tajo/worker/MockTaskExecutor.java    |  153 ++
 .../org/apache/tajo/worker/MockTaskManager.java |   69 +
 .../apache/tajo/worker/MockWorkerContext.java   |  109 ++
 .../apache/tajo/worker/TestDeletionService.java |   61 +
 .../org/apache/tajo/worker/TestFetcher.java     |  236 +++
 .../tajo/worker/TestNodeResourceManager.java    |  281 ++++
 .../tajo/worker/TestNodeStatusUpdater.java      |  192 +++
 .../apache/tajo/worker/TestTaskExecutor.java    |  315 ++++
 .../org/apache/tajo/worker/TestTaskManager.java |  184 +++
 .../tajo/ws/rs/resources/RestTestUtils.java     |   64 +
 .../ws/rs/resources/TestClusterResource.java    |   83 ++
 .../ws/rs/resources/TestDatabasesResource.java  |  189 +++
 .../ws/rs/resources/TestFunctionsResource.java  |   78 +
 .../tajo/ws/rs/resources/TestQueryResource.java |  199 +++
 .../rs/resources/TestQueryResultResource.java   |  296 ++++
 .../ws/rs/resources/TestSessionsResource.java   |  263 ++++
 .../ws/rs/resources/TestTablesResource.java     |  202 +++
 .../resources/dataset/TestAlterTable/table1.tbl |    3 +
 .../resources/dataset/TestAlterTable/table2.tbl |    1 +
 .../dataset/TestCreateTable/table1/table1.tbl   |    3 +
 .../dataset/TestCreateTable/table2/table2.tbl   |    3 +
 .../resources/dataset/TestDropTable/table1.tbl  |    3 +
 .../dataset/TestHBaseTable/splits.data          |    4 +
 .../dataset/TestJoinQuery/table1/table1.tbl     |    5 +
 .../dataset/TestJoinQuery/table2/table2.tbl     |    4 +
 .../dataset/TestNetTypes/table1/table1.tbl      |    5 +
 .../dataset/TestNetTypes/table2/table2.tbl      |    5 +
 .../TestSelectNestedRecord/sample1/table.json   |    3 +
 .../TestSelectNestedRecord/sample2/sample2.json |    1 +
 .../TestSelectNestedRecord/tweets/sample1.json  |    4 +
 .../multibytes_delimiter1/table1.tbl            |    5 +
 .../multibytes_delimiter2/table2.tbl            |    5 +
 .../TestSelectQuery/timezoned/table1.tbl        |    3 +
 .../dataset/TestSortQuery/table1/table1.tbl     |    5 +
 .../dataset/TestSortQuery/table2/table2.tbl     |   24 +
 .../TestTablePartitions/lineitemspecial.tbl     |    5 +
 .../dataset/TestTajoJdbc/table1/table1.tbl      |    5 +
 .../truncate_table2/table2.tbl                  |    4 +
 .../src/test/resources/log4j.properties         |   28 +
 .../src/test/resources/python/__init__.py       |   17 +
 .../src/test/resources/python/test_funcs.py     |   33 +
 .../src/test/resources/python/test_funcs2.py    |   32 +
 .../src/test/resources/python/test_udaf.py      |   76 +
 .../alter_table_add_new_column_ddl.sql          |    1 +
 .../alter_table_add_partition1.sql              |    1 +
 .../alter_table_add_partition2.sql              |    1 +
 .../alter_table_drop_partition1.sql             |    1 +
 .../alter_table_drop_partition2.sql             |    1 +
 .../alter_table_rename_column_ddl.sql           |    1 +
 .../alter_table_rename_table_ddl.sql            |    1 +
 .../alter_table_set_property_delimiter.sql      |    1 +
 .../alter_table_set_property_timezone.sql       |    1 +
 .../TestAlterTable/create_partitioned_table.sql |    1 +
 .../queries/TestAlterTable/table1_ddl.sql       |    1 +
 .../queries/TestAlterTable/table2_ddl.sql       |    1 +
 .../testAlterTableSetProperty.sql               |    1 +
 .../testAlterTableSetProperty2.sql              |    1 +
 .../TestBuiltinFunctions/testAvgDouble.sql      |    1 +
 .../queries/TestBuiltinFunctions/testAvgInt.sql |    1 +
 .../TestBuiltinFunctions/testAvgLong.sql        |    1 +
 .../testAvgLongOverflow.sql                     |    1 +
 .../queries/TestBuiltinFunctions/testCount.sql  |    1 +
 .../TestBuiltinFunctions/testMaxLong.sql        |    1 +
 .../TestBuiltinFunctions/testMaxString.sql      |    1 +
 .../TestBuiltinFunctions/testMinLong.sql        |    1 +
 .../TestBuiltinFunctions/testMinString.sql      |    1 +
 .../queries/TestBuiltinFunctions/testRandom.sql |    1 +
 .../TestBuiltinFunctions/testSplitPart.sql      |    1 +
 .../testSplitPartByString.sql                   |    1 +
 .../testSplitPartNested.sql                     |    1 +
 .../queries/TestCTASQuery/CtasWithGroupby.sql   |    2 +
 .../queries/TestCTASQuery/CtasWithLimit.sql     |   13 +
 .../TestCTASQuery/CtasWithManagedTable.sql      |   12 +
 .../TestCTASQuery/CtasWithMultipleUnions.sql    |   12 +
 .../queries/TestCTASQuery/CtasWithOptions.sql   |   13 +
 .../queries/TestCTASQuery/CtasWithOrderby.sql   |   11 +
 .../queries/TestCTASQuery/CtasWithStoreType.sql |   12 +
 .../queries/TestCTASQuery/CtasWithTextFile.sql  |   12 +
 .../queries/TestCTASQuery/CtasWithUnion.sql     |   35 +
 .../resources/queries/TestCTASQuery/check1.sql  |    1 +
 .../resources/queries/TestCTASQuery/check2.sql  |    1 +
 .../testCtasWithColumnedPartition.sql           |    2 +
 .../TestCTASQuery/testCtasWithGroupby.sql       |    1 +
 .../queries/TestCTASQuery/testCtasWithLimit.sql |    1 +
 .../testCtasWithMultipleUnions.sql              |    1 +
 .../TestCTASQuery/testCtasWithOptions.sql       |    1 +
 .../TestCTASQuery/testCtasWithOrderby.sql       |    1 +
 .../TestCTASQuery/testCtasWithStoreType.sql     |    1 +
 .../TestCTASQuery/testCtasWithTextFile.sql      |    1 +
 .../queries/TestCTASQuery/testCtasWithUnion.sql |    1 +
 .../testCtasWithoutTableDefinition.sql          |    2 +
 .../TestCaseByCases/testTAJO1224Case1.sql       |    1 +
 .../queries/TestCaseByCases/testTAJO415Case.sql |   36 +
 .../queries/TestCaseByCases/testTAJO418Case.sql |   29 +
 .../queries/TestCaseByCases/testTAJO619Case.sql |    4 +
 .../queries/TestCaseByCases/testTAJO718Case.sql |   10 +
 .../queries/TestCaseByCases/testTAJO739Case.sql |    5 +
 .../TestCaseByCases/testTAJO914Case1.sql        |   10 +
 .../TestCaseByCases/testTAJO914Case2.sql        |    9 +
 .../TestCaseByCases/testTAJO914Case3.sql        |   10 +
 .../TestCaseByCases/testTAJO914Case4.sql        |   10 +
 .../TestCaseByCases/testTAJO917Case1.sql        |   13 +
 .../queries/TestCreateIndex/testCreateIndex.sql |    1 +
 .../testCreateIndexOnExpression.sql             |    1 +
 .../testCreateIndexOnLocation.sql               |    1 +
 .../testCreateIndexOnMultiAttrs.sql             |    1 +
 .../testCreateIndexOnMultiExprs.sql             |    1 +
 .../testCreateIndexWithCondition.sql            |    1 +
 .../create_table_various_types.sql              |   50 +
 ...ate_table_various_types_for_hive_catalog.sql |   50 +
 .../quoted_identifier_mixed_chars_1.sql         |    1 +
 .../quoted_identifier_mixed_chars_2.sql         |    1 +
 .../quoted_identifier_mixed_chars_3.sql         |   22 +
 .../quoted_identifier_mixed_chars_ddl_1.sql     |    1 +
 .../quoted_identifier_mixed_chars_ddl_2.sql     |    1 +
 .../quoted_identifier_non_ascii_1.sql           |    1 +
 .../quoted_identifier_non_ascii_2.sql           |    1 +
 .../quoted_identifier_non_ascii_3.sql           |    1 +
 .../quoted_identifier_non_ascii_ddl.sql         |    1 +
 .../queries/TestCreateTable/table1_ddl.sql      |    1 +
 .../TestCreateTable/testNestedRecord1.sql       |    1 +
 .../TestCreateTable/testNestedRecord2.sql       |    1 +
 .../queries/TestDropTable/drop_table_ddl.sql    |    1 +
 .../queries/TestDropTable/table1_ddl.sql        |    1 +
 .../TestGroupByQuery/testComplexParameter.sql   |    1 +
 .../TestGroupByQuery/testComplexParameter2.sql  |    1 +
 .../testComplexParameterWithSubQuery.sql        |    6 +
 .../testComplexTargetWithPythonUdaf.sql         |    1 +
 .../testDistinctAggregation1.sql                |    1 +
 .../testDistinctAggregation2.sql                |    1 +
 .../testDistinctAggregation3.sql                |    1 +
 .../testDistinctAggregation4.sql                |    1 +
 .../testDistinctAggregation5.sql                |    1 +
 .../testDistinctAggregation6.sql                |    9 +
 .../testDistinctAggregation7.sql                |    6 +
 .../testDistinctAggregation8.sql                |    9 +
 .../testDistinctAggregationCaseByCase3.sql      |    8 +
 .../testDistinctAggregationCaseByCase4.sql      |    7 +
 .../testDistinctAggregationWithHaving1.sql      |    1 +
 .../testDistinctAggregationWithUnion1.sql       |   21 +
 .../testDistinctAggregation_case1.sql           |    7 +
 .../testDistinctAggregation_case10.sql          |    5 +
 .../testDistinctAggregation_case2.sql           |    8 +
 .../testDistinctAggregation_case3.sql           |    9 +
 .../testDistinctAggregation_case4.sql           |   10 +
 .../testDistinctAggregation_case5.sql           |   10 +
 .../testDistinctAggregation_case6.sql           |   12 +
 .../testDistinctAggregation_case7.sql           |    9 +
 .../testDistinctAggregation_case8.sql           |   10 +
 .../testDistinctAggregation_case9.sql           |   11 +
 .../testDistinctPythonUdafWithUnion1.sql        |   21 +
 .../queries/TestGroupByQuery/testGroupBy.sql    |    1 +
 .../queries/TestGroupByQuery/testGroupBy2.sql   |    1 +
 .../queries/TestGroupByQuery/testGroupBy3.sql   |    1 +
 .../queries/TestGroupByQuery/testGroupBy4.sql   |    9 +
 .../queries/TestGroupByQuery/testGroupBy5.sql   |    1 +
 .../TestGroupByQuery/testGroupByNested1.sql     |    8 +
 .../TestGroupByQuery/testGroupByNested2.sql     |   10 +
 .../testGroupByWithConstantKeys1.sql            |    1 +
 .../testGroupByWithConstantKeys2.sql            |    1 +
 .../testGroupByWithConstantKeys3.sql            |    8 +
 .../testGroupByWithConstantKeys4.sql            |   12 +
 .../testGroupByWithConstantKeys5.sql            |   13 +
 .../testGroupByWithExpressionKeys1.sql          |    1 +
 .../testGroupByWithExpressionKeys2.sql          |    1 +
 .../testGroupByWithNullData1.sql                |    1 +
 .../testGroupByWithNullData10.sql               |    3 +
 .../testGroupByWithNullData11.sql               |    5 +
 .../testGroupByWithNullData12.sql               |   29 +
 .../testGroupByWithNullData2.sql                |    1 +
 .../testGroupByWithNullData3.sql                |    3 +
 .../testGroupByWithNullData4.sql                |    3 +
 .../testGroupByWithNullData5.sql                |    1 +
 .../testGroupByWithNullData6.sql                |    1 +
 .../testGroupByWithNullData7.sql                |    1 +
 .../testGroupByWithNullData8.sql                |    1 +
 .../testGroupByWithNullData9.sql                |    4 +
 .../testGroupByWithSameConstantKeys1.sql        |    1 +
 .../testGroupByWithSameExprs1.sql               |    8 +
 .../testGroupByWithSameExprs2.sql               |    8 +
 .../TestGroupByQuery/testGroupbyWithJson.json   |  127 ++
 .../TestGroupByQuery/testGroupbyWithLimit1.sql  |    1 +
 .../TestGroupByQuery/testGroupbyWithLimit2.sql  |    1 +
 .../TestGroupByQuery/testGroupbyWithLimit3.sql  |    1 +
 .../testGroupbyWithPythonFunc.sql               |    1 +
 .../testGroupbyWithPythonFunc2.sql              |    1 +
 .../testHavingWithAggFunction.sql               |    1 +
 .../testHavingWithNamedTarget.sql               |   13 +
 .../queries/TestGroupByQuery/testPythonUdaf.sql |    1 +
 .../TestGroupByQuery/testPythonUdaf2.sql        |    1 +
 .../TestGroupByQuery/testPythonUdaf3.sql        |    1 +
 .../testPythonUdafWithHaving.sql                |    3 +
 .../testPythonUdafWithNullData.sql              |    4 +
 .../TestInSubquery/testInAndNotInSubQuery.sql   |    3 +
 .../queries/TestInSubquery/testInSubQuery.sql   |    1 +
 .../queries/TestInSubquery/testInSubQuery2.sql  |    2 +
 .../TestInSubquery/testInSubQueryWithJoin.sql   |    2 +
 .../testInSubQueryWithOtherConditions.sql       |    2 +
 .../testInSubQueryWithTableSubQuery.sql         |    2 +
 .../TestInSubquery/testMultipleInSubQuery.sql   |    5 +
 .../testMultipleNotInSubQuery.sql               |    3 +
 .../testNestedInAndNotInSubQuery.sql            |    5 +
 .../TestInSubquery/testNestedInSubQuery.sql     |    4 +
 .../TestInSubquery/testNestedInSubQuery2.sql    |    4 +
 .../TestInSubquery/testNestedNotInSubQuery.sql  |    4 +
 .../TestInSubquery/testNotInSubQuery.sql        |    1 +
 .../testSameKeyNameOfOuterAndInnerQueries.sql   |   22 +
 .../TestInSubquery/testWithAsteriskAndJoin.sql  |    7 +
 .../testBroadcastTwoPartJoin.sql                |   19 +
 .../testCrossJoinAndCaseWhen.sql                |   18 +
 .../testCrossJoinWithAsterisk1.sql              |    1 +
 .../testCrossJoinWithAsterisk2.sql              |    1 +
 .../testCrossJoinWithAsterisk3.sql              |    1 +
 .../testCrossJoinWithAsterisk4.sql              |    1 +
 .../testBroadcastSubquery.sql                   |   12 +
 .../testBroadcastSubquery2.sql                  |   19 +
 .../testThetaJoinKeyPairs.sql                   |   20 +
 .../TestInsertQuery/full_table_csv_ddl.sql      |    1 +
 .../TestInsertQuery/full_table_parquet_ddl.sql  |    1 +
 .../TestInsertQuery/lineitem_year_month_ddl.sql |   18 +
 .../load_to_lineitem_year_month.sql             |    1 +
 .../TestInsertQuery/nation_diff_col_order.ddl   |    1 +
 .../queries/TestInsertQuery/table1_ddl.sql      |    1 +
 .../queries/TestInsertQuery/test1_ddl.sql       |    1 +
 .../TestInsertQuery/test1_nolength_ddl.sql      |    1 +
 .../queries/TestInsertQuery/testInsertInto.sql  |    1 +
 .../testInsertIntoSelectWithFixedSizeChar.sql   |    4 +
 ...tIntoSelectWithFixedSizeCharWithNoLength.sql |    2 +
 .../TestInsertQuery/testInsertOverwrite.sql     |    1 +
 .../testInsertOverwriteLocation.sql             |    1 +
 ...stInsertOverwriteLocationWithCompression.sql |    1 +
 .../testInsertOverwriteLocationWithUnion.sql    |    4 +
 ...verwriteLocationWithUnionDifferenceAlias.sql |    4 +
 .../testInsertOverwriteSmallerColumns.sql       |    1 +
 .../testInsertOverwriteWithAsterisk.sql         |    1 +
 .../testInsertOverwriteWithAsteriskAndMore.sql  |    1 +
 .../testInsertOverwriteWithCompression.sql      |    1 +
 .../testInsertOverwriteWithCompression_ddl.sql  |    4 +
 .../testInsertOverwriteWithDatabase.sql         |    1 +
 .../testInsertOverwriteWithTargetColumns.sql    |    1 +
 .../testInsertOverwriteWithUnion.sql            |    4 +
 ...stInsertOverwriteWithUnionDifferentAlias.sql |    4 +
 .../testInsertWithDifferentColumnOrder.sql      |    1 +
 .../selfJoinOfPartitionedTable.sql              |    9 +
 .../testBroadcastPartitionTable.sql             |   16 +
 ...estFilterPushDownPartitionColumnCaseWhen.sql |    6 +
 ...rtitionedBroadcastDataFileWithZeroLength.sql |    3 +
 ...titionedBroadcastDataFileWithZeroLength2.sql |    5 +
 .../testNoProjectionJoinQual.sql                |    1 +
 .../testPartialFilterPushDown.sql               |    9 +
 .../testPartialFilterPushDownOuterJoin.sql      |    4 +
 .../testPartialFilterPushDownOuterJoin2.sql     |    5 +
 .../testPartitionTableJoinSmallTable.sql        |   11 +
 .../TestJoinQuery/create_customer_large_ddl.sql |    7 +
 .../TestJoinQuery/create_lineitem_large_ddl.sql |    7 +
 .../TestJoinQuery/create_orders_large_ddl.sql   |    7 +
 .../TestJoinQuery/customer_partition_ddl.sql    |    9 +
 .../TestJoinQuery/insert_into_customer.sql      |   11 +
 .../insert_into_customer_partition.sql          |   11 +
 .../TestJoinQuery/nation_multifile_ddl.sql      |    5 +
 .../queries/TestJoinQuery/oj_table1_ddl.sql     |    3 +
 .../queries/TestJoinQuery/oj_table2_ddl.sql     |    3 +
 .../TestJoinQuery/orders_multifile_ddl.sql      |    5 +
 .../TestJoinQuery/partitioned_customer_ddl.sql  |   19 +
 .../queries/TestJoinQuery/table1_int4_ddl.sql   |    3 +
 .../queries/TestJoinQuery/table1_int8_ddl.sql   |    3 +
 .../TestJoinQuery/testComplexJoinCondition1.sql |    6 +
 .../TestJoinQuery/testComplexJoinCondition2.sql |    6 +
 .../TestJoinQuery/testComplexJoinCondition3.sql |    6 +
 .../TestJoinQuery/testComplexJoinCondition4.sql |    6 +
 .../TestJoinQuery/testComplexJoinCondition5.sql |    6 +
 .../TestJoinQuery/testComplexJoinCondition6.sql |    6 +
 .../TestJoinQuery/testComplexJoinCondition7.sql |    6 +
 .../testComplexJoinsWithCaseWhen.sql            |   11 +
 .../testComplexJoinsWithCaseWhen2.sql           |    9 +
 .../testCrossJoinWithEmptyTable1.sql            |    8 +
 ...stCrossJoinWithThetaJoinConditionInWhere.sql |    2 +
 .../testDifferentTypesJoinCondition.sql         |    1 +
 .../TestJoinQuery/testFullOuterJoin1.sql        |    8 +
 .../testFullOuterJoinWithEmptyTable1.sql        |    8 +
 .../TestJoinQuery/testInnerJoinAndCaseWhen.sql  |   18 +
 .../testInnerJoinWithEmptyTable.sql             |    8 +
 ...stInnerJoinWithThetaJoinConditionInWhere.sql |    3 +
 .../queries/TestJoinQuery/testJoinAsterisk.sql  |    3 +
 .../TestJoinQuery/testJoinCoReferredEvals1.sql  |   11 +
 .../testJoinCoReferredEvalsFilterPushdown.sql   |   13 +
 .../testJoinCoReferredEvalsWithSameExprs1.sql   |   14 +
 .../testJoinCoReferredEvalsWithSameExprs2.sql   |   22 +
 .../testJoinFilterOfRowPreservedTable1.sql      |    8 +
 .../testJoinOnMultipleDatabases.sql             |   25 +
 .../testJoinOnMultipleDatabasesWithJson.json    |  210 +++
 .../queries/TestJoinQuery/testJoinWithJson.json |   92 ++
 .../TestJoinQuery/testJoinWithJson2.json        |  219 +++
 .../testJoinWithMultipleJoinQual1.sql           |   20 +
 .../testJoinWithMultipleJoinQual2.sql           |    8 +
 .../testJoinWithMultipleJoinQual3.sql           |    9 +
 .../testJoinWithMultipleJoinQual4.sql           |   10 +
 .../testJoinWithMultipleJoinTypes.sql           |    4 +
 .../TestJoinQuery/testJoinWithOrPredicates.sql  |    6 +
 .../TestJoinQuery/testLeftOuterJoin1.sql        |    9 +
 .../testLeftOuterJoinWithConstantExpr1.sql      |    9 +
 .../testLeftOuterJoinWithConstantExpr2.sql      |    9 +
 .../testLeftOuterJoinWithConstantExpr3.sql      |   17 +
 .../testLeftOuterJoinWithConstantExpr4.sql      |    6 +
 .../testLeftOuterJoinWithConstantExpr5.sql      |    9 +
 .../testLeftOuterJoinWithEmptyTable1.sql        |    9 +
 .../testLeftOuterJoinWithEmptyTable2.sql        |    9 +
 .../testLeftOuterJoinWithEmptyTable3.sql        |   14 +
 .../testLeftOuterJoinWithEmptyTable4.sql        |   17 +
 .../testLeftOuterJoinWithEmptyTable5.sql        |   11 +
 .../testLeftOuterJoinWithNull1.sql              |   10 +
 .../testLeftOuterJoinWithNull2.sql              |   11 +
 .../testLeftOuterJoinWithNull3.sql              |   10 +
 ...ftOuterJoinWithThetaJoinConditionInWhere.sql |    3 +
 .../queries/TestJoinQuery/testNaturalJoin.sql   |    3 +
 .../TestJoinQuery/testOuterJoinAndCaseWhen1.sql |   12 +
 .../TestJoinQuery/testRightOuterJoin1.sql       |    8 +
 .../testRightOuterJoinWithEmptyTable1.sql       |    8 +
 ...htOuterJoinWithThetaJoinConditionInWhere.sql |    3 +
 .../queries/TestJoinQuery/testTPCHQ2Join.sql    |   25 +
 .../TestJoinQuery/testWhereClauseJoin1.sql      |   11 +
 .../TestJoinQuery/testWhereClauseJoin2.sql      |    9 +
 .../TestJoinQuery/testWhereClauseJoin3.sql      |   10 +
 .../TestJoinQuery/testWhereClauseJoin4.sql      |    9 +
 .../TestJoinQuery/testWhereClauseJoin5.sql      |   15 +
 .../TestJoinQuery/testWhereClauseJoin6.sql      |   19 +
 .../queries/TestLogicalPlanner/window1.sql      |    5 +
 .../queries/TestNetTypes/table1_ddl.sql         |    4 +
 .../queries/TestNetTypes/table2_ddl.sql         |    4 +
 .../queries/TestNetTypes/testGroupby.sql        |    8 +
 .../queries/TestNetTypes/testGroupby2.sql       |    9 +
 .../resources/queries/TestNetTypes/testJoin.sql |    1 +
 .../queries/TestNetTypes/testSelect.sql         |    1 +
 .../resources/queries/TestNetTypes/testSort.sql |    1 +
 .../queries/TestNetTypes/testSort2.sql          |    1 +
 .../TestOuterJoinQuery/testLeftOuterJoin2.sql   |    5 +
 .../TestOuterJoinQuery/testLeftOuterJoin3.sql   |    7 +
 ...tMultipleBroadcastDataFileWithZeroLength.sql |    3 +
 ...MultipleBroadcastDataFileWithZeroLength2.sql |    5 +
 .../TestQueryValidation/error_groupby_1.sql     |    1 +
 .../TestQueryValidation/error_groupby_2.sql     |    1 +
 .../TestQueryValidation/invalid_casewhen_1.sql  |   15 +
 .../TestQueryValidation/invalid_limit_1.sql     |    1 +
 .../invalid_store_format.sql                    |    1 +
 .../TestQueryValidation/valid_groupby_1.sql     |    1 +
 .../TestQueryValidation/valid_limit_1.sql       |    1 +
 .../TestSQLAnalyzer/create_table_nested_1.sql   |    1 +
 .../TestSQLAnalyzer/create_table_nested_2.sql   |    1 +
 .../queries/TestSQLAnalyzer/setcatalog1.sql     |    1 +
 .../queries/TestSQLAnalyzer/setcatalog2.sql     |    1 +
 .../queries/TestSQLAnalyzer/setsession1.sql     |    1 +
 .../queries/TestSQLAnalyzer/setsession2.sql     |    1 +
 .../queries/TestSQLAnalyzer/setsession3.sql     |    1 +
 .../queries/TestSQLAnalyzer/setsession4.sql     |    1 +
 .../queries/TestSQLAnalyzer/setsession5.sql     |    1 +
 .../queries/TestSQLAnalyzer/setsession6.sql     |    1 +
 .../queries/TestSQLAnalyzer/setsession7.sql     |    1 +
 .../queries/TestSQLAnalyzer/settimezone1.sql    |    1 +
 .../queries/TestSQLAnalyzer/settimezone2.sql    |    1 +
 .../queries/TestSQLAnalyzer/settimezone3.sql    |    1 +
 .../queries/TestSQLAnalyzer/window1.sql         |    5 +
 .../queries/TestSQLAnalyzer/window2.sql         |    5 +
 .../queries/TestSQLAnalyzer/window3.sql         |    5 +
 .../queries/TestSQLAnalyzer/window4.sql         |    5 +
 .../queries/TestSQLAnalyzer/window5.sql         |    6 +
 .../queries/TestSQLAnalyzer/window6.sql         |    6 +
 .../queries/TestSQLAnalyzer/window7.sql         |    6 +
 .../queries/TestSQLAnalyzer/window8.sql         |    6 +
 .../queries/TestSQLAnalyzer/window9.sql         |    9 +
 .../TestSelectNestedRecord/sample0_ddl.sql      |    1 +
 .../TestSelectNestedRecord/sample1_ddl.sql      |    7 +
 .../TestSelectNestedRecord/sample2_ddl.sql      |   23 +
 .../testNestedFieldAsGroupbyKey1.sql            |    9 +
 .../testNestedFieldAsJoinKey1.sql               |    7 +
 .../TestSelectNestedRecord/testSelect0.sql      |    1 +
 .../TestSelectNestedRecord/testSelect1.sql      |    1 +
 .../TestSelectNestedRecord/testSelect2.sql      |   61 +
 .../TestSelectNestedRecord/testSelect3.sql      |    1 +
 .../TestSelectNestedRecord/tweets_ddl.sql       |   74 +
 .../queries/TestSelectQuery/customer_ddl.sql    |    9 +
 .../TestSelectQuery/datetime_table_ddl.sql      |    4 +
 .../datetime_table_timezoned_ddl.sql            |    4 +
 .../TestSelectQuery/insert_into_customer.sql    |   11 +
 .../multibytes_delimiter_table1_ddl.sql         |    3 +
 .../multibytes_delimiter_table2_ddl.sql         |    3 +
 .../multibytes_delimiter_table3_ddl.sql         |    3 +
 .../multibytes_delimiter_table4_ddl.sql         |    3 +
 .../queries/TestSelectQuery/testCaseWhen.sql    |   11 +
 .../TestSelectQuery/testCaseWhenRound.sql       |    8 +
 .../TestSelectQuery/testCaseWhenWithoutElse.sql |   10 +
 .../testColumnEqualityButNotJoinCondition1.sql  |    7 +
 .../testColumnEqualityButNotJoinCondition2.sql  |    7 +
 .../TestSelectQuery/testCreateAfterSelect.sql   |    1 +
 .../TestSelectQuery/testDatabaseRef1.sql        |    1 +
 .../TestSelectQuery/testDatabaseRef2.sql        |    1 +
 .../TestSelectQuery/testDatabaseRef3.sql        |    1 +
 .../TestSelectQuery/testExplainSelect.sql       |    1 +
 .../queries/TestSelectQuery/testInClause.sql    |    1 +
 .../queries/TestSelectQuery/testInStrClause.sql |    1 +
 .../queries/TestSelectQuery/testLikeClause.sql  |    1 +
 .../queries/TestSelectQuery/testLimit.sql       |    1 +
 .../testMultiBytesDelimiter1.sql                |    1 +
 .../testMultiBytesDelimiter2.sql                |    1 +
 .../testMultiBytesDelimiter3.sql                |    1 +
 .../testMultiBytesDelimiter4.sql                |    1 +
 .../testNestedPythonFunction.sql                |    1 +
 .../TestSelectQuery/testNonFromSelect1.sql      |    1 +
 .../TestSelectQuery/testNonQualifiedNames.sql   |    1 +
 .../queries/TestSelectQuery/testNotEqual.sql    |    1 +
 .../queries/TestSelectQuery/testNotInClause.sql |    1 +
 .../TestSelectQuery/testNotInStrClause.sql      |    1 +
 .../TestSelectQuery/testRealValueCompare.sql    |    1 +
 .../queries/TestSelectQuery/testSelect.sql      |    1 +
 .../queries/TestSelectQuery/testSelect2.sql     |    1 +
 .../queries/TestSelectQuery/testSelect3.sql     |    1 +
 .../TestSelectQuery/testSelectAsterik.sql       |    1 +
 .../TestSelectQuery/testSelectAsterisk1.sql     |    1 +
 .../TestSelectQuery/testSelectAsterisk2.sql     |    1 +
 .../TestSelectQuery/testSelectAsterisk3.sql     |    1 +
 .../TestSelectQuery/testSelectAsterisk4.sql     |    1 +
 .../TestSelectQuery/testSelectAsterisk5.sql     |    1 +
 .../TestSelectQuery/testSelectColumnAlias1.sql  |    1 +
 ...testSelectColumnAliasExistingInRelation1.sql |    1 +
 ...testSelectColumnAliasExistingInRelation2.sql |    1 +
 ...testSelectColumnAliasExistingInRelation3.sql |   19 +
 .../TestSelectQuery/testSelectDistinct.sql      |    7 +
 .../testSelectOnSessionTable.sql                |    1 +
 .../TestSelectQuery/testSelectPythonFuncs.sql   |    2 +
 ...tSelectSameConstantsWithDifferentAliases.sql |    1 +
 ...SelectSameConstantsWithDifferentAliases2.sql |    1 +
 ...SelectSameConstantsWithDifferentAliases3.sql |   10 +
 .../testSelectSameExprsWithDifferentAliases.sql |    1 +
 .../TestSelectQuery/testSelectWithJson.json     |   74 +
 .../testSelectWithParentheses1.sql              |    1 +
 .../testSelectWithParentheses2.sql              |    1 +
 .../testSelectWithPredicateOnPythonFunc.sql     |    1 +
 .../queries/TestSelectQuery/testSimpleQuery.sql |    1 +
 .../testSimpleQueryWithLimit.sql                |    1 +
 ...testSimpleQueryWithLimitPartitionedTable.sql |    1 +
 .../TestSelectQuery/testStringCompare.sql       |    1 +
 .../TestSelectQuery/testSumFloatOverflow.sql    |    1 +
 .../TestSelectQuery/testSumIntOverflow.sql      |    1 +
 .../TestSelectQuery/testTimezonedTable1.sql     |    1 +
 .../TestSelectQuery/testTimezonedTable2.sql     |    2 +
 .../TestSelectQuery/testTimezonedTable3.sql     |    1 +
 .../TestSelectQuery/testTimezonedTable4.sql     |    2 +
 .../TestSelectQuery/testTimezonedTable5.sql     |    2 +
 .../queries/TestSelectQuery/testWhereCond1.sql  |    1 +
 .../queries/TestSelectQuery/testWhereCond2.sql  |    9 +
 .../TestSelectQuery/testWhereCondWithAlias1.sql |    1 +
 .../TestSelectQuery/testWhereCondWithAlias2.sql |    1 +
 .../create_table_with_asc_desc_keys.sql         |    1 +
 .../create_table_with_date_ddl.sql              |   10 +
 .../queries/TestSortQuery/testAsterisk.sql      |    1 +
 .../queries/TestSortQuery/testSort.sql          |    1 +
 .../TestSortQuery/testSortAfterGroupby.sql      |    1 +
 .../testSortAfterGroupbyWithAlias.sql           |    1 +
 .../queries/TestSortQuery/testSortDesc.sql      |    1 +
 .../queries/TestSortQuery/testSortFirstDesc.sql |    1 +
 .../TestSortQuery/testSortOnNullColumn.sql      |   13 +
 .../TestSortQuery/testSortOnUnicodeTextAsc.sql  |    6 +
 .../TestSortQuery/testSortOnUnicodeTextDesc.sql |    6 +
 .../TestSortQuery/testSortWithAlias1.sql        |    1 +
 .../TestSortQuery/testSortWithAlias2.sql        |    9 +
 .../TestSortQuery/testSortWithAlias3.sql        |   11 +
 .../testSortWithAliasButOriginalName.sql        |    1 +
 .../TestSortQuery/testSortWithAscDescKeys.sql   |    1 +
 .../TestSortQuery/testSortWithConstKeys.sql     |   10 +
 .../queries/TestSortQuery/testSortWithDate.sql  |    1 +
 .../queries/TestSortQuery/testSortWithExpr1.sql |    1 +
 .../queries/TestSortQuery/testSortWithExpr2.sql |    1 +
 .../queries/TestSortQuery/testSortWithJson.json |   65 +
 .../testSubQuerySortAfterGroupMultiBlocks.sql   |    5 +
 .../queries/TestSortQuery/testTopK.sql          |    1 +
 .../queries/TestSortQuery/testTopkWithJson.json |   51 +
 .../queries/TestTPCH/testFirstJoinInQ7.sql      |   13 +
 .../queries/TestTPCH/testQ1OrderBy.sql          |   12 +
 .../queries/TestTPCH/testQ2FourJoins.sql        |   18 +
 .../queries/TestTPCH/testTPCH14Expr.sql         |   12 +
 .../resources/queries/TestTPCH/testTPCHQ5.sql   |   24 +
 .../queries/TestTablePartitions/case1.sql       |   16 +
 .../queries/TestTablePartitions/case10.sql      |    1 +
 .../queries/TestTablePartitions/case11.sql      |    1 +
 .../queries/TestTablePartitions/case12.sql      |    7 +
 .../queries/TestTablePartitions/case13.sql      |   11 +
 .../queries/TestTablePartitions/case14.sql      |    3 +
 .../queries/TestTablePartitions/case15.sql      |    3 +
 .../queries/TestTablePartitions/case2.sql       |   31 +
 .../queries/TestTablePartitions/case3.sql       |    8 +
 .../queries/TestTablePartitions/case4.sql       |    1 +
 .../queries/TestTablePartitions/case5.sql       |    1 +
 .../queries/TestTablePartitions/case6.sql       |    1 +
 .../queries/TestTablePartitions/case7.sql       |    1 +
 .../queries/TestTablePartitions/case8.sql       |    1 +
 .../queries/TestTablePartitions/case9.sql       |    1 +
 .../TestTablePartitions/lineitemspecial_ddl.sql |    3 +
 .../TestTableSubQuery/testGroupBySubQuery.sql   |    1 +
 .../testGroupbySubqueryWithJson.json            |   59 +
 .../TestTableSubQuery/testJoinSubQuery.sql      |    5 +
 .../TestTableSubQuery/testJoinSubQuery2.sql     |    4 +
 .../testJoinSubqueryWithJson.json               |  108 ++
 .../TestTableSubQuery/testTableSubquery1.sql    |    1 +
 .../TestTajoJdbc/create_table_with_date_ddl.sql |   10 +
 .../queries/TestTaskStatusUpdate/case1.sql      |    1 +
 .../queries/TestTaskStatusUpdate/case2.sql      |    5 +
 .../queries/TestTaskStatusUpdate/case3.sql      |   10 +
 .../queries/TestTruncateTable/table1_ddl.sql    |    1 +
 .../queries/TestTruncateTable/table2_ddl.sql    |    1 +
 .../TestUnionQuery/testComplexUnion1.sql        |   27 +
 .../TestUnionQuery/testComplexUnion2.sql        |   35 +
 .../queries/TestUnionQuery/testUnion1.sql       |   19 +
 .../queries/TestUnionQuery/testUnion10.sql      |  158 ++
 .../queries/TestUnionQuery/testUnion11.sql      |    8 +
 .../queries/TestUnionQuery/testUnion12.sql      |   14 +
 .../queries/TestUnionQuery/testUnion13.sql      |   15 +
 .../queries/TestUnionQuery/testUnion14.sql      |    8 +
 .../queries/TestUnionQuery/testUnion15.sql      |   15 +
 .../queries/TestUnionQuery/testUnion16.sql      |   15 +
 .../queries/TestUnionQuery/testUnion2.sql       |   18 +
 .../queries/TestUnionQuery/testUnion3.sql       |   19 +
 .../queries/TestUnionQuery/testUnion4.sql       |   16 +
 .../queries/TestUnionQuery/testUnion5.sql       |   20 +
 .../queries/TestUnionQuery/testUnion6.sql       |   15 +
 .../queries/TestUnionQuery/testUnion7.sql       |   18 +
 .../queries/TestUnionQuery/testUnion8.sql       |   24 +
 .../queries/TestUnionQuery/testUnion9.sql       |   29 +
 .../queries/TestUnionQuery/testUnionAll1.sql    |   19 +
 .../queries/TestUnionQuery/testUnionAll10.sql   |  158 ++
 .../queries/TestUnionQuery/testUnionAll11.sql   |    8 +
 .../queries/TestUnionQuery/testUnionAll12.sql   |   13 +
 .../queries/TestUnionQuery/testUnionAll13.sql   |   14 +
 .../queries/TestUnionQuery/testUnionAll14.sql   |    8 +
 .../queries/TestUnionQuery/testUnionAll15.sql   |   15 +
 .../queries/TestUnionQuery/testUnionAll16.sql   |   15 +
 .../queries/TestUnionQuery/testUnionAll2.sql    |   18 +
 .../queries/TestUnionQuery/testUnionAll3.sql    |   19 +
 .../queries/TestUnionQuery/testUnionAll4.sql    |   16 +
 .../queries/TestUnionQuery/testUnionAll5.sql    |   20 +
 .../queries/TestUnionQuery/testUnionAll6.sql    |   15 +
 .../queries/TestUnionQuery/testUnionAll7.sql    |   18 +
 .../queries/TestUnionQuery/testUnionAll8.sql    |   24 +
 .../queries/TestUnionQuery/testUnionAll9.sql    |   29 +
 .../testUnionAllWithDifferentAlias.sql          |   29 +
 ...estUnionAllWithDifferentAliasAndFunction.sql |   29 +
 .../testUnionAllWithSameAliasNames.sql          |   25 +
 .../testUnionWithDifferentAlias.sql             |   29 +
 .../testUnionWithDifferentAliasAndFunction.sql  |   29 +
 .../testUnionWithSameAliasNames.sql             |   25 +
 .../TestWindowQuery/testComplexOrderBy1.sql     |    5 +
 .../queries/TestWindowQuery/testFirstValue1.sql |   18 +
 .../queries/TestWindowQuery/testLag1.sql        |   18 +
 .../TestWindowQuery/testLagWithDefault.sql      |   18 +
 .../TestWindowQuery/testLagWithNoArgs.sql       |   18 +
 .../queries/TestWindowQuery/testLastValue1.sql  |   18 +
 .../queries/TestWindowQuery/testLead1.sql       |   18 +
 .../TestWindowQuery/testLeadWithDefault.sql     |   18 +
 .../TestWindowQuery/testLeadWithNoArgs.sql      |   18 +
 .../queries/TestWindowQuery/testRowNumber1.sql  |    5 +
 .../queries/TestWindowQuery/testRowNumber2.sql  |    5 +
 .../queries/TestWindowQuery/testRowNumber3.sql  |    7 +
 .../queries/TestWindowQuery/testStdDevPop1.sql  |   14 +
 .../queries/TestWindowQuery/testStdDevSamp1.sql |   14 +
 .../queries/TestWindowQuery/testWindow1.sql     |    1 +
 .../queries/TestWindowQuery/testWindow2.sql     |    1 +
 .../queries/TestWindowQuery/testWindow3.sql     |    1 +
 .../queries/TestWindowQuery/testWindow4.sql     |    1 +
 .../queries/TestWindowQuery/testWindow5.sql     |    1 +
 .../queries/TestWindowQuery/testWindow6.sql     |    1 +
 .../queries/TestWindowQuery/testWindow7.sql     |    1 +
 .../queries/TestWindowQuery/testWindow8.sql     |    7 +
 .../TestWindowQuery/testWindowBeforeLimit.sql   |    6 +
 .../testWindowWithAggregation1.sql              |    4 +
 .../testWindowWithAggregation2.sql              |    7 +
 .../testWindowWithAggregation3.sql              |    5 +
 .../testWindowWithAggregation4.sql              |    8 +
 .../testWindowWithAggregation5.sql              |    9 +
 .../testWindowWithAggregation6.sql              |   10 +
 .../TestWindowQuery/testWindowWithOrderBy1.sql  |    6 +
 .../TestWindowQuery/testWindowWithOrderBy2.sql  |    6 +
 .../TestWindowQuery/testWindowWithOrderBy3.sql  |    6 +
 .../TestWindowQuery/testWindowWithOrderBy4.sql  |    7 +
 .../TestWindowQuery/testWindowWithOrderBy5.sql  |    9 +
 .../TestWindowQuery/testWindowWithSubQuery.sql  |   14 +
 .../TestWindowQuery/testWindowWithSubQuery2.sql |   15 +
 .../TestWindowQuery/testWindowWithSubQuery3.sql |   14 +
 .../TestWindowQuery/testWindowWithSubQuery4.sql |   14 +
 .../TestWindowQuery/testWindowWithSubQuery5.sql |   11 +
 .../TestWindowQuery/testWindowWithSubQuery6.sql |    9 +
 .../default/alter_table_add_partition_1.sql     |    1 +
 .../default/alter_table_add_partition_2.sql     |    1 +
 .../default/alter_table_add_partition_3.sql     |    2 +
 .../default/alter_table_add_partition_4.sql     |    1 +
 .../default/alter_table_add_partition_5.sql     |    1 +
 .../default/alter_table_drop_partition_1.sql    |    1 +
 .../default/alter_table_drop_partition_2.sql    |    1 +
 .../default/alter_table_drop_partition_3.sql    |    1 +
 .../default/alter_table_drop_partition_4.sql    |    1 +
 .../default/alter_table_set_property_1.sql      |    1 +
 .../default/alter_table_set_property_2.sql      |    1 +
 .../default/alter_table_set_property_3.sql      |    1 +
 .../resources/queries/default/asterisk_1.sql    |    1 +
 .../resources/queries/default/asterisk_2.sql    |    1 +
 .../resources/queries/default/asterisk_3.sql    |    1 +
 .../resources/queries/default/asterisk_4.sql    |    1 +
 .../create_partitioned_table_as_select.sql      |   17 +
 .../queries/default/create_table_1.hiveql       |    1 +
 .../queries/default/create_table_1.sql          |    1 +
 .../queries/default/create_table_10.sql         |    1 +
 .../queries/default/create_table_11.hiveql      |    3 +
 .../queries/default/create_table_11.sql         |    3 +
 .../queries/default/create_table_12.hiveql      |    4 +
 .../queries/default/create_table_12.sql         |    3 +
 .../queries/default/create_table_2.hiveql       |    1 +
 .../queries/default/create_table_2.sql          |    1 +
 .../queries/default/create_table_3.sql          |    1 +
 .../queries/default/create_table_4.sql          |    1 +
 .../queries/default/create_table_5.sql          |    1 +
 .../queries/default/create_table_6.sql          |    1 +
 .../queries/default/create_table_7.sql          |    1 +
 .../queries/default/create_table_8.sql          |   48 +
 .../queries/default/create_table_9.sql          |    1 +
 .../queries/default/create_table_like_1.sql     |    1 +
 .../create_table_partition_by_column.sql        |    4 +
 .../create_table_partition_by_hash_1.sql        |    3 +
 .../create_table_partition_by_hash_2.sql        |    7 +
 .../default/create_table_partition_by_list.sql  |    8 +
 .../default/create_table_partition_by_range.sql |    9 +
 .../resources/queries/default/drop_table.sql    |    1 +
 .../queries/default/exists_predicate_1.sql      |    1 +
 .../queries/default/exists_predicate_2.sql      |    1 +
 .../resources/queries/default/groupby_1.sql     |    1 +
 .../resources/queries/default/groupby_2.sql     |    1 +
 .../resources/queries/default/groupby_3.sql     |    1 +
 .../resources/queries/default/groupby_4.sql     |    1 +
 .../resources/queries/default/groupby_5.sql     |    1 +
 .../resources/queries/default/in_subquery_1.sql |    1 +
 .../resources/queries/default/in_subquery_2.sql |    1 +
 .../queries/default/insert_into_select_1.sql    |    1 +
 .../queries/default/insert_into_select_2.sql    |    1 +
 .../queries/default/insert_into_select_3.sql    |    1 +
 .../default/insert_overwrite_into_select_1.sql  |    1 +
 .../insert_overwrite_into_select_2.hiveql       |    1 +
 .../default/insert_overwrite_into_select_2.sql  |    1 +
 .../default/insert_overwrite_into_select_3.sql  |    1 +
 .../test/resources/queries/default/join_1.sql   |    1 +
 .../test/resources/queries/default/join_10.sql  |    1 +
 .../test/resources/queries/default/join_11.sql  |    1 +
 .../test/resources/queries/default/join_12.sql  |    1 +
 .../test/resources/queries/default/join_13.sql  |   13 +
 .../test/resources/queries/default/join_14.sql  |    1 +
 .../resources/queries/default/join_15.hiveql    |    1 +
 .../test/resources/queries/default/join_15.sql  |    1 +
 .../test/resources/queries/default/join_2.sql   |    1 +
 .../test/resources/queries/default/join_3.sql   |    1 +
 .../test/resources/queries/default/join_4.sql   |    1 +
 .../test/resources/queries/default/join_5.sql   |    1 +
 .../test/resources/queries/default/join_6.sql   |    1 +
 .../test/resources/queries/default/join_7.sql   |    1 +
 .../test/resources/queries/default/join_8.sql   |   13 +
 .../test/resources/queries/default/join_9.sql   |    5 +
 .../test/resources/queries/default/select_1.sql |    1 +
 .../resources/queries/default/select_10.hiveql  |    5 +
 .../resources/queries/default/select_10.sql     |    5 +
 .../resources/queries/default/select_11.hiveql  |    4 +
 .../resources/queries/default/select_11.sql     |    6 +
 .../resources/queries/default/select_12.hiveql  |    3 +
 .../resources/queries/default/select_13.hiveql  |    2 +
 .../resources/queries/default/select_13.sql     |    2 +
 .../resources/queries/default/select_14.sql     |    2 +
 .../resources/queries/default/select_15.hiveql  |    1 +
 .../resources/queries/default/select_15.sql     |    1 +
 .../test/resources/queries/default/select_2.sql |    1 +
 .../test/resources/queries/default/select_3.sql |    1 +
 .../test/resources/queries/default/select_4.sql |    1 +
 .../test/resources/queries/default/select_5.sql |    1 +
 .../test/resources/queries/default/select_6.sql |    1 +
 .../test/resources/queries/default/select_7.sql |    1 +
 .../test/resources/queries/default/select_8.sql |    1 +
 .../resources/queries/default/select_9.hiveql   |    4 +
 .../test/resources/queries/default/select_9.sql |    4 +
 .../test/resources/queries/default/set_1.sql    |    1 +
 .../test/resources/queries/default/set_2.sql    |    1 +
 .../test/resources/queries/default/set_3.sql    |    1 +
 .../test/resources/queries/default/set_4.sql    |   36 +
 .../queries/default/table_subquery1.sql         |   19 +
 .../queries/default/table_subquery2.sql         |   21 +
 .../resources/queries/default/union_1.hiveql    |   14 +
 .../after_set_property_delimiter.result         |    3 +
 .../before_set_property_delimiter.result        |    3 +
 .../TestBuiltinFunctions/testAvgDouble.result   |    5 +
 .../TestBuiltinFunctions/testAvgInt.result      |    3 +
 .../TestBuiltinFunctions/testAvgLong.result     |    3 +
 .../testAvgLongOverflow.result                  |    3 +
 .../TestBuiltinFunctions/testCount.result       |    3 +
 .../TestBuiltinFunctions/testMaxLong.result     |    3 +
 .../TestBuiltinFunctions/testMaxString.result   |    3 +
 .../TestBuiltinFunctions/testMinLong.result     |    3 +
 .../TestBuiltinFunctions/testMinString.result   |    3 +
 .../TestBuiltinFunctions/testSplitPart.result   |    7 +
 .../testSplitPartByString.result                |    7 +
 .../testSplitPartNested.result                  |    7 +
 .../TestCTASQuery/testCtasWithGroupby.result    |    7 +
 .../TestCTASQuery/testCtasWithLimit.result      |    5 +
 .../TestCTASQuery/testCtasWithOptions.result    |    5 +
 .../TestCTASQuery/testCtasWithOrderby.result    |    7 +
 .../TestCTASQuery/testCtasWithStoreType.result  |    5 +
 .../TestCTASQuery/testCtasWithTextFile.result   |    5 +
 .../TestCTASQuery/testCtasWithUnion.result      |    8 +
 .../TestCaseByCases/testTAJO1224Case1.result    |    3 +
 .../TestCaseByCases/testTAJO415Case.result      |    7 +
 .../TestCaseByCases/testTAJO418Case.result      |    4 +
 .../TestCaseByCases/testTAJO619Case.result      |    3 +
 .../TestCaseByCases/testTAJO718Case.result      |    5 +
 .../TestCaseByCases/testTAJO739Case.result      |    7 +
 .../TestCaseByCases/testTAJO914Case1.result     |    5 +
 .../TestCaseByCases/testTAJO914Case2.result     |    5 +
 .../TestCaseByCases/testTAJO914Case3.result     |    5 +
 .../TestCaseByCases/testTAJO914Case4.result     |    5 +
 .../TestCaseByCases/testTAJO917Case1.result     |    7 +
 .../quoted_identifier_mixed_chars_1.result      |    5 +
 .../quoted_identifier_mixed_chars_2.result      |    5 +
 .../quoted_identifier_mixed_chars_3.result      |    8 +
 .../quoted_identifier_non_ascii_1.result        |    5 +
 .../quoted_identifier_non_ascii_2.result        |    5 +
 .../quoted_identifier_non_ascii_3.result        |    5 +
 .../testFindScalarFunctions.result              |    2 +
 .../testComplexParameter.result                 |    3 +
 .../testComplexParameter2.result                |    3 +
 .../testComplexParameterWithSubQuery.result     |    3 +
 .../testComplexTargetWithPythonUdaf.result      |    3 +
 .../testDistinctAggregation1.result             |    5 +
 .../testDistinctAggregation2.result             |    5 +
 .../testDistinctAggregation3.result             |    3 +
 .../testDistinctAggregation4.result             |    4 +
 .../testDistinctAggregation5.result             |    4 +
 .../testDistinctAggregation6.result             |    5 +
 .../testDistinctAggregation7.result             |    3 +
 .../testDistinctAggregation8.result             |    7 +
 .../testDistinctAggregationCaseByCase3.result   |    3 +
 .../testDistinctAggregationCaseByCase4.result   |    3 +
 .../testDistinctAggregationWithHaving1.result   |    3 +
 .../testDistinctAggregationWithUnion1.result    |    4 +
 .../testDistinctAggregation_case1.result        |    4 +
 .../testDistinctAggregation_case10.result       |    3 +
 .../testDistinctAggregation_case2.result        |    4 +
 .../testDistinctAggregation_case3.result        |    4 +
 .../testDistinctAggregation_case4.result        |    5 +
 .../testDistinctAggregation_case5.result        |    5 +
 .../testDistinctAggregation_case6.result        |    5 +
 .../testDistinctAggregation_case7.result        |    5 +
 .../testDistinctAggregation_case8.result        |    6 +
 .../testDistinctAggregation_case9.result        |    6 +
 .../testDistinctPythonUdafWithUnion1.result     |    4 +
 .../results/TestGroupByQuery/testGroupBy.result |    3 +
 .../TestGroupByQuery/testGroupBy2.result        |    4 +
 .../TestGroupByQuery/testGroupBy3.result        |    5 +
 .../TestGroupByQuery/testGroupBy4.result        |    5 +
 .../TestGroupByQuery/testGroupBy5.result        |    5 +
 .../TestGroupByQuery/testGroupByNested1.result  |    6 +
 .../TestGroupByQuery/testGroupByNested2.result  |    6 +
 .../testGroupByWithConstantKeys1.result         |    3 +
 .../testGroupByWithConstantKeys2.result         |    5 +
 .../testGroupByWithConstantKeys3.result         |    3 +
 .../testGroupByWithConstantKeys4.result         |    5 +
 .../testGroupByWithConstantKeys5.result         |    5 +
 .../testGroupByWithExpressionKeys1.result       |    5 +
 .../testGroupByWithExpressionKeys2.result       |    5 +
 .../testGroupByWithNullData1.result             |    3 +
 .../testGroupByWithNullData10.result            |    3 +
 .../testGroupByWithNullData11.result            |    2 +
 .../testGroupByWithNullData12.result            |    2 +
 .../testGroupByWithNullData2.result             |    3 +
 .../testGroupByWithNullData3.result             |    3 +
 .../testGroupByWithNullData4.result             |    3 +
 .../testGroupByWithNullData5.result             |    3 +
 .../testGroupByWithNullData6.result             |    3 +
 .../testGroupByWithNullData7.result             |    3 +
 .../testGroupByWithNullData8.result             |    3 +
 .../testGroupByWithNullData9.result             |    2 +
 .../testGroupByWithSameConstantKeys1.result     |    5 +
 .../testGroupByWithSameExprs1.result            |    6 +
 .../testGroupByWithSameExprs2.result            |    6 +
 .../TestGroupByQuery/testGroupbyWithJson.result |    5 +
 .../testGroupbyWithLimit1.result                |    3 +
 .../testGroupbyWithLimit2.result                |    3 +
 .../testGroupbyWithLimit3.result                |    3 +
 .../testGroupbyWithPythonFunc.result            |    7 +
 .../testGroupbyWithPythonFunc2.result           |    7 +
 .../testHavingWithAggFunction.result            |    4 +
 .../testHavingWithNamedTarget.result            |    5 +
 .../TestGroupByQuery/testPythonUdaf.result      |    3 +
 .../TestGroupByQuery/testPythonUdaf2.result     |    4 +
 .../TestGroupByQuery/testPythonUdaf3.result     |    5 +
 .../testPythonUdafWithHaving.result             |    4 +
 .../testPythonUdafWithNullData.result           |    2 +
 .../TestHBaseTable/testBinaryMappedQuery.result |   81 +
 .../results/TestHBaseTable/testCTAS.result      |  100 ++
 .../testColumnKeyValueSelectQuery.result        |   12 +
 .../TestHBaseTable/testIndexPredication.result  |   38 +
 .../TestHBaseTable/testInsertInto.result        |    3 +
 .../testInsertIntoBinaryMultiRegion.result      |  100 ++
 .../testInsertIntoColumnKeyValue.result         |   21 +
 .../testInsertIntoMultiRegion.result            |  100 ++
 .../testInsertIntoMultiRegion2.result           |  100 ++
 ...stInsertIntoMultiRegionMultiRowFields.result |  100 ++
 ...estInsertIntoMultiRegionWithSplitFile.result |  100 ++
 .../testInsertIntoRowField.result               |    4 +
 .../testInsertIntoUsingPut.result               |    3 +
 .../TestHBaseTable/testInsertValues1.result     |    4 +
 .../results/TestHBaseTable/testJoin.result      |    7 +
 .../TestHBaseTable/testNonForwardQuery.result   |  102 ++
 .../testRowFieldSelectQuery.result              |   88 ++
 .../TestHBaseTable/testSimpleSelectQuery.result |   88 ++
 .../testInAndNotInSubQuery.result               |   24 +
 .../TestInSubquery/testInSubQuery.result        |   27 +
 .../TestInSubquery/testInSubQuery2.result       |    3 +
 .../testInSubQueryWithJoin.result               |    5 +
 .../testInSubQueryWithOtherConditions.result    |   25 +
 .../testInSubQueryWithTableSubQuery.result      |    4 +
 .../testMultipleInSubQuery.result               |    5 +
 .../testMultipleNotInSubQuery.result            |   20 +
 .../testNestedInAndNotInSubQuery.result         |    3 +
 .../TestInSubquery/testNestedInSubQuery.result  |    3 +
 .../TestInSubquery/testNestedInSubQuery2.result |    3 +
 .../testNestedNotInSubQuery.result              |    7 +
 .../TestInSubquery/testNotInSubQuery.result     |   22 +
 ...testSameKeyNameOfOuterAndInnerQueries.result |    3 +
 .../testWithAsteriskAndJoin.result              |    6 +
 .../TestIndexScan/testOnMultipleExprs.result    |    3 +
 .../TestIndexScan/testOnMultipleKeys.result     |    3 +
 .../TestIndexScan/testOnMultipleKeys2.result    |    3 +
 .../testOnSortedNonUniqueKeys.result            |    4 +
 .../TestIndexScan/testOnUnsortedTextKeys.result |    3 +
 .../TestIndexScan/testWithGroupBy.result        |    3 +
 .../results/TestIndexScan/testWithJoin.result   |    4 +
 .../results/TestIndexScan/testWithSort.result   |    4 +
 .../testBroadcastTwoPartJoin.Hash.plan          |  135 ++
 ...stBroadcastTwoPartJoin.Hash_NoBroadcast.plan |  249 ++++
 .../testBroadcastTwoPartJoin.Sort.plan          |  135 ++
 ...stBroadcastTwoPartJoin.Sort_NoBroadcast.plan |  249 ++++
 .../testBroadcastTwoPartJoin.result             |    7 +
 .../testComplexJoinCondition1.Hash.plan         |   78 +
 ...tComplexJoinCondition1.Hash_NoBroadcast.plan |  105 ++
 .../testComplexJoinCondition1.Sort.plan         |   78 +
 ...tComplexJoinCondition1.Sort_NoBroadcast.plan |  105 ++
 .../testComplexJoinCondition1.result            |   27 +
 .../testComplexJoinCondition2.Hash.plan         |   78 +
 ...tComplexJoinCondition2.Hash_NoBroadcast.plan |  105 ++
 .../testComplexJoinCondition2.Sort.plan         |   78 +
 ...tComplexJoinCondition2.Sort_NoBroadcast.plan |  105 ++
 .../testComplexJoinCondition2.result            |   27 +
 .../testComplexJoinCondition3.Hash.plan         |   78 +
 ...tComplexJoinCondition3.Hash_NoBroadcast.plan |  105 ++
 .../testComplexJoinCondition3.Sort.plan         |   78 +
 ...tComplexJoinCondition3.Sort_NoBroadcast.plan |  105 ++
 .../testComplexJoinCondition3.result            |   27 +
 .../testComplexJoinCondition4.Hash.plan         |   78 +
 ...tComplexJoinCondition4.Hash_NoBroadcast.plan |  105 ++
 .../testComplexJoinCondition4.Sort.plan         |   78 +
 ...tComplexJoinCondition4.Sort_NoBroadcast.plan |  105 ++
 .../testComplexJoinCondition4.result            |   29 +
 .../testCrossJoin.1.Hash.plan                   |   76 +
 .../testCrossJoin.1.Hash_NoBroadcast.plan       |  103 ++
 .../testCrossJoin.1.Sort.plan                   |   76 +
 .../testCrossJoin.1.Sort_NoBroadcast.plan       |  103 ++
 .../TestInnerJoinQuery/testCrossJoin.1.result   |  127 ++
 .../testCrossJoin.2.Hash.plan                   |   51 +
 .../testCrossJoin.2.Hash_NoBroadcast.plan       |   78 +
 .../testCrossJoin.2.Sort.plan                   |   51 +
 .../testCrossJoin.2.Sort_NoBroadcast.plan       |   78 +
 .../TestInnerJoinQuery/testCrossJoin.2.result   |   27 +
 .../testCrossJoin.3.Hash.plan                   |   51 +
 .../testCrossJoin.3.Hash_NoBroadcast.plan       |   78 +
 .../testCrossJoin.3.Sort.plan                   |   51 +
 .../testCrossJoin.3.Sort_NoBroadcast.plan       |   78 +
 .../TestInnerJoinQuery/testCrossJoin.3.result   |   27 +
 .../testCrossJoin.4.Hash.plan                   |   51 +
 .../testCrossJoin.4.Hash_NoBroadcast.plan       |   78 +
 .../testCrossJoin.4.Sort.plan                   |   51 +
 .../testCrossJoin.4.Sort_NoBroadcast.plan       |   78 +
 .../TestInnerJoinQuery/testCrossJoin.4.result   |   27 +
 .../testCrossJoin.5.Hash.plan                   |   76 +
 .../testCrossJoin.5.Hash_NoBroadcast.plan       |  103 ++
 .../testCrossJoin.5.Sort.plan                   |   76 +
 .../testCrossJoin.5.Sort_NoBroadcast.plan       |  103 ++
 .../TestInnerJoinQuery/testCrossJoin.5.result   |   27 +
 .../testCrossJoinAndCaseWhen.Hash.plan          |   78 +
 ...stCrossJoinAndCaseWhen.Hash_NoBroadcast.plan |  105 ++
 .../testCrossJoinAndCaseWhen.Sort.plan          |   78 +
 ...stCrossJoinAndCaseWhen.Sort_NoBroadcast.plan |  105 ++
 .../testCrossJoinAndCaseWhen.result             |   27 +
 .../testCrossJoinWithAsterisk1.Hash.plan        |   76 +
 ...CrossJoinWithAsterisk1.Hash_NoBroadcast.plan |  103 ++
 .../testCrossJoinWithAsterisk1.Sort.plan        |   76 +
 ...CrossJoinWithAsterisk1.Sort_NoBroadcast.plan |  103 ++
 .../testCrossJoinWithAsterisk1.result           |   27 +
 .../testCrossJoinWithAsterisk2.Hash.plan        |   76 +
 ...CrossJoinWithAsterisk2.Hash_NoBroadcast.plan |  103 ++
 .../testCrossJoinWithAsterisk2.Sort.plan        |   76 +
 ...CrossJoinWithAsterisk2.Sort_NoBroadcast.plan |  103 ++
 .../testCrossJoinWithAsterisk2.result           |   27 +
 .../testCrossJoinWithAsterisk3.Hash.plan        |   76 +
 ...CrossJoinWithAsterisk3.Hash_NoBroadcast.plan |  103 ++
 .../testCrossJoinWithAsterisk3.Sort.plan        |   76 +
 ...CrossJoinWithAsterisk3.Sort_NoBroadcast.plan |  103 ++
 .../testCrossJoinWithAsterisk3.result           |   27 +
 .../testCrossJoinWithAsterisk4.Hash.plan        |   76 +
 ...CrossJoinWithAsterisk4.Hash_NoBroadcast.plan |  103 ++
 .../testCrossJoinWithAsterisk4.Sort.plan        |   76 +
 ...CrossJoinWithAsterisk4.Sort_NoBroadcast.plan |  103 ++
 .../testCrossJoinWithAsterisk4.result           |   27 +
 .../testCrossJoinWithEmptyTable1.Hash.plan      |   78 +
 ...ossJoinWithEmptyTable1.Hash_NoBroadcast.plan |  105 ++
 .../testCrossJoinWithEmptyTable1.Sort.plan      |   78 +
 ...ossJoinWithEmptyTable1.Sort_NoBroadcast.plan |  105 ++
 .../testCrossJoinWithEmptyTable1.result         |    2 +
 ...sJoinWithThetaJoinConditionInWhere.Hash.plan |   63 +
 ...taJoinConditionInWhere.Hash_NoBroadcast.plan |   90 ++
 ...sJoinWithThetaJoinConditionInWhere.Sort.plan |   63 +
 ...taJoinConditionInWhere.Sort_NoBroadcast.plan |   90 ++
 ...rossJoinWithThetaJoinConditionInWhere.result |   12 +
 .../testDifferentTypesJoinCondition.Hash.plan   |   53 +
 ...rentTypesJoinCondition.Hash_NoBroadcast.plan |   80 +
 .../testDifferentTypesJoinCondition.Sort.plan   |   53 +
 ...rentTypesJoinCondition.Sort_NoBroadcast.plan |   80 +
 .../testDifferentTypesJoinCondition.result      |    7 +
 .../testInnerJoinAndCaseWhen.Hash.plan          |   78 +
 ...stInnerJoinAndCaseWhen.Hash_NoBroadcast.plan |  105 ++
 .../testInnerJoinAndCaseWhen.Sort.plan          |   78 +
 ...stInnerJoinAndCaseWhen.Sort_NoBroadcast.plan |  105 ++
 .../testInnerJoinAndCaseWhen.result             |   27 +
 .../testInnerJoinWithEmptyTable.Hash.plan       |   78 +
 ...nnerJoinWithEmptyTable.Hash_NoBroadcast.plan |  105 ++
 .../testInnerJoinWithEmptyTable.Sort.plan       |   78 +
 ...nnerJoinWithEmptyTable.Sort_NoBroadcast.plan |  105 ++
 .../testInnerJoinWithEmptyTable.result          |    2 +
 ...rJoinWithThetaJoinConditionInWhere.Hash.plan |   57 +
 ...taJoinConditionInWhere.Hash_NoBroadcast.plan |   84 ++
 ...rJoinWithThetaJoinConditionInWhere.Sort.plan |   57 +
 ...taJoinConditionInWhere.Sort_NoBroadcast.plan |   84 ++
 ...nnerJoinWithThetaJoinConditionInWhere.result |    7 +
 .../testJoinAsterisk.Hash.plan                  |   53 +
 .../testJoinAsterisk.Hash_NoBroadcast.plan      |   80 +
 .../testJoinAsterisk.Sort.plan                  |   53 +
 .../testJoinAsterisk.Sort_NoBroadcast.plan      |   80 +
 .../TestInnerJoinQuery/testJoinAsterisk.result  |    7 +
 .../testJoinCoReferredEvals1.Hash.plan          |   78 +
 ...stJoinCoReferredEvals1.Hash_NoBroadcast.plan |  105 ++
 .../testJoinCoReferredEvals1.Sort.plan          |   78 +
 ...stJoinCoReferredEvals1.Sort_NoBroadcast.plan |  105 ++
 .../testJoinCoReferredEvals1.result             |   27 +
 ...tJoinCoReferredEvalsWithSameExprs1.Hash.plan |   88 ++
 ...redEvalsWithSameExprs1.Hash_NoBroadcast.plan |  115 ++
 ...tJoinCoReferredEvalsWithSameExprs1.Sort.plan |   88 ++
 ...redEvalsWithSameExprs1.Sort_NoBroadcast.plan |  115 ++
 ...testJoinCoReferredEvalsWithSameExprs1.result |   22 +
 ...tJoinCoReferredEvalsWithSameExprs2.Hash.plan |  119 ++
 ...redEvalsWithSameExprs2.Hash_NoBroadcast.plan |  146 ++
 ...tJoinCoReferredEvalsWithSameExprs2.Sort.plan |  119 ++
 ...redEvalsWithSameExprs2.Sort_NoBroadcast.plan |  146 ++
 ...testJoinCoReferredEvalsWithSameExprs2.result |   22 +
 .../testJoinOnMultipleDatabases.Hash.plan       |  135 ++
 ...oinOnMultipleDatabases.Hash_NoBroadcast.plan |  249 ++++
 .../testJoinOnMultipleDatabases.Sort.plan       |  135 ++
 ...oinOnMultipleDatabases.Sort_NoBroadcast.plan |  249 ++++
 .../testJoinOnMultipleDatabases.result          |    5 +
 .../testJoinOnMultipleDatabasesWithJson.result  |    5 +
 .../TestInnerJoinQuery/testJoinWithJson.result  |   27 +
 .../testJoinWithMultipleJoinQual1.Hash.plan     |  135 ++
 ...nWithMultipleJoinQual1.Hash_NoBroadcast.plan |  249 ++++
 .../testJoinWithMultipleJoinQual1.Sort.plan     |  135 ++
 ...nWithMultipleJoinQual1.Sort_NoBroadcast.plan |  249 ++++
 .../testJoinWithMultipleJoinQual1.result        |    2 +
 .../testJoinWithOrPredicates.Hash.plan          |   90 ++
 ...stJoinWithOrPredicates.Hash_NoBroadcast.plan |  117 ++
 .../testJoinWithOrPredicates.Sort.plan          |   90 ++
 ...stJoinWithOrPredicates.Sort_NoBroadcast.plan |  117 ++
 .../testJoinWithOrPredicates.result             |    4 +
 .../testNaturalJoin.Hash.plan                   |   78 +
 .../testNaturalJoin.Hash_NoBroadcast.plan       |  105 ++
 .../testNaturalJoin.Sort.plan                   |   78 +
 .../testNaturalJoin.Sort_NoBroadcast.plan       |  105 ++
 .../TestInnerJoinQuery/testNaturalJoin.result   |   27 +
 .../TestInnerJoinQuery/testTPCHQ2Join.Hash.plan |  135 ++
 .../testTPCHQ2Join.Hash_NoBroadcast.plan        |  249 ++++
 .../TestInnerJoinQuery/testTPCHQ2Join.Sort.plan |  135 ++
 .../testTPCHQ2Join.Sort_NoBroadcast.plan        |  249 ++++
 .../TestInnerJoinQuery/testTPCHQ2Join.result    |    5 +
 .../testWhereClauseJoin1.Hash.plan              |   78 +
 .../testWhereClauseJoin1.Hash_NoBroadcast.plan  |  105 ++
 .../testWhereClauseJoin1.Sort.plan              |   78 +
 .../testWhereClauseJoin1.Sort_NoBroadcast.plan  |  105 ++
 .../testWhereClauseJoin1.result                 |   27 +
 .../testWhereClauseJoin2.Hash.plan              |   78 +
 .../testWhereClauseJoin2.Hash_NoBroadcast.plan  |  105 ++
 .../testWhereClauseJoin2.Sort.plan              |   78 +
 .../testWhereClauseJoin2.Sort_NoBroadcast.plan  |  105 ++
 .../testWhereClauseJoin2.result                 |   27 +
 .../testWhereClauseJoin3.Hash.plan              |   78 +
 .../testWhereClauseJoin3.Hash_NoBroadcast.plan  |  105 ++
 .../testWhereClauseJoin3.Sort.plan              |   78 +
 .../testWhereClauseJoin3.Sort_NoBroadcast.plan  |  105 ++
 .../testWhereClauseJoin3.result                 |   27 +
 .../testWhereClauseJoin4.Hash.plan              |   78 +
 .../testWhereClauseJoin4.Hash_NoBroadcast.plan  |  105 ++
 .../testWhereClauseJoin4.Sort.plan              |   78 +
 .../testWhereClauseJoin4.Sort_NoBroadcast.plan  |  105 ++
 .../testWhereClauseJoin4.result                 |   27 +
 .../testWhereClauseJoin5.Hash.plan              |   97 ++
 .../testWhereClauseJoin5.Hash_NoBroadcast.plan  |  153 ++
 .../testWhereClauseJoin5.Sort.plan              |   97 ++
 .../testWhereClauseJoin5.Sort_NoBroadcast.plan  |  153 ++
 .../testWhereClauseJoin5.result                 |    5 +
 .../testWhereClauseJoin6.Hash.plan              |  116 ++
 .../testWhereClauseJoin6.Hash_NoBroadcast.plan  |  201 +++
 .../testWhereClauseJoin6.Sort.plan              |  116 ++
 .../testWhereClauseJoin6.Sort_NoBroadcast.plan  |  201 +++
 .../testWhereClauseJoin6.result                 |    5 +
 .../testBroadcastSubquery.Hash.plan             |  109 ++
 .../testBroadcastSubquery.Hash_NoBroadcast.plan |  165 ++
 .../testBroadcastSubquery.Sort.plan             |  109 ++
 .../testBroadcastSubquery.Sort_NoBroadcast.plan |  165 ++
 .../testBroadcastSubquery.result                |    7 +
 .../testBroadcastSubquery2.Hash.plan            |  216 +++
 ...testBroadcastSubquery2.Hash_NoBroadcast.plan |  328 ++++
 .../testBroadcastSubquery2.Sort.plan            |  216 +++
 ...testBroadcastSubquery2.Sort_NoBroadcast.plan |  328 ++++
 .../testBroadcastSubquery2.result               |    3 +
 .../testComplexJoinCondition5.Hash.plan         |   90 ++
 ...tComplexJoinCondition5.Hash_NoBroadcast.plan |  117 ++
 .../testComplexJoinCondition5.Sort.plan         |   90 ++
 ...tComplexJoinCondition5.Sort_NoBroadcast.plan |  117 ++
 .../testComplexJoinCondition5.result            |   29 +
 .../testComplexJoinCondition6.Hash.plan         |  109 ++
 ...tComplexJoinCondition6.Hash_NoBroadcast.plan |  145 ++
 .../testComplexJoinCondition6.Sort.plan         |  109 ++
 ...tComplexJoinCondition6.Sort_NoBroadcast.plan |  145 ++
 .../testComplexJoinCondition6.result            |   56 +
 .../testComplexJoinCondition7.Hash.plan         |  109 ++
 ...tComplexJoinCondition7.Hash_NoBroadcast.plan |  145 ++
 .../testComplexJoinCondition7.Sort.plan         |  109 ++
 ...tComplexJoinCondition7.Sort_NoBroadcast.plan |  145 ++
 .../testComplexJoinCondition7.result            |   56 +
 .../testJoinWithJson2.result                    |    5 +
 .../testJoinWithMultipleJoinQual2.Hash.plan     |   86 ++
 ...nWithMultipleJoinQual2.Hash_NoBroadcast.plan |  142 ++
 .../testJoinWithMultipleJoinQual2.Sort.plan     |   86 ++
 ...nWithMultipleJoinQual2.Sort_NoBroadcast.plan |  142 ++
 .../testJoinWithMultipleJoinQual2.result        |    3 +
 .../testJoinWithMultipleJoinQual3.Hash.plan     |  105 ++
 ...nWithMultipleJoinQual3.Hash_NoBroadcast.plan |  190 +++
 .../testJoinWithMultipleJoinQual3.Sort.plan     |  105 ++
 ...nWithMultipleJoinQual3.Sort_NoBroadcast.plan |  190 +++
 .../testJoinWithMultipleJoinQual3.result        |    5 +
 .../testJoinWithMultipleJoinQual4.Hash.plan     |  109 ++
 ...nWithMultipleJoinQual4.Hash_NoBroadcast.plan |  194 +++
 .../testJoinWithMultipleJoinQual4.Sort.plan     |  109 ++
 ...nWithMultipleJoinQual4.Sort_NoBroadcast.plan |  194 +++
 .../testJoinWithMultipleJoinQual4.result        |    4 +
 .../testThetaJoinKeyPairs.Hash.plan             |  146 ++
 .../testThetaJoinKeyPairs.Hash_NoBroadcast.plan |  200 +++
 .../testThetaJoinKeyPairs.Sort.plan             |  146 ++
 .../testThetaJoinKeyPairs.Sort_NoBroadcast.plan |  200 +++
 .../testThetaJoinKeyPairs.result                |   21 +
 ...estInsertOverwriteWithAsteriskAndMore.result |    7 +
 ...sertOverwriteWithAsteriskUsingParquet.result |    4 +
 ...ertOverwriteWithAsteriskUsingParquet2.result |    4 +
 .../testInsertWithDifferentColumnOrder.result   |   27 +
 .../selfJoinOfPartitionedTable.result           |    7 +
 .../testBroadcastPartitionTable.result          |    5 +
 ...FilterPushDownPartitionColumnCaseWhen.result |    4 +
 ...tionedBroadcastDataFileWithZeroLength.result |    7 +
 ...ionedBroadcastDataFileWithZeroLength2.result |    7 +
 .../testNoProjectionJoinQual.result             |    3 +
 .../testPartialFilterPushDown.result            |    3 +
 .../testPartialFilterPushDownOuterJoin.result   |   27 +
 .../testPartialFilterPushDownOuterJoin2.result  |   27 +
 ...estPartitionMultiplePartitionFilter.1.result |    2 +
 .../testPartitionTableJoinSmallTable.result     |    7 +
 .../TestJoinQuery/testWhereClauseJoin6.result   |    5 +
 .../testComplexJoinsWithCaseWhen.Hash.plan      |   97 ++
 ...mplexJoinsWithCaseWhen.Hash_NoBroadcast.plan |  153 ++
 .../testComplexJoinsWithCaseWhen.Sort.plan      |   97 ++
 ...mplexJoinsWithCaseWhen.Sort_NoBroadcast.plan |  153 ++
 .../testComplexJoinsWithCaseWhen.result         |   27 +
 .../testComplexJoinsWithCaseWhen2.Hash.plan     |  109 ++
 ...plexJoinsWithCaseWhen2.Hash_NoBroadcast.plan |  165 ++
 .../testComplexJoinsWithCaseWhen2.Sort.plan     |  109 ++
 ...plexJoinsWithCaseWhen2.Sort_NoBroadcast.plan |  165 ++
 .../testComplexJoinsWithCaseWhen2.result        |   27 +
 .../testInnerAndOuterWithEmpty.1.Hash.plan      |   74 +
 ...nerAndOuterWithEmpty.1.Hash_NoBroadcast.plan |  130 ++
 .../testInnerAndOuterWithEmpty.1.Sort.plan      |   74 +
 ...nerAndOuterWithEmpty.1.Sort_NoBroadcast.plan |  130 ++
 .../testInnerAndOuterWithEmpty.1.result         |    7 +
 .../testJoinWithMultipleJoinTypes.Hash.plan     |   84 ++
 ...nWithMultipleJoinTypes.Hash_NoBroadcast.plan |  140 ++
 .../testJoinWithMultipleJoinTypes.Sort.plan     |   84 ++
 ...nWithMultipleJoinTypes.Sort_NoBroadcast.plan |  140 ++
 .../testJoinWithMultipleJoinTypes.result        |    6 +
 .../results/TestNetTypes/testGroupby.result     |    7 +
 .../results/TestNetTypes/testGroupby2.result    |    5 +
 .../results/TestNetTypes/testJoin.result        |    6 +
 .../results/TestNetTypes/testSelect.result      |    7 +
 .../results/TestNetTypes/testSort.result        |    7 +
 .../results/TestNetTypes/testSort2.result       |    7 +
 .../testGetClusterDetails.result                |    4 +
 .../testGetNextRowsForAggregateFunction.result  |    3 +
 .../testGetNextRowsForTable.result              |    5 +
 .../testFullOuterJoin1.Hash.plan                |  105 ++
 .../testFullOuterJoin1.Hash_NoBroadcast.plan    |  105 ++
 .../testFullOuterJoin1.Sort.plan                |  105 ++
 .../testFullOuterJoin1.Sort_NoBroadcast.plan    |  105 ++
 .../testFullOuterJoin1.result                   |    7 +
 ...lOuterJoinPredicationCaseByCase1.1.Hash.plan |  153 ++
 ...edicationCaseByCase1.1.Hash_NoBroadcast.plan |  153 ++
 ...lOuterJoinPredicationCaseByCase1.1.Sort.plan |  153 ++
 ...edicationCaseByCase1.1.Sort_NoBroadcast.plan |  153 ++
 ...FullOuterJoinPredicationCaseByCase1.1.result |    9 +
 .../testFullOuterJoinWithEmptyTable1.Hash.plan  |  105 ++
 ...terJoinWithEmptyTable1.Hash_NoBroadcast.plan |  105 ++
 .../testFullOuterJoinWithEmptyTable1.Sort.plan  |  105 ++
 ...terJoinWithEmptyTable1.Sort_NoBroadcast.plan |  105 ++
 .../testFullOuterJoinWithEmptyTable1.result     |    7 +
 ...testJoinFilterOfRowPreservedTable1.Hash.plan |   78 +
 ...erOfRowPreservedTable1.Hash_NoBroadcast.plan |  105 ++
 ...testJoinFilterOfRowPreservedTable1.Sort.plan |   78 +
 ...erOfRowPreservedTable1.Sort_NoBroadcast.plan |  105 ++
 .../testJoinFilterOfRowPreservedTable1.result   |   15 +
 .../testLeftOuterJoin1.Hash.plan                |   78 +
 .../testLeftOuterJoin1.Hash_NoBroadcast.plan    |  105 ++
 .../testLeftOuterJoin1.Sort.plan                |   78 +
 .../testLeftOuterJoin1.Sort_NoBroadcast.plan    |  105 ++
 .../testLeftOuterJoin1.result                   |    7 +
 .../testLeftOuterJoin2.Hash.plan                |   91 ++
 .../testLeftOuterJoin2.Hash_NoBroadcast.plan    |  176 +++
 .../testLeftOuterJoin2.Sort.plan                |   91 ++
 .../testLeftOuterJoin2.Sort_NoBroadcast.plan    |  176 +++
 .../testLeftOuterJoin2.result                   |    7 +
 .../testLeftOuterJoin3.Hash.plan                |  160 ++
 .../testLeftOuterJoin3.Hash_NoBroadcast.plan    |  272 ++++
 .../testLeftOuterJoin3.Sort.plan                |  160 ++
 .../testLeftOuterJoin3.Sort_NoBroadcast.plan    |  272 ++++
 .../testLeftOuterJoin3.result                   |    9 +
 ...tLeftOuterJoinLeftSideSmallTable.1.Hash.plan |  105 ++
 ...inLeftSideSmallTable.1.Hash_NoBroadcast.plan |  105 ++
 ...tLeftOuterJoinLeftSideSmallTable.1.Sort.plan |  105 ++
 ...inLeftSideSmallTable.1.Sort_NoBroadcast.plan |  105 ++
 ...testLeftOuterJoinLeftSideSmallTable.1.result |    7 +
 ...tOuterJoinPredicationCaseByCase1.1.Hash.plan |   72 +
 ...edicationCaseByCase1.1.Hash_NoBroadcast.plan |  128 ++
 ...tOuterJoinPredicationCaseByCase1.1.Sort.plan |   72 +
 ...edicationCaseByCase1.1.Sort_NoBroadcast.plan |  128 ++
 ...LeftOuterJoinPredicationCaseByCase1.1.result |    7 +
 ...tOuterJoinPredicationCaseByCase2.1.Hash.plan |  122 ++
 ...edicationCaseByCase2.1.Hash_NoBroadcast.plan |  176 +++
 ...tOuterJoinPredicationCaseByCase2.1.Sort.plan |  122 ++
 ...edicationCaseByCase2.1.Sort_NoBroadcast.plan |  176 +++
 ...LeftOuterJoinPredicationCaseByCase2.1.result |    4 +
 ...uterJoinPredicationCaseByCase2_1.1.Hash.plan |   97 ++
 ...icationCaseByCase2_1.1.Hash_NoBroadcast.plan |  182 +++
 ...uterJoinPredicationCaseByCase2_1.1.Sort.plan |   97 ++
 ...icationCaseByCase2_1.1.Sort_NoBroadcast.plan |  182 +++
 ...ftOuterJoinPredicationCaseByCase2_1.1.result |    5 +
 ...tOuterJoinPredicationCaseByCase3.1.Hash.plan |   72 +
 ...edicationCaseByCase3.1.Hash_NoBroadcast.plan |  128 ++
 ...tOuterJoinPredicationCaseByCase3.1.Sort.plan |   72 +
 ...edicationCaseByCase3.1.Sort_NoBroadcast.plan |  128 ++
 ...LeftOuterJoinPredicationCaseByCase3.1.result |    7 +
 ...tOuterJoinPredicationCaseByCase4.1.Hash.plan |   74 +
 ...edicationCaseByCase4.1.Hash_NoBroadcast.plan |  130 ++
 ...tOuterJoinPredicationCaseByCase4.1.Sort.plan |   74 +
 ...edicationCaseByCase4.1.Sort_NoBroadcast.plan |  130 ++
 ...LeftOuterJoinPredicationCaseByCase4.1.result |    7 +
 ...tOuterJoinPredicationCaseByCase5.1.Hash.plan |   74 +
 ...edicationCaseByCase5.1.Hash_NoBroadcast.plan |  130 ++
 ...tOuterJoinPredicationCaseByCase5.1.Sort.plan |   74 +
 ...edicationCaseByCase5.1.Sort_NoBroadcast.plan |  130 ++
 ...LeftOuterJoinPredicationCaseByCase5.1.result |    6 +
 ...tOuterJoinPredicationCaseByCase6.1.Hash.plan |   76 +
 ...edicationCaseByCase6.1.Hash_NoBroadcast.plan |  132 ++
 ...tOuterJoinPredicationCaseByCase6.1.Sort.plan |   76 +
 ...edicationCaseByCase6.1.Sort_NoBroadcast.plan |  132 ++
 ...LeftOuterJoinPredicationCaseByCase6.1.result |    3 +
 ...testLeftOuterJoinWithConstantExpr1.Hash.plan |   86 ++
 ...rJoinWithConstantExpr1.Hash_NoBroadcast.plan |  113 ++
 ...testLeftOuterJoinWithConstantExpr1.Sort.plan |   86 ++
 ...rJoinWithConstantExpr1.Sort_NoBroadcast.plan |  113 ++
 .../testLeftOuterJoinWithConstantExpr1.result   |    7 +
 ...testLeftOuterJoinWithConstantExpr4.Hash.plan |   63 +
 ...rJoinWithConstantExpr4.Hash_NoBroadcast.plan |   90 ++
 ...testLeftOuterJoinWithConstantExpr4.Sort.plan |   63 +
 ...rJoinWithConstantExpr4.Sort_NoBroadcast.plan |   90 ++
 .../testLeftOuterJoinWithConstantExpr4.result   |    7 +
 ...testLeftOuterJoinWithConstantExpr5.Hash.plan |   65 +
 ...rJoinWithConstantExpr5.Hash_NoBroadcast.plan |   92 ++
 ...testLeftOuterJoinWithConstantExpr5.Sort.plan |   65 +
 ...rJoinWithConstantExpr5.Sort_NoBroadcast.plan |   92 ++
 .../testLeftOuterJoinWithConstantExpr5.result   |    6 +
 .../testLeftOuterJoinWithEmptyTable1.Hash.plan  |   78 +
 ...terJoinWithEmptyTable1.Hash_NoBroadcast.plan |  105 ++
 .../testLeftOuterJoinWithEmptyTable1.Sort.plan  |   78 +
 ...terJoinWithEmptyTable1.Sort_NoBroadcast.plan |  105 ++
 .../testLeftOuterJoinWithEmptyTable1.result     |    7 +
 .../testLeftOuterJoinWithEmptyTable2.Hash.plan  |  109 ++
 ...terJoinWithEmptyTable2.Hash_NoBroadcast.plan |  136 ++
 .../testLeftOuterJoinWithEmptyTable2.Sort.plan  |  109 ++
 ...terJoinWithEmptyTable2.Sort_NoBroadcast.plan |  136 ++
 .../testLeftOuterJoinWithEmptyTable2.result     |    7 +
 .../testLeftOuterJoinWithEmptyTable3.Hash.plan  |  160 ++
 ...terJoinWithEmptyTable3.Hash_NoBroadcast.plan |  187 +++
 .../testLeftOuterJoinWithEmptyTable3.Sort.plan  |  160 ++
 ...terJoinWithEmptyTable3.Sort_NoBroadcast.plan |  187 +++
 .../testLeftOuterJoinWithEmptyTable3.result     |    7 +
 .../testLeftOuterJoinWithEmptyTable4.Hash.plan  |  160 ++
 ...terJoinWithEmptyTable4.Hash_NoBroadcast.plan |  214 +++
 .../testLeftOuterJoinWithEmptyTable4.Sort.plan  |  160 ++
 ...terJoinWithEmptyTable4.Sort_NoBroadcast.plan |  214 +++
 .../testLeftOuterJoinWithEmptyTable4.result     |    4 +
 .../testLeftOuterJoinWithEmptyTable5.Hash.plan  |  109 ++
 ...terJoinWithEmptyTable5.Hash_NoBroadcast.plan |  136 ++
 .../testLeftOuterJoinWithEmptyTable5.Sort.plan  |  109 ++
 ...terJoinWithEmptyTable5.Sort_NoBroadcast.plan |  136 ++
 .../testLeftOuterJoinWithEmptyTable5.result     |    4 +
 .../testLeftOuterJoinWithNull1.Hash.plan        |   82 +
 ...LeftOuterJoinWithNull1.Hash_NoBroadcast.plan |  109 ++
 .../testLeftOuterJoinWithNull1.Sort.plan        |   82 +
 ...LeftOuterJoinWithNull1.Sort_NoBroadcast.plan |  109 ++
 .../testLeftOuterJoinWithNull1.result           |    4 +
 .../testLeftOuterJoinWithNull2.Hash.plan        |   82 +
 ...LeftOuterJoinWithNull2.Hash_NoBroadcast.plan |  109 ++
 .../testLeftOuterJoinWithNull2.Sort.plan        |   82 +
 ...LeftOuterJoinWithNull2.Sort_NoBroadcast.plan |  109 ++
 .../testLeftOuterJoinWithNull2.result           |    4 +
 .../testLeftOuterJoinWithNull3.Hash.plan        |   82 +
 ...LeftOuterJoinWithNull3.Hash_NoBroadcast.plan |  109 ++
 .../testLeftOuterJoinWithNull3.Sort.plan        |   82 +
 ...LeftOuterJoinWithNull3.Sort_NoBroadcast.plan |  109 ++
 .../testLeftOuterJoinWithNull3.result           |    2 +
 ...rJoinWithThetaJoinConditionInWhere.Hash.plan |   57 +
 ...taJoinConditionInWhere.Hash_NoBroadcast.plan |   84 ++
 ...rJoinWithThetaJoinConditionInWhere.Sort.plan |   57 +
 ...taJoinConditionInWhere.Sort_NoBroadcast.plan |   84 ++
 ...uterJoinWithThetaJoinConditionInWhere.result |    4 +
 .../testLeftOuterWithEmptyTable.1.Hash.plan     |   53 +
 ...tOuterWithEmptyTable.1.Hash_NoBroadcast.plan |   80 +
 .../testLeftOuterWithEmptyTable.1.Sort.plan     |   53 +
 ...tOuterWithEmptyTable.1.Sort_NoBroadcast.plan |   80 +
 .../testLeftOuterWithEmptyTable.1.result        |    7 +
 ...pleBroadcastDataFileWithZeroLength.Hash.plan |   57 +
 ...DataFileWithZeroLength.Hash_NoBroadcast.plan |   84 ++
 ...pleBroadcastDataFileWithZeroLength.Sort.plan |   57 +
 ...DataFileWithZeroLength.Sort_NoBroadcast.plan |   84 ++
 ...ltipleBroadcastDataFileWithZeroLength.result |    2 +
 ...leBroadcastDataFileWithZeroLength2.Hash.plan |   76 +
 ...ataFileWithZeroLength2.Hash_NoBroadcast.plan |  132 ++
 ...leBroadcastDataFileWithZeroLength2.Sort.plan |   76 +
 ...ataFileWithZeroLength2.Sort_NoBroadcast.plan |  132 ++
 ...tipleBroadcastDataFileWithZeroLength2.result |    7 +
 .../testOuterJoinAndCaseWhen1.Hash.plan         |  126 ++
 ...tOuterJoinAndCaseWhen1.Hash_NoBroadcast.plan |  153 ++
 .../testOuterJoinAndCaseWhen1.Sort.plan         |  126 ++
 ...tOuterJoinAndCaseWhen1.Sort_NoBroadcast.plan |  153 ++
 .../testOuterJoinAndCaseWhen1.result            |    7 +
 .../testRightOuterJoin1.Hash.plan               |   78 +
 .../testRightOuterJoin1.Hash_NoBroadcast.plan   |  105 ++
 .../testRightOuterJoin1.Sort.plan               |   78 +
 .../testRightOuterJoin1.Sort_NoBroadcast.plan   |  105 ++
 .../testRightOuterJoin1.result                  |    7 +
 ...tOuterJoinPredicationCaseByCase1.1.Hash.plan |  101 ++
 ...edicationCaseByCase1.1.Hash_NoBroadcast.plan |  128 ++
 ...tOuterJoinPredicationCaseByCase1.1.Sort.plan |  101 ++
 ...edicationCaseByCase1.1.Sort_NoBroadcast.plan |  128 ++
 ...ightOuterJoinPredicationCaseByCase1.1.result |    4 +
 ...tOuterJoinPredicationCaseByCase2.1.Hash.plan |   76 +
 ...edicationCaseByCase2.1.Hash_NoBroadcast.plan |  132 ++
 ...tOuterJoinPredicationCaseByCase2.1.Sort.plan |   76 +
 ...edicationCaseByCase2.1.Sort_NoBroadcast.plan |  132 ++
 ...ightOuterJoinPredicationCaseByCase2.1.result |    4 +
 ...tOuterJoinPredicationCaseByCase3.1.Hash.plan |  101 ++
 ...edicationCaseByCase3.1.Hash_NoBroadcast.plan |  128 ++
 ...tOuterJoinPredicationCaseByCase3.1.Sort.plan |  101 ++
 ...edicationCaseByCase3.1.Sort_NoBroadcast.plan |  128 ++
 ...ightOuterJoinPredicationCaseByCase3.1.result |    4 +
 .../testRightOuterJoinWithEmptyTable1.Hash.plan |   78 +
 ...terJoinWithEmptyTable1.Hash_NoBroadcast.plan |  105 ++
 .../testRightOuterJoinWithEmptyTable1.Sort.plan |   78 +
 ...terJoinWithEmptyTable1.Sort_NoBroadcast.plan |  105 ++
 .../testRightOuterJoinWithEmptyTable1.result    |    7 +
 ...rJoinWithThetaJoinConditionInWhere.Hash.plan |   57 +
 ...taJoinConditionInWhere.Hash_NoBroadcast.plan |   84 ++
 ...rJoinWithThetaJoinConditionInWhere.Sort.plan |   57 +
 ...taJoinConditionInWhere.Sort_NoBroadcast.plan |   84 ++
 ...uterJoinWithThetaJoinConditionInWhere.result |    4 +
 ...terJoinWithEmptyIntermediateData.1.Hash.plan |  108 ++
 ...mptyIntermediateData.1.Hash_NoBroadcast.plan |  108 ++
 ...terJoinWithEmptyIntermediateData.1.Sort.plan |  108 ++
 ...mptyIntermediateData.1.Sort_NoBroadcast.plan |  108 ++
 ...lOuterJoinWithEmptyIntermediateData.1.result |    2 +
 .../testJoinWithDifferentShuffleKey.1.Hash.plan |  199 +++
 ...hDifferentShuffleKey.1.Hash_NoBroadcast.plan |  199 +++
 .../testJoinWithDifferentShuffleKey.1.Sort.plan |  199 +++
 ...hDifferentShuffleKey.1.Sort_NoBroadcast.plan |  199 +++
 .../testJoinWithDifferentShuffleKey.1.result    |    3 +
 ...testLeftOuterJoinWithConstantExpr2.Hash.plan |   98 ++
 ...rJoinWithConstantExpr2.Hash_NoBroadcast.plan |  125 ++
 ...testLeftOuterJoinWithConstantExpr2.Sort.plan |   98 ++
 ...rJoinWithConstantExpr2.Sort_NoBroadcast.plan |  125 ++
 .../testLeftOuterJoinWithConstantExpr2.result   |    7 +
 ...testLeftOuterJoinWithConstantExpr3.Hash.plan |  156 ++
 ...rJoinWithConstantExpr3.Hash_NoBroadcast.plan |  156 ++
 ...testLeftOuterJoinWithConstantExpr3.Sort.plan |  156 ++
 ...rJoinWithConstantExpr3.Sort_NoBroadcast.plan |  156 ++
 .../testLeftOuterJoinWithConstantExpr3.result   |    7 +
 ...tLeftOuterJoinWithEmptySubquery1.1.Hash.plan |  111 ++
 ...inWithEmptySubquery1.1.Hash_NoBroadcast.plan |  167 +++
 ...tLeftOuterJoinWithEmptySubquery1.1.Sort.plan |  111 ++
 ...inWithEmptySubquery1.1.Sort_NoBroadcast.plan |  167 +++
 ...testLeftOuterJoinWithEmptySubquery1.1.result |    7 +
 ...tLeftOuterJoinWithEmptySubquery2.1.Hash.plan |   86 ++
 ...inWithEmptySubquery2.1.Hash_NoBroadcast.plan |  142 ++
 ...tLeftOuterJoinWithEmptySubquery2.1.Sort.plan |   86 ++
 ...inWithEmptySubquery2.1.Sort_NoBroadcast.plan |  142 ++
 ...testLeftOuterJoinWithEmptySubquery2.1.result |    2 +
 .../TestQueryUnitStatusUpdate/case3.result      |    4 +
 .../create_table_nested_1.result                |   40 +
 .../create_table_nested_2.result                |   57 +
 .../results/TestSQLAnalyzer/setcatalog1.result  |    5 +
 .../results/TestSQLAnalyzer/setcatalog2.result  |    5 +
 .../results/TestSQLAnalyzer/setsession1.result  |    5 +
 .../results/TestSQLAnalyzer/setsession2.result  |    5 +
 .../results/TestSQLAnalyzer/setsession3.result  |    5 +
 .../results/TestSQLAnalyzer/setsession4.result  |    5 +
 .../results/TestSQLAnalyzer/setsession5.result  |    5 +
 .../results/TestSQLAnalyzer/setsession6.result  |    5 +
 .../results/TestSQLAnalyzer/setsession7.result  |    5 +
 .../results/TestSQLAnalyzer/settimezone1.result |    5 +
 .../results/TestSQLAnalyzer/settimezone2.result |    5 +
 .../results/TestSQLAnalyzer/settimezone3.result |    4 +
 .../results/TestSQLAnalyzer/window1.result      |   37 +
 .../results/TestSQLAnalyzer/window2.result      |   44 +
 .../results/TestSQLAnalyzer/window3.result      |   50 +
 .../results/TestSQLAnalyzer/window4.result      |   48 +
 .../results/TestSQLAnalyzer/window5.result      |   77 +
 .../results/TestSQLAnalyzer/window6.result      |   83 ++
 .../results/TestSQLAnalyzer/window7.result      |   81 +
 .../results/TestSQLAnalyzer/window8.result      |   86 ++
 .../results/TestSQLAnalyzer/window9.result      |   56 +
 .../testInsertType1.result                      |    5 +
 .../testInsertType2.result                      |    5 +
 .../testNestedFieldAsGroupbyKey1.result         |    6 +
 .../testNestedFieldAsJoinKey1.result            |    6 +
 .../TestSelectNestedRecord/testSelect0.result   |    5 +
 .../TestSelectNestedRecord/testSelect1.result   |    5 +
 .../TestSelectNestedRecord/testSelect2.result   |    6 +
 .../TestSelectNestedRecord/testSelect3.result   |    3 +
 .../results/TestSelectQuery/testCaseWhen.result |    7 +
 .../TestSelectQuery/testCaseWhenRound.result    |   22 +
 .../testCaseWhenWithoutElse.result              |    7 +
 ...estColumnEqualityButNotJoinCondition1.result |    3 +
 ...estColumnEqualityButNotJoinCondition2.result |    6 +
 .../TestSelectQuery/testDatabaseRef.result      |    7 +
 .../TestSelectQuery/testExplainSelect.result    |    6 +
 .../testExplainSelectPhysical.1.result          |   26 +
 .../testExplainSelectPhysical.2.result          |   88 ++
 .../testExplainSelectPhysical.3.result          |   89 ++
 .../results/TestSelectQuery/testInClause.result |    5 +
 .../TestSelectQuery/testInStrClause.result      |    4 +
 .../TestSelectQuery/testLikeClause.result       |    9 +
 .../results/TestSelectQuery/testLimit.result    |    5 +
 .../testMultiBytesDelimiter1.result             |    7 +
 .../testMultiBytesDelimiter2.result             |    7 +
 .../testMultiBytesDelimiter3.result             |    7 +
 .../testMultiBytesDelimiter4.result             |    7 +
 .../testNestedPythonFunction.result             |    7 +
 .../TestSelectQuery/testNonFromSelect1.result   |    3 +
 .../testNonQualifiedNames.result                |    7 +
 .../results/TestSelectQuery/testNotEqual.result |    5 +
 .../TestSelectQuery/testNotInClause.result      |    4 +
 .../TestSelectQuery/testNotInStrClause.result   |    4 +
 .../TestSelectQuery/testRealValueCompare.result |    3 +
 .../results/TestSelectQuery/testSelect.result   |    7 +
 .../results/TestSelectQuery/testSelect2.result  |    7 +
 .../results/TestSelectQuery/testSelect3.result  |    7 +
 .../TestSelectQuery/testSelectAsterisk1.result  |    7 +
 .../TestSelectQuery/testSelectAsterisk2.result  |    3 +
 .../TestSelectQuery/testSelectAsterisk3.result  |    3 +
 .../TestSelectQuery/testSelectAsterisk4.result  |    7 +
 .../TestSelectQuery/testSelectAsterisk5.result  |    3 +
 .../testSelectColumnAlias1.result               |    7 +
 ...tSelectColumnAliasExistingInRelation1.result |    4 +
 ...tSelectColumnAliasExistingInRelation2.result |    7 +
 ...tSelectColumnAliasExistingInRelation3.result |   11 +
 .../TestSelectQuery/testSelectDistinct.result   |    7 +
 .../testSelectOnSessionTable.result             |    3 +
 .../testSelectPythonFuncs.result                |    7 +
 ...lectSameConstantsWithDifferentAliases.result |    7 +
 ...ectSameConstantsWithDifferentAliases2.result |    7 +
 ...ectSameConstantsWithDifferentAliases3.result |    7 +
 ...stSelectSameExprsWithDifferentAliases.result |    7 +
 .../testSelectWithCommonQuals1.1.plan           |    7 +
 .../testSelectWithCommonQuals1.1.result         |   27 +
 .../testSelectWithCommonQuals2.1.plan           |    7 +
 .../testSelectWithCommonQuals2.1.result         |   27 +
 .../testSelectWithCommonQuals3.1.plan           |    7 +
 .../testSelectWithCommonQuals3.1.result         |    7 +
 .../TestSelectQuery/testSelectWithJson.result   |    7 +
 .../testSelectWithParentheses1.result           |    3 +
 .../testSelectWithParentheses2.result           |    3 +
 .../testSelectWithPredicateOnPythonFunc.result  |   17 +
 .../TestSelectQuery/testSimpleQuery.result      |    7 +
 .../testSimpleQueryWithLimit.result             |    5 +
 ...tSimpleQueryWithLimitPartitionedTable.result |   12 +
 .../TestSelectQuery/testStringCompare.result    |    5 +
 .../TestSelectQuery/testSumFloatOverflow.result |    3 +
 .../TestSelectQuery/testSumIntOverflow.result   |    3 +
 .../TestSelectQuery/testTimezonedTable1.result  |    5 +
 .../TestSelectQuery/testTimezonedTable2.result  |    5 +
 .../TestSelectQuery/testTimezonedTable3.result  |    5 +
 .../results/TestSelectQuery/testUnion1.result   |   10 +
 .../results/TestSelectQuery/testUnion2.result   |   12 +
 .../TestSelectQuery/testWhereCond1.result       |    3 +
 .../TestSelectQuery/testWhereCond2.result       |    3 +
 .../testWhereCondWithAlias1.result              |    4 +
 .../testWhereCondWithAlias2.result              |    4 +
 .../results/TestSortQuery/testAsterisk.result   |    7 +
 .../results/TestSortQuery/testSort.result       |    7 +
 .../TestSortQuery/testSortAfterGroupby.result   |    5 +
 .../testSortAfterGroupbyWithAlias.result        |    5 +
 .../results/TestSortQuery/testSortDesc.result   |    7 +
 .../TestSortQuery/testSortFirstDesc.result      |   10 +
 .../TestSortQuery/testSortOnNullColumn.result   |    6 +
 .../testSortOnUnicodeTextAsc.result             |    6 +
 .../testSortOnUnicodeTextDesc.result            |    6 +
 .../TestSortQuery/testSortWithAlias1.result     |    7 +
 .../TestSortQuery/testSortWithAlias2.result     |    5 +
 .../TestSortQuery/testSortWithAlias3.result     |    7 +
 .../testSortWithAliasButOriginalName.result     |    7 +
 .../testSortWithAscDescKeys.result              |   26 +
 .../TestSortQuery/testSortWithConstKeys.result  |    7 +
 .../TestSortQuery/testSortWithDate.result       |    7 +
 .../TestSortQuery/testSortWithExpr1.result      |    7 +
 .../TestSortQuery/testSortWithExpr2.result      |    7 +
 .../TestSortQuery/testSortWithJson.result       |    5 +
 .../testSubQuerySortAfterGroupMultiBlocks.plan  |  112 ++
 ...testSubQuerySortAfterGroupMultiBlocks.result |    5 +
 .../results/TestSortQuery/testTopK.result       |    5 +
 .../TestSortQuery/testTopkWithJson.result       |    5 +
 .../results/TestTPCH/testFirstJoinInQ7.plan     |  156 ++
 .../results/TestTPCH/testFirstJoinInQ7.result   |    4 +
 .../results/TestTPCH/testQ1OrderBy.plan         |   88 ++
 .../results/TestTPCH/testQ1OrderBy.result       |    4 +
 .../results/TestTPCH/testQ2FourJoins.plan       |  228 +++
 .../results/TestTPCH/testQ2FourJoins.result     |    3 +
 .../results/TestTPCH/testTPCH14Expr.plan        |  119 ++
 .../results/TestTPCH/testTPCH14Expr.result      |    3 +
 .../resources/results/TestTPCH/testTPCHQ5.plan  |  332 +++++
 .../results/TestTPCH/testTPCHQ5.result          |    2 +
 .../TestSpecialCharPartitionKeys1.result        |    4 +
 .../TestSpecialCharPartitionKeys2.result        |    3 +
 .../results/TestTablePartitions/case1.result    |    4 +
 .../results/TestTablePartitions/case10.result   |    7 +
 .../results/TestTablePartitions/case11.result   |    7 +
 .../results/TestTablePartitions/case12.result   |    7 +
 .../results/TestTablePartitions/case13.result   |    7 +
 .../results/TestTablePartitions/case14.result   |    3 +
 .../results/TestTablePartitions/case15.result   |    3 +
 .../results/TestTablePartitions/case2.result    |    6 +
 .../results/TestTablePartitions/case3.result    |    5 +
 .../results/TestTablePartitions/case4.result    |    7 +
 .../results/TestTablePartitions/case5.result    |    7 +
 .../results/TestTablePartitions/case6.result    |    7 +
 .../results/TestTablePartitions/case7.result    |    5 +
 .../results/TestTablePartitions/case8.result    |    7 +
 .../results/TestTablePartitions/case9.result    |    7 +
 ...rtitionedTableWithSmallerExpressions5.result |    7 +
 ...rtitionedTableWithSmallerExpressions6.result |    4 +
 .../testGroupBySubQuery.result                  |    3 +
 .../testGroupbySubqueryWithJson.result          |    3 +
 .../TestTableSubQuery/testJoinSubQuery.result   |    4 +
 .../TestTableSubQuery/testJoinSubQuery2.result  |    4 +
 .../testJoinSubqueryWithJson.result             |    4 +
 .../TestTableSubQuery/testTableSubquery1.result |    7 +
 .../testAlterTableAddDropPartition.result       |    9 +
 .../results/TestTajoCli/testDescTable.result    |   27 +
 .../testDescTableForNestedSchema.result         |   29 +
 .../TestTajoCli/testHelpSessionVars.result      |   44 +
 .../testLocalQueryWithoutFrom.result            |    8 +
 .../TestTajoCli/testNonForwardQueryPause.result |    6 +
 .../testSelectResultWithNullFalse.result        |    8 +
 .../testSelectResultWithNullTrue.result         |    8 +
 ...estSelectResultWithNullTrueDeprecated.result |    9 +
 .../results/TestTajoCli/testSetTimezone1.result |    4 +
 .../TestTajoCli/testStopWhenError.result        |    5 +
 .../testStopWhenErrorDeprecated.result          |    6 +
 .../testQueryFailure.result                     |    0
 .../TestTajoCliNegatives/testQuerySyntax.result |    3 +
 .../testExecuteQueryAsync.result                |    7 +
 .../testExecuteQueryAsyncWithListener.result    |    2 +
 .../testExecuteQueryType1.result                |    7 +
 .../testExecuteQueryType2.result                |    4 +
 .../testExecuteQueryType3.result                |    4 +
 .../TestTajoDatabaseMetaData/getSchemas1.result |    3 +
 .../TestTajoDatabaseMetaData/getSchemas2.result |    3 +
 .../getTableTypes.result                        |    3 +
 .../TestTajoDatabaseMetaData/getTables1.result  |    4 +
 .../TestTajoDatabaseMetaData/getTables2.result  |    4 +
 .../results/TestTajoDump/testDump1.result       |   16 +
 .../results/TestTajoDump/testDump2.result       |   16 +
 .../results/TestTajoDump/testDump3.result       |   20 +
 .../TestTajoJdbc/testSortWithDateTime.result    |    7 +
 .../TestUnionQuery/testComplexUnion1.plan       |   80 +
 .../TestUnionQuery/testComplexUnion1.result     |    6 +
 .../TestUnionQuery/testComplexUnion2.plan       |  116 ++
 .../TestUnionQuery/testComplexUnion2.result     |    7 +
 .../results/TestUnionQuery/testUnion1.result    |    7 +
 .../results/TestUnionQuery/testUnion10.result   |    7 +
 .../results/TestUnionQuery/testUnion11.result   |    3 +
 .../results/TestUnionQuery/testUnion12.result   |    7 +
 .../results/TestUnionQuery/testUnion13.result   |    7 +
 .../results/TestUnionQuery/testUnion14.result   |    9 +
 .../results/TestUnionQuery/testUnion15.result   |    5 +
 .../results/TestUnionQuery/testUnion16.result   |    5 +
 .../results/TestUnionQuery/testUnion2.result    |    5 +
 .../results/TestUnionQuery/testUnion3.result    |    4 +
 .../results/TestUnionQuery/testUnion4.result    |    3 +
 .../results/TestUnionQuery/testUnion5.result    |    3 +
 .../results/TestUnionQuery/testUnion6.result    |    3 +
 .../results/TestUnionQuery/testUnion7.result    |    5 +
 .../results/TestUnionQuery/testUnion8.result    |    3 +
 .../results/TestUnionQuery/testUnion9.result    |    7 +
 .../results/TestUnionQuery/testUnionAll1.result |   10 +
 .../TestUnionQuery/testUnionAll10.result        |   22 +
 .../TestUnionQuery/testUnionAll11.result        |    3 +
 .../TestUnionQuery/testUnionAll12.result        |    7 +
 .../TestUnionQuery/testUnionAll13.result        |    7 +
 .../TestUnionQuery/testUnionAll14.result        |    9 +
 .../TestUnionQuery/testUnionAll15.result        |    5 +
 .../TestUnionQuery/testUnionAll16.result        |    5 +
 .../results/TestUnionQuery/testUnionAll2.result |   12 +
 .../results/TestUnionQuery/testUnionAll3.result |    4 +
 .../results/TestUnionQuery/testUnionAll4.result |    3 +
 .../results/TestUnionQuery/testUnionAll5.result |    3 +
 .../results/TestUnionQuery/testUnionAll6.result |    3 +
 .../results/TestUnionQuery/testUnionAll7.result |   12 +
 .../results/TestUnionQuery/testUnionAll8.result |    3 +
 .../results/TestUnionQuery/testUnionAll9.result |    7 +
 .../testUnionAllWithDifferentAlias.result       |    4 +
 ...UnionAllWithDifferentAliasAndFunction.result |    7 +
 .../testUnionAllWithSameAliasNames.result       |   12 +
 .../testUnionWithDifferentAlias.result          |    4 +
 ...estUnionWithDifferentAliasAndFunction.result |    7 +
 .../testUnionWithSameAliasNames.result          |    5 +
 .../TestWindowQuery/testComplexOrderBy1.result  |    7 +
 .../TestWindowQuery/testFirstValue1.result      |    7 +
 .../results/TestWindowQuery/testLag1.result     |    7 +
 .../TestWindowQuery/testLagWithDefault.result   |    7 +
 .../TestWindowQuery/testLagWithNoArgs.result    |    7 +
 .../TestWindowQuery/testLastValue1.result       |    7 +
 .../results/TestWindowQuery/testLead1.result    |    7 +
 .../TestWindowQuery/testLeadWithDefault.result  |    7 +
 .../TestWindowQuery/testLeadWithNoArgs.result   |    7 +
 .../TestWindowQuery/testRowNumber1.result       |    7 +
 .../TestWindowQuery/testRowNumber2.result       |    7 +
 .../TestWindowQuery/testRowNumber3.result       |    7 +
 .../TestWindowQuery/testStdDevPop1.result       |    7 +
 .../TestWindowQuery/testStdDevSamp1.result      |    7 +
 .../results/TestWindowQuery/testWindow1.result  |    7 +
 .../results/TestWindowQuery/testWindow2.result  |    7 +
 .../results/TestWindowQuery/testWindow3.result  |    7 +
 .../results/TestWindowQuery/testWindow4.result  |    7 +
 .../results/TestWindowQuery/testWindow5.result  |    7 +
 .../results/TestWindowQuery/testWindow6.result  |    7 +
 .../results/TestWindowQuery/testWindow7.result  |    7 +
 .../results/TestWindowQuery/testWindow8.result  |    7 +
 .../testWindowBeforeLimit.result                |    5 +
 .../testWindowWithAggregation1.result           |    3 +
 .../testWindowWithAggregation2.result           |    5 +
 .../testWindowWithAggregation3.result           |    3 +
 .../testWindowWithAggregation4.result           |    5 +
 .../testWindowWithAggregation5.result           |    5 +
 .../testWindowWithAggregation6.result           |    5 +
 .../testWindowWithOrderBy1.result               |    7 +
 .../testWindowWithOrderBy2.result               |    7 +
 .../testWindowWithOrderBy3.result               |    7 +
 .../testWindowWithOrderBy4.result               |    7 +
 .../testWindowWithOrderBy5.result               |    7 +
 .../testWindowWithSubQuery.result               |    7 +
 .../testWindowWithSubQuery2.result              |    5 +
 .../testWindowWithSubQuery3.result              |    7 +
 .../testWindowWithSubQuery4.result              |    7 +
 .../testWindowWithSubQuery5.result              |    5 +
 .../testWindowWithSubQuery6.result              |    3 +
 .../testBuildDDLForBaseTable.result             |    4 +
 .../testBuildDDLForExternalTable.result         |    5 +
 .../testBuildDDLQuotedTableName1.result         |    5 +
 .../testBuildDDLQuotedTableName2.result         |    4 +
 .../src/test/resources/yarn-site.xml            |   25 +
 tajo-core-tests/src/test/tpch/customer.tbl      |    5 +
 tajo-core-tests/src/test/tpch/empty_orders.tbl  |    0
 tajo-core-tests/src/test/tpch/lineitem.tbl      |    5 +
 tajo-core-tests/src/test/tpch/nation.tbl        |   25 +
 tajo-core-tests/src/test/tpch/orders.tbl        |    3 +
 tajo-core-tests/src/test/tpch/part.tbl          |    4 +
 tajo-core-tests/src/test/tpch/partsupp.tbl      |    3 +
 tajo-core-tests/src/test/tpch/region.tbl        |    5 +
 tajo-core-tests/src/test/tpch/supplier.tbl      |    3 +
 tajo-core/pom.xml                               |  173 ---
 .../apache/tajo/engine/parser/SQLAnalyzer.java  |    7 +-
 .../org/apache/tajo/master/GlobalEngine.java    |    8 +-
 tajo-core/src/test/java/log4j.properties        |   28 -
 .../org/apache/tajo/BackendTestingUtil.java     |   74 -
 .../org/apache/tajo/HBaseTestClusterUtil.java   |  184 ---
 .../java/org/apache/tajo/IntegrationTest.java   |   22 -
 .../apache/tajo/LocalTajoTestingUtility.java    |  169 ---
 .../test/java/org/apache/tajo/NamedTest.java    |   27 -
 .../java/org/apache/tajo/QueryTestCaseBase.java | 1030 -------------
 .../org/apache/tajo/TajoTestingCluster.java     |  778 ----------
 .../org/apache/tajo/TestQueryIdFactory.java     |   58 -
 .../test/java/org/apache/tajo/TestTajoIds.java  |  168 ---
 .../test/java/org/apache/tajo/TpchTestBase.java |  113 --
 .../org/apache/tajo/benchmark/TestTPCH.java     |   70 -
 .../apache/tajo/cli/tools/TestDDLBuilder.java   |  133 --
 .../org/apache/tajo/cli/tools/TestTajoDump.java |  124 --
 .../cli/tsql/TestDefaultCliOutputFormatter.java |  181 ---
 .../apache/tajo/cli/tsql/TestSimpleParser.java  |  286 ----
 .../org/apache/tajo/cli/tsql/TestTajoCli.java   |  472 ------
 .../tajo/cli/tsql/TestTajoCliNegatives.java     |  146 --
 .../commands/TestExecExternalShellCommand.java  |   45 -
 .../tajo/cli/tsql/commands/TestHdfsCommand.java |   47 -
 .../TestCatalogAdminClientExceptions.java       |  103 --
 .../tajo/client/TestQueryClientExceptions.java  |  126 --
 .../org/apache/tajo/client/TestTajoClient.java  |  777 ----------
 .../apache/tajo/client/v2/TestTajoClientV2.java |  274 ----
 .../tajo/cluster/TestWorkerConnectionInfo.java  |   36 -
 .../engine/codegen/TestEvalCodeGenerator.java   |  310 ----
 .../engine/codegen/TestGeneratorAdapter.java    |   41 -
 .../apache/tajo/engine/eval/ExprTestBase.java   |  341 -----
 .../apache/tajo/engine/eval/TestEvalTree.java   |  424 ------
 .../tajo/engine/eval/TestEvalTreeUtil.java      |  374 -----
 .../tajo/engine/eval/TestIntervalType.java      |  124 --
 .../apache/tajo/engine/eval/TestPredicates.java |  407 -----
 .../tajo/engine/eval/TestSQLDateTimeTypes.java  |   50 -
 .../tajo/engine/eval/TestSQLExpression.java     | 1001 -------------
 .../tajo/engine/function/TestAggFunction.java   |   65 -
 .../engine/function/TestBuiltinFunctions.java   |  824 ----------
 .../function/TestConditionalExpressions.java    |  242 ---
 .../engine/function/TestDateTimeFunctions.java  |  483 ------
 .../engine/function/TestFunctionLoader.java     |   45 -
 .../engine/function/TestGeneralFunction.java    |   49 -
 .../tajo/engine/function/TestJsonFunctions.java |   66 -
 .../tajo/engine/function/TestMathFunctions.java |  470 ------
 .../function/TestPatternMatchingPredicates.java |  139 --
 .../engine/function/TestPythonFunctions.java    |   45 -
 .../TestStringOperatorsAndFunctions.java        |  615 --------
 .../tajo/engine/parser/TestSQLAnalyzer.java     |  804 ----------
 .../engine/planner/TestJoinOrderAlgorithm.java  |  185 ---
 .../engine/planner/TestLogicalOptimizer.java    |  272 ----
 .../tajo/engine/planner/TestLogicalPlan.java    |   86 --
 .../tajo/engine/planner/TestLogicalPlanner.java | 1360 -----------------
 .../tajo/engine/planner/TestPlannerUtil.java    |  387 -----
 .../engine/planner/TestQueryValidation.java     |   66 -
 .../planner/TestUniformRangePartition.java      | 1143 --------------
 .../engine/planner/global/TestMasterPlan.java   |   53 -
 .../planner/physical/TestBNLJoinExec.java       |  224 ---
 .../planner/physical/TestExternalSortExec.java  |  187 ---
 .../physical/TestFullOuterHashJoinExec.java     |  414 -----
 .../physical/TestFullOuterMergeJoinExec.java    |  537 -------
 .../planner/physical/TestHashAntiJoinExec.java  |  215 ---
 .../planner/physical/TestHashJoinExec.java      |  281 ----
 .../planner/physical/TestHashPartitioner.java   |  117 --
 .../planner/physical/TestHashSemiJoinExec.java  |  220 ---
 .../physical/TestLeftOuterHashJoinExec.java     |  440 ------
 .../planner/physical/TestMergeJoinExec.java     |  197 ---
 .../engine/planner/physical/TestNLJoinExec.java |  208 ---
 .../planner/physical/TestPhysicalPlanner.java   | 1144 --------------
 .../physical/TestProgressExternalSortExec.java  |  229 ---
 .../physical/TestRightOuterHashJoinExec.java    |  351 -----
 .../physical/TestRightOuterMergeJoinExec.java   |  531 -------
 .../engine/planner/physical/TestSortExec.java   |  179 ---
 .../planner/physical/TestSortIntersectExec.java |  293 ----
 .../planner/physical/TestTupleSorter.java       |  127 --
 .../tajo/engine/query/TestAlterTable.java       |  114 --
 .../tajo/engine/query/TestAlterTablespace.java  |   59 -
 .../apache/tajo/engine/query/TestCTASQuery.java |  281 ----
 .../tajo/engine/query/TestCaseByCases.java      |  183 ---
 .../tajo/engine/query/TestCreateDatabase.java   |   75 -
 .../tajo/engine/query/TestCreateIndex.java      |  113 --
 .../tajo/engine/query/TestCreateTable.java      |  643 --------
 .../apache/tajo/engine/query/TestDropTable.java |   38 -
 .../tajo/engine/query/TestGroupByQuery.java     |  870 -----------
 .../tajo/engine/query/TestHBaseTable.java       | 1409 ------------------
 .../apache/tajo/engine/query/TestIndexScan.java |  145 --
 .../tajo/engine/query/TestInnerJoinQuery.java   |  335 -----
 .../engine/query/TestInnerJoinWithSubQuery.java |  132 --
 .../tajo/engine/query/TestInsertQuery.java      |  882 -----------
 .../query/TestJoinOnPartitionedTables.java      |  340 -----
 .../apache/tajo/engine/query/TestJoinQuery.java |  315 ----
 .../engine/query/TestMultipleJoinTypes.java     |  106 --
 .../apache/tajo/engine/query/TestNetTypes.java  |  102 --
 .../tajo/engine/query/TestNullValues.java       |  322 ----
 .../tajo/engine/query/TestOuterJoinQuery.java   |  457 ------
 .../engine/query/TestOuterJoinWithSubQuery.java |  144 --
 .../engine/query/TestSelectNestedRecord.java    |  119 --
 .../tajo/engine/query/TestSelectQuery.java      |  778 ----------
 .../tajo/engine/query/TestSetSessionQuery.java  |   81 -
 .../apache/tajo/engine/query/TestSortQuery.java |  378 -----
 .../tajo/engine/query/TestTablePartitions.java  | 1301 ----------------
 .../tajo/engine/query/TestTableSubQuery.java    |   81 -
 .../tajo/engine/query/TestTruncateTable.java    |   96 --
 .../tajo/engine/query/TestUnionQuery.java       |  693 ---------
 .../tajo/engine/query/TestWindowQuery.java      |  465 ------
 .../apache/tajo/engine/util/TestTableCache.java |  109 --
 .../apache/tajo/engine/util/TestTupleUtil.java  |  188 ---
 .../apache/tajo/ha/TestHAServiceHDFSImpl.java   |  160 --
 .../org/apache/tajo/jdbc/TestResultSet.java     |  224 ---
 .../java/org/apache/tajo/jdbc/TestSQLState.java |   91 --
 .../tajo/jdbc/TestTajoDatabaseMetaData.java     |  504 -------
 .../java/org/apache/tajo/jdbc/TestTajoJdbc.java |  608 --------
 .../tajo/master/TestExecutionBlockCursor.java   |  135 --
 .../TestNonForwardQueryResultSystemScanner.java |   41 -
 .../apache/tajo/master/TestRepartitioner.java   |  511 -------
 .../tajo/master/rule/TestMasterRules.java       |  156 --
 .../master/scheduler/TestSimpleScheduler.java   |  301 ----
 .../tajo/querymaster/TestIntermediateEntry.java |   53 -
 .../apache/tajo/querymaster/TestKillQuery.java  |  312 ----
 .../tajo/querymaster/TestQueryProgress.java     |   77 -
 .../apache/tajo/querymaster/TestQueryState.java |   99 --
 .../tajo/querymaster/TestTaskStatusUpdate.java  |  191 ---
 .../org/apache/tajo/resource/TestResources.java |   48 -
 .../apache/tajo/storage/TestFileFragment.java   |   93 --
 .../org/apache/tajo/storage/TestRowFile.java    |  146 --
 .../java/org/apache/tajo/util/TestJSPUtil.java  |  113 --
 .../util/history/TestHistoryWriterReader.java   |  313 ----
 .../tajo/util/metrics/TestMetricsFilter.java    |   52 -
 .../tajo/util/metrics/TestSystemMetrics.java    |  143 --
 .../apache/tajo/worker/MockExecutionBlock.java  |   42 -
 .../tajo/worker/MockNodeResourceManager.java    |   88 --
 .../tajo/worker/MockNodeStatusUpdater.java      |   97 --
 .../apache/tajo/worker/MockTaskExecutor.java    |  153 --
 .../org/apache/tajo/worker/MockTaskManager.java |   69 -
 .../apache/tajo/worker/MockWorkerContext.java   |  109 --
 .../apache/tajo/worker/TestDeletionService.java |   61 -
 .../org/apache/tajo/worker/TestFetcher.java     |  236 ---
 .../tajo/worker/TestNodeResourceManager.java    |  281 ----
 .../tajo/worker/TestNodeStatusUpdater.java      |  192 ---
 .../apache/tajo/worker/TestTaskExecutor.java    |  315 ----
 .../org/apache/tajo/worker/TestTaskManager.java |  184 ---
 .../tajo/ws/rs/resources/RestTestUtils.java     |   64 -
 .../ws/rs/resources/TestClusterResource.java    |   84 --
 .../ws/rs/resources/TestDatabasesResource.java  |  189 ---
 .../ws/rs/resources/TestFunctionsResource.java  |   78 -
 .../tajo/ws/rs/resources/TestQueryResource.java |  199 ---
 .../rs/resources/TestQueryResultResource.java   |  297 ----
 .../ws/rs/resources/TestSessionsResource.java   |  263 ----
 .../ws/rs/resources/TestTablesResource.java     |  204 ---
 .../resources/dataset/TestAlterTable/table1.tbl |    3 -
 .../resources/dataset/TestAlterTable/table2.tbl |    1 -
 .../dataset/TestCreateTable/table1/table1.tbl   |    3 -
 .../dataset/TestCreateTable/table2/table2.tbl   |    3 -
 .../resources/dataset/TestDropTable/table1.tbl  |    3 -
 .../dataset/TestHBaseTable/splits.data          |    4 -
 .../dataset/TestJoinQuery/table1/table1.tbl     |    5 -
 .../dataset/TestJoinQuery/table2/table2.tbl     |    4 -
 .../dataset/TestNetTypes/table1/table1.tbl      |    5 -
 .../dataset/TestNetTypes/table2/table2.tbl      |    5 -
 .../TestSelectNestedRecord/sample1/table.json   |    3 -
 .../TestSelectNestedRecord/sample2/sample2.json |    1 -
 .../TestSelectNestedRecord/tweets/sample1.json  |    4 -
 .../multibytes_delimiter1/table1.tbl            |    5 -
 .../multibytes_delimiter2/table2.tbl            |    5 -
 .../TestSelectQuery/timezoned/table1.tbl        |    3 -
 .../dataset/TestSortQuery/table1/table1.tbl     |    5 -
 .../dataset/TestSortQuery/table2/table2.tbl     |   24 -
 .../TestTablePartitions/lineitemspecial.tbl     |    5 -
 .../dataset/TestTajoJdbc/table1/table1.tbl      |    5 -
 .../truncate_table2/table2.tbl                  |    4 -
 tajo-core/src/test/resources/log4j.properties   |   28 -
 tajo-core/src/test/resources/python/__init__.py |   17 -
 .../src/test/resources/python/test_funcs.py     |   33 -
 .../src/test/resources/python/test_funcs2.py    |   32 -
 .../src/test/resources/python/test_udaf.py      |   76 -
 .../alter_table_add_new_column_ddl.sql          |    1 -
 .../alter_table_add_partition1.sql              |    1 -
 .../alter_table_add_partition2.sql              |    1 -
 .../alter_table_drop_partition1.sql             |    1 -
 .../alter_table_drop_partition2.sql             |    1 -
 .../alter_table_rename_column_ddl.sql           |    1 -
 .../alter_table_rename_table_ddl.sql            |    1 -
 .../alter_table_set_property_delimiter.sql      |    1 -
 .../alter_table_set_property_timezone.sql       |    1 -
 .../TestAlterTable/create_partitioned_table.sql |    1 -
 .../queries/TestAlterTable/table1_ddl.sql       |    1 -
 .../queries/TestAlterTable/table2_ddl.sql       |    1 -
 .../testAlterTableSetProperty.sql               |    1 -
 .../testAlterTableSetProperty2.sql              |    1 -
 .../TestBuiltinFunctions/testAvgDouble.sql      |    1 -
 .../queries/TestBuiltinFunctions/testAvgInt.sql |    1 -
 .../TestBuiltinFunctions/testAvgLong.sql        |    1 -
 .../testAvgLongOverflow.sql                     |    1 -
 .../queries/TestBuiltinFunctions/testCount.sql  |    1 -
 .../TestBuiltinFunctions/testMaxLong.sql        |    1 -
 .../TestBuiltinFunctions/testMaxString.sql      |    1 -
 .../TestBuiltinFunctions/testMinLong.sql        |    1 -
 .../TestBuiltinFunctions/testMinString.sql      |    1 -
 .../queries/TestBuiltinFunctions/testRandom.sql |    1 -
 .../TestBuiltinFunctions/testSplitPart.sql      |    1 -
 .../testSplitPartByString.sql                   |    1 -
 .../testSplitPartNested.sql                     |    1 -
 .../queries/TestCTASQuery/CtasWithGroupby.sql   |    2 -
 .../queries/TestCTASQuery/CtasWithLimit.sql     |   13 -
 .../TestCTASQuery/CtasWithManagedTable.sql      |   12 -
 .../TestCTASQuery/CtasWithMultipleUnions.sql    |   12 -
 .../queries/TestCTASQuery/CtasWithOptions.sql   |   13 -
 .../queries/TestCTASQuery/CtasWithOrderby.sql   |   11 -
 .../queries/TestCTASQuery/CtasWithStoreType.sql |   12 -
 .../queries/TestCTASQuery/CtasWithTextFile.sql  |   12 -
 .../queries/TestCTASQuery/CtasWithUnion.sql     |   35 -
 .../resources/queries/TestCTASQuery/check1.sql  |    1 -
 .../resources/queries/TestCTASQuery/check2.sql  |    1 -
 .../testCtasWithColumnedPartition.sql           |    2 -
 .../TestCTASQuery/testCtasWithGroupby.sql       |    1 -
 .../queries/TestCTASQuery/testCtasWithLimit.sql |    1 -
 .../testCtasWithMultipleUnions.sql              |    1 -
 .../TestCTASQuery/testCtasWithOptions.sql       |    1 -
 .../TestCTASQuery/testCtasWithOrderby.sql       |    1 -
 .../TestCTASQuery/testCtasWithStoreType.sql     |    1 -
 .../TestCTASQuery/testCtasWithTextFile.sql      |    1 -
 .../queries/TestCTASQuery/testCtasWithUnion.sql |    1 -
 .../testCtasWithoutTableDefinition.sql          |    2 -
 .../TestCaseByCases/testTAJO1224Case1.sql       |    1 -
 .../queries/TestCaseByCases/testTAJO415Case.sql |   36 -
 .../queries/TestCaseByCases/testTAJO418Case.sql |   29 -
 .../queries/TestCaseByCases/testTAJO619Case.sql |    4 -
 .../queries/TestCaseByCases/testTAJO718Case.sql |   10 -
 .../queries/TestCaseByCases/testTAJO739Case.sql |    5 -
 .../TestCaseByCases/testTAJO914Case1.sql        |   10 -
 .../TestCaseByCases/testTAJO914Case2.sql        |    9 -
 .../TestCaseByCases/testTAJO914Case3.sql        |   10 -
 .../TestCaseByCases/testTAJO914Case4.sql        |   10 -
 .../TestCaseByCases/testTAJO917Case1.sql        |   13 -
 .../queries/TestCreateIndex/testCreateIndex.sql |    1 -
 .../testCreateIndexOnExpression.sql             |    1 -
 .../testCreateIndexOnLocation.sql               |    1 -
 .../testCreateIndexOnMultiAttrs.sql             |    1 -
 .../testCreateIndexOnMultiExprs.sql             |    1 -
 .../testCreateIndexWithCondition.sql            |    1 -
 .../create_table_various_types.sql              |   50 -
 ...ate_table_various_types_for_hive_catalog.sql |   50 -
 .../quoted_identifier_mixed_chars_1.sql         |    1 -
 .../quoted_identifier_mixed_chars_2.sql         |    1 -
 .../quoted_identifier_mixed_chars_3.sql         |   22 -
 .../quoted_identifier_mixed_chars_ddl_1.sql     |    1 -
 .../quoted_identifier_mixed_chars_ddl_2.sql     |    1 -
 .../quoted_identifier_non_ascii_1.sql           |    1 -
 .../quoted_identifier_non_ascii_2.sql           |    1 -
 .../quoted_identifier_non_ascii_3.sql           |    1 -
 .../quoted_identifier_non_ascii_ddl.sql         |    1 -
 .../queries/TestCreateTable/table1_ddl.sql      |    1 -
 .../TestCreateTable/testNestedRecord1.sql       |    1 -
 .../TestCreateTable/testNestedRecord2.sql       |    1 -
 .../queries/TestDropTable/drop_table_ddl.sql    |    1 -
 .../queries/TestDropTable/table1_ddl.sql        |    1 -
 .../TestGroupByQuery/testComplexParameter.sql   |    1 -
 .../TestGroupByQuery/testComplexParameter2.sql  |    1 -
 .../testComplexParameterWithSubQuery.sql        |    6 -
 .../testComplexTargetWithPythonUdaf.sql         |    1 -
 .../testDistinctAggregation1.sql                |    1 -
 .../testDistinctAggregation2.sql                |    1 -
 .../testDistinctAggregation3.sql                |    1 -
 .../testDistinctAggregation4.sql                |    1 -
 .../testDistinctAggregation5.sql                |    1 -
 .../testDistinctAggregation6.sql                |    9 -
 .../testDistinctAggregation7.sql                |    6 -
 .../testDistinctAggregation8.sql                |    9 -
 .../testDistinctAggregationCaseByCase3.sql      |    8 -
 .../testDistinctAggregationCaseByCase4.sql      |    7 -
 .../testDistinctAggregationWithHaving1.sql      |    1 -
 .../testDistinctAggregationWithUnion1.sql       |   21 -
 .../testDistinctAggregation_case1.sql           |    7 -
 .../testDistinctAggregation_case10.sql          |    5 -
 .../testDistinctAggregation_case2.sql           |    8 -
 .../testDistinctAggregation_case3.sql           |    9 -
 .../testDistinctAggregation_case4.sql           |   10 -
 .../testDistinctAggregation_case5.sql           |   10 -
 .../testDistinctAggregation_case6.sql           |   12 -
 .../testDistinctAggregation_case7.sql           |    9 -
 .../testDistinctAggregation_case8.sql           |   10 -
 .../testDistinctAggregation_case9.sql           |   11 -
 .../testDistinctPythonUdafWithUnion1.sql        |   21 -
 .../queries/TestGroupByQuery/testGroupBy.sql    |    1 -
 .../queries/TestGroupByQuery/testGroupBy2.sql   |    1 -
 .../queries/TestGroupByQuery/testGroupBy3.sql   |    1 -
 .../queries/TestGroupByQuery/testGroupBy4.sql   |    9 -
 .../queries/TestGroupByQuery/testGroupBy5.sql   |    1 -
 .../TestGroupByQuery/testGroupByNested1.sql     |    8 -
 .../TestGroupByQuery/testGroupByNested2.sql     |   10 -
 .../testGroupByWithConstantKeys1.sql            |    1 -
 .../testGroupByWithConstantKeys2.sql            |    1 -
 .../testGroupByWithConstantKeys3.sql            |    8 -
 .../testGroupByWithConstantKeys4.sql            |   12 -
 .../testGroupByWithConstantKeys5.sql            |   13 -
 .../testGroupByWithExpressionKeys1.sql          |    1 -
 .../testGroupByWithExpressionKeys2.sql          |    1 -
 .../testGroupByWithNullData1.sql                |    1 -
 .../testGroupByWithNullData10.sql               |    3 -
 .../testGroupByWithNullData11.sql               |    5 -
 .../testGroupByWithNullData12.sql               |   29 -
 .../testGroupByWithNullData2.sql                |    1 -
 .../testGroupByWithNullData3.sql                |    3 -
 .../testGroupByWithNullData4.sql                |    3 -
 .../testGroupByWithNullData5.sql                |    1 -
 .../testGroupByWithNullData6.sql                |    1 -
 .../testGroupByWithNullData7.sql                |    1 -
 .../testGroupByWithNullData8.sql                |    1 -
 .../testGroupByWithNullData9.sql                |    4 -
 .../testGroupByWithSameConstantKeys1.sql        |    1 -
 .../testGroupByWithSameExprs1.sql               |    8 -
 .../testGroupByWithSameExprs2.sql               |    8 -
 .../TestGroupByQuery/testGroupbyWithJson.json   |  127 --
 .../TestGroupByQuery/testGroupbyWithLimit1.sql  |    1 -
 .../TestGroupByQuery/testGroupbyWithLimit2.sql  |    1 -
 .../TestGroupByQuery/testGroupbyWithLimit3.sql  |    1 -
 .../testGroupbyWithPythonFunc.sql               |    1 -
 .../testGroupbyWithPythonFunc2.sql              |    1 -
 .../testHavingWithAggFunction.sql               |    1 -
 .../testHavingWithNamedTarget.sql               |   13 -
 .../queries/TestGroupByQuery/testPythonUdaf.sql |    1 -
 .../TestGroupByQuery/testPythonUdaf2.sql        |    1 -
 .../TestGroupByQuery/testPythonUdaf3.sql        |    1 -
 .../testPythonUdafWithHaving.sql                |    3 -
 .../testPythonUdafWithNullData.sql              |    4 -
 .../testBroadcastTwoPartJoin.sql                |   19 -
 .../testCrossJoinAndCaseWhen.sql                |   18 -
 .../testCrossJoinWithAsterisk1.sql              |    1 -
 .../testCrossJoinWithAsterisk2.sql              |    1 -
 .../testCrossJoinWithAsterisk3.sql              |    1 -
 .../testCrossJoinWithAsterisk4.sql              |    1 -
 .../testBroadcastSubquery.sql                   |   12 -
 .../testBroadcastSubquery2.sql                  |   19 -
 .../testThetaJoinKeyPairs.sql                   |   20 -
 .../TestInsertQuery/full_table_csv_ddl.sql      |    1 -
 .../TestInsertQuery/full_table_parquet_ddl.sql  |    1 -
 .../TestInsertQuery/lineitem_year_month_ddl.sql |   18 -
 .../load_to_lineitem_year_month.sql             |    1 -
 .../TestInsertQuery/nation_diff_col_order.ddl   |    1 -
 .../queries/TestInsertQuery/table1_ddl.sql      |    1 -
 .../queries/TestInsertQuery/test1_ddl.sql       |    1 -
 .../TestInsertQuery/test1_nolength_ddl.sql      |    1 -
 .../queries/TestInsertQuery/testInsertInto.sql  |    1 -
 .../testInsertIntoSelectWithFixedSizeChar.sql   |    4 -
 ...tIntoSelectWithFixedSizeCharWithNoLength.sql |    2 -
 .../TestInsertQuery/testInsertOverwrite.sql     |    1 -
 .../testInsertOverwriteLocation.sql             |    1 -
 ...stInsertOverwriteLocationWithCompression.sql |    1 -
 .../testInsertOverwriteLocationWithUnion.sql    |    4 -
 ...verwriteLocationWithUnionDifferenceAlias.sql |    4 -
 .../testInsertOverwriteSmallerColumns.sql       |    1 -
 .../testInsertOverwriteWithAsterisk.sql         |    1 -
 .../testInsertOverwriteWithAsteriskAndMore.sql  |    1 -
 .../testInsertOverwriteWithCompression.sql      |    1 -
 .../testInsertOverwriteWithCompression_ddl.sql  |    4 -
 .../testInsertOverwriteWithDatabase.sql         |    1 -
 .../testInsertOverwriteWithTargetColumns.sql    |    1 -
 .../testInsertOverwriteWithUnion.sql            |    4 -
 ...stInsertOverwriteWithUnionDifferentAlias.sql |    4 -
 .../testInsertWithDifferentColumnOrder.sql      |    1 -
 .../selfJoinOfPartitionedTable.sql              |    9 -
 .../testBroadcastPartitionTable.sql             |   16 -
 ...estFilterPushDownPartitionColumnCaseWhen.sql |    6 -
 ...rtitionedBroadcastDataFileWithZeroLength.sql |    3 -
 ...titionedBroadcastDataFileWithZeroLength2.sql |    5 -
 .../testNoProjectionJoinQual.sql                |    1 -
 .../testPartialFilterPushDown.sql               |    9 -
 .../testPartialFilterPushDownOuterJoin.sql      |    4 -
 .../testPartialFilterPushDownOuterJoin2.sql     |    5 -
 .../testPartitionTableJoinSmallTable.sql        |   11 -
 .../TestJoinQuery/create_customer_large_ddl.sql |    7 -
 .../TestJoinQuery/create_lineitem_large_ddl.sql |    7 -
 .../TestJoinQuery/create_orders_large_ddl.sql   |    7 -
 .../TestJoinQuery/customer_partition_ddl.sql    |    9 -
 .../TestJoinQuery/insert_into_customer.sql      |   11 -
 .../insert_into_customer_partition.sql          |   11 -
 .../TestJoinQuery/nation_multifile_ddl.sql      |    5 -
 .../queries/TestJoinQuery/oj_table1_ddl.sql     |    3 -
 .../queries/TestJoinQuery/oj_table2_ddl.sql     |    3 -
 .../TestJoinQuery/orders_multifile_ddl.sql      |    5 -
 .../TestJoinQuery/partitioned_customer_ddl.sql  |   19 -
 .../queries/TestJoinQuery/table1_int4_ddl.sql   |    3 -
 .../queries/TestJoinQuery/table1_int8_ddl.sql   |    3 -
 .../TestJoinQuery/testComplexJoinCondition1.sql |    6 -
 .../TestJoinQuery/testComplexJoinCondition2.sql |    6 -
 .../TestJoinQuery/testComplexJoinCondition3.sql |    6 -
 .../TestJoinQuery/testComplexJoinCondition4.sql |    6 -
 .../TestJoinQuery/testComplexJoinCondition5.sql |    6 -
 .../TestJoinQuery/testComplexJoinCondition6.sql |    6 -
 .../TestJoinQuery/testComplexJoinCondition7.sql |    6 -
 .../testComplexJoinsWithCaseWhen.sql            |   11 -
 .../testComplexJoinsWithCaseWhen2.sql           |    9 -
 .../testCrossJoinWithEmptyTable1.sql            |    8 -
 ...stCrossJoinWithThetaJoinConditionInWhere.sql |    2 -
 .../testDifferentTypesJoinCondition.sql         |    1 -
 .../TestJoinQuery/testFullOuterJoin1.sql        |    8 -
 .../testFullOuterJoinWithEmptyTable1.sql        |    8 -
 .../TestJoinQuery/testInnerJoinAndCaseWhen.sql  |   18 -
 .../testInnerJoinWithEmptyTable.sql             |    8 -
 ...stInnerJoinWithThetaJoinConditionInWhere.sql |    3 -
 .../queries/TestJoinQuery/testJoinAsterisk.sql  |    3 -
 .../TestJoinQuery/testJoinCoReferredEvals1.sql  |   11 -
 .../testJoinCoReferredEvalsFilterPushdown.sql   |   13 -
 .../testJoinCoReferredEvalsWithSameExprs1.sql   |   14 -
 .../testJoinCoReferredEvalsWithSameExprs2.sql   |   22 -
 .../testJoinFilterOfRowPreservedTable1.sql      |    8 -
 .../testJoinOnMultipleDatabases.sql             |   25 -
 .../testJoinOnMultipleDatabasesWithJson.json    |  210 ---
 .../queries/TestJoinQuery/testJoinWithJson.json |   92 --
 .../TestJoinQuery/testJoinWithJson2.json        |  219 ---
 .../testJoinWithMultipleJoinQual1.sql           |   20 -
 .../testJoinWithMultipleJoinQual2.sql           |    8 -
 .../testJoinWithMultipleJoinQual3.sql           |    9 -
 .../testJoinWithMultipleJoinQual4.sql           |   10 -
 .../testJoinWithMultipleJoinTypes.sql           |    4 -
 .../TestJoinQuery/testJoinWithOrPredicates.sql  |    6 -
 .../TestJoinQuery/testLeftOuterJoin1.sql        |    9 -
 .../testLeftOuterJoinWithConstantExpr1.sql      |    9 -
 .../testLeftOuterJoinWithConstantExpr2.sql      |    9 -
 .../testLeftOuterJoinWithConstantExpr3.sql      |   17 -
 .../testLeftOuterJoinWithConstantExpr4.sql      |    6 -
 .../testLeftOuterJoinWithConstantExpr5.sql      |    9 -
 .../testLeftOuterJoinWithEmptyTable1.sql        |    9 -
 .../testLeftOuterJoinWithEmptyTable2.sql        |    9 -
 .../testLeftOuterJoinWithEmptyTable3.sql        |   14 -
 .../testLeftOuterJoinWithEmptyTable4.sql        |   17 -
 .../testLeftOuterJoinWithEmptyTable5.sql        |   11 -
 .../testLeftOuterJoinWithNull1.sql              |   10 -
 .../testLeftOuterJoinWithNull2.sql              |   11 -
 .../testLeftOuterJoinWithNull3.sql              |   10 -
 ...ftOuterJoinWithThetaJoinConditionInWhere.sql |    3 -
 .../queries/TestJoinQuery/testNaturalJoin.sql   |    3 -
 .../TestJoinQuery/testOuterJoinAndCaseWhen1.sql |   12 -
 .../TestJoinQuery/testRightOuterJoin1.sql       |    8 -
 .../testRightOuterJoinWithEmptyTable1.sql       |    8 -
 ...htOuterJoinWithThetaJoinConditionInWhere.sql |    3 -
 .../queries/TestJoinQuery/testTPCHQ2Join.sql    |   25 -
 .../TestJoinQuery/testWhereClauseJoin1.sql      |   11 -
 .../TestJoinQuery/testWhereClauseJoin2.sql      |    9 -
 .../TestJoinQuery/testWhereClauseJoin3.sql      |   10 -
 .../TestJoinQuery/testWhereClauseJoin4.sql      |    9 -
 .../TestJoinQuery/testWhereClauseJoin5.sql      |   15 -
 .../TestJoinQuery/testWhereClauseJoin6.sql      |   19 -
 .../queries/TestLogicalPlanner/window1.sql      |    5 -
 .../queries/TestNetTypes/table1_ddl.sql         |    4 -
 .../queries/TestNetTypes/table2_ddl.sql         |    4 -
 .../queries/TestNetTypes/testGroupby.sql        |    8 -
 .../queries/TestNetTypes/testGroupby2.sql       |    9 -
 .../resources/queries/TestNetTypes/testJoin.sql |    1 -
 .../queries/TestNetTypes/testSelect.sql         |    1 -
 .../resources/queries/TestNetTypes/testSort.sql |    1 -
 .../queries/TestNetTypes/testSort2.sql          |    1 -
 .../TestOuterJoinQuery/testLeftOuterJoin2.sql   |    5 -
 .../TestOuterJoinQuery/testLeftOuterJoin3.sql   |    7 -
 ...tMultipleBroadcastDataFileWithZeroLength.sql |    3 -
 ...MultipleBroadcastDataFileWithZeroLength2.sql |    5 -
 .../TestQueryValidation/error_groupby_1.sql     |    1 -
 .../TestQueryValidation/error_groupby_2.sql     |    1 -
 .../TestQueryValidation/invalid_casewhen_1.sql  |   15 -
 .../TestQueryValidation/invalid_limit_1.sql     |    1 -
 .../invalid_store_format.sql                    |    1 -
 .../TestQueryValidation/valid_groupby_1.sql     |    1 -
 .../TestQueryValidation/valid_limit_1.sql       |    1 -
 .../TestSQLAnalyzer/create_table_nested_1.sql   |    1 -
 .../TestSQLAnalyzer/create_table_nested_2.sql   |    1 -
 .../queries/TestSQLAnalyzer/setcatalog1.sql     |    1 -
 .../queries/TestSQLAnalyzer/setcatalog2.sql     |    1 -
 .../queries/TestSQLAnalyzer/setsession1.sql     |    1 -
 .../queries/TestSQLAnalyzer/setsession2.sql     |    1 -
 .../queries/TestSQLAnalyzer/setsession3.sql     |    1 -
 .../queries/TestSQLAnalyzer/setsession4.sql     |    1 -
 .../queries/TestSQLAnalyzer/setsession5.sql     |    1 -
 .../queries/TestSQLAnalyzer/setsession6.sql     |    1 -
 .../queries/TestSQLAnalyzer/setsession7.sql     |    1 -
 .../queries/TestSQLAnalyzer/settimezone1.sql    |    1 -
 .../queries/TestSQLAnalyzer/settimezone2.sql    |    1 -
 .../queries/TestSQLAnalyzer/settimezone3.sql    |    1 -
 .../queries/TestSQLAnalyzer/window1.sql         |    5 -
 .../queries/TestSQLAnalyzer/window2.sql         |    5 -
 .../queries/TestSQLAnalyzer/window3.sql         |    5 -
 .../queries/TestSQLAnalyzer/window4.sql         |    5 -
 .../queries/TestSQLAnalyzer/window5.sql         |    6 -
 .../queries/TestSQLAnalyzer/window6.sql         |    6 -
 .../queries/TestSQLAnalyzer/window7.sql         |    6 -
 .../queries/TestSQLAnalyzer/window8.sql         |    6 -
 .../queries/TestSQLAnalyzer/window9.sql         |    9 -
 .../TestSelectNestedRecord/sample0_ddl.sql      |    1 -
 .../TestSelectNestedRecord/sample1_ddl.sql      |    7 -
 .../TestSelectNestedRecord/sample2_ddl.sql      |   23 -
 .../testNestedFieldAsGroupbyKey1.sql            |    9 -
 .../testNestedFieldAsJoinKey1.sql               |    7 -
 .../TestSelectNestedRecord/testSelect0.sql      |    1 -
 .../TestSelectNestedRecord/testSelect1.sql      |    1 -
 .../TestSelectNestedRecord/testSelect2.sql      |   61 -
 .../TestSelectNestedRecord/testSelect3.sql      |    1 -
 .../TestSelectNestedRecord/tweets_ddl.sql       |   74 -
 .../queries/TestSelectQuery/customer_ddl.sql    |    9 -
 .../TestSelectQuery/datetime_table_ddl.sql      |    4 -
 .../datetime_table_timezoned_ddl.sql            |    4 -
 .../TestSelectQuery/insert_into_customer.sql    |   11 -
 .../multibytes_delimiter_table1_ddl.sql         |    3 -
 .../multibytes_delimiter_table2_ddl.sql         |    3 -
 .../multibytes_delimiter_table3_ddl.sql         |    3 -
 .../multibytes_delimiter_table4_ddl.sql         |    3 -
 .../queries/TestSelectQuery/testCaseWhen.sql    |   11 -
 .../TestSelectQuery/testCaseWhenRound.sql       |    8 -
 .../TestSelectQuery/testCaseWhenWithoutElse.sql |   10 -
 .../testColumnEqualityButNotJoinCondition1.sql  |    7 -
 .../testColumnEqualityButNotJoinCondition2.sql  |    7 -
 .../TestSelectQuery/testCreateAfterSelect.sql   |    1 -
 .../TestSelectQuery/testDatabaseRef1.sql        |    1 -
 .../TestSelectQuery/testDatabaseRef2.sql        |    1 -
 .../TestSelectQuery/testDatabaseRef3.sql        |    1 -
 .../TestSelectQuery/testExplainSelect.sql       |    1 -
 .../queries/TestSelectQuery/testInClause.sql    |    1 -
 .../queries/TestSelectQuery/testInStrClause.sql |    1 -
 .../queries/TestSelectQuery/testLikeClause.sql  |    1 -
 .../queries/TestSelectQuery/testLimit.sql       |    1 -
 .../testMultiBytesDelimiter1.sql                |    1 -
 .../testMultiBytesDelimiter2.sql                |    1 -
 .../testMultiBytesDelimiter3.sql                |    1 -
 .../testMultiBytesDelimiter4.sql                |    1 -
 .../testNestedPythonFunction.sql                |    1 -
 .../TestSelectQuery/testNonFromSelect1.sql      |    1 -
 .../TestSelectQuery/testNonQualifiedNames.sql   |    1 -
 .../queries/TestSelectQuery/testNotEqual.sql    |    1 -
 .../queries/TestSelectQuery/testNotInClause.sql |    1 -
 .../TestSelectQuery/testNotInStrClause.sql      |    1 -
 .../TestSelectQuery/testRealValueCompare.sql    |    1 -
 .../queries/TestSelectQuery/testSelect.sql      |    1 -
 .../queries/TestSelectQuery/testSelect2.sql     |    1 -
 .../queries/TestSelectQuery/testSelect3.sql     |    1 -
 .../TestSelectQuery/testSelectAsterik.sql       |    1 -
 .../TestSelectQuery/testSelectAsterisk1.sql     |    1 -
 .../TestSelectQuery/testSelectAsterisk2.sql     |    1 -
 .../TestSelectQuery/testSelectAsterisk3.sql     |    1 -
 .../TestSelectQuery/testSelectAsterisk4.sql     |    1 -
 .../TestSelectQuery/testSelectAsterisk5.sql     |    1 -
 .../TestSelectQuery/testSelectColumnAlias1.sql  |    1 -
 ...testSelectColumnAliasExistingInRelation1.sql |    1 -
 ...testSelectColumnAliasExistingInRelation2.sql |    1 -
 ...testSelectColumnAliasExistingInRelation3.sql |   19 -
 .../TestSelectQuery/testSelectDistinct.sql      |    7 -
 .../testSelectOnSessionTable.sql                |    1 -
 .../TestSelectQuery/testSelectPythonFuncs.sql   |    2 -
 ...tSelectSameConstantsWithDifferentAliases.sql |    1 -
 ...SelectSameConstantsWithDifferentAliases2.sql |    1 -
 ...SelectSameConstantsWithDifferentAliases3.sql |   10 -
 .../testSelectSameExprsWithDifferentAliases.sql |    1 -
 .../TestSelectQuery/testSelectWithJson.json     |   74 -
 .../testSelectWithParentheses1.sql              |    1 -
 .../testSelectWithParentheses2.sql              |    1 -
 .../testSelectWithPredicateOnPythonFunc.sql     |    1 -
 .../queries/TestSelectQuery/testSimpleQuery.sql |    1 -
 .../testSimpleQueryWithLimit.sql                |    1 -
 ...testSimpleQueryWithLimitPartitionedTable.sql |    1 -
 .../TestSelectQuery/testStringCompare.sql       |    1 -
 .../TestSelectQuery/testSumFloatOverflow.sql    |    1 -
 .../TestSelectQuery/testSumIntOverflow.sql      |    1 -
 .../TestSelectQuery/testTimezonedTable1.sql     |    1 -
 .../TestSelectQuery/testTimezonedTable2.sql     |    2 -
 .../TestSelectQuery/testTimezonedTable3.sql     |    1 -
 .../TestSelectQuery/testTimezonedTable4.sql     |    2 -
 .../TestSelectQuery/testTimezonedTable5.sql     |    2 -
 .../queries/TestSelectQuery/testWhereCond1.sql  |    1 -
 .../queries/TestSelectQuery/testWhereCond2.sql  |    9 -
 .../TestSelectQuery/testWhereCondWithAlias1.sql |    1 -
 .../TestSelectQuery/testWhereCondWithAlias2.sql |    1 -
 .../create_table_with_asc_desc_keys.sql         |    1 -
 .../create_table_with_date_ddl.sql              |   10 -
 .../queries/TestSortQuery/testAsterisk.sql      |    1 -
 .../queries/TestSortQuery/testSort.sql          |    1 -
 .../TestSortQuery/testSortAfterGroupby.sql      |    1 -
 .../testSortAfterGroupbyWithAlias.sql           |    1 -
 .../queries/TestSortQuery/testSortDesc.sql      |    1 -
 .../queries/TestSortQuery/testSortFirstDesc.sql |    1 -
 .../TestSortQuery/testSortOnNullColumn.sql      |   13 -
 .../TestSortQuery/testSortOnUnicodeTextAsc.sql  |    6 -
 .../TestSortQuery/testSortOnUnicodeTextDesc.sql |    6 -
 .../TestSortQuery/testSortWithAlias1.sql        |    1 -
 .../TestSortQuery/testSortWithAlias2.sql        |    9 -
 .../TestSortQuery/testSortWithAlias3.sql        |   11 -
 .../testSortWithAliasButOriginalName.sql        |    1 -
 .../TestSortQuery/testSortWithAscDescKeys.sql   |    1 -
 .../TestSortQuery/testSortWithConstKeys.sql     |   10 -
 .../queries/TestSortQuery/testSortWithDate.sql  |    1 -
 .../queries/TestSortQuery/testSortWithExpr1.sql |    1 -
 .../queries/TestSortQuery/testSortWithExpr2.sql |    1 -
 .../queries/TestSortQuery/testSortWithJson.json |   65 -
 .../testSubQuerySortAfterGroupMultiBlocks.sql   |    5 -
 .../queries/TestSortQuery/testTopK.sql          |    1 -
 .../queries/TestSortQuery/testTopkWithJson.json |   51 -
 .../queries/TestTPCH/testFirstJoinInQ7.sql      |   13 -
 .../queries/TestTPCH/testQ1OrderBy.sql          |   12 -
 .../queries/TestTPCH/testQ2FourJoins.sql        |   18 -
 .../queries/TestTPCH/testTPCH14Expr.sql         |   12 -
 .../resources/queries/TestTPCH/testTPCHQ5.sql   |   24 -
 .../queries/TestTablePartitions/case1.sql       |   16 -
 .../queries/TestTablePartitions/case10.sql      |    1 -
 .../queries/TestTablePartitions/case11.sql      |    1 -
 .../queries/TestTablePartitions/case12.sql      |    7 -
 .../queries/TestTablePartitions/case13.sql      |   11 -
 .../queries/TestTablePartitions/case14.sql      |    3 -
 .../queries/TestTablePartitions/case15.sql      |    3 -
 .../queries/TestTablePartitions/case2.sql       |   31 -
 .../queries/TestTablePartitions/case3.sql       |    8 -
 .../queries/TestTablePartitions/case4.sql       |    1 -
 .../queries/TestTablePartitions/case5.sql       |    1 -
 .../queries/TestTablePartitions/case6.sql       |    1 -
 .../queries/TestTablePartitions/case7.sql       |    1 -
 .../queries/TestTablePartitions/case8.sql       |    1 -
 .../queries/TestTablePartitions/case9.sql       |    1 -
 .../TestTablePartitions/lineitemspecial_ddl.sql |    3 -
 .../TestTableSubQuery/testGroupBySubQuery.sql   |    1 -
 .../testGroupbySubqueryWithJson.json            |   59 -
 .../TestTableSubQuery/testJoinSubQuery.sql      |    5 -
 .../TestTableSubQuery/testJoinSubQuery2.sql     |    4 -
 .../testJoinSubqueryWithJson.json               |  108 --
 .../TestTableSubQuery/testTableSubquery1.sql    |    1 -
 .../TestTajoJdbc/create_table_with_date_ddl.sql |   10 -
 .../queries/TestTaskStatusUpdate/case1.sql      |    1 -
 .../queries/TestTaskStatusUpdate/case2.sql      |    5 -
 .../queries/TestTaskStatusUpdate/case3.sql      |   10 -
 .../queries/TestTruncateTable/table1_ddl.sql    |    1 -
 .../queries/TestTruncateTable/table2_ddl.sql    |    1 -
 .../TestUnionQuery/testComplexUnion1.sql        |   27 -
 .../TestUnionQuery/testComplexUnion2.sql        |   35 -
 .../queries/TestUnionQuery/testUnion1.sql       |   19 -
 .../queries/TestUnionQuery/testUnion10.sql      |  158 --
 .../queries/TestUnionQuery/testUnion11.sql      |    8 -
 .../queries/TestUnionQuery/testUnion12.sql      |   14 -
 .../queries/TestUnionQuery/testUnion13.sql      |   15 -
 .../queries/TestUnionQuery/testUnion14.sql      |    8 -
 .../queries/TestUnionQuery/testUnion15.sql      |   15 -
 .../queries/TestUnionQuery/testUnion16.sql      |   15 -
 .../queries/TestUnionQuery/testUnion2.sql       |   18 -
 .../queries/TestUnionQuery/testUnion3.sql       |   19 -
 .../queries/TestUnionQuery/testUnion4.sql       |   16 -
 .../queries/TestUnionQuery/testUnion5.sql       |   20 -
 .../queries/TestUnionQuery/testUnion6.sql       |   15 -
 .../queries/TestUnionQuery/testUnion7.sql       |   18 -
 .../queries/TestUnionQuery/testUnion8.sql       |   24 -
 .../queries/TestUnionQuery/testUnion9.sql       |   29 -
 .../queries/TestUnionQuery/testUnionAll1.sql    |   19 -
 .../queries/TestUnionQuery/testUnionAll10.sql   |  158 --
 .../queries/TestUnionQuery/testUnionAll11.sql   |    8 -
 .../queries/TestUnionQuery/testUnionAll12.sql   |   13 -
 .../queries/TestUnionQuery/testUnionAll13.sql   |   14 -
 .../queries/TestUnionQuery/testUnionAll14.sql   |    8 -
 .../queries/TestUnionQuery/testUnionAll15.sql   |   15 -
 .../queries/TestUnionQuery/testUnionAll16.sql   |   15 -
 .../queries/TestUnionQuery/testUnionAll2.sql    |   18 -
 .../queries/TestUnionQuery/testUnionAll3.sql    |   19 -
 .../queries/TestUnionQuery/testUnionAll4.sql    |   16 -
 .../queries/TestUnionQuery/testUnionAll5.sql    |   20 -
 .../queries/TestUnionQuery/testUnionAll6.sql    |   15 -
 .../queries/TestUnionQuery/testUnionAll7.sql    |   18 -
 .../queries/TestUnionQuery/testUnionAll8.sql    |   24 -
 .../queries/TestUnionQuery/testUnionAll9.sql    |   29 -
 .../testUnionAllWithDifferentAlias.sql          |   29 -
 ...estUnionAllWithDifferentAliasAndFunction.sql |   29 -
 .../testUnionAllWithSameAliasNames.sql          |   25 -
 .../testUnionWithDifferentAlias.sql             |   29 -
 .../testUnionWithDifferentAliasAndFunction.sql  |   29 -
 .../testUnionWithSameAliasNames.sql             |   25 -
 .../TestWindowQuery/testComplexOrderBy1.sql     |    5 -
 .../queries/TestWindowQuery/testFirstValue1.sql |   18 -
 .../queries/TestWindowQuery/testLag1.sql        |   18 -
 .../TestWindowQuery/testLagWithDefault.sql      |   18 -
 .../TestWindowQuery/testLagWithNoArgs.sql       |   18 -
 .../queries/TestWindowQuery/testLastValue1.sql  |   18 -
 .../queries/TestWindowQuery/testLead1.sql       |   18 -
 .../TestWindowQuery/testLeadWithDefault.sql     |   18 -
 .../TestWindowQuery/testLeadWithNoArgs.sql      |   18 -
 .../queries/TestWindowQuery/testRowNumber1.sql  |    5 -
 .../queries/TestWindowQuery/testRowNumber2.sql  |    5 -
 .../queries/TestWindowQuery/testRowNumber3.sql  |    7 -
 .../queries/TestWindowQuery/testStdDevPop1.sql  |   14 -
 .../queries/TestWindowQuery/testStdDevSamp1.sql |   14 -
 .../queries/TestWindowQuery/testWindow1.sql     |    1 -
 .../queries/TestWindowQuery/testWindow2.sql     |    1 -
 .../queries/TestWindowQuery/testWindow3.sql     |    1 -
 .../queries/TestWindowQuery/testWindow4.sql     |    1 -
 .../queries/TestWindowQuery/testWindow5.sql     |    1 -
 .../queries/TestWindowQuery/testWindow6.sql     |    1 -
 .../queries/TestWindowQuery/testWindow7.sql     |    1 -
 .../queries/TestWindowQuery/testWindow8.sql     |    7 -
 .../TestWindowQuery/testWindowBeforeLimit.sql   |    6 -
 .../testWindowWithAggregation1.sql              |    4 -
 .../testWindowWithAggregation2.sql              |    7 -
 .../testWindowWithAggregation3.sql              |    5 -
 .../testWindowWithAggregation4.sql              |    8 -
 .../testWindowWithAggregation5.sql              |    9 -
 .../testWindowWithAggregation6.sql              |   10 -
 .../TestWindowQuery/testWindowWithOrderBy1.sql  |    6 -
 .../TestWindowQuery/testWindowWithOrderBy2.sql  |    6 -
 .../TestWindowQuery/testWindowWithOrderBy3.sql  |    6 -
 .../TestWindowQuery/testWindowWithOrderBy4.sql  |    7 -
 .../TestWindowQuery/testWindowWithOrderBy5.sql  |    9 -
 .../TestWindowQuery/testWindowWithSubQuery.sql  |   14 -
 .../TestWindowQuery/testWindowWithSubQuery2.sql |   15 -
 .../TestWindowQuery/testWindowWithSubQuery3.sql |   14 -
 .../TestWindowQuery/testWindowWithSubQuery4.sql |   14 -
 .../TestWindowQuery/testWindowWithSubQuery5.sql |   11 -
 .../TestWindowQuery/testWindowWithSubQuery6.sql |    9 -
 .../default/alter_table_add_partition_1.sql     |    1 -
 .../default/alter_table_add_partition_2.sql     |    1 -
 .../default/alter_table_add_partition_3.sql     |    2 -
 .../default/alter_table_add_partition_4.sql     |    1 -
 .../default/alter_table_add_partition_5.sql     |    1 -
 .../default/alter_table_drop_partition_1.sql    |    1 -
 .../default/alter_table_drop_partition_2.sql    |    1 -
 .../default/alter_table_drop_partition_3.sql    |    1 -
 .../default/alter_table_drop_partition_4.sql    |    1 -
 .../default/alter_table_set_property_1.sql      |    1 -
 .../default/alter_table_set_property_2.sql      |    1 -
 .../default/alter_table_set_property_3.sql      |    1 -
 .../resources/queries/default/asterisk_1.sql    |    1 -
 .../resources/queries/default/asterisk_2.sql    |    1 -
 .../resources/queries/default/asterisk_3.sql    |    1 -
 .../resources/queries/default/asterisk_4.sql    |    1 -
 .../create_partitioned_table_as_select.sql      |   17 -
 .../queries/default/create_table_1.hiveql       |    1 -
 .../queries/default/create_table_1.sql          |    1 -
 .../queries/default/create_table_10.sql         |    1 -
 .../queries/default/create_table_11.hiveql      |    3 -
 .../queries/default/create_table_11.sql         |    3 -
 .../queries/default/create_table_12.hiveql      |    4 -
 .../queries/default/create_table_12.sql         |    3 -
 .../queries/default/create_table_2.hiveql       |    1 -
 .../queries/default/create_table_2.sql          |    1 -
 .../queries/default/create_table_3.sql          |    1 -
 .../queries/default/create_table_4.sql          |    1 -
 .../queries/default/create_table_5.sql          |    1 -
 .../queries/default/create_table_6.sql          |    1 -
 .../queries/default/create_table_7.sql          |    1 -
 .../queries/default/create_table_8.sql          |   48 -
 .../queries/default/create_table_9.sql          |    1 -
 .../queries/default/create_table_like_1.sql     |    1 -
 .../create_table_partition_by_column.sql        |    4 -
 .../create_table_partition_by_hash_1.sql        |    3 -
 .../create_table_partition_by_hash_2.sql        |    7 -
 .../default/create_table_partition_by_list.sql  |    8 -
 .../default/create_table_partition_by_range.sql |    9 -
 .../resources/queries/default/drop_table.sql    |    1 -
 .../queries/default/exists_predicate_1.sql      |    1 -
 .../queries/default/exists_predicate_2.sql      |    1 -
 .../resources/queries/default/groupby_1.sql     |    1 -
 .../resources/queries/default/groupby_2.sql     |    1 -
 .../resources/queries/default/groupby_3.sql     |    1 -
 .../resources/queries/default/groupby_4.sql     |    1 -
 .../resources/queries/default/groupby_5.sql     |    1 -
 .../resources/queries/default/in_subquery_1.sql |    1 -
 .../resources/queries/default/in_subquery_2.sql |    1 -
 .../queries/default/insert_into_select_1.sql    |    1 -
 .../queries/default/insert_into_select_2.sql    |    1 -
 .../queries/default/insert_into_select_3.sql    |    1 -
 .../default/insert_overwrite_into_select_1.sql  |    1 -
 .../insert_overwrite_into_select_2.hiveql       |    1 -
 .../default/insert_overwrite_into_select_2.sql  |    1 -
 .../default/insert_overwrite_into_select_3.sql  |    1 -
 .../test/resources/queries/default/join_1.sql   |    1 -
 .../test/resources/queries/default/join_10.sql  |    1 -
 .../test/resources/queries/default/join_11.sql  |    1 -
 .../test/resources/queries/default/join_12.sql  |    1 -
 .../test/resources/queries/default/join_13.sql  |   13 -
 .../test/resources/queries/default/join_14.sql  |    1 -
 .../resources/queries/default/join_15.hiveql    |    1 -
 .../test/resources/queries/default/join_15.sql  |    1 -
 .../test/resources/queries/default/join_2.sql   |    1 -
 .../test/resources/queries/default/join_3.sql   |    1 -
 .../test/resources/queries/default/join_4.sql   |    1 -
 .../test/resources/queries/default/join_5.sql   |    1 -
 .../test/resources/queries/default/join_6.sql   |    1 -
 .../test/resources/queries/default/join_7.sql   |    1 -
 .../test/resources/queries/default/join_8.sql   |   13 -
 .../test/resources/queries/default/join_9.sql   |    5 -
 .../test/resources/queries/default/select_1.sql |    1 -
 .../resources/queries/default/select_10.hiveql  |    5 -
 .../resources/queries/default/select_10.sql     |    5 -
 .../resources/queries/default/select_11.hiveql  |    4 -
 .../resources/queries/default/select_11.sql     |    6 -
 .../resources/queries/default/select_12.hiveql  |    3 -
 .../resources/queries/default/select_13.hiveql  |    2 -
 .../resources/queries/default/select_13.sql     |    2 -
 .../resources/queries/default/select_14.sql     |    2 -
 .../resources/queries/default/select_15.hiveql  |    1 -
 .../resources/queries/default/select_15.sql     |    1 -
 .../test/resources/queries/default/select_2.sql |    1 -
 .../test/resources/queries/default/select_3.sql |    1 -
 .../test/resources/queries/default/select_4.sql |    1 -
 .../test/resources/queries/default/select_5.sql |    1 -
 .../test/resources/queries/default/select_6.sql |    1 -
 .../test/resources/queries/default/select_7.sql |    1 -
 .../test/resources/queries/default/select_8.sql |    1 -
 .../resources/queries/default/select_9.hiveql   |    4 -
 .../test/resources/queries/default/select_9.sql |    4 -
 .../test/resources/queries/default/set_1.sql    |    1 -
 .../test/resources/queries/default/set_2.sql    |    1 -
 .../test/resources/queries/default/set_3.sql    |    1 -
 .../test/resources/queries/default/set_4.sql    |   36 -
 .../queries/default/table_subquery1.sql         |   19 -
 .../queries/default/table_subquery2.sql         |   21 -
 .../resources/queries/default/union_1.hiveql    |   14 -
 .../after_set_property_delimiter.result         |    3 -
 .../before_set_property_delimiter.result        |    3 -
 .../TestBuiltinFunctions/testAvgDouble.result   |    5 -
 .../TestBuiltinFunctions/testAvgInt.result      |    3 -
 .../TestBuiltinFunctions/testAvgLong.result     |    3 -
 .../testAvgLongOverflow.result                  |    3 -
 .../TestBuiltinFunctions/testCount.result       |    3 -
 .../TestBuiltinFunctions/testMaxLong.result     |    3 -
 .../TestBuiltinFunctions/testMaxString.result   |    3 -
 .../TestBuiltinFunctions/testMinLong.result     |    3 -
 .../TestBuiltinFunctions/testMinString.result   |    3 -
 .../TestBuiltinFunctions/testSplitPart.result   |    7 -
 .../testSplitPartByString.result                |    7 -
 .../testSplitPartNested.result                  |    7 -
 .../TestCTASQuery/testCtasWithGroupby.result    |    7 -
 .../TestCTASQuery/testCtasWithLimit.result      |    5 -
 .../TestCTASQuery/testCtasWithOptions.result    |    5 -
 .../TestCTASQuery/testCtasWithOrderby.result    |    7 -
 .../TestCTASQuery/testCtasWithStoreType.result  |    5 -
 .../TestCTASQuery/testCtasWithTextFile.result   |    5 -
 .../TestCTASQuery/testCtasWithUnion.result      |    8 -
 .../TestCaseByCases/testTAJO1224Case1.result    |    3 -
 .../TestCaseByCases/testTAJO415Case.result      |    7 -
 .../TestCaseByCases/testTAJO418Case.result      |    4 -
 .../TestCaseByCases/testTAJO619Case.result      |    3 -
 .../TestCaseByCases/testTAJO718Case.result      |    5 -
 .../TestCaseByCases/testTAJO739Case.result      |    7 -
 .../TestCaseByCases/testTAJO914Case1.result     |    5 -
 .../TestCaseByCases/testTAJO914Case2.result     |    5 -
 .../TestCaseByCases/testTAJO914Case3.result     |    5 -
 .../TestCaseByCases/testTAJO914Case4.result     |    5 -
 .../TestCaseByCases/testTAJO917Case1.result     |    7 -
 .../quoted_identifier_mixed_chars_1.result      |    5 -
 .../quoted_identifier_mixed_chars_2.result      |    5 -
 .../quoted_identifier_mixed_chars_3.result      |    8 -
 .../quoted_identifier_non_ascii_1.result        |    5 -
 .../quoted_identifier_non_ascii_2.result        |    5 -
 .../quoted_identifier_non_ascii_3.result        |    5 -
 .../testFindScalarFunctions.result              |    2 -
 .../testComplexParameter.result                 |    3 -
 .../testComplexParameter2.result                |    3 -
 .../testComplexParameterWithSubQuery.result     |    3 -
 .../testComplexTargetWithPythonUdaf.result      |    3 -
 .../testDistinctAggregation1.result             |    5 -
 .../testDistinctAggregation2.result             |    5 -
 .../testDistinctAggregation3.result             |    3 -
 .../testDistinctAggregation4.result             |    4 -
 .../testDistinctAggregation5.result             |    4 -
 .../testDistinctAggregation6.result             |    5 -
 .../testDistinctAggregation7.result             |    3 -
 .../testDistinctAggregation8.result             |    7 -
 .../testDistinctAggregationCaseByCase3.result   |    3 -
 .../testDistinctAggregationCaseByCase4.result   |    3 -
 .../testDistinctAggregationWithHaving1.result   |    3 -
 .../testDistinctAggregationWithUnion1.result    |    4 -
 .../testDistinctAggregation_case1.result        |    4 -
 .../testDistinctAggregation_case10.result       |    3 -
 .../testDistinctAggregation_case2.result        |    4 -
 .../testDistinctAggregation_case3.result        |    4 -
 .../testDistinctAggregation_case4.result        |    5 -
 .../testDistinctAggregation_case5.result        |    5 -
 .../testDistinctAggregation_case6.result        |    5 -
 .../testDistinctAggregation_case7.result        |    5 -
 .../testDistinctAggregation_case8.result        |    6 -
 .../testDistinctAggregation_case9.result        |    6 -
 .../testDistinctPythonUdafWithUnion1.result     |    4 -
 .../results/TestGroupByQuery/testGroupBy.result |    3 -
 .../TestGroupByQuery/testGroupBy2.result        |    4 -
 .../TestGroupByQuery/testGroupBy3.result        |    5 -
 .../TestGroupByQuery/testGroupBy4.result        |    5 -
 .../TestGroupByQuery/testGroupBy5.result        |    5 -
 .../TestGroupByQuery/testGroupByNested1.result  |    6 -
 .../TestGroupByQuery/testGroupByNested2.result  |    6 -
 .../testGroupByWithConstantKeys1.result         |    3 -
 .../testGroupByWithConstantKeys2.result         |    5 -
 .../testGroupByWithConstantKeys3.result         |    3 -
 .../testGroupByWithConstantKeys4.result         |    5 -
 .../testGroupByWithConstantKeys5.result         |    5 -
 .../testGroupByWithExpressionKeys1.result       |    5 -
 .../testGroupByWithExpressionKeys2.result       |    5 -
 .../testGroupByWithNullData1.result             |    3 -
 .../testGroupByWithNullData10.result            |    3 -
 .../testGroupByWithNullData11.result            |    2 -
 .../testGroupByWithNullData12.result            |    2 -
 .../testGroupByWithNullData2.result             |    3 -
 .../testGroupByWithNullData3.result             |    3 -
 .../testGroupByWithNullData4.result             |    3 -
 .../testGroupByWithNullData5.result             |    3 -
 .../testGroupByWithNullData6.result             |    3 -
 .../testGroupByWithNullData7.result             |    3 -
 .../testGroupByWithNullData8.result             |    3 -
 .../testGroupByWithNullData9.result             |    2 -
 .../testGroupByWithSameConstantKeys1.result     |    5 -
 .../testGroupByWithSameExprs1.result            |    6 -
 .../testGroupByWithSameExprs2.result            |    6 -
 .../TestGroupByQuery/testGroupbyWithJson.result |    5 -
 .../testGroupbyWithLimit1.result                |    3 -
 .../testGroupbyWithLimit2.result                |    3 -
 .../testGroupbyWithLimit3.result                |    3 -
 .../testGroupbyWithPythonFunc.result            |    7 -
 .../testGroupbyWithPythonFunc2.result           |    7 -
 .../testHavingWithAggFunction.result            |    4 -
 .../testHavingWithNamedTarget.result            |    5 -
 .../TestGroupByQuery/testPythonUdaf.result      |    3 -
 .../TestGroupByQuery/testPythonUdaf2.result     |    4 -
 .../TestGroupByQuery/testPythonUdaf3.result     |    5 -
 .../testPythonUdafWithHaving.result             |    4 -
 .../testPythonUdafWithNullData.result           |    2 -
 .../TestHBaseTable/testBinaryMappedQuery.result |   81 -
 .../results/TestHBaseTable/testCTAS.result      |  100 --
 .../testColumnKeyValueSelectQuery.result        |   12 -
 .../TestHBaseTable/testIndexPredication.result  |   38 -
 .../TestHBaseTable/testInsertInto.result        |    3 -
 .../testInsertIntoBinaryMultiRegion.result      |  100 --
 .../testInsertIntoColumnKeyValue.result         |   21 -
 .../testInsertIntoMultiRegion.result            |  100 --
 .../testInsertIntoMultiRegion2.result           |  100 --
 ...stInsertIntoMultiRegionMultiRowFields.result |  100 --
 ...estInsertIntoMultiRegionWithSplitFile.result |  100 --
 .../testInsertIntoRowField.result               |    4 -
 .../testInsertIntoUsingPut.result               |    3 -
 .../TestHBaseTable/testInsertValues1.result     |    4 -
 .../results/TestHBaseTable/testJoin.result      |    7 -
 .../TestHBaseTable/testNonForwardQuery.result   |  102 --
 .../testRowFieldSelectQuery.result              |   88 --
 .../TestHBaseTable/testSimpleSelectQuery.result |   88 --
 .../TestIndexScan/testOnMultipleExprs.result    |    3 -
 .../TestIndexScan/testOnMultipleKeys.result     |    3 -
 .../TestIndexScan/testOnMultipleKeys2.result    |    3 -
 .../testOnSortedNonUniqueKeys.result            |    4 -
 .../TestIndexScan/testOnUnsortedTextKeys.result |    3 -
 .../TestIndexScan/testWithGroupBy.result        |    3 -
 .../results/TestIndexScan/testWithJoin.result   |    4 -
 .../results/TestIndexScan/testWithSort.result   |    4 -
 .../testBroadcastTwoPartJoin.Hash.plan          |  135 --
 ...stBroadcastTwoPartJoin.Hash_NoBroadcast.plan |  249 ----
 .../testBroadcastTwoPartJoin.Sort.plan          |  135 --
 ...stBroadcastTwoPartJoin.Sort_NoBroadcast.plan |  249 ----
 .../testBroadcastTwoPartJoin.result             |    7 -
 .../testComplexJoinCondition1.Hash.plan         |   78 -
 ...tComplexJoinCondition1.Hash_NoBroadcast.plan |  105 --
 .../testComplexJoinCondition1.Sort.plan         |   78 -
 ...tComplexJoinCondition1.Sort_NoBroadcast.plan |  105 --
 .../testComplexJoinCondition1.result            |   27 -
 .../testComplexJoinCondition2.Hash.plan         |   78 -
 ...tComplexJoinCondition2.Hash_NoBroadcast.plan |  105 --
 .../testComplexJoinCondition2.Sort.plan         |   78 -
 ...tComplexJoinCondition2.Sort_NoBroadcast.plan |  105 --
 .../testComplexJoinCondition2.result            |   27 -
 .../testComplexJoinCondition3.Hash.plan         |   78 -
 ...tComplexJoinCondition3.Hash_NoBroadcast.plan |  105 --
 .../testComplexJoinCondition3.Sort.plan         |   78 -
 ...tComplexJoinCondition3.Sort_NoBroadcast.plan |  105 --
 .../testComplexJoinCondition3.result            |   27 -
 .../testComplexJoinCondition4.Hash.plan         |   78 -
 ...tComplexJoinCondition4.Hash_NoBroadcast.plan |  105 --
 .../testComplexJoinCondition4.Sort.plan         |   78 -
 ...tComplexJoinCondition4.Sort_NoBroadcast.plan |  105 --
 .../testComplexJoinCondition4.result            |   29 -
 .../testCrossJoin.1.Hash.plan                   |   76 -
 .../testCrossJoin.1.Hash_NoBroadcast.plan       |  103 --
 .../testCrossJoin.1.Sort.plan                   |   76 -
 .../testCrossJoin.1.Sort_NoBroadcast.plan       |  103 --
 .../TestInnerJoinQuery/testCrossJoin.1.result   |  127 --
 .../testCrossJoin.2.Hash.plan                   |   51 -
 .../testCrossJoin.2.Hash_NoBroadcast.plan       |   78 -
 .../testCrossJoin.2.Sort.plan                   |   51 -
 .../testCrossJoin.2.Sort_NoBroadcast.plan       |   78 -
 .../TestInnerJoinQuery/testCrossJoin.2.result   |   27 -
 .../testCrossJoin.3.Hash.plan                   |   51 -
 .../testCrossJoin.3.Hash_NoBroadcast.plan       |   78 -
 .../testCrossJoin.3.Sort.plan                   |   51 -
 .../testCrossJoin.3.Sort_NoBroadcast.plan       |   78 -
 .../TestInnerJoinQuery/testCrossJoin.3.result   |   27 -
 .../testCrossJoin.4.Hash.plan                   |   51 -
 .../testCrossJoin.4.Hash_NoBroadcast.plan       |   78 -
 .../testCrossJoin.4.Sort.plan                   |   51 -
 .../testCrossJoin.4.Sort_NoBroadcast.plan       |   78 -
 .../TestInnerJoinQuery/testCrossJoin.4.result   |   27 -
 .../testCrossJoin.5.Hash.plan                   |   76 -
 .../testCrossJoin.5.Hash_NoBroadcast.plan       |  103 --
 .../testCrossJoin.5.Sort.plan                   |   76 -
 .../testCrossJoin.5.Sort_NoBroadcast.plan       |  103 --
 .../TestInnerJoinQuery/testCrossJoin.5.result   |   27 -
 .../testCrossJoinAndCaseWhen.Hash.plan          |   78 -
 ...stCrossJoinAndCaseWhen.Hash_NoBroadcast.plan |  105 --
 .../testCrossJoinAndCaseWhen.Sort.plan          |   78 -
 ...stCrossJoinAndCaseWhen.Sort_NoBroadcast.plan |  105 --
 .../testCrossJoinAndCaseWhen.result             |   27 -
 .../testCrossJoinWithAsterisk1.Hash.plan        |   76 -
 ...CrossJoinWithAsterisk1.Hash_NoBroadcast.plan |  103 --
 .../testCrossJoinWithAsterisk1.Sort.plan        |   76 -
 ...CrossJoinWithAsterisk1.Sort_NoBroadcast.plan |  103 --
 .../testCrossJoinWithAsterisk1.result           |   27 -
 .../testCrossJoinWithAsterisk2.Hash.plan        |   76 -
 ...CrossJoinWithAsterisk2.Hash_NoBroadcast.plan |  103 --
 .../testCrossJoinWithAsterisk2.Sort.plan        |   76 -
 ...CrossJoinWithAsterisk2.Sort_NoBroadcast.plan |  103 --
 .../testCrossJoinWithAsterisk2.result           |   27 -
 .../testCrossJoinWithAsterisk3.Hash.plan        |   76 -
 ...CrossJoinWithAsterisk3.Hash_NoBroadcast.plan |  103 --
 .../testCrossJoinWithAsterisk3.Sort.plan        |   76 -
 ...CrossJoinWithAsterisk3.Sort_NoBroadcast.plan |  103 --
 .../testCrossJoinWithAsterisk3.result           |   27 -
 .../testCrossJoinWithAsterisk4.Hash.plan        |   76 -
 ...CrossJoinWithAsterisk4.Hash_NoBroadcast.plan |  103 --
 .../testCrossJoinWithAsterisk4.Sort.plan        |   76 -
 ...CrossJoinWithAsterisk4.Sort_NoBroadcast.plan |  103 --
 .../testCrossJoinWithAsterisk4.result           |   27 -
 .../testCrossJoinWithEmptyTable1.Hash.plan      |   78 -
 ...ossJoinWithEmptyTable1.Hash_NoBroadcast.plan |  105 --
 .../testCrossJoinWithEmptyTable1.Sort.plan      |   78 -
 ...ossJoinWithEmptyTable1.Sort_NoBroadcast.plan |  105 --
 .../testCrossJoinWithEmptyTable1.result         |    2 -
 ...sJoinWithThetaJoinConditionInWhere.Hash.plan |   63 -
 ...taJoinConditionInWhere.Hash_NoBroadcast.plan |   90 --
 ...sJoinWithThetaJoinConditionInWhere.Sort.plan |   63 -
 ...taJoinConditionInWhere.Sort_NoBroadcast.plan |   90 --
 ...rossJoinWithThetaJoinConditionInWhere.result |   12 -
 .../testDifferentTypesJoinCondition.Hash.plan   |   53 -
 ...rentTypesJoinCondition.Hash_NoBroadcast.plan |   80 -
 .../testDifferentTypesJoinCondition.Sort.plan   |   53 -
 ...rentTypesJoinCondition.Sort_NoBroadcast.plan |   80 -
 .../testDifferentTypesJoinCondition.result      |    7 -
 .../testInnerJoinAndCaseWhen.Hash.plan          |   78 -
 ...stInnerJoinAndCaseWhen.Hash_NoBroadcast.plan |  105 --
 .../testInnerJoinAndCaseWhen.Sort.plan          |   78 -
 ...stInnerJoinAndCaseWhen.Sort_NoBroadcast.plan |  105 --
 .../testInnerJoinAndCaseWhen.result             |   27 -
 .../testInnerJoinWithEmptyTable.Hash.plan       |   78 -
 ...nnerJoinWithEmptyTable.Hash_NoBroadcast.plan |  105 --
 .../testInnerJoinWithEmptyTable.Sort.plan       |   78 -
 ...nnerJoinWithEmptyTable.Sort_NoBroadcast.plan |  105 --
 .../testInnerJoinWithEmptyTable.result          |    2 -
 ...rJoinWithThetaJoinConditionInWhere.Hash.plan |   57 -
 ...taJoinConditionInWhere.Hash_NoBroadcast.plan |   84 --
 ...rJoinWithThetaJoinConditionInWhere.Sort.plan |   57 -
 ...taJoinConditionInWhere.Sort_NoBroadcast.plan |   84 --
 ...nnerJoinWithThetaJoinConditionInWhere.result |    7 -
 .../testJoinAsterisk.Hash.plan                  |   53 -
 .../testJoinAsterisk.Hash_NoBroadcast.plan      |   80 -
 .../testJoinAsterisk.Sort.plan                  |   53 -
 .../testJoinAsterisk.Sort_NoBroadcast.plan      |   80 -
 .../TestInnerJoinQuery/testJoinAsterisk.result  |    7 -
 .../testJoinCoReferredEvals1.Hash.plan          |   78 -
 ...stJoinCoReferredEvals1.Hash_NoBroadcast.plan |  105 --
 .../testJoinCoReferredEvals1.Sort.plan          |   78 -
 ...stJoinCoReferredEvals1.Sort_NoBroadcast.plan |  105 --
 .../testJoinCoReferredEvals1.result             |   27 -
 ...tJoinCoReferredEvalsWithSameExprs1.Hash.plan |   88 --
 ...redEvalsWithSameExprs1.Hash_NoBroadcast.plan |  115 --
 ...tJoinCoReferredEvalsWithSameExprs1.Sort.plan |   88 --
 ...redEvalsWithSameExprs1.Sort_NoBroadcast.plan |  115 --
 ...testJoinCoReferredEvalsWithSameExprs1.result |   22 -
 ...tJoinCoReferredEvalsWithSameExprs2.Hash.plan |  119 --
 ...redEvalsWithSameExprs2.Hash_NoBroadcast.plan |  146 --
 ...tJoinCoReferredEvalsWithSameExprs2.Sort.plan |  119 --
 ...redEvalsWithSameExprs2.Sort_NoBroadcast.plan |  146 --
 ...testJoinCoReferredEvalsWithSameExprs2.result |   22 -
 .../testJoinOnMultipleDatabases.Hash.plan       |  135 --
 ...oinOnMultipleDatabases.Hash_NoBroadcast.plan |  249 ----
 .../testJoinOnMultipleDatabases.Sort.plan       |  135 --
 ...oinOnMultipleDatabases.Sort_NoBroadcast.plan |  249 ----
 .../testJoinOnMultipleDatabases.result          |    5 -
 .../testJoinOnMultipleDatabasesWithJson.result  |    5 -
 .../TestInnerJoinQuery/testJoinWithJson.result  |   27 -
 .../testJoinWithMultipleJoinQual1.Hash.plan     |  135 --
 ...nWithMultipleJoinQual1.Hash_NoBroadcast.plan |  249 ----
 .../testJoinWithMultipleJoinQual1.Sort.plan     |  135 --
 ...nWithMultipleJoinQual1.Sort_NoBroadcast.plan |  249 ----
 .../testJoinWithMultipleJoinQual1.result        |    2 -
 .../testJoinWithOrPredicates.Hash.plan          |   90 --
 ...stJoinWithOrPredicates.Hash_NoBroadcast.plan |  117 --
 .../testJoinWithOrPredicates.Sort.plan          |   90 --
 ...stJoinWithOrPredicates.Sort_NoBroadcast.plan |  117 --
 .../testJoinWithOrPredicates.result             |    4 -
 .../testNaturalJoin.Hash.plan                   |   78 -
 .../testNaturalJoin.Hash_NoBroadcast.plan       |  105 --
 .../testNaturalJoin.Sort.plan                   |   78 -
 .../testNaturalJoin.Sort_NoBroadcast.plan       |  105 --
 .../TestInnerJoinQuery/testNaturalJoin.result   |   27 -
 .../TestInnerJoinQuery/testTPCHQ2Join.Hash.plan |  135 --
 .../testTPCHQ2Join.Hash_NoBroadcast.plan        |  249 ----
 .../TestInnerJoinQuery/testTPCHQ2Join.Sort.plan |  135 --
 .../testTPCHQ2Join.Sort_NoBroadcast.plan        |  249 ----
 .../TestInnerJoinQuery/testTPCHQ2Join.result    |    5 -
 .../testWhereClauseJoin1.Hash.plan              |   78 -
 .../testWhereClauseJoin1.Hash_NoBroadcast.plan  |  105 --
 .../testWhereClauseJoin1.Sort.plan              |   78 -
 .../testWhereClauseJoin1.Sort_NoBroadcast.plan  |  105 --
 .../testWhereClauseJoin1.result                 |   27 -
 .../testWhereClauseJoin2.Hash.plan              |   78 -
 .../testWhereClauseJoin2.Hash_NoBroadcast.plan  |  105 --
 .../testWhereClauseJoin2.Sort.plan              |   78 -
 .../testWhereClauseJoin2.Sort_NoBroadcast.plan  |  105 --
 .../testWhereClauseJoin2.result                 |   27 -
 .../testWhereClauseJoin3.Hash.plan              |   78 -
 .../testWhereClauseJoin3.Hash_NoBroadcast.plan  |  105 --
 .../testWhereClauseJoin3.Sort.plan              |   78 -
 .../testWhereClauseJoin3.Sort_NoBroadcast.plan  |  105 --
 .../testWhereClauseJoin3.result                 |   27 -
 .../testWhereClauseJoin4.Hash.plan              |   78 -
 .../testWhereClauseJoin4.Hash_NoBroadcast.plan  |  105 --
 .../testWhereClauseJoin4.Sort.plan              |   78 -
 .../testWhereClauseJoin4.Sort_NoBroadcast.plan  |  105 --
 .../testWhereClauseJoin4.result                 |   27 -
 .../testWhereClauseJoin5.Hash.plan              |   97 --
 .../testWhereClauseJoin5.Hash_NoBroadcast.plan  |  153 --
 .../testWhereClauseJoin5.Sort.plan              |   97 --
 .../testWhereClauseJoin5.Sort_NoBroadcast.plan  |  153 --
 .../testWhereClauseJoin5.result                 |    5 -
 .../testWhereClauseJoin6.Hash.plan              |  116 --
 .../testWhereClauseJoin6.Hash_NoBroadcast.plan  |  201 ---
 .../testWhereClauseJoin6.Sort.plan              |  116 --
 .../testWhereClauseJoin6.Sort_NoBroadcast.plan  |  201 ---
 .../testWhereClauseJoin6.result                 |    5 -
 .../testBroadcastSubquery.Hash.plan             |  109 --
 .../testBroadcastSubquery.Hash_NoBroadcast.plan |  165 --
 .../testBroadcastSubquery.Sort.plan             |  109 --
 .../testBroadcastSubquery.Sort_NoBroadcast.plan |  165 --
 .../testBroadcastSubquery.result                |    7 -
 .../testBroadcastSubquery2.Hash.plan            |  216 ---
 ...testBroadcastSubquery2.Hash_NoBroadcast.plan |  328 ----
 .../testBroadcastSubquery2.Sort.plan            |  216 ---
 ...testBroadcastSubquery2.Sort_NoBroadcast.plan |  328 ----
 .../testBroadcastSubquery2.result               |    3 -
 .../testComplexJoinCondition5.Hash.plan         |   90 --
 ...tComplexJoinCondition5.Hash_NoBroadcast.plan |  117 --
 .../testComplexJoinCondition5.Sort.plan         |   90 --
 ...tComplexJoinCondition5.Sort_NoBroadcast.plan |  117 --
 .../testComplexJoinCondition5.result            |   29 -
 .../testComplexJoinCondition6.Hash.plan         |  109 --
 ...tComplexJoinCondition6.Hash_NoBroadcast.plan |  145 --
 .../testComplexJoinCondition6.Sort.plan         |  109 --
 ...tComplexJoinCondition6.Sort_NoBroadcast.plan |  145 --
 .../testComplexJoinCondition6.result            |   56 -
 .../testComplexJoinCondition7.Hash.plan         |  109 --
 ...tComplexJoinCondition7.Hash_NoBroadcast.plan |  145 --
 .../testComplexJoinCondition7.Sort.plan         |  109 --
 ...tComplexJoinCondition7.Sort_NoBroadcast.plan |  145 --
 .../testComplexJoinCondition7.result            |   56 -
 .../testJoinWithJson2.result                    |    5 -
 .../testJoinWithMultipleJoinQual2.Hash.plan     |   86 --
 ...nWithMultipleJoinQual2.Hash_NoBroadcast.plan |  142 --
 .../testJoinWithMultipleJoinQual2.Sort.plan     |   86 --
 ...nWithMultipleJoinQual2.Sort_NoBroadcast.plan |  142 --
 .../testJoinWithMultipleJoinQual2.result        |    3 -
 .../testJoinWithMultipleJoinQual3.Hash.plan     |  105 --
 ...nWithMultipleJoinQual3.Hash_NoBroadcast.plan |  190 ---
 .../testJoinWithMultipleJoinQual3.Sort.plan     |  105 --
 ...nWithMultipleJoinQual3.Sort_NoBroadcast.plan |  190 ---
 .../testJoinWithMultipleJoinQual3.result        |    5 -
 .../testJoinWithMultipleJoinQual4.Hash.plan     |  109 --
 ...nWithMultipleJoinQual4.Hash_NoBroadcast.plan |  194 ---
 .../testJoinWithMultipleJoinQual4.Sort.plan     |  109 --
 ...nWithMultipleJoinQual4.Sort_NoBroadcast.plan |  194 ---
 .../testJoinWithMultipleJoinQual4.result        |    4 -
 .../testThetaJoinKeyPairs.Hash.plan             |  146 --
 .../testThetaJoinKeyPairs.Hash_NoBroadcast.plan |  200 ---
 .../testThetaJoinKeyPairs.Sort.plan             |  146 --
 .../testThetaJoinKeyPairs.Sort_NoBroadcast.plan |  200 ---
 .../testThetaJoinKeyPairs.result                |   21 -
 ...estInsertOverwriteWithAsteriskAndMore.result |    7 -
 ...sertOverwriteWithAsteriskUsingParquet.result |    4 -
 ...ertOverwriteWithAsteriskUsingParquet2.result |    4 -
 .../testInsertWithDifferentColumnOrder.result   |   27 -
 .../selfJoinOfPartitionedTable.result           |    7 -
 .../testBroadcastPartitionTable.result          |    5 -
 ...FilterPushDownPartitionColumnCaseWhen.result |    4 -
 ...tionedBroadcastDataFileWithZeroLength.result |    7 -
 ...ionedBroadcastDataFileWithZeroLength2.result |    7 -
 .../testNoProjectionJoinQual.result             |    3 -
 .../testPartialFilterPushDown.result            |    3 -
 .../testPartialFilterPushDownOuterJoin.result   |   27 -
 .../testPartialFilterPushDownOuterJoin2.result  |   27 -
 ...estPartitionMultiplePartitionFilter.1.result |    2 -
 .../testPartitionTableJoinSmallTable.result     |    7 -
 .../TestJoinQuery/testWhereClauseJoin6.result   |    5 -
 .../testComplexJoinsWithCaseWhen.Hash.plan      |   97 --
 ...mplexJoinsWithCaseWhen.Hash_NoBroadcast.plan |  153 --
 .../testComplexJoinsWithCaseWhen.Sort.plan      |   97 --
 ...mplexJoinsWithCaseWhen.Sort_NoBroadcast.plan |  153 --
 .../testComplexJoinsWithCaseWhen.result         |   27 -
 .../testComplexJoinsWithCaseWhen2.Hash.plan     |  109 --
 ...plexJoinsWithCaseWhen2.Hash_NoBroadcast.plan |  165 --
 .../testComplexJoinsWithCaseWhen2.Sort.plan     |  109 --
 ...plexJoinsWithCaseWhen2.Sort_NoBroadcast.plan |  165 --
 .../testComplexJoinsWithCaseWhen2.result        |   27 -
 .../testInnerAndOuterWithEmpty.1.Hash.plan      |   74 -
 ...nerAndOuterWithEmpty.1.Hash_NoBroadcast.plan |  130 --
 .../testInnerAndOuterWithEmpty.1.Sort.plan      |   74 -
 ...nerAndOuterWithEmpty.1.Sort_NoBroadcast.plan |  130 --
 .../testInnerAndOuterWithEmpty.1.result         |    7 -
 .../testJoinWithMultipleJoinTypes.Hash.plan     |   84 --
 ...nWithMultipleJoinTypes.Hash_NoBroadcast.plan |  140 --
 .../testJoinWithMultipleJoinTypes.Sort.plan     |   84 --
 ...nWithMultipleJoinTypes.Sort_NoBroadcast.plan |  140 --
 .../testJoinWithMultipleJoinTypes.result        |    6 -
 .../results/TestNetTypes/testGroupby.result     |    7 -
 .../results/TestNetTypes/testGroupby2.result    |    5 -
 .../results/TestNetTypes/testJoin.result        |    6 -
 .../results/TestNetTypes/testSelect.result      |    7 -
 .../results/TestNetTypes/testSort.result        |    7 -
 .../results/TestNetTypes/testSort2.result       |    7 -
 .../testGetClusterDetails.result                |    4 -
 .../testGetNextRowsForAggregateFunction.result  |    3 -
 .../testGetNextRowsForTable.result              |    5 -
 .../testFullOuterJoin1.Hash.plan                |  105 --
 .../testFullOuterJoin1.Hash_NoBroadcast.plan    |  105 --
 .../testFullOuterJoin1.Sort.plan                |  105 --
 .../testFullOuterJoin1.Sort_NoBroadcast.plan    |  105 --
 .../testFullOuterJoin1.result                   |    7 -
 ...lOuterJoinPredicationCaseByCase1.1.Hash.plan |  153 --
 ...edicationCaseByCase1.1.Hash_NoBroadcast.plan |  153 --
 ...lOuterJoinPredicationCaseByCase1.1.Sort.plan |  153 --
 ...edicationCaseByCase1.1.Sort_NoBroadcast.plan |  153 --
 ...FullOuterJoinPredicationCaseByCase1.1.result |    9 -
 .../testFullOuterJoinWithEmptyTable1.Hash.plan  |  105 --
 ...terJoinWithEmptyTable1.Hash_NoBroadcast.plan |  105 --
 .../testFullOuterJoinWithEmptyTable1.Sort.plan  |  105 --
 ...terJoinWithEmptyTable1.Sort_NoBroadcast.plan |  105 --
 .../testFullOuterJoinWithEmptyTable1.result     |    7 -
 ...testJoinFilterOfRowPreservedTable1.Hash.plan |   78 -
 ...erOfRowPreservedTable1.Hash_NoBroadcast.plan |  105 --
 ...testJoinFilterOfRowPreservedTable1.Sort.plan |   78 -
 ...erOfRowPreservedTable1.Sort_NoBroadcast.plan |  105 --
 .../testJoinFilterOfRowPreservedTable1.result   |   15 -
 .../testLeftOuterJoin1.Hash.plan                |   78 -
 .../testLeftOuterJoin1.Hash_NoBroadcast.plan    |  105 --
 .../testLeftOuterJoin1.Sort.plan                |   78 -
 .../testLeftOuterJoin1.Sort_NoBroadcast.plan    |  105 --
 .../testLeftOuterJoin1.result                   |    7 -
 .../testLeftOuterJoin2.Hash.plan                |   91 --
 .../testLeftOuterJoin2.Hash_NoBroadcast.plan    |  176 ---
 .../testLeftOuterJoin2.Sort.plan                |   91 --
 .../testLeftOuterJoin2.Sort_NoBroadcast.plan    |  176 ---
 .../testLeftOuterJoin2.result                   |    7 -
 .../testLeftOuterJoin3.Hash.plan                |  160 --
 .../testLeftOuterJoin3.Hash_NoBroadcast.plan    |  272 ----
 .../testLeftOuterJoin3.Sort.plan                |  160 --
 .../testLeftOuterJoin3.Sort_NoBroadcast.plan    |  272 ----
 .../testLeftOuterJoin3.result                   |    9 -
 ...tLeftOuterJoinLeftSideSmallTable.1.Hash.plan |  105 --
 ...inLeftSideSmallTable.1.Hash_NoBroadcast.plan |  105 --
 ...tLeftOuterJoinLeftSideSmallTable.1.Sort.plan |  105 --
 ...inLeftSideSmallTable.1.Sort_NoBroadcast.plan |  105 --
 ...testLeftOuterJoinLeftSideSmallTable.1.result |    7 -
 ...tOuterJoinPredicationCaseByCase1.1.Hash.plan |   72 -
 ...edicationCaseByCase1.1.Hash_NoBroadcast.plan |  128 --
 ...tOuterJoinPredicationCaseByCase1.1.Sort.plan |   72 -
 ...edicationCaseByCase1.1.Sort_NoBroadcast.plan |  128 --
 ...LeftOuterJoinPredicationCaseByCase1.1.result |    7 -
 ...tOuterJoinPredicationCaseByCase2.1.Hash.plan |  122 --
 ...edicationCaseByCase2.1.Hash_NoBroadcast.plan |  176 ---
 ...tOuterJoinPredicationCaseByCase2.1.Sort.plan |  122 --
 ...edicationCaseByCase2.1.Sort_NoBroadcast.plan |  176 ---
 ...LeftOuterJoinPredicationCaseByCase2.1.result |    4 -
 ...uterJoinPredicationCaseByCase2_1.1.Hash.plan |   97 --
 ...icationCaseByCase2_1.1.Hash_NoBroadcast.plan |  182 ---
 ...uterJoinPredicationCaseByCase2_1.1.Sort.plan |   97 --
 ...icationCaseByCase2_1.1.Sort_NoBroadcast.plan |  182 ---
 ...ftOuterJoinPredicationCaseByCase2_1.1.result |    5 -
 ...tOuterJoinPredicationCaseByCase3.1.Hash.plan |   72 -
 ...edicationCaseByCase3.1.Hash_NoBroadcast.plan |  128 --
 ...tOuterJoinPredicationCaseByCase3.1.Sort.plan |   72 -
 ...edicationCaseByCase3.1.Sort_NoBroadcast.plan |  128 --
 ...LeftOuterJoinPredicationCaseByCase3.1.result |    7 -
 ...tOuterJoinPredicationCaseByCase4.1.Hash.plan |   74 -
 ...edicationCaseByCase4.1.Hash_NoBroadcast.plan |  130 --
 ...tOuterJoinPredicationCaseByCase4.1.Sort.plan |   74 -
 ...edicationCaseByCase4.1.Sort_NoBroadcast.plan |  130 --
 ...LeftOuterJoinPredicationCaseByCase4.1.result |    7 -
 ...tOuterJoinPredicationCaseByCase5.1.Hash.plan |   74 -
 ...edicationCaseByCase5.1.Hash_NoBroadcast.plan |  130 --
 ...tOuterJoinPredicationCaseByCase5.1.Sort.plan |   74 -
 ...edicationCaseByCase5.1.Sort_NoBroadcast.plan |  130 --
 ...LeftOuterJoinPredicationCaseByCase5.1.result |    6 -
 ...tOuterJoinPredicationCaseByCase6.1.Hash.plan |   76 -
 ...edicationCaseByCase6.1.Hash_NoBroadcast.plan |  132 --
 ...tOuterJoinPredicationCaseByCase6.1.Sort.plan |   76 -
 ...edicationCaseByCase6.1.Sort_NoBroadcast.plan |  132 --
 ...LeftOuterJoinPredicationCaseByCase6.1.result |    3 -
 ...testLeftOuterJoinWithConstantExpr1.Hash.plan |   86 --
 ...rJoinWithConstantExpr1.Hash_NoBroadcast.plan |  113 --
 ...testLeftOuterJoinWithConstantExpr1.Sort.plan |   86 --
 ...rJoinWithConstantExpr1.Sort_NoBroadcast.plan |  113 --
 .../testLeftOuterJoinWithConstantExpr1.result   |    7 -
 ...testLeftOuterJoinWithConstantExpr4.Hash.plan |   63 -
 ...rJoinWithConstantExpr4.Hash_NoBroadcast.plan |   90 --
 ...testLeftOuterJoinWithConstantExpr4.Sort.plan |   63 -
 ...rJoinWithConstantExpr4.Sort_NoBroadcast.plan |   90 --
 .../testLeftOuterJoinWithConstantExpr4.result   |    7 -
 ...testLeftOuterJoinWithConstantExpr5.Hash.plan |   65 -
 ...rJoinWithConstantExpr5.Hash_NoBroadcast.plan |   92 --
 ...testLeftOuterJoinWithConstantExpr5.Sort.plan |   65 -
 ...rJoinWithConstantExpr5.Sort_NoBroadcast.plan |   92 --
 .../testLeftOuterJoinWithConstantExpr5.result   |    6 -
 .../testLeftOuterJoinWithEmptyTable1.Hash.plan  |   78 -
 ...terJoinWithEmptyTable1.Hash_NoBroadcast.plan |  105 --
 .../testLeftOuterJoinWithEmptyTable1.Sort.plan  |   78 -
 ...terJoinWithEmptyTable1.Sort_NoBroadcast.plan |  105 --
 .../testLeftOuterJoinWithEmptyTable1.result     |    7 -
 .../testLeftOuterJoinWithEmptyTable2.Hash.plan  |  109 --
 ...terJoinWithEmptyTable2.Hash_NoBroadcast.plan |  136 --
 .../testLeftOuterJoinWithEmptyTable2.Sort.plan  |  109 --
 ...terJoinWithEmptyTable2.Sort_NoBroadcast.plan |  136 --
 .../testLeftOuterJoinWithEmptyTable2.result     |    7 -
 .../testLeftOuterJoinWithEmptyTable3.Hash.plan  |  160 --
 ...terJoinWithEmptyTable3.Hash_NoBroadcast.plan |  187 ---
 .../testLeftOuterJoinWithEmptyTable3.Sort.plan  |  160 --
 ...terJoinWithEmptyTable3.Sort_NoBroadcast.plan |  187 ---
 .../testLeftOuterJoinWithEmptyTable3.result     |    7 -
 .../testLeftOuterJoinWithEmptyTable4.Hash.plan  |  160 --
 ...terJoinWithEmptyTable4.Hash_NoBroadcast.plan |  214 ---
 .../testLeftOuterJoinWithEmptyTable4.Sort.plan  |  160 --
 ...terJoinWithEmptyTable4.Sort_NoBroadcast.plan |  214 ---
 .../testLeftOuterJoinWithEmptyTable4.result     |    4 -
 .../testLeftOuterJoinWithEmptyTable5.Hash.plan  |  109 --
 ...terJoinWithEmptyTable5.Hash_NoBroadcast.plan |  136 --
 .../testLeftOuterJoinWithEmptyTable5.Sort.plan  |  109 --
 ...terJoinWithEmptyTable5.Sort_NoBroadcast.plan |  136 --
 .../testLeftOuterJoinWithEmptyTable5.result     |    4 -
 .../testLeftOuterJoinWithNull1.Hash.plan        |   82 -
 ...LeftOuterJoinWithNull1.Hash_NoBroadcast.plan |  109 --
 .../testLeftOuterJoinWithNull1.Sort.plan        |   82 -
 ...LeftOuterJoinWithNull1.Sort_NoBroadcast.plan |  109 --
 .../testLeftOuterJoinWithNull1.result           |    4 -
 .../testLeftOuterJoinWithNull2.Hash.plan        |   82 -
 ...LeftOuterJoinWithNull2.Hash_NoBroadcast.plan |  109 --
 .../testLeftOuterJoinWithNull2.Sort.plan        |   82 -
 ...LeftOuterJoinWithNull2.Sort_NoBroadcast.plan |  109 --
 .../testLeftOuterJoinWithNull2.result           |    4 -
 .../testLeftOuterJoinWithNull3.Hash.plan        |   82 -
 ...LeftOuterJoinWithNull3.Hash_NoBroadcast.plan |  109 --
 .../testLeftOuterJoinWithNull3.Sort.plan        |   82 -
 ...LeftOuterJoinWithNull3.Sort_NoBroadcast.plan |  109 --
 .../testLeftOuterJoinWithNull3.result           |    2 -
 ...rJoinWithThetaJoinConditionInWhere.Hash.plan |   57 -
 ...taJoinConditionInWhere.Hash_NoBroadcast.plan |   84 --
 ...rJoinWithThetaJoinConditionInWhere.Sort.plan |   57 -
 ...taJoinConditionInWhere.Sort_NoBroadcast.plan |   84 --
 ...uterJoinWithThetaJoinConditionInWhere.result |    4 -
 .../testLeftOuterWithEmptyTable.1.Hash.plan     |   53 -
 ...tOuterWithEmptyTable.1.Hash_NoBroadcast.plan |   80 -
 .../testLeftOuterWithEmptyTable.1.Sort.plan     |   53 -
 ...tOuterWithEmptyTable.1.Sort_NoBroadcast.plan |   80 -
 .../testLeftOuterWithEmptyTable.1.result        |    7 -
 ...pleBroadcastDataFileWithZeroLength.Hash.plan |   57 -
 ...DataFileWithZeroLength.Hash_NoBroadcast.plan |   84 --
 ...pleBroadcastDataFileWithZeroLength.Sort.plan |   57 -
 ...DataFileWithZeroLength.Sort_NoBroadcast.plan |   84 --
 ...ltipleBroadcastDataFileWithZeroLength.result |    2 -
 ...leBroadcastDataFileWithZeroLength2.Hash.plan |   76 -
 ...ataFileWithZeroLength2.Hash_NoBroadcast.plan |  132 --
 ...leBroadcastDataFileWithZeroLength2.Sort.plan |   76 -
 ...ataFileWithZeroLength2.Sort_NoBroadcast.plan |  132 --
 ...tipleBroadcastDataFileWithZeroLength2.result |    7 -
 .../testOuterJoinAndCaseWhen1.Hash.plan         |  126 --
 ...tOuterJoinAndCaseWhen1.Hash_NoBroadcast.plan |  153 --
 .../testOuterJoinAndCaseWhen1.Sort.plan         |  126 --
 ...tOuterJoinAndCaseWhen1.Sort_NoBroadcast.plan |  153 --
 .../testOuterJoinAndCaseWhen1.result            |    7 -
 .../testRightOuterJoin1.Hash.plan               |   78 -
 .../testRightOuterJoin1.Hash_NoBroadcast.plan   |  105 --
 .../testRightOuterJoin1.Sort.plan               |   78 -
 .../testRightOuterJoin1.Sort_NoBroadcast.plan   |  105 --
 .../testRightOuterJoin1.result                  |    7 -
 ...tOuterJoinPredicationCaseByCase1.1.Hash.plan |  101 --
 ...edicationCaseByCase1.1.Hash_NoBroadcast.plan |  128 --
 ...tOuterJoinPredicationCaseByCase1.1.Sort.plan |  101 --
 ...edicationCaseByCase1.1.Sort_NoBroadcast.plan |  128 --
 ...ightOuterJoinPredicationCaseByCase1.1.result |    4 -
 ...tOuterJoinPredicationCaseByCase2.1.Hash.plan |   76 -
 ...edicationCaseByCase2.1.Hash_NoBroadcast.plan |  132 --
 ...tOuterJoinPredicationCaseByCase2.1.Sort.plan |   76 -
 ...edicationCaseByCase2.1.Sort_NoBroadcast.plan |  132 --
 ...ightOuterJoinPredicationCaseByCase2.1.result |    4 -
 ...tOuterJoinPredicationCaseByCase3.1.Hash.plan |  101 --
 ...edicationCaseByCase3.1.Hash_NoBroadcast.plan |  128 --
 ...tOuterJoinPredicationCaseByCase3.1.Sort.plan |  101 --
 ...edicationCaseByCase3.1.Sort_NoBroadcast.plan |  128 --
 ...ightOuterJoinPredicationCaseByCase3.1.result |    4 -
 .../testRightOuterJoinWithEmptyTable1.Hash.plan |   78 -
 ...terJoinWithEmptyTable1.Hash_NoBroadcast.plan |  105 --
 .../testRightOuterJoinWithEmptyTable1.Sort.plan |   78 -
 ...terJoinWithEmptyTable1.Sort_NoBroadcast.plan |  105 --
 .../testRightOuterJoinWithEmptyTable1.result    |    7 -
 ...rJoinWithThetaJoinConditionInWhere.Hash.plan |   57 -
 ...taJoinConditionInWhere.Hash_NoBroadcast.plan |   84 --
 ...rJoinWithThetaJoinConditionInWhere.Sort.plan |   57 -
 ...taJoinConditionInWhere.Sort_NoBroadcast.plan |   84 --
 ...uterJoinWithThetaJoinConditionInWhere.result |    4 -
 ...terJoinWithEmptyIntermediateData.1.Hash.plan |  108 --
 ...mptyIntermediateData.1.Hash_NoBroadcast.plan |  108 --
 ...terJoinWithEmptyIntermediateData.1.Sort.plan |  108 --
 ...mptyIntermediateData.1.Sort_NoBroadcast.plan |  108 --
 ...lOuterJoinWithEmptyIntermediateData.1.result |    2 -
 .../testJoinWithDifferentShuffleKey.1.Hash.plan |  199 ---
 ...hDifferentShuffleKey.1.Hash_NoBroadcast.plan |  199 ---
 .../testJoinWithDifferentShuffleKey.1.Sort.plan |  199 ---
 ...hDifferentShuffleKey.1.Sort_NoBroadcast.plan |  199 ---
 .../testJoinWithDifferentShuffleKey.1.result    |    3 -
 ...testLeftOuterJoinWithConstantExpr2.Hash.plan |   98 --
 ...rJoinWithConstantExpr2.Hash_NoBroadcast.plan |  125 --
 ...testLeftOuterJoinWithConstantExpr2.Sort.plan |   98 --
 ...rJoinWithConstantExpr2.Sort_NoBroadcast.plan |  125 --
 .../testLeftOuterJoinWithConstantExpr2.result   |    7 -
 ...testLeftOuterJoinWithConstantExpr3.Hash.plan |  156 --
 ...rJoinWithConstantExpr3.Hash_NoBroadcast.plan |  156 --
 ...testLeftOuterJoinWithConstantExpr3.Sort.plan |  156 --
 ...rJoinWithConstantExpr3.Sort_NoBroadcast.plan |  156 --
 .../testLeftOuterJoinWithConstantExpr3.result   |    7 -
 ...tLeftOuterJoinWithEmptySubquery1.1.Hash.plan |  111 --
 ...inWithEmptySubquery1.1.Hash_NoBroadcast.plan |  167 ---
 ...tLeftOuterJoinWithEmptySubquery1.1.Sort.plan |  111 --
 ...inWithEmptySubquery1.1.Sort_NoBroadcast.plan |  167 ---
 ...testLeftOuterJoinWithEmptySubquery1.1.result |    7 -
 ...tLeftOuterJoinWithEmptySubquery2.1.Hash.plan |   86 --
 ...inWithEmptySubquery2.1.Hash_NoBroadcast.plan |  142 --
 ...tLeftOuterJoinWithEmptySubquery2.1.Sort.plan |   86 --
 ...inWithEmptySubquery2.1.Sort_NoBroadcast.plan |  142 --
 ...testLeftOuterJoinWithEmptySubquery2.1.result |    2 -
 .../TestQueryUnitStatusUpdate/case3.result      |    4 -
 .../create_table_nested_1.result                |   40 -
 .../create_table_nested_2.result                |   57 -
 .../results/TestSQLAnalyzer/setcatalog1.result  |    5 -
 .../results/TestSQLAnalyzer/setcatalog2.result  |    5 -
 .../results/TestSQLAnalyzer/setsession1.result  |    5 -
 .../results/TestSQLAnalyzer/setsession2.result  |    5 -
 .../results/TestSQLAnalyzer/setsession3.result  |    5 -
 .../results/TestSQLAnalyzer/setsession4.result  |    5 -
 .../results/TestSQLAnalyzer/setsession5.result  |    5 -
 .../results/TestSQLAnalyzer/setsession6.result  |    5 -
 .../results/TestSQLAnalyzer/setsession7.result  |    5 -
 .../results/TestSQLAnalyzer/settimezone1.result |    5 -
 .../results/TestSQLAnalyzer/settimezone2.result |    5 -
 .../results/TestSQLAnalyzer/settimezone3.result |    4 -
 .../results/TestSQLAnalyzer/window1.result      |   37 -
 .../results/TestSQLAnalyzer/window2.result      |   44 -
 .../results/TestSQLAnalyzer/window3.result      |   50 -
 .../results/TestSQLAnalyzer/window4.result      |   48 -
 .../results/TestSQLAnalyzer/window5.result      |   77 -
 .../results/TestSQLAnalyzer/window6.result      |   83 --
 .../results/TestSQLAnalyzer/window7.result      |   81 -
 .../results/TestSQLAnalyzer/window8.result      |   86 --
 .../results/TestSQLAnalyzer/window9.result      |   56 -
 .../testInsertType1.result                      |    5 -
 .../testInsertType2.result                      |    5 -
 .../testNestedFieldAsGroupbyKey1.result         |    6 -
 .../testNestedFieldAsJoinKey1.result            |    6 -
 .../TestSelectNestedRecord/testSelect0.result   |    5 -
 .../TestSelectNestedRecord/testSelect1.result   |    5 -
 .../TestSelectNestedRecord/testSelect2.result   |    6 -
 .../TestSelectNestedRecord/testSelect3.result   |    3 -
 .../results/TestSelectQuery/testCaseWhen.result |    7 -
 .../TestSelectQuery/testCaseWhenRound.result    |   22 -
 .../testCaseWhenWithoutElse.result              |    7 -
 ...estColumnEqualityButNotJoinCondition1.result |    3 -
 ...estColumnEqualityButNotJoinCondition2.result |    6 -
 .../TestSelectQuery/testDatabaseRef.result      |    7 -
 .../TestSelectQuery/testExplainSelect.result    |    6 -
 .../testExplainSelectPhysical.1.result          |   26 -
 .../testExplainSelectPhysical.2.result          |   88 --
 .../testExplainSelectPhysical.3.result          |   89 --
 .../results/TestSelectQuery/testInClause.result |    5 -
 .../TestSelectQuery/testInStrClause.result      |    4 -
 .../TestSelectQuery/testLikeClause.result       |    9 -
 .../results/TestSelectQuery/testLimit.result    |    5 -
 .../testMultiBytesDelimiter1.result             |    7 -
 .../testMultiBytesDelimiter2.result             |    7 -
 .../testMultiBytesDelimiter3.result             |    7 -
 .../testMultiBytesDelimiter4.result             |    7 -
 .../testNestedPythonFunction.result             |    7 -
 .../TestSelectQuery/testNonFromSelect1.result   |    3 -
 .../testNonQualifiedNames.result                |    7 -
 .../results/TestSelectQuery/testNotEqual.result |    5 -
 .../TestSelectQuery/testNotInClause.result      |    4 -
 .../TestSelectQuery/testNotInStrClause.result   |    4 -
 .../TestSelectQuery/testRealValueCompare.result |    3 -
 .../results/TestSelectQuery/testSelect.result   |    7 -
 .../results/TestSelectQuery/testSelect2.result  |    7 -
 .../results/TestSelectQuery/testSelect3.result  |    7 -
 .../TestSelectQuery/testSelectAsterisk1.result  |    7 -
 .../TestSelectQuery/testSelectAsterisk2.result  |    3 -
 .../TestSelectQuery/testSelectAsterisk3.result  |    3 -
 .../TestSelectQuery/testSelectAsterisk4.result  |    7 -
 .../TestSelectQuery/testSelectAsterisk5.result  |    3 -
 .../testSelectColumnAlias1.result               |    7 -
 ...tSelectColumnAliasExistingInRelation1.result |    4 -
 ...tSelectColumnAliasExistingInRelation2.result |    7 -
 ...tSelectColumnAliasExistingInRelation3.result |   11 -
 .../TestSelectQuery/testSelectDistinct.result   |    7 -
 .../testSelectOnSessionTable.result             |    3 -
 .../testSelectPythonFuncs.result                |    7 -
 ...lectSameConstantsWithDifferentAliases.result |    7 -
 ...ectSameConstantsWithDifferentAliases2.result |    7 -
 ...ectSameConstantsWithDifferentAliases3.result |    7 -
 ...stSelectSameExprsWithDifferentAliases.result |    7 -
 .../testSelectWithCommonQuals1.1.plan           |    7 -
 .../testSelectWithCommonQuals1.1.result         |   27 -
 .../testSelectWithCommonQuals2.1.plan           |    7 -
 .../testSelectWithCommonQuals2.1.result         |   27 -
 .../testSelectWithCommonQuals3.1.plan           |    7 -
 .../testSelectWithCommonQuals3.1.result         |    7 -
 .../TestSelectQuery/testSelectWithJson.result   |    7 -
 .../testSelectWithParentheses1.result           |    3 -
 .../testSelectWithParentheses2.result           |    3 -
 .../testSelectWithPredicateOnPythonFunc.result  |   17 -
 .../TestSelectQuery/testSimpleQuery.result      |    7 -
 .../testSimpleQueryWithLimit.result             |    5 -
 ...tSimpleQueryWithLimitPartitionedTable.result |   12 -
 .../TestSelectQuery/testStringCompare.result    |    5 -
 .../TestSelectQuery/testSumFloatOverflow.result |    3 -
 .../TestSelectQuery/testSumIntOverflow.result   |    3 -
 .../TestSelectQuery/testTimezonedTable1.result  |    5 -
 .../TestSelectQuery/testTimezonedTable2.result  |    5 -
 .../TestSelectQuery/testTimezonedTable3.result  |    5 -
 .../results/TestSelectQuery/testUnion1.result   |   10 -
 .../results/TestSelectQuery/testUnion2.result   |   12 -
 .../TestSelectQuery/testWhereCond1.result       |    3 -
 .../TestSelectQuery/testWhereCond2.result       |    3 -
 .../testWhereCondWithAlias1.result              |    4 -
 .../testWhereCondWithAlias2.result              |    4 -
 .../results/TestSortQuery/testAsterisk.result   |    7 -
 .../results/TestSortQuery/testSort.result       |    7 -
 .../TestSortQuery/testSortAfterGroupby.result   |    5 -
 .../testSortAfterGroupbyWithAlias.result        |    5 -
 .../results/TestSortQuery/testSortDesc.result   |    7 -
 .../TestSortQuery/testSortFirstDesc.result      |   10 -
 .../TestSortQuery/testSortOnNullColumn.result   |    6 -
 .../testSortOnUnicodeTextAsc.result             |    6 -
 .../testSortOnUnicodeTextDesc.result            |    6 -
 .../TestSortQuery/testSortWithAlias1.result     |    7 -
 .../TestSortQuery/testSortWithAlias2.result     |    5 -
 .../TestSortQuery/testSortWithAlias3.result     |    7 -
 .../testSortWithAliasButOriginalName.result     |    7 -
 .../testSortWithAscDescKeys.result              |   26 -
 .../TestSortQuery/testSortWithConstKeys.result  |    7 -
 .../TestSortQuery/testSortWithDate.result       |    7 -
 .../TestSortQuery/testSortWithExpr1.result      |    7 -
 .../TestSortQuery/testSortWithExpr2.result      |    7 -
 .../TestSortQuery/testSortWithJson.result       |    5 -
 .../testSubQuerySortAfterGroupMultiBlocks.plan  |  112 --
 ...testSubQuerySortAfterGroupMultiBlocks.result |    5 -
 .../results/TestSortQuery/testTopK.result       |    5 -
 .../TestSortQuery/testTopkWithJson.result       |    5 -
 .../results/TestTPCH/testFirstJoinInQ7.plan     |  156 --
 .../results/TestTPCH/testFirstJoinInQ7.result   |    4 -
 .../results/TestTPCH/testQ1OrderBy.plan         |   88 --
 .../results/TestTPCH/testQ1OrderBy.result       |    4 -
 .../results/TestTPCH/testQ2FourJoins.plan       |  228 ---
 .../results/TestTPCH/testQ2FourJoins.result     |    3 -
 .../results/TestTPCH/testTPCH14Expr.plan        |  119 --
 .../results/TestTPCH/testTPCH14Expr.result      |    3 -
 .../resources/results/TestTPCH/testTPCHQ5.plan  |  332 -----
 .../results/TestTPCH/testTPCHQ5.result          |    2 -
 .../TestSpecialCharPartitionKeys1.result        |    4 -
 .../TestSpecialCharPartitionKeys2.result        |    3 -
 .../results/TestTablePartitions/case1.result    |    4 -
 .../results/TestTablePartitions/case10.result   |    7 -
 .../results/TestTablePartitions/case11.result   |    7 -
 .../results/TestTablePartitions/case12.result   |    7 -
 .../results/TestTablePartitions/case13.result   |    7 -
 .../results/TestTablePartitions/case14.result   |    3 -
 .../results/TestTablePartitions/case15.result   |    3 -
 .../results/TestTablePartitions/case2.result    |    6 -
 .../results/TestTablePartitions/case3.result    |    5 -
 .../results/TestTablePartitions/case4.result    |    7 -
 .../results/TestTablePartitions/case5.result    |    7 -
 .../results/TestTablePartitions/case6.result    |    7 -
 .../results/TestTablePartitions/case7.result    |    5 -
 .../results/TestTablePartitions/case8.result    |    7 -
 .../results/TestTablePartitions/case9.result    |    7 -
 ...rtitionedTableWithSmallerExpressions5.result |    7 -
 ...rtitionedTableWithSmallerExpressions6.result |    4 -
 .../testGroupBySubQuery.result                  |    3 -
 .../testGroupbySubqueryWithJson.result          |    3 -
 .../TestTableSubQuery/testJoinSubQuery.result   |    4 -
 .../TestTableSubQuery/testJoinSubQuery2.result  |    4 -
 .../testJoinSubqueryWithJson.result             |    4 -
 .../TestTableSubQuery/testTableSubquery1.result |    7 -
 .../testAlterTableAddDropPartition.result       |    9 -
 .../results/TestTajoCli/testDescTable.result    |   27 -
 .../testDescTableForNestedSchema.result         |   29 -
 .../TestTajoCli/testHelpSessionVars.result      |   44 -
 .../testLocalQueryWithoutFrom.result            |    8 -
 .../TestTajoCli/testNonForwardQueryPause.result |    6 -
 .../testSelectResultWithNullFalse.result        |    8 -
 .../testSelectResultWithNullTrue.result         |    8 -
 ...estSelectResultWithNullTrueDeprecated.result |    9 -
 .../results/TestTajoCli/testSetTimezone1.result |    4 -
 .../TestTajoCli/testStopWhenError.result        |    5 -
 .../testStopWhenErrorDeprecated.result          |    6 -
 .../testQueryFailure.result                     |    0
 .../TestTajoCliNegatives/testQuerySyntax.result |    3 -
 .../testExecuteQueryAsync.result                |    7 -
 .../testExecuteQueryAsyncWithListener.result    |    2 -
 .../testExecuteQueryType1.result                |    7 -
 .../testExecuteQueryType2.result                |    4 -
 .../testExecuteQueryType3.result                |    4 -
 .../TestTajoDatabaseMetaData/getSchemas1.result |    3 -
 .../TestTajoDatabaseMetaData/getSchemas2.result |    3 -
 .../getTableTypes.result                        |    3 -
 .../TestTajoDatabaseMetaData/getTables1.result  |    4 -
 .../TestTajoDatabaseMetaData/getTables2.result  |    4 -
 .../results/TestTajoDump/testDump1.result       |   16 -
 .../results/TestTajoDump/testDump2.result       |   16 -
 .../results/TestTajoDump/testDump3.result       |   20 -
 .../TestTajoJdbc/testSortWithDateTime.result    |    7 -
 .../TestUnionQuery/testComplexUnion1.plan       |   80 -
 .../TestUnionQuery/testComplexUnion1.result     |    6 -
 .../TestUnionQuery/testComplexUnion2.plan       |  116 --
 .../TestUnionQuery/testComplexUnion2.result     |    7 -
 .../results/TestUnionQuery/testUnion1.result    |    7 -
 .../results/TestUnionQuery/testUnion10.result   |    7 -
 .../results/TestUnionQuery/testUnion11.result   |    3 -
 .../results/TestUnionQuery/testUnion12.result   |    7 -
 .../results/TestUnionQuery/testUnion13.result   |    7 -
 .../results/TestUnionQuery/testUnion14.result   |    9 -
 .../results/TestUnionQuery/testUnion15.result   |    5 -
 .../results/TestUnionQuery/testUnion16.result   |    5 -
 .../results/TestUnionQuery/testUnion2.result    |    5 -
 .../results/TestUnionQuery/testUnion3.result    |    4 -
 .../results/TestUnionQuery/testUnion4.result    |    3 -
 .../results/TestUnionQuery/testUnion5.result    |    3 -
 .../results/TestUnionQuery/testUnion6.result    |    3 -
 .../results/TestUnionQuery/testUnion7.result    |    5 -
 .../results/TestUnionQuery/testUnion8.result    |    3 -
 .../results/TestUnionQuery/testUnion9.result    |    7 -
 .../results/TestUnionQuery/testUnionAll1.result |   10 -
 .../TestUnionQuery/testUnionAll10.result        |   22 -
 .../TestUnionQuery/testUnionAll11.result        |    3 -
 .../TestUnionQuery/testUnionAll12.result        |    7 -
 .../TestUnionQuery/testUnionAll13.result        |    7 -
 .../TestUnionQuery/testUnionAll14.result        |    9 -
 .../TestUnionQuery/testUnionAll15.result        |    5 -
 .../TestUnionQuery/testUnionAll16.result        |    5 -
 .../results/TestUnionQuery/testUnionAll2.result |   12 -
 .../results/TestUnionQuery/testUnionAll3.result |    4 -
 .../results/TestUnionQuery/testUnionAll4.result |    3 -
 .../results/TestUnionQuery/testUnionAll5.result |    3 -
 .../results/TestUnionQuery/testUnionAll6.result |    3 -
 .../results/TestUnionQuery/testUnionAll7.result |   12 -
 .../results/TestUnionQuery/testUnionAll8.result |    3 -
 .../results/TestUnionQuery/testUnionAll9.result |    7 -
 .../testUnionAllWithDifferentAlias.result       |    4 -
 ...UnionAllWithDifferentAliasAndFunction.result |    7 -
 .../testUnionAllWithSameAliasNames.result       |   12 -
 .../testUnionWithDifferentAlias.result          |    4 -
 ...estUnionWithDifferentAliasAndFunction.result |    7 -
 .../testUnionWithSameAliasNames.result          |    5 -
 .../TestWindowQuery/testComplexOrderBy1.result  |    7 -
 .../TestWindowQuery/testFirstValue1.result      |    7 -
 .../results/TestWindowQuery/testLag1.result     |    7 -
 .../TestWindowQuery/testLagWithDefault.result   |    7 -
 .../TestWindowQuery/testLagWithNoArgs.result    |    7 -
 .../TestWindowQuery/testLastValue1.result       |    7 -
 .../results/TestWindowQuery/testLead1.result    |    7 -
 .../TestWindowQuery/testLeadWithDefault.result  |    7 -
 .../TestWindowQuery/testLeadWithNoArgs.result   |    7 -
 .../TestWindowQuery/testRowNumber1.result       |    7 -
 .../TestWindowQuery/testRowNumber2.result       |    7 -
 .../TestWindowQuery/testRowNumber3.result       |    7 -
 .../TestWindowQuery/testStdDevPop1.result       |    7 -
 .../TestWindowQuery/testStdDevSamp1.result      |    7 -
 .../results/TestWindowQuery/testWindow1.result  |    7 -
 .../results/TestWindowQuery/testWindow2.result  |    7 -
 .../results/TestWindowQuery/testWindow3.result  |    7 -
 .../results/TestWindowQuery/testWindow4.result  |    7 -
 .../results/TestWindowQuery/testWindow5.result  |    7 -
 .../results/TestWindowQuery/testWindow6.result  |    7 -
 .../results/TestWindowQuery/testWindow7.result  |    7 -
 .../results/TestWindowQuery/testWindow8.result  |    7 -
 .../testWindowBeforeLimit.result                |    5 -
 .../testWindowWithAggregation1.result           |    3 -
 .../testWindowWithAggregation2.result           |    5 -
 .../testWindowWithAggregation3.result           |    3 -
 .../testWindowWithAggregation4.result           |    5 -
 .../testWindowWithAggregation5.result           |    5 -
 .../testWindowWithAggregation6.result           |    5 -
 .../testWindowWithOrderBy1.result               |    7 -
 .../testWindowWithOrderBy2.result               |    7 -
 .../testWindowWithOrderBy3.result               |    7 -
 .../testWindowWithOrderBy4.result               |    7 -
 .../testWindowWithOrderBy5.result               |    7 -
 .../testWindowWithSubQuery.result               |    7 -
 .../testWindowWithSubQuery2.result              |    5 -
 .../testWindowWithSubQuery3.result              |    7 -
 .../testWindowWithSubQuery4.result              |    7 -
 .../testWindowWithSubQuery5.result              |    5 -
 .../testWindowWithSubQuery6.result              |    3 -
 .../testBuildDDLForBaseTable.result             |    4 -
 .../testBuildDDLForExternalTable.result         |    5 -
 .../testBuildDDLQuotedTableName1.result         |    5 -
 .../testBuildDDLQuotedTableName2.result         |    4 -
 tajo-core/src/test/resources/yarn-site.xml      |   25 -
 tajo-core/src/test/tpch/customer.tbl            |    5 -
 tajo-core/src/test/tpch/empty_orders.tbl        |    0
 tajo-core/src/test/tpch/lineitem.tbl            |    5 -
 tajo-core/src/test/tpch/nation.tbl              |   25 -
 tajo-core/src/test/tpch/orders.tbl              |    3 -
 tajo-core/src/test/tpch/part.tbl                |    4 -
 tajo-core/src/test/tpch/partsupp.tbl            |    3 -
 tajo-core/src/test/tpch/region.tbl              |    5 -
 tajo-core/src/test/tpch/supplier.tbl            |    3 -
 .../org/apache/tajo/plan/ExprAnnotator.java     |   17 +-
 .../org/apache/tajo/plan/LogicalOptimizer.java  |  101 +-
 .../java/org/apache/tajo/plan/LogicalPlan.java  |   15 +-
 .../tajo/plan/LogicalPlanPreprocessor.java      |   38 +-
 .../org/apache/tajo/plan/LogicalPlanner.java    |   45 +-
 .../tajo/plan/algebra/AlgebraVisitor.java       |    2 +-
 .../tajo/plan/algebra/BaseAlgebraVisitor.java   |   11 +-
 .../tajo/plan/expr/BasicEvalNodeVisitor.java    |    9 +
 .../apache/tajo/plan/expr/EvalNodeVisitor2.java |    2 +
 .../org/apache/tajo/plan/expr/EvalType.java     |    4 +-
 .../java/org/apache/tajo/plan/expr/InEval.java  |    9 +-
 .../apache/tajo/plan/expr/RowConstantEval.java  |   34 +-
 .../tajo/plan/expr/SimpleEvalNodeVisitor.java   |    8 +
 .../org/apache/tajo/plan/expr/SubqueryEval.java |   99 ++
 .../org/apache/tajo/plan/expr/ValueSetEval.java |   54 +
 .../GreedyHeuristicJoinOrderAlgorithm.java      |    7 +-
 .../apache/tajo/plan/joinorder/JoinGraph.java   |   12 +-
 .../tajo/plan/joinorder/JoinOrderingUtil.java   |   18 +-
 .../apache/tajo/plan/logical/RelationNode.java  |   10 +
 .../tajo/plan/nameresolver/NameResolver.java    |   39 +-
 .../BaseLogicalPlanRewriteRuleProvider.java     |    2 +
 .../rewrite/rules/InSubqueryRewriteRule.java    |  189 +++
 .../rewrite/rules/ProjectionPushDownRule.java   |    2 +-
 .../tajo/plan/serder/EvalNodeDeserializer.java  |    9 +-
 .../tajo/plan/serder/EvalNodeSerializer.java    |   15 +
 .../plan/serder/LogicalNodeDeserializer.java    |    2 +
 .../tajo/plan/serder/LogicalNodeSerializer.java |    2 +
 .../org/apache/tajo/plan/util/ExprFinder.java   |   14 +-
 .../org/apache/tajo/plan/util/PlannerUtil.java  |   17 +
 .../tajo/plan/verifier/LogicalPlanVerifier.java |   11 +-
 .../tajo/plan/visitor/SimpleAlgebraVisitor.java |    6 +
 tajo-plan/src/main/proto/Plan.proto             |    9 +
 tajo-project/pom.xml                            |   19 +-
 3491 files changed, 96653 insertions(+), 95235 deletions(-)
----------------------------------------------------------------------



[22/39] tajo git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730

Posted by hy...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/ccd18603
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/ccd18603
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/ccd18603

Branch: refs/heads/TAJO-1730
Commit: ccd1860389724daeb06c30c2aaac7ce51cf02557
Parents: 825e25f 0b59a93
Author: Hyunsik Choi <hy...@apache.org>
Authored: Fri Aug 21 09:35:49 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Fri Aug 21 09:35:49 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |  23 +
 .../apache/tajo/algebra/ColumnDefinition.java   |   9 +-
 .../org/apache/tajo/algebra/DataTypeExpr.java   |  81 ++-
 .../tajo/catalog/store/HiveCatalogStore.java    |  22 +-
 .../tajo/catalog/store/HiveCatalogUtil.java     |  19 +-
 .../apache/tajo/client/DummyServiceTracker.java |  11 +-
 .../org/apache/tajo/client/ResultSetUtil.java   |  83 ++-
 .../tajo/client/v2/LegacyClientDelegate.java    |  20 +-
 .../org/apache/tajo/jdbc/MetaDataTuple.java     | 200 ++++++
 .../apache/tajo/jdbc/TajoMetaDataResultSet.java |  74 +++
 .../org/apache/tajo/storage/RowStoreUtil.java   |  15 +-
 tajo-cluster-tests/pom.xml                      |   7 +-
 .../java/org/apache/tajo/QueryTestCaseBase.java |  23 +-
 .../test/java/org/apache/tajo/TpchTestBase.java |  23 +-
 .../src/test/resources/tpch/customer.tbl        |   5 +
 .../src/test/resources/tpch/empty_orders.tbl    |   0
 .../src/test/resources/tpch/lineitem.tbl        |   5 +
 .../src/test/resources/tpch/nation.tbl          |  25 +
 .../src/test/resources/tpch/orders.tbl          |   3 +
 .../src/test/resources/tpch/part.tbl            |   4 +
 .../src/test/resources/tpch/partsupp.tbl        |   3 +
 .../src/test/resources/tpch/region.tbl          |   5 +
 .../src/test/resources/tpch/supplier.tbl        |   3 +
 .../org/apache/tajo/datum/TimestampDatum.java   |   7 +
 .../apache/tajo/exception/ExceptionUtil.java    |   9 +-
 .../exception/InvalidDataTypeException.java     |   3 +-
 .../tajo/exception/NotImplementedException.java |   2 +-
 .../apache/tajo/exception/SQLSyntaxError.java   |   2 +-
 .../tajo/exception/TajoRuntimeException.java    |  20 +-
 .../exception/UnsupportedDataTypeException.java |   2 +-
 .../tajo/exception/UnsupportedException.java    |  10 +-
 .../java/org/apache/tajo/storage/VTuple.java    |   5 +-
 .../java/org/apache/tajo/util/FileUtil.java     |  18 +-
 tajo-common/src/main/proto/DataTypes.proto      |   1 +
 tajo-core-tests/pom.xml                         |   4 +
 .../tajo/cli/tsql/TestTajoCliNegatives.java     |   9 -
 .../org/apache/tajo/client/TestTajoClient.java  |   1 -
 .../apache/tajo/client/v2/TestTajoClientV2.java |   3 +
 .../apache/tajo/engine/eval/ExprTestBase.java   |   1 -
 .../tajo/engine/eval/TestEvalTreeUtil.java      |   6 +-
 .../tajo/engine/parser/TestSQLAnalyzer.java     |  18 +
 .../engine/query/TestCommonConditionReduce.java | 110 ++++
 .../tajo/engine/query/TestCreateTable.java      |   5 +
 .../tajo/engine/query/TestInSubquery.java       |  10 +-
 .../apache/tajo/engine/query/TestJoinQuery.java |   1 -
 .../tajo/engine/query/TestSelectQuery.java      |  46 +-
 .../org/apache/tajo/jdbc/TestResultSet.java     | 224 -------
 .../java/org/apache/tajo/jdbc/TestSQLState.java |  91 ---
 .../tajo/jdbc/TestTajoDatabaseMetaData.java     | 504 ---------------
 .../java/org/apache/tajo/jdbc/TestTajoJdbc.java | 608 -------------------
 .../apache/tajo/querymaster/TestKillQuery.java  |   6 +-
 .../dataset/TestTajoJdbc/table1/table1.tbl      |   5 -
 .../TestCreateTable/negative/map_type.sql       |   3 +
 .../TestSQLAnalyzer/create_table_maptype_1.sql  |   1 +
 .../TestSQLAnalyzer/create_table_maptype_2.sql  |   1 +
 .../TestSQLAnalyzer/create_table_maptype_3.sql  |   1 +
 .../datetime_table_timezoned_ddl2.sql           |   4 +
 .../TestSelectQuery/nagative/operations.sql     |   1 -
 .../queries/TestSelectQuery/nagative/tables.sql |   1 -
 .../TestSelectQuery/negative/operations.sql     |   1 +
 .../queries/TestSelectQuery/negative/tables.sql |   1 +
 .../testLoadIntoTimezonedTable.sql              |   2 +
 .../TestTajoJdbc/create_table_with_date_ddl.sql |  10 -
 .../TestCommonConditionReduce/test11.plan       |   7 +
 .../TestCommonConditionReduce/test11.result     |  27 +
 .../TestCommonConditionReduce/test21.plan       |   7 +
 .../TestCommonConditionReduce/test21.result     |  27 +
 .../TestCommonConditionReduce/test31.plan       |   7 +
 .../TestCommonConditionReduce/test31.result     |   7 +
 .../TestCommonConditionReduce/test41.plan       |   7 +
 .../TestCommonConditionReduce/test41.result     |   3 +
 .../TestCommonConditionReduce/test51.plan       |   7 +
 .../TestCommonConditionReduce/test51.result     |   3 +
 .../TestCommonConditionReduce/test61.plan       |   7 +
 .../TestCommonConditionReduce/test61.result     |   4 +
 .../TestCommonConditionReduce/test71.plan       |   7 +
 .../TestCommonConditionReduce/test71.result     |   3 +
 .../TestCommonConditionReduce/test81.plan       |   7 +
 .../TestCommonConditionReduce/test81.result     |   6 +
 .../create_table_maptype_1.result               |  38 ++
 .../create_table_maptype_2.result               |  52 ++
 .../create_table_maptype_3.result               |  66 ++
 .../create_table_nested_1.result                |  26 +-
 .../create_table_nested_2.result                |  60 +-
 .../testSelectWithCommonQuals1.1.plan           |   7 -
 .../testSelectWithCommonQuals1.1.result         |  27 -
 .../testSelectWithCommonQuals2.1.plan           |   7 -
 .../testSelectWithCommonQuals2.1.result         |  27 -
 .../testSelectWithCommonQuals3.1.plan           |   7 -
 .../testSelectWithCommonQuals3.1.result         |   7 -
 .../results/TestTPCH/testQ2FourJoins.plan       |   4 +-
 .../resources/results/TestTPCH/testTPCHQ5.plan  |   8 +-
 .../TestTajoDatabaseMetaData/getSchemas1.result |   3 -
 .../TestTajoDatabaseMetaData/getSchemas2.result |   3 -
 .../getTableTypes.result                        |   3 -
 .../TestTajoDatabaseMetaData/getTables1.result  |   4 -
 .../TestTajoDatabaseMetaData/getTables2.result  |   4 -
 .../TestTajoJdbc/testSortWithDateTime.result    |   7 -
 .../src/test/resources/tpch/customer.tbl        |   5 -
 .../src/test/resources/tpch/empty_orders.tbl    |   0
 .../src/test/resources/tpch/lineitem.tbl        |   5 -
 .../src/test/resources/tpch/nation.tbl          |  25 -
 .../src/test/resources/tpch/orders.tbl          |   3 -
 .../src/test/resources/tpch/part.tbl            |   4 -
 .../src/test/resources/tpch/partsupp.tbl        |   3 -
 .../src/test/resources/tpch/region.tbl          |   5 -
 .../src/test/resources/tpch/supplier.tbl        |   3 -
 tajo-core/pom.xml                               |  12 +-
 .../org/apache/tajo/engine/parser/SQLLexer.g4   |   1 +
 .../org/apache/tajo/engine/parser/SQLParser.g4  |   6 +
 .../java/org/apache/tajo/benchmark/TPCH.java    |   8 -
 .../engine/codegen/TajoGeneratorAdapter.java    |   3 +-
 .../tajo/engine/function/FunctionLoader.java    |  11 +-
 .../apache/tajo/engine/parser/SQLAnalyzer.java  |  23 +-
 .../engine/planner/global/GlobalPlanner.java    |   2 +-
 .../global/builder/DistinctGroupbyBuilder.java  |   1 -
 .../global/rewriter/GlobalPlanRewriteRule.java  |   1 -
 .../rewriter/rules/BroadcastJoinRule.java       |  63 +-
 .../rewriter/rules/GlobalPlanRewriteUtil.java   |  40 +-
 .../planner/physical/ComparableVector.java      |   6 +-
 .../planner/physical/SortIntersectExec.java     |   5 +-
 .../tajo/engine/planner/physical/UnionExec.java |   5 +-
 .../planner/physical/VectorizedSorter.java      |   3 +-
 .../org/apache/tajo/master/GlobalEngine.java    |  32 +-
 .../apache/tajo/master/exec/DDLExecutor.java    |   6 +-
 .../exec/ExplainPlanPreprocessorForTest.java    |   1 -
 .../NonForwardQueryResultSystemScanner.java     |   4 +-
 .../apache/tajo/master/exec/QueryExecutor.java  |  17 +-
 .../apache/tajo/querymaster/Repartitioner.java  |   7 +-
 .../tajo/session/InvalidSessionException.java   |   3 +-
 tajo-jdbc/pom.xml                               |  78 +++
 .../org/apache/tajo/jdbc/MetaDataTuple.java     | 200 ------
 .../apache/tajo/jdbc/TajoDatabaseMetaData.java  |   1 -
 .../apache/tajo/jdbc/TajoMetaDataResultSet.java |  74 ---
 .../org/apache/tajo/jdbc/TestResultSet.java     | 224 +++++++
 .../java/org/apache/tajo/jdbc/TestSQLState.java |  91 +++
 .../tajo/jdbc/TestTajoDatabaseMetaData.java     | 504 +++++++++++++++
 .../java/org/apache/tajo/jdbc/TestTajoJdbc.java | 607 ++++++++++++++++++
 .../tajo/jdbc/util/TestResultSetUtil.java       | 179 ++++++
 .../dataset/TestTajoJdbc/table1/table1.tbl      |   5 +
 .../TestTajoJdbc/create_table_with_date_ddl.sql |  10 +
 .../TestTajoDatabaseMetaData/getSchemas1.result |   3 +
 .../TestTajoDatabaseMetaData/getSchemas2.result |   3 +
 .../getTableTypes.result                        |   3 +
 .../TestTajoDatabaseMetaData/getTables1.result  |   4 +
 .../TestTajoDatabaseMetaData/getTables2.result  |   4 +
 .../TestTajoJdbc/testSortWithDateTime.result    |   7 +
 .../tajo/plan/IllegalQueryStatusException.java  |  38 --
 .../apache/tajo/plan/InvalidQueryException.java |  35 --
 .../org/apache/tajo/plan/PlanningException.java |  30 -
 .../apache/tajo/plan/expr/AlgebraicUtil.java    |  21 +-
 .../tajo/plan/expr/BasicEvalNodeVisitor.java    |   3 +-
 .../org/apache/tajo/plan/expr/BinaryEval.java   |   8 +-
 .../org/apache/tajo/plan/expr/SubqueryEval.java |   7 +-
 .../tajo/plan/function/AggFunctionInvoke.java   |   3 +-
 .../tajo/plan/function/FunctionInvoke.java      |   3 +-
 .../function/python/PythonScriptEngine.java     | 147 +++--
 .../plan/function/stream/CSVLineSerializer.java |   3 +-
 .../stream/TextFieldSerializerDeserializer.java |   3 +-
 .../GreedyHeuristicJoinOrderAlgorithm.java      |   3 -
 .../tajo/plan/joinorder/JoinOrderAlgorithm.java |   6 -
 .../tajo/plan/logical/SetSessionNode.java       |   5 +-
 .../tajo/plan/nameresolver/NameResolver.java    |   6 +-
 .../rules/CommonConditionReduceRule.java        |  88 +--
 .../plan/rewrite/rules/FilterPushDownRule.java  |   3 +-
 .../plan/serder/LogicalNodeDeserializer.java    |   7 +-
 .../tajo/plan/serder/LogicalNodeSerializer.java |   4 +-
 .../org/apache/tajo/plan/util/PlannerUtil.java  |   6 +-
 .../tajo/plan/verifier/LogicalPlanVerifier.java |   2 +-
 .../plan/verifier/PreLogicalPlanVerifier.java   |  15 +
 .../tajo/plan/verifier/VerifyException.java     |  27 -
 .../apache/tajo/storage/AbstractScanner.java    |  23 +-
 .../org/apache/tajo/storage/FrameTuple.java     |  17 +-
 .../java/org/apache/tajo/storage/LazyTuple.java |   3 +-
 .../org/apache/tajo/storage/MergeScanner.java   |   3 +-
 .../org/apache/tajo/storage/NullScanner.java    |   3 +-
 .../org/apache/tajo/storage/RowStoreUtil.java   |  17 +-
 .../org/apache/tajo/storage/Tablespace.java     |   3 +-
 .../apache/tajo/tuple/offheap/HeapTuple.java    |   9 +-
 .../apache/tajo/tuple/offheap/UnSafeTuple.java  |   9 +-
 .../apache/tajo/storage/hbase/HBaseScanner.java |   2 +-
 .../java/org/apache/tajo/storage/RawFile.java   |   3 +-
 .../java/org/apache/tajo/storage/RowFile.java   |   3 +-
 .../apache/tajo/storage/avro/AvroScanner.java   |   3 +-
 .../tajo/storage/json/JsonLineDeserializer.java |   4 +-
 .../tajo/storage/json/JsonLineSerializer.java   |   4 +-
 .../org/apache/tajo/storage/orc/ORCScanner.java |   6 +-
 .../tajo/storage/parquet/ParquetScanner.java    |   3 +-
 .../org/apache/tajo/storage/rcfile/RCFile.java  |   3 +-
 .../sequencefile/SequenceFileScanner.java       |   3 +-
 .../tajo/storage/text/DelimitedLineReader.java  |   6 +-
 .../tajo/storage/text/DelimitedTextFile.java    |   3 +-
 .../text/TextFieldSerializerDeserializer.java   |   4 +-
 193 files changed, 3263 insertions(+), 2570 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/ccd18603/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
----------------------------------------------------------------------


[39/39] tajo git commit: Refined the patch.

Posted by hy...@apache.org.
Refined the patch.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/555ac7d8
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/555ac7d8
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/555ac7d8

Branch: refs/heads/TAJO-1730
Commit: 555ac7d85f528a074525b5a87e017a60cd09e55b
Parents: 705bf9b
Author: Hyunsik Choi <hy...@apache.org>
Authored: Wed Sep 2 20:01:37 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Wed Sep 2 20:01:37 2015 +0900

----------------------------------------------------------------------
 .../org/apache/tajo/catalog/CatalogServer.java  |  7 ++-
 .../tajo/catalog/LinkedMetadataManager.java     | 14 +----
 .../org/apache/tajo/storage/StorageService.java |  1 -
 .../org/apache/tajo/util/JavaResourceUtil.java  |  3 ++
 .../main/java/org/apache/tajo/util/UriUtil.java |  4 +-
 .../org/apache/tajo/util/TestFileUtils.java     | 54 -------------------
 .../engine/planner/PhysicalPlannerImpl.java     |  2 -
 .../physical/OperatorPushableScanExec.java      | 56 --------------------
 .../org/apache/tajo/plan/logical/ScanNode.java  |  2 +-
 .../org/apache/tajo/plan/util/PlannerUtil.java  |  9 ++++
 tajo-plan/src/main/proto/Plan.proto             |  5 --
 .../org/apache/tajo/storage/PlanPushable.java   | 36 -------------
 .../java/org/apache/tajo/storage/Scanner.java   |  1 +
 .../apache/tajo/storage/TablespaceManager.java  |  4 +-
 .../src/main/resources/storage-default.json     |  4 --
 .../org/apache/tajo/storage/FileTablespace.java |  1 -
 .../apache/tajo/storage/jdbc/JdbcFragment.java  |  1 -
 .../apache/tajo/storage/jdbc/JdbcScanner.java   |  1 -
 .../tajo/storage/jdbc/JdbcTablespace.java       |  5 +-
 .../storage/jdbc/SQLExpressionGenerator.java    |  1 -
 .../tajo/storage/pgsql/PgSQLTablespace.java     |  5 +-
 .../dataset/TestPgSQLQueryTests/lineitem.csv    |  0
 22 files changed, 28 insertions(+), 188 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
index 8a500db..4028f9b 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
@@ -103,7 +103,8 @@ public class CatalogServer extends AbstractService {
     this.builtingFuncs = new ArrayList<FunctionDesc>();
   }
 
-  public CatalogServer(Collection<MetadataProvider> metadataProviders, Collection<FunctionDesc> sqlFuncs) throws IOException {
+  public CatalogServer(Collection<MetadataProvider> metadataProviders, Collection<FunctionDesc> sqlFuncs)
+      throws IOException {
     super(CatalogServer.class.getName());
     this.handler = new CatalogProtocolHandler();
     this.linkedMetadataManager = new LinkedMetadataManager(metadataProviders);
@@ -193,6 +194,10 @@ public class CatalogServer extends AbstractService {
     super.serviceStop();
   }
 
+  /**
+   * Refresh the linked metadata manager. This must be used for only testing.
+   * @param metadataProviders
+   */
   @VisibleForTesting
   public void refresh(Collection<MetadataProvider> metadataProviders) {
     this.linkedMetadataManager = new LinkedMetadataManager(metadataProviders);

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/LinkedMetadataManager.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/LinkedMetadataManager.java b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/LinkedMetadataManager.java
index a12d8f8..73fd188 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/LinkedMetadataManager.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/LinkedMetadataManager.java
@@ -167,19 +167,7 @@ public class LinkedMetadataManager {
                                           @Nullable final String schemaPattern,
                                           @Nullable final String tablePattern) throws UndefinedDatabaseException {
     ensureIfDBExists(dbName);
-
-//    if (tablePattern == null) { // all tables in this database
-      return providerMap.get(dbName).getTables(schemaPattern, tablePattern);
-//
-//    } else {
-//      final Pattern pattern = Pattern.compile(tablePattern);
-//      return filter(providerMap.get(dbName).getTables(schemaPattern, tablePattern), new Predicate<String>() {
-//        @Override
-//        public boolean apply(@Nullable String input) {
-//          return pattern.matcher(tablePattern).matches();
-//        }
-//      });
-//    }
+    return providerMap.get(dbName).getTables(schemaPattern, tablePattern);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-common/src/main/java/org/apache/tajo/storage/StorageService.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/storage/StorageService.java b/tajo-common/src/main/java/org/apache/tajo/storage/StorageService.java
index 44349ba..0c3c031 100644
--- a/tajo-common/src/main/java/org/apache/tajo/storage/StorageService.java
+++ b/tajo-common/src/main/java/org/apache/tajo/storage/StorageService.java
@@ -21,7 +21,6 @@ package org.apache.tajo.storage;
 import org.apache.tajo.exception.UnsupportedException;
 
 import javax.annotation.Nullable;
-import java.io.IOException;
 import java.net.URI;
 
 /**

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-common/src/main/java/org/apache/tajo/util/JavaResourceUtil.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/JavaResourceUtil.java b/tajo-common/src/main/java/org/apache/tajo/util/JavaResourceUtil.java
index cd19b5e..5a6e50e 100644
--- a/tajo-common/src/main/java/org/apache/tajo/util/JavaResourceUtil.java
+++ b/tajo-common/src/main/java/org/apache/tajo/util/JavaResourceUtil.java
@@ -22,6 +22,9 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 
+/**
+ * An utility for Java resources
+ */
 public class JavaResourceUtil {
 
   public static URL getResourceURL(String resource) throws IOException {

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-common/src/main/java/org/apache/tajo/util/UriUtil.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/UriUtil.java b/tajo-common/src/main/java/org/apache/tajo/util/UriUtil.java
index c0ee853..0cf9629 100644
--- a/tajo-common/src/main/java/org/apache/tajo/util/UriUtil.java
+++ b/tajo-common/src/main/java/org/apache/tajo/util/UriUtil.java
@@ -20,8 +20,10 @@ package org.apache.tajo.util;
 
 import java.net.URI;
 
+/**
+ * Utility for URI representation
+ */
 public class UriUtil {
-
   public static String getScheme(URI uri) {
     return getScheme(uri.toASCIIString());
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-common/src/test/java/org/apache/tajo/util/TestFileUtils.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/test/java/org/apache/tajo/util/TestFileUtils.java b/tajo-common/src/test/java/org/apache/tajo/util/TestFileUtils.java
deleted file mode 100644
index 90b1a39..0000000
--- a/tajo-common/src/test/java/org/apache/tajo/util/TestFileUtils.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.util;
-
-import org.apache.tajo.util.TestProtos.TestMessageProto;
-import org.junit.After;
-import org.junit.Before;
-
-import java.io.File;
-
-public class TestFileUtils {
-	private static final String TEST_PATH = "target/test-data/TestFileUTils";
-	TestMessageProto proto = null;	
-	
-	@Before
-	public void setUp() throws Exception {
-		TestMessageProto.Builder builder = TestMessageProto.newBuilder();
-		builder.setName("TestFileUtils");
-		builder.setAge(30);
-		builder.setAddr(TestFileUtils.class.getName());
-		
-		proto = builder.build();
-				
-		File testDir = new File(TEST_PATH);
-		if(testDir.exists()) {
-			testDir.delete();
-		}
-		testDir.mkdirs();
-	}
-	
-	@After
-	public void tearDown() throws Exception {
-    File testDir = new File(TEST_PATH);
-    if (testDir.exists()) {
-      testDir.delete();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-core/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java b/tajo-core/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
index 70c48e7..9847ff6 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
@@ -120,8 +120,6 @@ public class PhysicalPlannerImpl implements PhysicalPlanner {
     PhysicalExec leftExec;
     PhysicalExec rightExec;
 
-    //ctx.getEnforcer().getEnforceProperties().get
-
     switch (logicalNode.getType()) {
 
       case ROOT:

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/OperatorPushableScanExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/OperatorPushableScanExec.java b/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/OperatorPushableScanExec.java
deleted file mode 100644
index 66ae844..0000000
--- a/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/OperatorPushableScanExec.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.engine.planner.physical;
-
-import org.apache.tajo.catalog.Schema;
-import org.apache.tajo.plan.logical.LogicalNode;
-import org.apache.tajo.storage.Tuple;
-import org.apache.tajo.worker.TaskAttemptContext;
-
-import java.io.IOException;
-
-public class OperatorPushableScanExec extends PhysicalExec {
-  private final LogicalNode plan;
-  
-
-  public OperatorPushableScanExec(TaskAttemptContext context, Schema inSchema, Schema outSchema, LogicalNode plan) {
-    super(context, inSchema, outSchema);
-    this.plan = plan;
-  }
-
-  @Override
-  public Tuple next() throws IOException {
-    return null;
-  }
-
-  @Override
-  public void rescan() throws IOException {
-
-  }
-
-  @Override
-  public void close() throws IOException {
-
-  }
-
-  @Override
-  public float getProgress() {
-    return 0;
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ScanNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ScanNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ScanNode.java
index f5e6b78..4b8a9e9 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ScanNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ScanNode.java
@@ -38,7 +38,7 @@ public class ScanNode extends RelationNode implements Projectable, SelectableNod
 	@Expose protected EvalNode qual;
 	@Expose protected Target[] targets;
   @Expose protected boolean broadcastTable;
-  @Expose protected long limit = -1; // -1 is infinite
+  @Expose protected long limit = -1; // -1 means no set
 
   protected ScanNode(int pid, NodeType nodeType) {
     super(pid, nodeType);

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java b/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java
index 8defa99..0210865 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java
@@ -968,6 +968,15 @@ public class PlannerUtil {
     return inSubqueries;
   }
 
+  /**
+   * Return a list of integers, maps input schema and projected columns.
+   * Each integer value means a column index of input schema corresponding to each project column
+   *
+   * @param inputSchema Input Schema
+   * @param targets Columns to be projected
+   * @return A list of integers, each of which is an index number of input schema corresponding
+   *         to each projected column.
+   */
   public static int [] getTargetIds(Schema inputSchema, Column...targets) {
     int [] targetIds = new int[targets.length];
     for (int i = 0; i < targetIds.length; i++) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-plan/src/main/proto/Plan.proto
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/proto/Plan.proto b/tajo-plan/src/main/proto/Plan.proto
index 93e1e7e..7815cac 100644
--- a/tajo-plan/src/main/proto/Plan.proto
+++ b/tajo-plan/src/main/proto/Plan.proto
@@ -582,7 +582,6 @@ message EnforceProperty {
     BROADCAST         = 5;
     COLUMN_PARTITION  = 6;
     DISTINCT_GROUP_BY = 7;
-    STORAGE_PUSHDOWN  = 8;
   }
 
   // Identifies which field is filled in.
@@ -674,8 +673,4 @@ message DistinctGroupbyEnforcer {
   repeated SortSpecArray sortSpecArrays = 3;
   required bool isMultipleAggregation = 4 [default = false];
   optional MultipleAggregationStage multipleAggregationStage = 5;
-}
-
-message StoragePushdownEnforcer {
-  required int32 marker = 1;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/PlanPushable.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/PlanPushable.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/PlanPushable.java
deleted file mode 100644
index 7500e9a..0000000
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/PlanPushable.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage;
-
-import org.apache.tajo.catalog.Column;
-import org.apache.tajo.catalog.SchemaObject;
-import org.apache.tajo.catalog.statistics.TableStats;
-import org.apache.tajo.plan.expr.EvalNode;
-import org.apache.tajo.plan.logical.LogicalNode;
-
-import java.io.Closeable;
-import java.io.IOException;
-
-/**
- * Scanner Interface
- */
-
-public interface PlanPushable {
-  void pushdown(LogicalNode pushed);
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Scanner.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Scanner.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Scanner.java
index f421515..e95f318 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Scanner.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Scanner.java
@@ -60,6 +60,7 @@ public interface Scanner extends SchemaObject, Closeable {
   void close() throws IOException;
 
   /**
+   * Push a plan part into scanner. It will be used in future issues.
    *
    * @param planPart
    */

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
index e57dc3a..869394e 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * <p/>
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-storage/tajo-storage-common/src/main/resources/storage-default.json
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/resources/storage-default.json b/tajo-storage/tajo-storage-common/src/main/resources/storage-default.json
index 6060d50..3ede2d4 100644
--- a/tajo-storage/tajo-storage-common/src/main/resources/storage-default.json
+++ b/tajo-storage/tajo-storage-common/src/main/resources/storage-default.json
@@ -16,10 +16,6 @@
       "handler": "org.apache.tajo.storage.hbase.HBaseTablespace",
       "default-format": "hbase"
     },
-    "jdbc:mysql": {
-      "handler": "org.apache.tajo.storage.mysql.MySQLTablespace",
-      "default-format": "rowstore"
-    },
     "jdbc:postgresql": {
       "handler": "org.apache.tajo.storage.pgsql.PgSQLTablespace",
       "default-format": "rowstore"

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
index 9f29c34..aa3f81a 100644
--- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
+++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
@@ -41,7 +41,6 @@ import org.apache.tajo.plan.LogicalPlan;
 import org.apache.tajo.plan.expr.EvalNode;
 import org.apache.tajo.plan.logical.LogicalNode;
 import org.apache.tajo.plan.logical.NodeType;
-import org.apache.tajo.plan.logical.ScanNode;
 import org.apache.tajo.storage.fragment.FileFragment;
 import org.apache.tajo.storage.fragment.Fragment;
 import org.apache.tajo.util.Bytes;

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcFragment.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcFragment.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcFragment.java
index e8a18fc..30b4197 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcFragment.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcFragment.java
@@ -20,7 +20,6 @@ package org.apache.tajo.storage.jdbc;
 
 import com.google.protobuf.ByteString;
 import com.google.protobuf.InvalidProtocolBufferException;
-import org.apache.tajo.BuiltinStorages;
 import org.apache.tajo.catalog.proto.CatalogProtos;
 import org.apache.tajo.storage.fragment.Fragment;
 import org.apache.tajo.storage.jdbc.JdbcFragmentProtos.JdbcFragmentProto;

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcScanner.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcScanner.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcScanner.java
index c08451d..f5af7d4 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcScanner.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcScanner.java
@@ -36,7 +36,6 @@ import org.apache.tajo.plan.logical.LogicalNode;
 import org.apache.tajo.storage.Scanner;
 import org.apache.tajo.storage.Tuple;
 import org.apache.tajo.storage.VTuple;
-import org.apache.tajo.util.datetime.DateTimeUtil;
 
 import java.io.Closeable;
 import java.io.IOException;

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
index d3ec273..5ec0ac8 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
@@ -44,10 +44,7 @@ import java.sql.SQLException;
 import java.util.List;
 
 /**
- * <h3>URI Examples:</h3>
- * <ul>
- *   <li>jdbc:mysql//primaryhost,secondaryhost1,secondaryhost2/test?profileSQL=true</li>
- * </ul>
+ * JDBC Tablespace
  */
 public abstract class JdbcTablespace extends Tablespace {
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLExpressionGenerator.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLExpressionGenerator.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLExpressionGenerator.java
index da07257..b1420e9 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLExpressionGenerator.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/SQLExpressionGenerator.java
@@ -24,7 +24,6 @@ import org.apache.tajo.datum.Datum;
 import org.apache.tajo.exception.TajoRuntimeException;
 import org.apache.tajo.exception.UnsupportedDataTypeException;
 import org.apache.tajo.plan.expr.*;
-import org.apache.tajo.util.Pair;
 
 import java.sql.DatabaseMetaData;
 import java.sql.SQLException;

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
index 4abb37b..3e187ee 100644
--- a/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
+++ b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
@@ -35,10 +35,7 @@ import java.io.IOException;
 import java.net.URI;
 
 /**
- * <h3>URI Examples:</h3>
- * <ul>
- *   <li>jdbc:mysql//primaryhost,secondaryhost1,secondaryhost2/test?profileSQL=true</li>
- * </ul>
+ * Postgresql Database Tablespace
  */
 public class PgSQLTablespace extends JdbcTablespace {
   private final String database;

http://git-wip-us.apache.org/repos/asf/tajo/blob/555ac7d8/tajo-storage/tajo-storage-pgsql/src/test/resources/dataset/TestPgSQLQueryTests/lineitem.csv
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/dataset/TestPgSQLQueryTests/lineitem.csv b/tajo-storage/tajo-storage-pgsql/src/test/resources/dataset/TestPgSQLQueryTests/lineitem.csv
deleted file mode 100644
index e69de29..0000000


[13/39] tajo git commit: TAJO-1763: tpch/*.tbl files cannot be founded in maven modules except for core-tests.

Posted by hy...@apache.org.
TAJO-1763: tpch/*.tbl files cannot be founded in maven modules except for core-tests.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/d49449a9
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/d49449a9
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/d49449a9

Branch: refs/heads/TAJO-1730
Commit: d49449a9a9ac6c50db958f9f73b6ebb8209134c2
Parents: c9f61e4
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sun Aug 16 11:05:12 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sun Aug 16 11:05:12 2015 +0900

----------------------------------------------------------------------
 .../test/java/org/apache/tajo/TpchTestBase.java |  5 ++--
 .../java/org/apache/tajo/util/FileUtil.java     |  4 ----
 .../src/test/resources/tpch/customer.tbl        |  5 ++++
 .../src/test/resources/tpch/empty_orders.tbl    |  0
 .../src/test/resources/tpch/lineitem.tbl        |  5 ++++
 .../src/test/resources/tpch/nation.tbl          | 25 ++++++++++++++++++++
 .../src/test/resources/tpch/orders.tbl          |  3 +++
 .../src/test/resources/tpch/part.tbl            |  4 ++++
 .../src/test/resources/tpch/partsupp.tbl        |  3 +++
 .../src/test/resources/tpch/region.tbl          |  5 ++++
 .../src/test/resources/tpch/supplier.tbl        |  3 +++
 tajo-core-tests/src/test/tpch/customer.tbl      |  5 ----
 tajo-core-tests/src/test/tpch/empty_orders.tbl  |  0
 tajo-core-tests/src/test/tpch/lineitem.tbl      |  5 ----
 tajo-core-tests/src/test/tpch/nation.tbl        | 25 --------------------
 tajo-core-tests/src/test/tpch/orders.tbl        |  3 ---
 tajo-core-tests/src/test/tpch/part.tbl          |  4 ----
 tajo-core-tests/src/test/tpch/partsupp.tbl      |  3 ---
 tajo-core-tests/src/test/tpch/region.tbl        |  5 ----
 tajo-core-tests/src/test/tpch/supplier.tbl      |  3 ---
 .../java/org/apache/tajo/benchmark/TPCH.java    | 21 +++++-----------
 21 files changed, 61 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-cluster-tests/src/test/java/org/apache/tajo/TpchTestBase.java
----------------------------------------------------------------------
diff --git a/tajo-cluster-tests/src/test/java/org/apache/tajo/TpchTestBase.java b/tajo-cluster-tests/src/test/java/org/apache/tajo/TpchTestBase.java
index 055dd02..7b0bf37 100644
--- a/tajo-cluster-tests/src/test/java/org/apache/tajo/TpchTestBase.java
+++ b/tajo-cluster-tests/src/test/java/org/apache/tajo/TpchTestBase.java
@@ -37,7 +37,6 @@ public class TpchTestBase {
 
   String [] names;
   String [] paths;
-  String [][] tables;
   Schema[] schemas;
   Map<String, Integer> nameMap = Maps.newHashMap();
   protected TPCH tpch;
@@ -70,11 +69,11 @@ public class TpchTestBase {
       schemas[i] = tpch.getSchema(names[i]);
     }
 
-    tables = new String[names.length][];
+    //tables = new String[names.length][];
     File file;
     for (int i = 0; i < names.length; i++) {
       file = TPCH.getDataFile(names[i]);
-      tables[i] = FileUtil.readTextFile(file).split("\n");
+      //tables[i] = FileUtil.readTextFile(file).split("\n");
       paths[i] = file.getAbsolutePath();
     }
     try {

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-common/src/main/java/org/apache/tajo/util/FileUtil.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/FileUtil.java b/tajo-common/src/main/java/org/apache/tajo/util/FileUtil.java
index 39f4c29..a7f8691 100644
--- a/tajo-common/src/main/java/org/apache/tajo/util/FileUtil.java
+++ b/tajo-common/src/main/java/org/apache/tajo/util/FileUtil.java
@@ -79,10 +79,6 @@ public class FileUtil {
     }
   }
 
-  public static File getFile(String path) {
-    return new File(path);
-  }
-
   public static URL getResourcePath(String resource) throws IOException {
     return ClassLoader.getSystemResource(resource);
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-core-tests/src/test/resources/tpch/customer.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/tpch/customer.tbl b/tajo-core-tests/src/test/resources/tpch/customer.tbl
new file mode 100644
index 0000000..4f684c6
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/tpch/customer.tbl
@@ -0,0 +1,5 @@
+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|Customer#000000002|XSTf4,NCwDVaWNe6tEgvwfmRchLXak|13|23-768-687-3665|121.65|AUTOMOBILE|l accounts. blithely ironic theodolites integrate boldly: caref|
+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|Customer#000000004|XxVSJsLAGtn|4|14-128-190-5944|2866.83|MACHINERY| requests. final, regular ideas sleep final accou|
+5|Customer#000000005|KvpyuHCplrB84WgAiGV6sYpZq7Tj|3|13-750-942-6364|794.47|HOUSEHOLD|n accounts will have to unwind. foxes cajole accor|

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-core-tests/src/test/resources/tpch/empty_orders.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/tpch/empty_orders.tbl b/tajo-core-tests/src/test/resources/tpch/empty_orders.tbl
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-core-tests/src/test/resources/tpch/lineitem.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/tpch/lineitem.tbl b/tajo-core-tests/src/test/resources/tpch/lineitem.tbl
new file mode 100644
index 0000000..e3beac9
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/tpch/lineitem.tbl
@@ -0,0 +1,5 @@
+1|1|7706|1|17|21168.23|0.04|0.02|N|O|1996-03-13|1996-02-12|1996-03-22|DELIVER IN PERSON|TRUCK|egular courts above the|
+1|1|7311|2|36|45983.16|0.09|0.06|N|O|1996-04-12|1996-02-28|1996-04-20|TAKE BACK RETURN|MAIL|ly final dependencies: slyly bold |
+2|2|1191|1|38|44694.46|0.00|0.05|N|O|1997-01-28|1997-01-14|1997-02-02|TAKE BACK RETURN|RAIL|ven requests. deposits breach a|
+3|2|1798|1|45|54058.05|0.06|0.00|R|F|1994-02-02|1994-01-04|1994-02-23|NONE|AIR|ongside of the furiously brave acco|
+3|3|6540|2|49|46796.47|0.10|0.00|R|F|1993-11-09|1993-12-20|1993-11-24|TAKE BACK RETURN|RAIL| unusual accounts. eve|

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-core-tests/src/test/resources/tpch/nation.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/tpch/nation.tbl b/tajo-core-tests/src/test/resources/tpch/nation.tbl
new file mode 100644
index 0000000..ed3fd5b
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/tpch/nation.tbl
@@ -0,0 +1,25 @@
+0|ALGERIA|0| haggle. carefully final deposits detect slyly agai|
+1|ARGENTINA|1|al foxes promise slyly according to the regular accounts. bold requests alon|
+2|BRAZIL|1|y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special |
+3|CANADA|1|eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold|
+4|EGYPT|4|y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d|
+5|ETHIOPIA|0|ven packages wake quickly. regu|
+6|FRANCE|3|refully final requests. regular, ironi|
+7|GERMANY|3|l platelets. regular accounts x-ray: unusual, regular acco|
+8|INDIA|2|ss excuses cajole slyly across the packages. deposits print aroun|
+9|INDONESIA|2| slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull|
+10|IRAN|4|efully alongside of the slyly final dependencies. |
+11|IRAQ|4|nic deposits boost atop the quickly final requests? quickly regula|
+12|JAPAN|2|ously. final, express gifts cajole a|
+13|JORDAN|4|ic deposits are blithely about the carefully regular pa|
+14|KENYA|0| pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t|
+15|MOROCCO|0|rns. blithely bold courts among the closely regular packages use furiously bold platelets?|
+16|MOZAMBIQUE|0|s. ironic, unusual asymptotes wake blithely r|
+17|PERU|1|platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun|
+18|CHINA|2|c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos|
+19|ROMANIA|3|ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account|
+20|SAUDI ARABIA|4|ts. silent requests haggle. closely express packages sleep across the blithely|
+21|VIETNAM|2|hely enticingly express accounts. even, final |
+22|RUSSIA|3| requests against the platelets use never according to the quickly regular pint|
+23|UNITED KINGDOM|3|eans boost carefully special requests. accounts are. carefull|
+24|UNITED STATES|1|y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be|

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-core-tests/src/test/resources/tpch/orders.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/tpch/orders.tbl b/tajo-core-tests/src/test/resources/tpch/orders.tbl
new file mode 100644
index 0000000..15a1b6f
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/tpch/orders.tbl
@@ -0,0 +1,3 @@
+1|3|O|173665.47|1996-01-02|5-LOW|Clerk#000000951|0|nstructions sleep furiously among |
+2|4|O|46929.18|1996-12-01|1-URGENT|Clerk#000000880|0| foxes. pending accounts at the pending, silent asymptot|
+3|2|F|193846.25|1993-10-14|5-LOW|Clerk#000000955|0|sly final accounts boost. carefully regular ideas cajole carefully. depos|

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-core-tests/src/test/resources/tpch/part.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/tpch/part.tbl b/tajo-core-tests/src/test/resources/tpch/part.tbl
new file mode 100644
index 0000000..6e6fa72
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/tpch/part.tbl
@@ -0,0 +1,4 @@
+1|goldenrod lavender spring chocolate lace|Manufacturer#1|Brand#13|PROMO BURNISHED COPPER|7|JUMBO PKG|901.00|ly. slyly ironi
+2|blush thistle blue yellow saddle|Manufacturer#1|Brand#13|LARGE BRUSHED BRASS|15|LG CASE|902.00|lar accounts amo
+3|spring green yellow purple cornsilk|Manufacturer#4|Brand#42|STANDARD POLISHED BRASS|21|WRAP CASE|903.00|egular deposits hag
+4|cornflower chocolate smoke green pink|Manufacturer#3|Brand#34|SMALL PLATED BRASS|14|MED DRUM|904.00|p furiously r
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-core-tests/src/test/resources/tpch/partsupp.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/tpch/partsupp.tbl b/tajo-core-tests/src/test/resources/tpch/partsupp.tbl
new file mode 100644
index 0000000..a6211e6
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/tpch/partsupp.tbl
@@ -0,0 +1,3 @@
+1|2|3325|771.64|, even theodolites. regular, final theodolites eat after the carefully pending foxes. furiously regular deposits sleep slyly. carefully bold realms above the ironic dependencies haggle careful|
+2|3|8895|1.01|nic accounts. final accounts sleep furiously about the ironic, bold packages. regular, regular accounts|
+3|4|4651|920.92|ilent foxes affix furiously quickly unusual requests. even packages across the carefully even theodolites nag above the sp|

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-core-tests/src/test/resources/tpch/region.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/tpch/region.tbl b/tajo-core-tests/src/test/resources/tpch/region.tbl
new file mode 100644
index 0000000..c5ebb63
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/tpch/region.tbl
@@ -0,0 +1,5 @@
+0|AFRICA|lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to |
+1|AMERICA|hs use ironic, even requests. s|
+2|ASIA|ges. thinly even pinto beans ca|
+3|EUROPE|ly final courts cajole furiously final excuse|
+4|MIDDLE EAST|uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl|

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-core-tests/src/test/resources/tpch/supplier.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/resources/tpch/supplier.tbl b/tajo-core-tests/src/test/resources/tpch/supplier.tbl
new file mode 100644
index 0000000..a6fafb3
--- /dev/null
+++ b/tajo-core-tests/src/test/resources/tpch/supplier.tbl
@@ -0,0 +1,3 @@
+2|Supplier#000000002|89eJ5ksX3ImxJQBvxObC,|5|15-679-861-2259|4032.68| slyly bold instructions. idle dependen|
+3|Supplier#000000003|q1,G3Pj6OjIuUYfUoH18BFTKP5aU9bEV3|1|11-383-516-1199|4192.40|blithely silent requests after the express dependencies are sl|
+4|Supplier#000000004|Bk7ah4CK8SYQTepEmvMkkgMwg|15|25-843-787-7479|4641.08|riously even requests above the exp|

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-core-tests/src/test/tpch/customer.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/tpch/customer.tbl b/tajo-core-tests/src/test/tpch/customer.tbl
deleted file mode 100644
index 4f684c6..0000000
--- a/tajo-core-tests/src/test/tpch/customer.tbl
+++ /dev/null
@@ -1,5 +0,0 @@
-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|Customer#000000002|XSTf4,NCwDVaWNe6tEgvwfmRchLXak|13|23-768-687-3665|121.65|AUTOMOBILE|l accounts. blithely ironic theodolites integrate boldly: caref|
-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|Customer#000000004|XxVSJsLAGtn|4|14-128-190-5944|2866.83|MACHINERY| requests. final, regular ideas sleep final accou|
-5|Customer#000000005|KvpyuHCplrB84WgAiGV6sYpZq7Tj|3|13-750-942-6364|794.47|HOUSEHOLD|n accounts will have to unwind. foxes cajole accor|

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-core-tests/src/test/tpch/empty_orders.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/tpch/empty_orders.tbl b/tajo-core-tests/src/test/tpch/empty_orders.tbl
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-core-tests/src/test/tpch/lineitem.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/tpch/lineitem.tbl b/tajo-core-tests/src/test/tpch/lineitem.tbl
deleted file mode 100644
index e3beac9..0000000
--- a/tajo-core-tests/src/test/tpch/lineitem.tbl
+++ /dev/null
@@ -1,5 +0,0 @@
-1|1|7706|1|17|21168.23|0.04|0.02|N|O|1996-03-13|1996-02-12|1996-03-22|DELIVER IN PERSON|TRUCK|egular courts above the|
-1|1|7311|2|36|45983.16|0.09|0.06|N|O|1996-04-12|1996-02-28|1996-04-20|TAKE BACK RETURN|MAIL|ly final dependencies: slyly bold |
-2|2|1191|1|38|44694.46|0.00|0.05|N|O|1997-01-28|1997-01-14|1997-02-02|TAKE BACK RETURN|RAIL|ven requests. deposits breach a|
-3|2|1798|1|45|54058.05|0.06|0.00|R|F|1994-02-02|1994-01-04|1994-02-23|NONE|AIR|ongside of the furiously brave acco|
-3|3|6540|2|49|46796.47|0.10|0.00|R|F|1993-11-09|1993-12-20|1993-11-24|TAKE BACK RETURN|RAIL| unusual accounts. eve|

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-core-tests/src/test/tpch/nation.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/tpch/nation.tbl b/tajo-core-tests/src/test/tpch/nation.tbl
deleted file mode 100644
index ed3fd5b..0000000
--- a/tajo-core-tests/src/test/tpch/nation.tbl
+++ /dev/null
@@ -1,25 +0,0 @@
-0|ALGERIA|0| haggle. carefully final deposits detect slyly agai|
-1|ARGENTINA|1|al foxes promise slyly according to the regular accounts. bold requests alon|
-2|BRAZIL|1|y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special |
-3|CANADA|1|eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold|
-4|EGYPT|4|y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d|
-5|ETHIOPIA|0|ven packages wake quickly. regu|
-6|FRANCE|3|refully final requests. regular, ironi|
-7|GERMANY|3|l platelets. regular accounts x-ray: unusual, regular acco|
-8|INDIA|2|ss excuses cajole slyly across the packages. deposits print aroun|
-9|INDONESIA|2| slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull|
-10|IRAN|4|efully alongside of the slyly final dependencies. |
-11|IRAQ|4|nic deposits boost atop the quickly final requests? quickly regula|
-12|JAPAN|2|ously. final, express gifts cajole a|
-13|JORDAN|4|ic deposits are blithely about the carefully regular pa|
-14|KENYA|0| pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t|
-15|MOROCCO|0|rns. blithely bold courts among the closely regular packages use furiously bold platelets?|
-16|MOZAMBIQUE|0|s. ironic, unusual asymptotes wake blithely r|
-17|PERU|1|platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun|
-18|CHINA|2|c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos|
-19|ROMANIA|3|ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account|
-20|SAUDI ARABIA|4|ts. silent requests haggle. closely express packages sleep across the blithely|
-21|VIETNAM|2|hely enticingly express accounts. even, final |
-22|RUSSIA|3| requests against the platelets use never according to the quickly regular pint|
-23|UNITED KINGDOM|3|eans boost carefully special requests. accounts are. carefull|
-24|UNITED STATES|1|y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be|

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-core-tests/src/test/tpch/orders.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/tpch/orders.tbl b/tajo-core-tests/src/test/tpch/orders.tbl
deleted file mode 100644
index 15a1b6f..0000000
--- a/tajo-core-tests/src/test/tpch/orders.tbl
+++ /dev/null
@@ -1,3 +0,0 @@
-1|3|O|173665.47|1996-01-02|5-LOW|Clerk#000000951|0|nstructions sleep furiously among |
-2|4|O|46929.18|1996-12-01|1-URGENT|Clerk#000000880|0| foxes. pending accounts at the pending, silent asymptot|
-3|2|F|193846.25|1993-10-14|5-LOW|Clerk#000000955|0|sly final accounts boost. carefully regular ideas cajole carefully. depos|

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-core-tests/src/test/tpch/part.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/tpch/part.tbl b/tajo-core-tests/src/test/tpch/part.tbl
deleted file mode 100644
index 6e6fa72..0000000
--- a/tajo-core-tests/src/test/tpch/part.tbl
+++ /dev/null
@@ -1,4 +0,0 @@
-1|goldenrod lavender spring chocolate lace|Manufacturer#1|Brand#13|PROMO BURNISHED COPPER|7|JUMBO PKG|901.00|ly. slyly ironi
-2|blush thistle blue yellow saddle|Manufacturer#1|Brand#13|LARGE BRUSHED BRASS|15|LG CASE|902.00|lar accounts amo
-3|spring green yellow purple cornsilk|Manufacturer#4|Brand#42|STANDARD POLISHED BRASS|21|WRAP CASE|903.00|egular deposits hag
-4|cornflower chocolate smoke green pink|Manufacturer#3|Brand#34|SMALL PLATED BRASS|14|MED DRUM|904.00|p furiously r
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-core-tests/src/test/tpch/partsupp.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/tpch/partsupp.tbl b/tajo-core-tests/src/test/tpch/partsupp.tbl
deleted file mode 100644
index a6211e6..0000000
--- a/tajo-core-tests/src/test/tpch/partsupp.tbl
+++ /dev/null
@@ -1,3 +0,0 @@
-1|2|3325|771.64|, even theodolites. regular, final theodolites eat after the carefully pending foxes. furiously regular deposits sleep slyly. carefully bold realms above the ironic dependencies haggle careful|
-2|3|8895|1.01|nic accounts. final accounts sleep furiously about the ironic, bold packages. regular, regular accounts|
-3|4|4651|920.92|ilent foxes affix furiously quickly unusual requests. even packages across the carefully even theodolites nag above the sp|

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-core-tests/src/test/tpch/region.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/tpch/region.tbl b/tajo-core-tests/src/test/tpch/region.tbl
deleted file mode 100644
index c5ebb63..0000000
--- a/tajo-core-tests/src/test/tpch/region.tbl
+++ /dev/null
@@ -1,5 +0,0 @@
-0|AFRICA|lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to |
-1|AMERICA|hs use ironic, even requests. s|
-2|ASIA|ges. thinly even pinto beans ca|
-3|EUROPE|ly final courts cajole furiously final excuse|
-4|MIDDLE EAST|uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl|

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-core-tests/src/test/tpch/supplier.tbl
----------------------------------------------------------------------
diff --git a/tajo-core-tests/src/test/tpch/supplier.tbl b/tajo-core-tests/src/test/tpch/supplier.tbl
deleted file mode 100644
index a6fafb3..0000000
--- a/tajo-core-tests/src/test/tpch/supplier.tbl
+++ /dev/null
@@ -1,3 +0,0 @@
-2|Supplier#000000002|89eJ5ksX3ImxJQBvxObC,|5|15-679-861-2259|4032.68| slyly bold instructions. idle dependen|
-3|Supplier#000000003|q1,G3Pj6OjIuUYfUoH18BFTKP5aU9bEV3|1|11-383-516-1199|4192.40|blithely silent requests after the express dependencies are sl|
-4|Supplier#000000004|Bk7ah4CK8SYQTepEmvMkkgMwg|15|25-843-787-7479|4641.08|riously even requests above the exp|

http://git-wip-us.apache.org/repos/asf/tajo/blob/d49449a9/tajo-core/src/main/java/org/apache/tajo/benchmark/TPCH.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/benchmark/TPCH.java b/tajo-core/src/main/java/org/apache/tajo/benchmark/TPCH.java
index 9739767..969a8be 100644
--- a/tajo-core/src/main/java/org/apache/tajo/benchmark/TPCH.java
+++ b/tajo-core/src/main/java/org/apache/tajo/benchmark/TPCH.java
@@ -34,9 +34,11 @@ import org.apache.tajo.common.TajoDataTypes;
 import org.apache.tajo.common.TajoDataTypes.Type;
 import org.apache.tajo.exception.TajoException;
 import org.apache.tajo.storage.StorageConstants;
+import org.apache.tajo.util.FileUtil;
 
 import java.io.File;
 import java.io.IOException;
+import java.net.URISyntaxException;
 import java.sql.SQLException;
 import java.util.List;
 import java.util.Map;
@@ -227,22 +229,11 @@ public class TPCH extends BenchmarkSet {
         new Path(dataDir, tableName).toUri(), meta, partitionMethodDesc);
   }
 
-  public static List<String> getDataFilePaths(String... tables) {
-    List<String> tablePaths = Lists.newArrayList();
-    File file;
-    for (String table : tables) {
-      file = getDataFile(table);
-      tablePaths.add(file.getAbsolutePath());
-    }
-    return tablePaths;
-  }
-
   public static File getDataFile(String table) {
-    File file = new File("src/test/tpch/" + table + ".tbl");
-    if (!file.exists()) {
-      file = new File(System.getProperty("user.dir") + "/tajo-core/src/test/tpch/" + table
-          + ".tbl");
+    try {
+      return new File(FileUtil.getResourcePath("tpch/" + table + ".tbl").toURI());
+    } catch (Throwable t) {
+      throw new RuntimeException(t);
     }
-    return file;
   }
 }


[15/39] tajo git commit: Merge branch 'TAJO-1763' of https://github.com/hyunsik/tajo into TAJO-1730

Posted by hy...@apache.org.
Merge branch 'TAJO-1763' of https://github.com/hyunsik/tajo into TAJO-1730


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/de9542ea
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/de9542ea
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/de9542ea

Branch: refs/heads/TAJO-1730
Commit: de9542ea8e0d5f4cb1d82bcbf9f4ba414931fa47
Parents: 4803b35 d49449a
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sun Aug 16 11:09:26 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sun Aug 16 11:09:26 2015 +0900

----------------------------------------------------------------------
 pom.xml                                         |  2 +-
 tajo-algebra/pom.xml                            |  2 +-
 tajo-catalog/pom.xml                            |  2 +-
 tajo-catalog/tajo-catalog-client/pom.xml        |  2 +-
 tajo-catalog/tajo-catalog-common/pom.xml        |  2 +-
 tajo-catalog/tajo-catalog-drivers/pom.xml       |  2 +-
 .../tajo-catalog-drivers/tajo-hive/pom.xml      |  2 +-
 tajo-catalog/tajo-catalog-server/pom.xml        |  2 +-
 tajo-cli/pom.xml                                |  2 +-
 tajo-client/pom.xml                             |  2 +-
 tajo-cluster-tests/pom.xml                      |  4 ++--
 .../test/java/org/apache/tajo/TpchTestBase.java |  5 ++--
 tajo-common/pom.xml                             |  2 +-
 .../java/org/apache/tajo/util/FileUtil.java     |  4 ----
 tajo-core-tests/pom.xml                         |  2 +-
 .../src/test/resources/tpch/customer.tbl        |  5 ++++
 .../src/test/resources/tpch/empty_orders.tbl    |  0
 .../src/test/resources/tpch/lineitem.tbl        |  5 ++++
 .../src/test/resources/tpch/nation.tbl          | 25 ++++++++++++++++++++
 .../src/test/resources/tpch/orders.tbl          |  3 +++
 .../src/test/resources/tpch/part.tbl            |  4 ++++
 .../src/test/resources/tpch/partsupp.tbl        |  3 +++
 .../src/test/resources/tpch/region.tbl          |  5 ++++
 .../src/test/resources/tpch/supplier.tbl        |  3 +++
 tajo-core-tests/src/test/tpch/customer.tbl      |  5 ----
 tajo-core-tests/src/test/tpch/empty_orders.tbl  |  0
 tajo-core-tests/src/test/tpch/lineitem.tbl      |  5 ----
 tajo-core-tests/src/test/tpch/nation.tbl        | 25 --------------------
 tajo-core-tests/src/test/tpch/orders.tbl        |  3 ---
 tajo-core-tests/src/test/tpch/part.tbl          |  4 ----
 tajo-core-tests/src/test/tpch/partsupp.tbl      |  3 ---
 tajo-core-tests/src/test/tpch/region.tbl        |  5 ----
 tajo-core-tests/src/test/tpch/supplier.tbl      |  3 ---
 tajo-core/pom.xml                               |  2 +-
 .../java/org/apache/tajo/benchmark/TPCH.java    | 21 +++++-----------
 tajo-dist/pom.xml                               |  2 +-
 tajo-docs/pom.xml                               |  2 +-
 tajo-jdbc/pom.xml                               |  2 +-
 tajo-maven-plugins/pom.xml                      |  2 +-
 tajo-metrics/pom.xml                            |  2 +-
 tajo-plan/pom.xml                               |  2 +-
 tajo-project/pom.xml                            |  4 ++--
 tajo-pullserver/pom.xml                         |  2 +-
 tajo-rpc/pom.xml                                |  2 +-
 tajo-rpc/tajo-rpc-common/pom.xml                |  2 +-
 tajo-rpc/tajo-rpc-protobuf/pom.xml              |  2 +-
 tajo-rpc/tajo-ws-rs/pom.xml                     |  2 +-
 tajo-storage/pom.xml                            |  2 +-
 tajo-storage/tajo-storage-common/pom.xml        |  2 +-
 tajo-storage/tajo-storage-hbase/pom.xml         |  4 ++--
 tajo-storage/tajo-storage-hdfs/pom.xml          |  4 ++--
 tajo-thirdparty/asm/pom.xml                     |  2 +-
 52 files changed, 96 insertions(+), 110 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/de9542ea/tajo-project/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/de9542ea/tajo-storage/pom.xml
----------------------------------------------------------------------


[03/39] tajo git commit: Implement the base jdbc tablespace and its unit test base.

Posted by hy...@apache.org.
Implement the base jdbc tablespace and its unit test base.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/920e8a42
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/920e8a42
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/920e8a42

Branch: refs/heads/TAJO-1730
Commit: 920e8a42689e3f38d1ccac7eff3b8a60dd0a8a46
Parents: 5ca1a4a
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sun Aug 9 23:36:24 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sun Aug 9 23:36:24 2015 +0900

----------------------------------------------------------------------
 .../apache/tajo/catalog/MetadataProvider.java   |   6 +-
 .../tajo/catalog/LinkedMetadataManager.java     |   2 +-
 .../tajo/catalog/TestLinkedMetadataManager.java |  12 +-
 .../apache/tajo/storage/StorageProperty.java    |  15 +-
 .../org/apache/tajo/storage/Tablespace.java     |   9 +-
 .../tajo/storage/hbase/HBaseTablespace.java     |   3 +-
 .../org/apache/tajo/storage/FileTablespace.java |   2 +-
 tajo-storage/tajo-storage-jdbc/pom.xml          |  22 +-
 .../storage/jdbc/JdbcMetadataProviderBase.java  | 244 +++++++++++++++++++
 .../tajo/storage/jdbc/JdbcTablespace.java       |  21 +-
 .../tajo/storage/hbase/TestJdbcTableSpace.java  |  72 ------
 .../tajo/storage/jdbc/TestJdbcTableSpace.java   |  98 ++++++++
 .../storage/jdbc/TestMysqlJdbcTableSpace.java   |  95 ++++++++
 .../storage/jdbc/TestPgSQLJdbcTableSpace.java   |  87 +++++++
 14 files changed, 589 insertions(+), 99 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/920e8a42/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/MetadataProvider.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/MetadataProvider.java b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/MetadataProvider.java
index 216d33c..4d55f6f 100644
--- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/MetadataProvider.java
+++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/MetadataProvider.java
@@ -31,9 +31,9 @@ public interface MetadataProvider {
 
   String getDatabaseName();
 
-  Collection<String> getCatalogs();
+  Collection<String> getSchemas();
 
-  Collection<String> getTables(@Nullable String catalog);
+  Collection<String> getTables(@Nullable String schemaPattern, @Nullable String tablePattern);
 
-  TableDesc getTableDescriptor(String catalogName, String tableName) throws UndefinedTablespaceException;
+  TableDesc getTableDescriptor(String schemaName, String tableName) throws UndefinedTablespaceException;
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/920e8a42/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/LinkedMetadataManager.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/LinkedMetadataManager.java b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/LinkedMetadataManager.java
index 080c984..dc438e8 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/LinkedMetadataManager.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/LinkedMetadataManager.java
@@ -148,7 +148,7 @@ public class LinkedMetadataManager {
   public Collection<String> getSchemas(@Nullable String dbName) throws UndefinedDatabaseException {
     ensureIfDBExists(dbName);
 
-    return providerMap.get(dbName).getCatalogs();
+    return providerMap.get(dbName).getSchemas();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/tajo/blob/920e8a42/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestLinkedMetadataManager.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestLinkedMetadataManager.java b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestLinkedMetadataManager.java
index 4ddf7ab..95550b6 100644
--- a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestLinkedMetadataManager.java
+++ b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestLinkedMetadataManager.java
@@ -89,17 +89,17 @@ public class TestLinkedMetadataManager {
     }
 
     @Override
-    public Collection<String> getCatalogs() {
+    public Collection<String> getSchemas() {
       return Lists.newArrayList("cat1", "cat2");
     }
 
     @Override
-    public Collection<String> getTables(@Nullable String catalog) {
+    public Collection<String> getTables(@Nullable String schemaPattern) {
       return Lists.newArrayList("table1", "table2");
     }
 
     @Override
-    public TableDesc getTableDescriptor(String catalogName, String tableName) throws UndefinedTablespaceException {
+    public TableDesc getTableDescriptor(String schemaName, String tableName) throws UndefinedTablespaceException {
       if (tableName.equals("table1")) {
         return TABLE1;
       } else if (tableName.equals("table2")) {
@@ -128,17 +128,17 @@ public class TestLinkedMetadataManager {
     }
 
     @Override
-    public Collection<String> getCatalogs() {
+    public Collection<String> getSchemas() {
       return Lists.newArrayList("cat3", "cat4");
     }
 
     @Override
-    public Collection<String> getTables(@Nullable String catalog) {
+    public Collection<String> getTables(@Nullable String schemaPattern) {
       return Lists.newArrayList("table3", "table4");
     }
 
     @Override
-    public TableDesc getTableDescriptor(String catalogName, String tableName) throws UndefinedTablespaceException {
+    public TableDesc getTableDescriptor(String schemaName, String tableName) throws UndefinedTablespaceException {
       if (tableName.equals("table3")) {
         return TABLE3;
       } else if (tableName.equals("table4")) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/920e8a42/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/StorageProperty.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/StorageProperty.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/StorageProperty.java
index c1db34e..41ecd38 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/StorageProperty.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/StorageProperty.java
@@ -30,16 +30,20 @@ public class StorageProperty {
   private final boolean writable;
   /** if this storage allows use of artibrary paths */
   private final boolean absolutePathAllowed;
+  /** if this storage provides metadata provider */
+  private final boolean metadataProvided;
 
   public StorageProperty(String defaultFormat,
                          boolean movable,
                          boolean writable,
-                         boolean absolutePathAllowed) {
+                         boolean absolutePathAllowed,
+                         boolean metadataProvided) {
 
     this.defaultFormat = defaultFormat;
     this.movable = movable;
     this.writable = writable;
     this.absolutePathAllowed = absolutePathAllowed;
+    this.metadataProvided = metadataProvided;
   }
 
   /**
@@ -76,4 +80,13 @@ public class StorageProperty {
   public boolean isArbitraryPathAllowed() {
     return this.absolutePathAllowed;
   }
+
+  /**
+   * Is metadata provided?
+   *
+   * @return True if this storage provides linked metadata.
+   */
+  public boolean isMetadataProvided() {
+    return this.metadataProvided;
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/920e8a42/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
index 968601c..9da48f4 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
@@ -22,10 +22,7 @@ import org.apache.hadoop.fs.Path;
 import org.apache.tajo.ExecutionBlockId;
 import org.apache.tajo.OverridableConf;
 import org.apache.tajo.TaskAttemptId;
-import org.apache.tajo.catalog.Schema;
-import org.apache.tajo.catalog.SortSpec;
-import org.apache.tajo.catalog.TableDesc;
-import org.apache.tajo.catalog.TableMeta;
+import org.apache.tajo.catalog.*;
 import org.apache.tajo.catalog.proto.CatalogProtos.FragmentProto;
 import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.exception.TajoException;
@@ -424,4 +421,8 @@ public abstract class Tablespace {
                                  TableMeta meta) throws IOException {
     throw new IOException("Staging the output result is not supported in this storage");
   }
+
+  public MetadataProvider getMetadataProvider() {
+    throw new UnsupportedException("Linked Metadata Provider for " + name);
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/920e8a42/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java b/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java
index 35c974b..c15d91f 100644
--- a/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java
+++ b/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java
@@ -66,7 +66,8 @@ import java.util.*;
 public class HBaseTablespace extends Tablespace {
   private static final Log LOG = LogFactory.getLog(HBaseTablespace.class);
 
-  public static final StorageProperty HBASE_STORAGE_PROPERTIES = new StorageProperty("hbase", false, true, false);
+  public static final StorageProperty HBASE_STORAGE_PROPERTIES =
+      new StorageProperty("hbase", false, true, false, false);
   public static final FormatProperty HFILE_FORMAT_PROPERTIES = new FormatProperty(true, false, true);
   public static final FormatProperty PUT_MODE_PROPERTIES = new FormatProperty(true, true, false);
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/920e8a42/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
index e8a6c12..b6e58b8 100644
--- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
+++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
@@ -95,7 +95,7 @@ public class FileTablespace extends Tablespace {
         }
       };
 
-  private static final StorageProperty FileStorageProperties = new StorageProperty("TEXT", true, true, true);
+  private static final StorageProperty FileStorageProperties = new StorageProperty("TEXT", true, true, true, false);
   private static final FormatProperty GeneralFileProperties = new FormatProperty(true, false, true);
 
   protected FileSystem fs;

http://git-wip-us.apache.org/repos/asf/tajo/blob/920e8a42/tajo-storage/tajo-storage-jdbc/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/pom.xml b/tajo-storage/tajo-storage-jdbc/pom.xml
index 93c15bb..40978ea 100644
--- a/tajo-storage/tajo-storage-jdbc/pom.xml
+++ b/tajo-storage/tajo-storage-jdbc/pom.xml
@@ -53,8 +53,8 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
-          <source>1.6</source>
-          <target>1.6</target>
+          <source>1.7</source>
+          <target>1.7</target>
           <encoding>${project.build.sourceEncoding}</encoding>
         </configuration>
       </plugin>
@@ -306,6 +306,24 @@
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>io.airlift</groupId>
+      <artifactId>testing-mysql-server</artifactId>
+      <version>0.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>io.airlift</groupId>
+      <artifactId>testing-postgresql-server</artifactId>
+      <version>0.3</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+      <version>15.0</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <profiles>

http://git-wip-us.apache.org/repos/asf/tajo/blob/920e8a42/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
new file mode 100644
index 0000000..1658b46
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
@@ -0,0 +1,244 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+import com.facebook.presto.hive.shaded.com.google.common.base.Function;
+import com.facebook.presto.hive.shaded.com.google.common.collect.Collections2;
+import com.facebook.presto.hive.shaded.com.google.common.collect.Lists;
+import com.google.common.base.Preconditions;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.tajo.catalog.*;
+import org.apache.tajo.catalog.exception.UndefinedTablespaceException;
+import org.apache.tajo.common.TajoDataTypes;
+import org.apache.tajo.common.TajoDataTypes.DataType;
+import org.apache.tajo.common.TajoDataTypes.Type;
+import org.apache.tajo.exception.TajoInternalError;
+import org.apache.tajo.exception.UnsupportedException;
+import org.apache.tajo.util.KeyValueSet;
+import org.apache.tajo.util.Pair;
+
+import javax.annotation.Nullable;
+import java.net.URI;
+import java.sql.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import static org.apache.tajo.catalog.CatalogUtil.newSimpleDataType;
+
+public abstract class JdbcMetadataProviderBase implements MetadataProvider {
+  protected static final Log LOG = LogFactory.getLog(JdbcMetadataProviderBase.class);
+
+  protected final JdbcTablespace space;
+  protected final String databaseName;
+
+  protected final String jdbcUri;
+  protected final String username;
+  protected final String password;
+
+  protected final Connection connection;
+
+  public JdbcMetadataProviderBase(JdbcTablespace space, String dbName) {
+    this.space = space;
+    this.databaseName = dbName;
+
+    this.jdbcUri  = "";
+    this.username = "";
+    this.password = "";
+
+    String jdbcDriver = getJdbcDriverName();
+    try {
+      Class.forName(jdbcDriver).newInstance();
+      LOG.info("Loaded JDBC driver (" + jdbcDriver + ")");
+    } catch (Exception e) {
+      throw new TajoInternalError(e);
+    }
+
+    try {
+      connection = DriverManager.getConnection(jdbcUri, this.username, this.password);
+    } catch (SQLException e) {
+      throw new TajoInternalError(e);
+    }
+  }
+
+  @Override
+  public String getTablespaceName() {
+    return space.getName();
+  }
+
+  @Override
+  public URI getTablespaceUri() {
+    return space.getUri();
+  }
+
+  @Override
+  public String getDatabaseName() {
+    return databaseName;
+  }
+
+  @Override
+  public Collection<String> getSchemas() {
+    return Collections.EMPTY_SET;
+  }
+
+  @Override
+  public Collection<String> getTables(@Nullable String schemaPattern, @Nullable String tablePattern) {
+    ResultSet res = null;
+    List<String> tableNames = Lists.newArrayList();
+    try {
+      res = connection.getMetaData().getTables(databaseName, schemaPattern, tablePattern, new String [] {});
+      while(res.next()) {
+        tableNames.add(res.getString("TABLE_NAME"));
+      }
+    } catch (SQLException e) {
+      throw new TajoInternalError(e);
+    } finally {
+      try {
+        if (res != null) {
+          res.close();
+        }
+      } catch (SQLException e) {
+        LOG.warn(e);
+      }
+    }
+
+    return tableNames;
+  }
+
+  private TypeDesc convertDataType(ResultSet res) throws SQLException {
+    final int typeId = res.getInt("DATA_TYPE");
+
+    switch (typeId ) {
+    case Types.BOOLEAN:
+      return new TypeDesc(newSimpleDataType(Type.BOOLEAN));
+
+    case Types.TINYINT:
+    case Types.SMALLINT:
+    case Types.INTEGER:
+      return new TypeDesc(newSimpleDataType(Type.INT4));
+
+    case Types.BIGINT:
+      return new TypeDesc(newSimpleDataType(Type.INT8));
+
+    case Types.FLOAT:
+      return new TypeDesc(newSimpleDataType(Type.FLOAT4));
+
+    case Types.DOUBLE:
+      return new TypeDesc(newSimpleDataType(Type.FLOAT8));
+
+    case Types.DATE:
+      return new TypeDesc(newSimpleDataType(Type.DATE));
+
+    case Types.TIME:
+      return new TypeDesc(newSimpleDataType(Type.TIME));
+
+    case Types.TIMESTAMP:
+      return new TypeDesc(newSimpleDataType(Type.TIMESTAMP));
+
+    case Types.CHAR:
+    case Types.NCHAR:
+    case Types.VARCHAR:
+    case Types.NVARCHAR:
+    case Types.CLOB:
+    case Types.NCLOB:
+    case Types.LONGVARCHAR:
+    case Types.LONGNVARCHAR:
+      new TypeDesc(newSimpleDataType(Type.TEXT));
+
+    case Types.BINARY:
+    case Types.VARBINARY:
+    case Types.BLOB:
+      new TypeDesc(newSimpleDataType(Type.BLOB));
+
+    default:
+      throw new UnsupportedException("DATA_TYPE(" + typeId + ")");
+    }
+  }
+
+  @Override
+  public TableDesc getTableDescriptor(String schemaName, String tableName) throws UndefinedTablespaceException {
+    ResultSet resultForTable = null;
+    ResultSet resultForColumns = null;
+    try {
+
+      // get table name
+      resultForTable = connection.getMetaData().getTables(databaseName, schemaName, tableName, new String[]{});
+      final String name = resultForTable.getString("TABLE_NAME");
+      Preconditions.checkState(tableName.equals(name));
+
+      // get columns
+      resultForColumns = connection.getMetaData().getColumns(databaseName, schemaName, tableName, null);
+
+      List<Pair<Integer, Column>> columns = Lists.newArrayList();
+
+      while(resultForColumns.next()) {
+        final int ordinalPos = resultForColumns.getInt("ORDINAL_POSITION");
+        final String qualifier = resultForColumns.getString("TABLE_NAME");
+        final String columnName = resultForColumns.getString("COLUMN_NAME");
+        final TypeDesc type = convertDataType(resultForColumns);
+        Column c = new Column(CatalogUtil.buildFQName(qualifier, columnName), type);
+
+        columns.add(new Pair<Integer, Column>(ordinalPos, c));
+      }
+
+      // sort columns in an order of ordinal position
+      Collections.sort(columns, new Comparator<Pair<Integer, Column>>() {
+        @Override
+        public int compare(Pair<Integer, Column> o1, Pair<Integer, Column> o2) {
+          return o1.getFirst() - o2.getFirst();
+        }
+      });
+
+      // transform the pair list into collection for columns
+      Schema schema = new Schema(Collections2.transform(columns, new Function<Pair<Integer, Column>, Column>() {
+        @Override
+        public Column apply(@Nullable Pair<Integer, Column> columnPair) {
+          return columnPair.getSecond();
+        }
+      }));
+
+      return new TableDesc(
+          CatalogUtil.buildFQName(databaseName, name),
+          schema,
+          new TableMeta("rowstore", new KeyValueSet()),
+          space.getTableUri(databaseName, name)
+      );
+
+    } catch (SQLException e) {
+      throw new TajoInternalError(e);
+    } finally {
+      try {
+        if (resultForTable != null) {
+          resultForTable.close();
+        }
+
+        if (resultForColumns != null) {
+          resultForColumns.close();
+        }
+
+      } catch (SQLException e) {
+        LOG.warn(e);
+      }
+    }
+  }
+
+  protected abstract String getJdbcDriverName();
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/920e8a42/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
index 95fd258..0cb13fc 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
@@ -21,10 +21,8 @@ package org.apache.tajo.storage.jdbc;
 import org.apache.hadoop.fs.Path;
 import org.apache.tajo.ExecutionBlockId;
 import org.apache.tajo.OverridableConf;
-import org.apache.tajo.catalog.Schema;
-import org.apache.tajo.catalog.SortSpec;
-import org.apache.tajo.catalog.TableDesc;
-import org.apache.tajo.catalog.TableMeta;
+import org.apache.tajo.catalog.*;
+import org.apache.tajo.exception.UnsupportedException;
 import org.apache.tajo.plan.LogicalPlan;
 import org.apache.tajo.plan.logical.LogicalNode;
 import org.apache.tajo.plan.logical.ScanNode;
@@ -47,6 +45,8 @@ import java.util.Map;
  */
 public class JdbcTablespace extends Tablespace {
 
+  static final StorageProperty STORAGE_PROPERTY = new StorageProperty("rowstore", false, true, false, true);
+
   public JdbcTablespace(String name, URI uri) {
     super(name, uri);
   }
@@ -86,8 +86,6 @@ public class JdbcTablespace extends Tablespace {
     return null;
   }
 
-  static final StorageProperty STORAGE_PROPERTY = new StorageProperty("rowstore", false, true, false);
-
   @Override
   public StorageProperty getProperty() {
     return STORAGE_PROPERTY;
@@ -104,7 +102,11 @@ public class JdbcTablespace extends Tablespace {
   }
 
   @Override
-  public TupleRange[] getInsertSortRanges(OverridableConf queryContext, TableDesc tableDesc, Schema inputSchema, SortSpec[] sortSpecs, TupleRange dataRange) throws IOException {
+  public TupleRange[] getInsertSortRanges(OverridableConf queryContext,
+                                          TableDesc tableDesc,
+                                          Schema inputSchema,
+                                          SortSpec[] sortSpecs,
+                                          TupleRange dataRange) throws IOException {
     return new TupleRange[0];
   }
 
@@ -115,7 +117,6 @@ public class JdbcTablespace extends Tablespace {
 
   @Override
   public void createTable(TableDesc tableDesc, boolean ifNotExists) throws IOException {
-
   }
 
   @Override
@@ -143,4 +144,8 @@ public class JdbcTablespace extends Tablespace {
   public URI getStagingUri(OverridableConf context, String queryId, TableMeta meta) throws IOException {
     return null;
   }
+
+  public MetadataProvider getMetadataProvider() {
+    throw new UnsupportedException("Linked Metadata Provider for " + name);
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/920e8a42/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/hbase/TestJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/hbase/TestJdbcTableSpace.java b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/hbase/TestJdbcTableSpace.java
deleted file mode 100644
index f489e47..0000000
--- a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/hbase/TestJdbcTableSpace.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.hbase;
-
-import org.apache.tajo.catalog.Column;
-import org.apache.tajo.common.TajoDataTypes.Type;
-import org.apache.tajo.conf.TajoConf;
-import org.apache.tajo.datum.Datum;
-import org.apache.tajo.datum.TextDatum;
-import org.apache.tajo.plan.expr.*;
-import org.apache.tajo.plan.logical.ScanNode;
-import org.apache.tajo.storage.TablespaceManager;
-import org.apache.tajo.storage.jdbc.JdbcTablespace;
-import org.apache.tajo.util.Pair;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.List;
-import java.util.Set;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-public class TestJdbcTableSpace {
-  @BeforeClass
-  public static void setUp() throws IOException {
-    String mysqlUri = "jdbc:mysql://host1:2171/db1";
-    JdbcTablespace mysqlTablespace = new JdbcTablespace("cluster2", URI.create(mysqlUri));
-    mysqlTablespace.init(new TajoConf());
-    TablespaceManager.addTableSpaceForTest(mysqlTablespace);
-
-    String pgsqlUri = "jdbc:postgres://host1:2615/db2";
-    JdbcTablespace pgSQLTablespace = new JdbcTablespace("cluster3", URI.create(pgsqlUri));
-    pgSQLTablespace.init(new TajoConf());
-    TablespaceManager.addTableSpaceForTest(pgSQLTablespace);
-  }
-
-  @Test
-  public void testTablespaceHandler() throws Exception {
-    assertTrue((TablespaceManager.getByName("cluster2").get()) instanceof JdbcTablespace);
-    assertEquals("cluster2", (TablespaceManager.getByName("cluster2").get().getName()));
-    assertTrue((TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get()) instanceof JdbcTablespace);
-    assertEquals(URI.create("jdbc:mysql://host1:2171/db1"),
-        TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get().getUri());
-
-    assertTrue((TablespaceManager.getByName("cluster3").get()) instanceof JdbcTablespace);
-    assertEquals("cluster3", (TablespaceManager.getByName("cluster3").get().getName()));
-    assertTrue((TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get()) instanceof JdbcTablespace);
-
-    assertEquals(URI.create("jdbc:postgres://host1:2615/db2"),
-        TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get().getUri());
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/920e8a42/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestJdbcTableSpace.java b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestJdbcTableSpace.java
new file mode 100644
index 0000000..997a419
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestJdbcTableSpace.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+import com.google.common.collect.ImmutableSet;
+import io.airlift.testing.mysql.TestingMySqlServer;
+import org.apache.tajo.conf.TajoConf;
+import org.apache.tajo.storage.TablespaceManager;
+import org.apache.tajo.storage.jdbc.JdbcTablespace;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.net.URI;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.Statement;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class TestJdbcTableSpace {
+  @BeforeClass
+  public static void setUp() throws IOException {
+    String mysqlUri = "jdbc:mysql://host1:2171/db1";
+    JdbcTablespace mysqlTablespace = new JdbcTablespace("cluster2", URI.create(mysqlUri));
+    mysqlTablespace.init(new TajoConf());
+    TablespaceManager.addTableSpaceForTest(mysqlTablespace);
+
+    String pgsqlUri = "jdbc:postgres://host1:2615/db2";
+    JdbcTablespace pgSQLTablespace = new JdbcTablespace("cluster3", URI.create(pgsqlUri));
+    pgSQLTablespace.init(new TajoConf());
+    TablespaceManager.addTableSpaceForTest(pgSQLTablespace);
+  }
+
+  @Test
+  public void testTablespaceHandler() throws Exception {
+    assertTrue((TablespaceManager.getByName("cluster2").get()) instanceof JdbcTablespace);
+    assertEquals("cluster2", (TablespaceManager.getByName("cluster2").get().getName()));
+    assertTrue((TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get()) instanceof JdbcTablespace);
+    assertEquals(URI.create("jdbc:mysql://host1:2171/db1"),
+        TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get().getUri());
+
+    assertTrue((TablespaceManager.getByName("cluster3").get()) instanceof JdbcTablespace);
+    assertEquals("cluster3", (TablespaceManager.getByName("cluster3").get().getName()));
+    assertTrue((TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get()) instanceof JdbcTablespace);
+
+    assertEquals(URI.create("jdbc:postgres://host1:2615/db2"),
+        TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get().getUri());
+  }
+
+  @Test
+  public void test() throws Exception {
+    try (TestingMySqlServer server = new TestingMySqlServer("testuser", "testpass", "db1", "db2")) {
+      assertTrue(server.isRunning());
+      assertTrue(server.isReadyForConnections());
+      assertEquals(server.getMySqlVersion(), "5.5.9");
+      assertEquals(server.getDatabases(), ImmutableSet.of("db1", "db2"));
+      assertEquals(server.getUser(), "testuser");
+      assertEquals(server.getPassword(), "testpass");
+      assertEquals(server.getJdbcUrl().substring(0, 5), "jdbc:");
+      assertEquals(server.getPort(), URI.create(server.getJdbcUrl().substring(5)).getPort());
+
+      for (String database : server.getDatabases()) {
+        try (Connection connection = DriverManager.getConnection(server.getJdbcUrl())) {
+          connection.setCatalog(database);
+          try (Statement statement = connection.createStatement()) {
+            statement.execute("CREATE TABLE test_table (c1 bigint PRIMARY KEY)");
+            statement.execute("INSERT INTO test_table (c1) VALUES (1)");
+            try (ResultSet resultSet = statement.executeQuery("SELECT count(*) FROM test_table")) {
+              assertTrue(resultSet.next());
+              assertEquals(resultSet.getLong(1), 1L);
+              assertFalse(resultSet.next());
+            }
+          }
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/920e8a42/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
new file mode 100644
index 0000000..966fa8b
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+import com.google.common.collect.ImmutableSet;
+import io.airlift.testing.mysql.TestingMySqlServer;
+import org.apache.tajo.conf.TajoConf;
+import org.apache.tajo.storage.TablespaceManager;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.net.URI;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.Statement;
+
+import static org.junit.Assert.*;
+
+public class TestMysqlJdbcTableSpace {
+  @BeforeClass
+  public static void setUp() throws IOException {
+    String mysqlUri = "jdbc:mysql://host1:2171/db1";
+    JdbcTablespace mysqlTablespace = new JdbcTablespace("cluster2", URI.create(mysqlUri));
+    mysqlTablespace.init(new TajoConf());
+    TablespaceManager.addTableSpaceForTest(mysqlTablespace);
+
+    String pgsqlUri = "jdbc:postgres://host1:2615/db2";
+    JdbcTablespace pgSQLTablespace = new JdbcTablespace("cluster3", URI.create(pgsqlUri));
+    pgSQLTablespace.init(new TajoConf());
+    TablespaceManager.addTableSpaceForTest(pgSQLTablespace);
+  }
+
+  @Test
+  public void testTablespaceHandler() throws Exception {
+    assertTrue((TablespaceManager.getByName("cluster2").get()) instanceof JdbcTablespace);
+    assertEquals("cluster2", (TablespaceManager.getByName("cluster2").get().getName()));
+    assertTrue((TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get()) instanceof JdbcTablespace);
+    assertEquals(URI.create("jdbc:mysql://host1:2171/db1"),
+        TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get().getUri());
+
+    assertTrue((TablespaceManager.getByName("cluster3").get()) instanceof JdbcTablespace);
+    assertEquals("cluster3", (TablespaceManager.getByName("cluster3").get().getName()));
+    assertTrue((TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get()) instanceof JdbcTablespace);
+
+    assertEquals(URI.create("jdbc:postgres://host1:2615/db2"),
+        TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get().getUri());
+  }
+
+  @Test
+  public void test() throws Exception {
+    try (TestingMySqlServer server = new TestingMySqlServer("testuser", "testpass", "db1", "db2")) {
+      assertTrue(server.isRunning());
+      assertTrue(server.isReadyForConnections());
+      assertEquals(server.getMySqlVersion(), "5.5.9");
+      assertEquals(server.getDatabases(), ImmutableSet.of("db1", "db2"));
+      assertEquals(server.getUser(), "testuser");
+      assertEquals(server.getPassword(), "testpass");
+      assertEquals(server.getJdbcUrl().substring(0, 5), "jdbc:");
+      assertEquals(server.getPort(), URI.create(server.getJdbcUrl().substring(5)).getPort());
+
+      for (String database : server.getDatabases()) {
+        try (Connection connection = DriverManager.getConnection(server.getJdbcUrl())) {
+          connection.setCatalog(database);
+          try (Statement statement = connection.createStatement()) {
+            statement.execute("CREATE TABLE test_table (c1 bigint PRIMARY KEY)");
+            statement.execute("INSERT INTO test_table (c1) VALUES (1)");
+            try (ResultSet resultSet = statement.executeQuery("SELECT count(*) FROM test_table")) {
+              assertTrue(resultSet.next());
+              assertEquals(resultSet.getLong(1), 1L);
+              assertFalse(resultSet.next());
+            }
+          }
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/920e8a42/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestPgSQLJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestPgSQLJdbcTableSpace.java b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestPgSQLJdbcTableSpace.java
new file mode 100644
index 0000000..aef70a9
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestPgSQLJdbcTableSpace.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+import io.airlift.testing.postgresql.TestingPostgreSqlServer;
+import org.apache.tajo.conf.TajoConf;
+import org.apache.tajo.storage.TablespaceManager;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.net.URI;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.Statement;
+
+import static org.junit.Assert.*;
+
+public class TestPgSQLJdbcTableSpace {
+  @BeforeClass
+  public static void setUp() throws IOException {
+    String mysqlUri = "jdbc:mysql://host1:2171/db1";
+    JdbcTablespace mysqlTablespace = new JdbcTablespace("cluster2", URI.create(mysqlUri));
+    mysqlTablespace.init(new TajoConf());
+    TablespaceManager.addTableSpaceForTest(mysqlTablespace);
+
+    String pgsqlUri = "jdbc:postgres://host1:2615/db2";
+    JdbcTablespace pgSQLTablespace = new JdbcTablespace("cluster3", URI.create(pgsqlUri));
+    pgSQLTablespace.init(new TajoConf());
+    TablespaceManager.addTableSpaceForTest(pgSQLTablespace);
+  }
+
+  @Test
+  public void testTablespaceHandler() throws Exception {
+    assertTrue((TablespaceManager.getByName("cluster2").get()) instanceof JdbcTablespace);
+    assertEquals("cluster2", (TablespaceManager.getByName("cluster2").get().getName()));
+    assertTrue((TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get()) instanceof JdbcTablespace);
+    assertEquals(URI.create("jdbc:mysql://host1:2171/db1"),
+        TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get().getUri());
+
+    assertTrue((TablespaceManager.getByName("cluster3").get()) instanceof JdbcTablespace);
+    assertEquals("cluster3", (TablespaceManager.getByName("cluster3").get().getName()));
+    assertTrue((TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get()) instanceof JdbcTablespace);
+
+    assertEquals(URI.create("jdbc:postgres://host1:2615/db2"),
+        TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get().getUri());
+  }
+
+  @Test
+  public void test() throws Exception {
+    try (TestingPostgreSqlServer server = new TestingPostgreSqlServer("testuser", "testdb")) {
+      assertEquals(server.getUser(), "testuser");
+      assertEquals(server.getDatabase(), "testdb");
+      assertEquals(server.getJdbcUrl().substring(0, 5), "jdbc:");
+      assertEquals(server.getPort(), URI.create(server.getJdbcUrl().substring(5)).getPort());
+
+      try (Connection connection = DriverManager.getConnection(server.getJdbcUrl())) {
+        try (Statement statement = connection.createStatement()) {
+          statement.execute("CREATE TABLE test_table (c1 bigint PRIMARY KEY)");
+          statement.execute("INSERT INTO test_table (c1) VALUES (1)");
+          try (ResultSet resultSet = statement.executeQuery("SELECT count(*) FROM test_table")) {
+            assertTrue(resultSet.next());
+            assertEquals(resultSet.getLong(1), 1L);
+            assertFalse(resultSet.next());
+          }
+        }
+      }
+    }
+  }
+}


[35/39] tajo git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730

Posted by hy...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/e3a92621
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/e3a92621
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/e3a92621

Branch: refs/heads/TAJO-1730
Commit: e3a9262178c6ab3755df42ca99c8cfdaa3d5f108
Parents: fa81988 848a8c3
Author: Hyunsik Choi <hy...@apache.org>
Authored: Tue Sep 1 12:23:24 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Tue Sep 1 12:23:24 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |  11 +-
 .../org/apache/tajo/algebra/Aggregation.java    |   2 +-
 .../org/apache/tajo/catalog/SchemaUtil.java     |   8 +-
 .../java/org/apache/tajo/QueryTestCaseBase.java |   6 +-
 .../src/test/resources/tpch/customer.tbl        |  10 +-
 .../src/test/resources/tpch/lineitem.tbl        |  10 +-
 .../src/test/resources/tpch/nation.tbl          |  50 ++--
 .../src/test/resources/tpch/orders.tbl          |   6 +-
 .../src/test/resources/tpch/partsupp.tbl        |   6 +-
 .../src/test/resources/tpch/region.tbl          |  10 +-
 .../src/test/resources/tpch/supplier.tbl        |   6 +-
 .../main/java/org/apache/tajo/SessionVars.java  |   7 +-
 .../java/org/apache/tajo/conf/TajoConf.java     |   5 +-
 .../apache/tajo/exception/ErrorMessages.java    |   5 +
 .../apache/tajo/exception/ExceptionUtil.java    |   3 +
 .../exception/InvalidInputsForCrossJoin.java    |  37 +++
 .../TooLargeInputForCrossJoinException.java     |  38 +++
 .../java/org/apache/tajo/util/StringUtils.java  |   2 +-
 tajo-common/src/main/proto/errors.proto         |  22 +-
 .../org/apache/tajo/cli/tsql/TestTajoCli.java   |   5 +-
 .../planner/physical/TestBNLJoinExec.java       | 224 -----------------
 .../engine/planner/physical/TestNLJoinExec.java | 208 ----------------
 .../apache/tajo/engine/query/TestCrossJoin.java | 163 ++++++++++++
 .../tajo/engine/query/TestInnerJoinQuery.java   |  67 -----
 .../apache/tajo/engine/query/TestJoinQuery.java |  12 +-
 .../tajo/engine/query/TestTablePartitions.java  |  46 +++-
 .../TestCrossJoin/testCrossJoinAndCaseWhen.sql  |  18 ++
 .../testCrossJoinWithAsterisk1.sql              |   1 +
 .../testCrossJoinWithAsterisk2.sql              |   1 +
 .../testCrossJoinWithAsterisk3.sql              |   1 +
 .../testCrossJoinWithAsterisk4.sql              |   1 +
 .../testCrossJoinAndCaseWhen.sql                |  18 --
 .../testCrossJoinWithAsterisk1.sql              |   1 -
 .../testCrossJoinWithAsterisk2.sql              |   1 -
 .../testCrossJoinWithAsterisk3.sql              |   1 -
 .../testCrossJoinWithAsterisk4.sql              |   1 -
 .../TestCrossJoin/testCrossJoin.1.Hash.plan     |  76 ++++++
 .../testCrossJoin.1.Hash_NoBroadcast.plan       | 103 ++++++++
 .../TestCrossJoin/testCrossJoin.1.Sort.plan     |  76 ++++++
 .../testCrossJoin.1.Sort_NoBroadcast.plan       | 103 ++++++++
 .../TestCrossJoin/testCrossJoin.1.result        | 127 ++++++++++
 .../TestCrossJoin/testCrossJoin.2.Hash.plan     |  51 ++++
 .../testCrossJoin.2.Hash_NoBroadcast.plan       |  78 ++++++
 .../TestCrossJoin/testCrossJoin.2.Sort.plan     |  51 ++++
 .../testCrossJoin.2.Sort_NoBroadcast.plan       |  78 ++++++
 .../TestCrossJoin/testCrossJoin.2.result        |  27 ++
 .../TestCrossJoin/testCrossJoin.3.Hash.plan     |  51 ++++
 .../testCrossJoin.3.Hash_NoBroadcast.plan       |  78 ++++++
 .../TestCrossJoin/testCrossJoin.3.Sort.plan     |  51 ++++
 .../testCrossJoin.3.Sort_NoBroadcast.plan       |  78 ++++++
 .../TestCrossJoin/testCrossJoin.3.result        |  27 ++
 .../TestCrossJoin/testCrossJoin.4.Hash.plan     |  51 ++++
 .../testCrossJoin.4.Hash_NoBroadcast.plan       |  78 ++++++
 .../TestCrossJoin/testCrossJoin.4.Sort.plan     |  51 ++++
 .../testCrossJoin.4.Sort_NoBroadcast.plan       |  78 ++++++
 .../TestCrossJoin/testCrossJoin.4.result        |  27 ++
 .../TestCrossJoin/testCrossJoin.5.Hash.plan     |  76 ++++++
 .../testCrossJoin.5.Hash_NoBroadcast.plan       | 103 ++++++++
 .../TestCrossJoin/testCrossJoin.5.Sort.plan     |  76 ++++++
 .../testCrossJoin.5.Sort_NoBroadcast.plan       | 103 ++++++++
 .../TestCrossJoin/testCrossJoin.5.result        |  27 ++
 .../testCrossJoinAndCaseWhen.Hash.plan          |  78 ++++++
 ...stCrossJoinAndCaseWhen.Hash_NoBroadcast.plan | 105 ++++++++
 .../testCrossJoinAndCaseWhen.Sort.plan          |  78 ++++++
 ...stCrossJoinAndCaseWhen.Sort_NoBroadcast.plan | 105 ++++++++
 .../testCrossJoinAndCaseWhen.result             |  27 ++
 .../testCrossJoinOfOneSmallTable.1.Hash.plan    |  51 ++++
 ...sJoinOfOneSmallTable.1.Hash_NoBroadcast.plan |  78 ++++++
 .../testCrossJoinOfOneSmallTable.1.Sort.plan    |  51 ++++
 ...sJoinOfOneSmallTable.1.Sort_NoBroadcast.plan |  78 ++++++
 .../testCrossJoinOfOneSmallTable.1.result       | 127 ++++++++++
 ...tCrossJoinOfOneSmallTableAndJoin.1.Hash.plan |  89 +++++++
 ...OneSmallTableAndJoin.1.Hash_NoBroadcast.plan | 174 +++++++++++++
 ...tCrossJoinOfOneSmallTableAndJoin.1.Sort.plan |  89 +++++++
 ...OneSmallTableAndJoin.1.Sort_NoBroadcast.plan | 174 +++++++++++++
 ...testCrossJoinOfOneSmallTableAndJoin.1.result |   2 +
 .../testCrossJoinOftwoSmallTables.1.Hash.plan   |  51 ++++
 ...JoinOftwoSmallTables.1.Hash_NoBroadcast.plan |  78 ++++++
 .../testCrossJoinOftwoSmallTables.1.Sort.plan   |  51 ++++
 ...JoinOftwoSmallTables.1.Sort_NoBroadcast.plan |  78 ++++++
 .../testCrossJoinOftwoSmallTables.1.result      |  27 ++
 .../testCrossJoinWithAsterisk1.Hash.plan        |  76 ++++++
 ...CrossJoinWithAsterisk1.Hash_NoBroadcast.plan | 103 ++++++++
 .../testCrossJoinWithAsterisk1.Sort.plan        |  76 ++++++
 ...CrossJoinWithAsterisk1.Sort_NoBroadcast.plan | 103 ++++++++
 .../testCrossJoinWithAsterisk1.result           |  27 ++
 .../testCrossJoinWithAsterisk2.Hash.plan        |  76 ++++++
 ...CrossJoinWithAsterisk2.Hash_NoBroadcast.plan | 103 ++++++++
 .../testCrossJoinWithAsterisk2.Sort.plan        |  76 ++++++
 ...CrossJoinWithAsterisk2.Sort_NoBroadcast.plan | 103 ++++++++
 .../testCrossJoinWithAsterisk2.result           |  27 ++
 .../testCrossJoinWithAsterisk3.Hash.plan        |  76 ++++++
 ...CrossJoinWithAsterisk3.Hash_NoBroadcast.plan | 103 ++++++++
 .../testCrossJoinWithAsterisk3.Sort.plan        |  76 ++++++
 ...CrossJoinWithAsterisk3.Sort_NoBroadcast.plan | 103 ++++++++
 .../testCrossJoinWithAsterisk3.result           |  27 ++
 .../testCrossJoinWithAsterisk4.Hash.plan        |  76 ++++++
 ...CrossJoinWithAsterisk4.Hash_NoBroadcast.plan | 103 ++++++++
 .../testCrossJoinWithAsterisk4.Sort.plan        |  76 ++++++
 ...CrossJoinWithAsterisk4.Sort_NoBroadcast.plan | 103 ++++++++
 .../testCrossJoinWithAsterisk4.result           |  27 ++
 .../testCrossJoinWithEmptyTable1.Hash.plan      |  78 ++++++
 ...ossJoinWithEmptyTable1.Hash_NoBroadcast.plan | 105 ++++++++
 .../testCrossJoinWithEmptyTable1.Sort.plan      |  78 ++++++
 ...ossJoinWithEmptyTable1.Sort_NoBroadcast.plan | 105 ++++++++
 .../testCrossJoinWithEmptyTable1.result         |   2 +
 ...sJoinWithThetaJoinConditionInWhere.Hash.plan |  63 +++++
 ...taJoinConditionInWhere.Hash_NoBroadcast.plan |  90 +++++++
 ...sJoinWithThetaJoinConditionInWhere.Sort.plan |  63 +++++
 ...taJoinConditionInWhere.Sort_NoBroadcast.plan |  90 +++++++
 ...rossJoinWithThetaJoinConditionInWhere.result |  12 +
 .../testCrossJoin.1.Hash.plan                   |  76 ------
 .../testCrossJoin.1.Hash_NoBroadcast.plan       | 103 --------
 .../testCrossJoin.1.Sort.plan                   |  76 ------
 .../testCrossJoin.1.Sort_NoBroadcast.plan       | 103 --------
 .../TestInnerJoinQuery/testCrossJoin.1.result   | 127 ----------
 .../testCrossJoin.2.Hash.plan                   |  51 ----
 .../testCrossJoin.2.Hash_NoBroadcast.plan       |  78 ------
 .../testCrossJoin.2.Sort.plan                   |  51 ----
 .../testCrossJoin.2.Sort_NoBroadcast.plan       |  78 ------
 .../TestInnerJoinQuery/testCrossJoin.2.result   |  27 --
 .../testCrossJoin.3.Hash.plan                   |  51 ----
 .../testCrossJoin.3.Hash_NoBroadcast.plan       |  78 ------
 .../testCrossJoin.3.Sort.plan                   |  51 ----
 .../testCrossJoin.3.Sort_NoBroadcast.plan       |  78 ------
 .../TestInnerJoinQuery/testCrossJoin.3.result   |  27 --
 .../testCrossJoin.4.Hash.plan                   |  51 ----
 .../testCrossJoin.4.Hash_NoBroadcast.plan       |  78 ------
 .../testCrossJoin.4.Sort.plan                   |  51 ----
 .../testCrossJoin.4.Sort_NoBroadcast.plan       |  78 ------
 .../TestInnerJoinQuery/testCrossJoin.4.result   |  27 --
 .../testCrossJoin.5.Hash.plan                   |  76 ------
 .../testCrossJoin.5.Hash_NoBroadcast.plan       | 103 --------
 .../testCrossJoin.5.Sort.plan                   |  76 ------
 .../testCrossJoin.5.Sort_NoBroadcast.plan       | 103 --------
 .../TestInnerJoinQuery/testCrossJoin.5.result   |  27 --
 .../testCrossJoinAndCaseWhen.Hash.plan          |  78 ------
 ...stCrossJoinAndCaseWhen.Hash_NoBroadcast.plan | 105 --------
 .../testCrossJoinAndCaseWhen.Sort.plan          |  78 ------
 ...stCrossJoinAndCaseWhen.Sort_NoBroadcast.plan | 105 --------
 .../testCrossJoinAndCaseWhen.result             |  27 --
 .../testCrossJoinWithAsterisk1.Hash.plan        |  76 ------
 ...CrossJoinWithAsterisk1.Hash_NoBroadcast.plan | 103 --------
 .../testCrossJoinWithAsterisk1.Sort.plan        |  76 ------
 ...CrossJoinWithAsterisk1.Sort_NoBroadcast.plan | 103 --------
 .../testCrossJoinWithAsterisk1.result           |  27 --
 .../testCrossJoinWithAsterisk2.Hash.plan        |  76 ------
 ...CrossJoinWithAsterisk2.Hash_NoBroadcast.plan | 103 --------
 .../testCrossJoinWithAsterisk2.Sort.plan        |  76 ------
 ...CrossJoinWithAsterisk2.Sort_NoBroadcast.plan | 103 --------
 .../testCrossJoinWithAsterisk2.result           |  27 --
 .../testCrossJoinWithAsterisk3.Hash.plan        |  76 ------
 ...CrossJoinWithAsterisk3.Hash_NoBroadcast.plan | 103 --------
 .../testCrossJoinWithAsterisk3.Sort.plan        |  76 ------
 ...CrossJoinWithAsterisk3.Sort_NoBroadcast.plan | 103 --------
 .../testCrossJoinWithAsterisk3.result           |  27 --
 .../testCrossJoinWithAsterisk4.Hash.plan        |  76 ------
 ...CrossJoinWithAsterisk4.Hash_NoBroadcast.plan | 103 --------
 .../testCrossJoinWithAsterisk4.Sort.plan        |  76 ------
 ...CrossJoinWithAsterisk4.Sort_NoBroadcast.plan | 103 --------
 .../testCrossJoinWithAsterisk4.result           |  27 --
 .../testCrossJoinWithEmptyTable1.Hash.plan      |  78 ------
 ...ossJoinWithEmptyTable1.Hash_NoBroadcast.plan | 105 --------
 .../testCrossJoinWithEmptyTable1.Sort.plan      |  78 ------
 ...ossJoinWithEmptyTable1.Sort_NoBroadcast.plan | 105 --------
 .../testCrossJoinWithEmptyTable1.result         |   2 -
 ...sJoinWithThetaJoinConditionInWhere.Hash.plan |  63 -----
 ...taJoinConditionInWhere.Hash_NoBroadcast.plan |  90 -------
 ...sJoinWithThetaJoinConditionInWhere.Sort.plan |  63 -----
 ...taJoinConditionInWhere.Sort_NoBroadcast.plan |  90 -------
 ...rossJoinWithThetaJoinConditionInWhere.result |  12 -
 .../testJoinWithMultipleJoinQual1.Hash.plan     |   4 +-
 ...nWithMultipleJoinQual1.Hash_NoBroadcast.plan |   4 +-
 .../testJoinWithMultipleJoinQual1.Sort.plan     |   4 +-
 ...nWithMultipleJoinQual1.Sort_NoBroadcast.plan |   4 +-
 .../testJoinWithOrPredicates.Hash.plan          |   4 +-
 ...stJoinWithOrPredicates.Hash_NoBroadcast.plan |   4 +-
 .../testJoinWithOrPredicates.Sort.plan          |   4 +-
 ...stJoinWithOrPredicates.Sort_NoBroadcast.plan |   4 +-
 .../testNaturalJoin.Hash.plan                   |   4 +-
 .../testNaturalJoin.Hash_NoBroadcast.plan       |   4 +-
 .../testNaturalJoin.Sort.plan                   |   4 +-
 .../testNaturalJoin.Sort_NoBroadcast.plan       |   4 +-
 ...testJoinFilterOfRowPreservedTable1.Hash.plan |   4 +-
 ...erOfRowPreservedTable1.Hash_NoBroadcast.plan |   4 +-
 ...testJoinFilterOfRowPreservedTable1.Sort.plan |   4 +-
 ...erOfRowPreservedTable1.Sort_NoBroadcast.plan |   4 +-
 .../testLeftOuterJoin2.Hash.plan                |  56 ++---
 .../testLeftOuterJoin2.Hash_NoBroadcast.plan    | 118 ++++-----
 .../testLeftOuterJoin2.Sort.plan                |  56 ++---
 .../testLeftOuterJoin2.Sort_NoBroadcast.plan    | 118 ++++-----
 .../testLeftOuterJoin3.Hash.plan                |  73 ++----
 .../testLeftOuterJoin3.Sort.plan                |  73 ++----
 ...tOuterJoinPredicationCaseByCase1.1.Hash.plan |   4 +-
 ...edicationCaseByCase1.1.Hash_NoBroadcast.plan |   4 +-
 ...tOuterJoinPredicationCaseByCase1.1.Sort.plan |   4 +-
 ...edicationCaseByCase1.1.Sort_NoBroadcast.plan |   4 +-
 ...tOuterJoinPredicationCaseByCase2.1.Hash.plan |  67 ++---
 ...tOuterJoinPredicationCaseByCase2.1.Sort.plan |  67 ++---
 ...tOuterJoinPredicationCaseByCase3.1.Hash.plan |   4 +-
 ...edicationCaseByCase3.1.Hash_NoBroadcast.plan |   4 +-
 ...tOuterJoinPredicationCaseByCase3.1.Sort.plan |   4 +-
 ...edicationCaseByCase3.1.Sort_NoBroadcast.plan |   4 +-
 .../testLeftOuterJoinWithNull2.Hash.plan        |   4 +-
 ...LeftOuterJoinWithNull2.Hash_NoBroadcast.plan |   4 +-
 .../testLeftOuterJoinWithNull2.Sort.plan        |   4 +-
 ...LeftOuterJoinWithNull2.Sort_NoBroadcast.plan |   4 +-
 .../testOuterJoinAndCaseWhen1.Hash.plan         |  73 ++----
 .../testOuterJoinAndCaseWhen1.Sort.plan         |  73 ++----
 ...tOuterJoinPredicationCaseByCase1.1.Hash.plan |  71 ++----
 ...edicationCaseByCase1.1.Hash_NoBroadcast.plan |   4 +-
 ...tOuterJoinPredicationCaseByCase1.1.Sort.plan |  71 ++----
 ...edicationCaseByCase1.1.Sort_NoBroadcast.plan |   4 +-
 ...tOuterJoinPredicationCaseByCase2.1.Hash.plan |   4 +-
 ...edicationCaseByCase2.1.Hash_NoBroadcast.plan |   4 +-
 ...tOuterJoinPredicationCaseByCase2.1.Sort.plan |   4 +-
 ...edicationCaseByCase2.1.Sort_NoBroadcast.plan |   4 +-
 ...tOuterJoinPredicationCaseByCase3.1.Hash.plan |  69 ++----
 ...edicationCaseByCase3.1.Hash_NoBroadcast.plan |   4 +-
 ...tOuterJoinPredicationCaseByCase3.1.Sort.plan |  69 ++----
 ...edicationCaseByCase3.1.Sort_NoBroadcast.plan |   4 +-
 .../TestTajoCli/testHelpSessionVars.result      |   5 +-
 .../engine/planner/PhysicalPlannerImpl.java     |  22 +-
 .../tajo/engine/planner/enforce/Enforcer.java   |   4 -
 .../engine/planner/global/ExecutionBlock.java   |   4 +-
 .../rewriter/rules/BroadcastJoinRule.java       | 248 +++++++++++++++----
 .../rewriter/rules/GlobalPlanRewriteUtil.java   |   2 +-
 .../engine/planner/physical/BNLJoinExec.java    | 183 --------------
 .../planner/physical/BSTIndexScanExec.java      |  26 +-
 .../physical/BasicPhysicalExecutorVisitor.java  |  29 +--
 .../planner/physical/CommonHashJoinExec.java    |  91 +++++--
 .../planner/physical/HashFullOuterJoinExec.java |   2 +-
 .../engine/planner/physical/HashJoinExec.java   |   7 +-
 .../planner/physical/IndexExecutorUtil.java     |  33 +++
 .../engine/planner/physical/NLJoinExec.java     |  75 ------
 .../physical/PartitionMergeScanExec.java        |   5 +
 .../physical/PhysicalExecutorVisitor.java       |   9 +-
 .../tajo/engine/planner/physical/ScanExec.java  |   3 +
 .../engine/planner/physical/SeqScanExec.java    |   5 +
 .../engine/planner/physical/StoreIndexExec.java |  10 +-
 .../apache/tajo/engine/utils/CacheHolder.java   |  26 +-
 .../org/apache/tajo/master/GlobalEngine.java    |  15 +-
 .../tajo/master/QueryCoordinatorService.java    |   6 +-
 .../org/apache/tajo/master/QueryInProgress.java |   7 +-
 .../apache/tajo/master/exec/QueryExecutor.java  |  33 ++-
 .../java/org/apache/tajo/querymaster/Query.java |  68 ++---
 .../apache/tajo/querymaster/QueryMaster.java    |   6 +
 .../tajo/querymaster/QueryMasterTask.java       |  57 +++--
 .../apache/tajo/querymaster/Repartitioner.java  |   6 +-
 .../java/org/apache/tajo/querymaster/Stage.java |  27 +-
 .../apache/tajo/querymaster/TaskAttempt.java    |  17 +-
 .../tajo/worker/ExecutionBlockContext.java      |   2 +-
 .../apache/tajo/worker/TaskAttemptContext.java  |  11 -
 tajo-core/src/main/proto/ResourceProtos.proto   |   4 +-
 .../org/apache/tajo/plan/LogicalPlanner.java    |   1 +
 .../GreedyHeuristicJoinOrderAlgorithm.java      |  20 +-
 .../plan/rewrite/rules/FilterPushDownRule.java  |   3 +-
 .../org/apache/tajo/plan/util/IndexUtil.java    |  72 ------
 .../org/apache/tajo/plan/util/PlannerUtil.java  |   6 +
 .../plan/verifier/PostLogicalPlanVerifier.java  | 148 +++++++++++
 tajo-plan/src/main/proto/Plan.proto             |   2 -
 .../tajo/storage/pgsql/EmbedPgSQLServer.java    |  45 +++-
 .../storage/pgsql/TestPgSQLJdbcTableSpace.java  |  10 +-
 .../pgsql/TestPgSQLMetadataProvider.java        |   2 +-
 .../pgsql/TestPgSQLSimpleQueryTests.java        |   1 +
 .../testSelectAll.result                        |   2 +-
 .../testSelectLimit.result                      |   2 +-
 267 files changed, 7149 insertions(+), 6310 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/e3a92621/tajo-cluster-tests/src/test/java/org/apache/tajo/QueryTestCaseBase.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/e3a92621/tajo-common/src/main/java/org/apache/tajo/exception/ExceptionUtil.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/e3a92621/tajo-common/src/main/java/org/apache/tajo/util/StringUtils.java
----------------------------------------------------------------------
diff --cc tajo-common/src/main/java/org/apache/tajo/util/StringUtils.java
index aa426c8,7a9f0c3..2d57c0a
--- a/tajo-common/src/main/java/org/apache/tajo/util/StringUtils.java
+++ b/tajo-common/src/main/java/org/apache/tajo/util/StringUtils.java
@@@ -406,17 -405,7 +406,17 @@@ public class StringUtils 
     * @return A joined string
     */
    public static String join(Object[] objects) {
-     return join(objects, ",");
 -    return join(objects, ", ", 0, objects.length);
++    return join(objects, ", ");
 +  }
 +
 +  /**
 +   * Concatenate all objects' string with the delimiter ", "
 +   *
 +   * @param objects Iterable objects
 +   * @return A joined string
 +   */
 +  public static String join(Object[] objects, String delimiter) {
 +    return join(objects, delimiter, 0, objects.length);
    }
  
    /**

http://git-wip-us.apache.org/repos/asf/tajo/blob/e3a92621/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/e3a92621/tajo-core/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/e3a92621/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/SeqScanExec.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/e3a92621/tajo-core/src/main/java/org/apache/tajo/master/exec/QueryExecutor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/e3a92621/tajo-core/src/main/java/org/apache/tajo/querymaster/Repartitioner.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/e3a92621/tajo-core/src/main/java/org/apache/tajo/querymaster/Stage.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/e3a92621/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlanner.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/e3a92621/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java
----------------------------------------------------------------------
diff --cc tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java
index 6dd5a7f,d9fb218..8defa99
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/util/PlannerUtil.java
@@@ -968,13 -993,9 +968,19 @@@ public class PlannerUtil 
      return inSubqueries;
    }
  
 +  public static int [] getTargetIds(Schema inputSchema, Column...targets) {
 +    int [] targetIds = new int[targets.length];
 +    for (int i = 0; i < targetIds.length; i++) {
 +      targetIds[i] = inputSchema.getColumnId(targets[i].getQualifiedName());
 +    }
 +    Arrays.sort(targetIds);
 +
 +    return targetIds;
 +  }
++
+   public static List<EvalNode> getAllEqualEvals(EvalNode qual) {
+     EvalTreeUtil.EvalFinder finder = new EvalTreeUtil.EvalFinder(EvalType.EQUAL);
+     finder.visit(null, qual, new Stack<EvalNode>());
+     return finder.getEvalNodes();
+   }
  }

http://git-wip-us.apache.org/repos/asf/tajo/blob/e3a92621/tajo-plan/src/main/proto/Plan.proto
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/e3a92621/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java
----------------------------------------------------------------------
diff --cc tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java
index a30a1cd,0000000..f9425ad
mode 100644,000000..100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java
@@@ -1,135 -1,0 +1,174 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *     http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +
 +package org.apache.tajo.storage.pgsql;
 +
 +import io.airlift.testing.postgresql.TestingPostgreSqlServer;
 +import net.minidev.json.JSONObject;
 +import org.apache.commons.logging.Log;
 +import org.apache.commons.logging.LogFactory;
 +import org.apache.hadoop.fs.Path;
 +import org.apache.tajo.conf.TajoConf;
 +import org.apache.tajo.storage.TablespaceManager;
 +import org.apache.tajo.util.CommonTestingUtil;
 +import org.apache.tajo.util.FileUtil;
 +import org.apache.tajo.util.JavaResourceUtil;
 +
 +import java.io.IOException;
 +import java.net.URI;
 +import java.sql.Connection;
 +import java.sql.DriverManager;
 +import java.sql.SQLException;
 +import java.sql.Statement;
 +import java.util.HashMap;
 +import java.util.Map;
 +
 +public class EmbedPgSQLServer {
 +  private static final Log LOG = LogFactory.getLog(EmbedPgSQLServer.class);
 +
 +  private static EmbedPgSQLServer instance;
 +
 +  public static final String [] TPCH_TABLES = {
 +      "customer", "lineitem", "nation", "orders", "part", "partsupp", "region", "supplier"
 +  };
 +
 +  public static final String SPACENAME = "pgsql_cluster";
 +  public static final String DATABASE_NAME = "tpch";
 +
-   private TestingPostgreSqlServer server;
++  private final TestingPostgreSqlServer server;
 +
 +  static {
 +    try {
 +      instance = new EmbedPgSQLServer();
 +    } catch (Exception e) {
 +      throw new RuntimeException(e);
 +    }
 +  }
 +
 +  public static EmbedPgSQLServer getInstance() {
 +    return instance;
 +  }
 +
 +  private EmbedPgSQLServer() throws Exception {
 +    server = new TestingPostgreSqlServer("testuser",
 +        "tpch"
 +    );
 +
++    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
++      @Override
++      public void run() {
++        try {
++          server.close();
++        } catch (IOException e) {
++          e.printStackTrace();
++        }
++      }
++    }));
++
 +    loadTPCHTables();
 +    registerTablespace();
 +  }
 +
 +  private void loadTPCHTables() throws SQLException, IOException {
 +    Path testPath = CommonTestingUtil.getTestDir();
 +
 +    try (Connection connection = DriverManager.getConnection(getJdbcUrlForAdmin(), "postgres", null)) {
 +      connection.setCatalog("tpch");
 +
 +      try (Statement statement = connection.createStatement()) {
 +
 +        for (String tableName : TPCH_TABLES) {
 +          String sql = JavaResourceUtil.readTextFromResource("tpch/pgsql/" + tableName + ".sql");
 +          statement.addBatch(sql);
 +        }
 +
 +        statement.executeBatch();
 +
 +        for (String tableName : TPCH_TABLES) {
-           String table = JavaResourceUtil.readTextFromResource("tpch/" + tableName + ".tbl");
++          String csvTable = JavaResourceUtil.readTextFromResource("tpch/" + tableName + ".tbl");
++          String fixedCsvTable = fixExtraColumn(csvTable);
 +          Path filePath = new Path(testPath, tableName + ".tbl");
-           FileUtil.writeTextToFile(table, filePath);
++          FileUtil.writeTextToFile(fixedCsvTable, filePath);
 +
 +          String copyCommand =
 +              "COPY " + tableName + " FROM '" + filePath.toUri().getPath() + "' WITH (FORMAT csv, DELIMITER '|');";
 +          statement.executeUpdate(copyCommand);
 +        }
 +
 +      } catch (Throwable t) {
 +        t.printStackTrace();
 +        throw t;
 +      }
 +    }
 +  }
 +
++  private String fixExtraColumn(String csvTable) {
++    final String [] lines = csvTable.split("\n");
++    final StringBuilder rewritten = new StringBuilder();
++
++    for (String l : lines) {
++      if (l.charAt(l.length() - 1) == '|') {
++        rewritten.append(l.substring(0, l.length() - 1));
++      } else {
++        rewritten.append(l.substring(0, l.length()));
++      }
++      rewritten.append("\n");
++    }
++
++    return rewritten.toString();
++  }
++
 +  private void registerTablespace() throws IOException {
 +    JSONObject configElements = new JSONObject();
 +    configElements.put("database", DATABASE_NAME);
 +
 +    Map<String, JSONObject> configMap = new HashMap<>();
 +    configMap.put(TablespaceManager.TABLESPACE_SPEC_CONFIGS_KEY, configElements);
 +    JSONObject config = new JSONObject(configMap);
 +
 +    PgSQLTablespace tablespace = new PgSQLTablespace(SPACENAME, URI.create(getJdbcUrlForAdmin()), config);
 +    tablespace.init(new TajoConf());
 +
 +    TablespaceManager.addTableSpaceForTest(tablespace);
 +  }
 +
++  /**
++   * get JDBC URL for a created user
++   *
++   * @return JDBC URL for the created user
++   */
 +  public String getJdbcUrl() {
 +    return server.getJdbcUrl() + "&connectTimeout=5&socketTimeout=5";
 +  }
 +
++  /**
++   * get JDBC URL for the Admin user
++   *
++   * @return JDBC URL for the Admin user
++   */
 +  public String getJdbcUrlForAdmin() {
++    // replace 'user' by postgres (admin)
 +    String url = server.getJdbcUrl().split("\\?")[0];
 +    url += "?user=postgres&connectTimeout=5&socketTimeout=5";
 +    return url;
 +  }
 +
 +  public TestingPostgreSqlServer getServer() {
 +    return server;
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/tajo/blob/e3a92621/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java
----------------------------------------------------------------------
diff --cc tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java
index 179eb33,0000000..f3b2d26
mode 100644,000000..100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLJdbcTableSpace.java
@@@ -1,75 -1,0 +1,75 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *     http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +
 +package org.apache.tajo.storage.pgsql;
 +
 +import org.apache.tajo.catalog.MetadataProvider;
 +import org.apache.tajo.catalog.TableDesc;
 +import org.apache.tajo.exception.NotImplementedException;
 +import org.apache.tajo.exception.TajoException;
 +import org.apache.tajo.exception.TajoRuntimeException;
 +import org.apache.tajo.exception.UnsupportedException;
 +import org.apache.tajo.storage.Tablespace;
 +import org.apache.tajo.storage.TablespaceManager;
 +import org.apache.tajo.storage.fragment.Fragment;
 +import org.junit.Test;
 +
 +import java.io.IOException;
 +import java.util.List;
 +
 +import static org.junit.Assert.assertEquals;
 +import static org.junit.Assert.assertNotNull;
 +import static org.junit.Assert.assertTrue;
 +
 +public class TestPgSQLJdbcTableSpace {
-   static String jdbcUrl = EmbedPgSQLServer.getInstance().getJdbcUrl();
++  static String jdbcUrl = EmbedPgSQLServer.getInstance().getJdbcUrlForAdmin();
 +
-   @Test
++  @Test(timeout = 5000)
 +  public void testTablespaceHandler() throws Exception {
 +    assertTrue((TablespaceManager.getByName("pgsql_cluster").get()) instanceof PgSQLTablespace);
 +    assertEquals("pgsql_cluster", (TablespaceManager.getByName("pgsql_cluster").get().getName()));
 +
 +    assertTrue((TablespaceManager.get(jdbcUrl).get()) instanceof PgSQLTablespace);
 +    assertTrue((TablespaceManager.get(jdbcUrl + "&table=tb1").get()) instanceof PgSQLTablespace);
 +
 +    assertEquals(jdbcUrl, TablespaceManager.get(jdbcUrl).get().getUri().toASCIIString());
 +    assertTrue(TablespaceManager.get(jdbcUrl).get().getMetadataProvider() instanceof PgSQLMetadataProvider);
 +  }
 +
-   @Test(expected = TajoRuntimeException.class)
++  @Test(timeout = 5000, expected = TajoRuntimeException.class)
 +  public void testCreateTable() throws IOException, TajoException {
 +    Tablespace space = TablespaceManager.getByName("pgsql_cluster").get();
 +    space.createTable(null, false);
 +  }
 +
-   @Test(expected = TajoRuntimeException.class)
++  @Test(timeout = 5000, expected = TajoRuntimeException.class)
 +  public void testDropTable() throws IOException, TajoException {
 +    Tablespace space = TablespaceManager.getByName("pgsql_cluster").get();
 +    space.purgeTable(null);
 +  }
 +
-   @Test
++  @Test(timeout = 5000)
 +  public void testGetSplits() throws IOException, TajoException {
 +    Tablespace space = TablespaceManager.getByName("pgsql_cluster").get();
 +    MetadataProvider provider = space.getMetadataProvider();
 +    TableDesc table = provider.getTableDescriptor(null, "lineitem");
 +    List<Fragment> fragments = space.getSplits("lineitem", table, null);
 +    assertNotNull(fragments);
 +    assertEquals(1, fragments.size());
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/tajo/blob/e3a92621/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLMetadataProvider.java
----------------------------------------------------------------------
diff --cc tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLMetadataProvider.java
index aac25f7,0000000..7650f86
mode 100644,000000..100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLMetadataProvider.java
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLMetadataProvider.java
@@@ -1,81 -1,0 +1,81 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *     http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +
 +package org.apache.tajo.storage.pgsql;
 +
 +import com.google.common.collect.Sets;
 +import org.apache.tajo.catalog.MetadataProvider;
 +import org.apache.tajo.catalog.TableDesc;
 +import org.apache.tajo.storage.Tablespace;
 +import org.apache.tajo.storage.TablespaceManager;
 +import org.junit.BeforeClass;
 +import org.junit.Test;
 +
 +import java.util.Set;
 +
 +import static org.junit.Assert.*;
 +
 +public class TestPgSQLMetadataProvider {
-   static final String jdbcUrl = EmbedPgSQLServer.getInstance().getJdbcUrl();
++  static final String jdbcUrl = EmbedPgSQLServer.getInstance().getJdbcUrlForAdmin();
 +
 +  @BeforeClass
 +  public static void setUp() throws Exception {
 +  }
 +
 +  @Test
 +  public void testGetTablespaceName() throws Exception {
 +    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
 +    MetadataProvider provider = tablespace.getMetadataProvider();
 +    assertEquals("pgsql_cluster", provider.getTablespaceName());
 +  }
 +
 +  @Test
 +  public void testGetDatabaseName() throws Exception {
 +    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
 +    MetadataProvider provider = tablespace.getMetadataProvider();
 +    assertEquals("tpch", provider.getDatabaseName());
 +  }
 +
 +  @Test
 +  public void testGetSchemas() throws Exception {
 +    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
 +    MetadataProvider provider = tablespace.getMetadataProvider();
 +    assertTrue(provider.getSchemas().isEmpty());
 +  }
 +
 +  @Test
 +  public void testGetTables() throws Exception {
 +    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
 +    MetadataProvider provider = tablespace.getMetadataProvider();
 +
 +    Set<String> found = Sets.newHashSet(provider.getTables(null, null));
 +    assertEquals(Sets.newHashSet(EmbedPgSQLServer.TPCH_TABLES), found);
 +  }
 +
 +  @Test
 +  public void testGetTableDescriptor() throws Exception {
 +    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
 +    MetadataProvider provider = tablespace.getMetadataProvider();
 +
 +    for (String tableName : EmbedPgSQLServer.TPCH_TABLES) {
 +      TableDesc table = provider.getTableDescriptor(null, tableName);
 +      assertEquals("tpch." + tableName, table.getName());
 +      assertEquals(jdbcUrl + "&table=" + tableName, table.getUri().toASCIIString());
 +    }
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/tajo/blob/e3a92621/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLSimpleQueryTests.java
----------------------------------------------------------------------
diff --cc tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLSimpleQueryTests.java
index 3971bbc,0000000..2968831
mode 100644,000000..100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLSimpleQueryTests.java
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLSimpleQueryTests.java
@@@ -1,47 -1,0 +1,48 @@@
 +/**
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *      http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +
 +package org.apache.tajo.storage.pgsql;
 +
 +import org.apache.tajo.QueryTestCaseBase;
 +import org.junit.BeforeClass;
 +import org.junit.Test;
 +
 +public class TestPgSQLSimpleQueryTests extends QueryTestCaseBase {
++  private static final String jdbcUrl = EmbedPgSQLServer.getInstance().getJdbcUrl();
 +
 +  public TestPgSQLSimpleQueryTests() {
 +    super(EmbedPgSQLServer.DATABASE_NAME);
 +  }
 +
 +  @BeforeClass
 +  public static void setUp() {
 +    QueryTestCaseBase.testingCluster.getMaster().refresh();
 +  }
 +
 +  @SimpleTest
 +  @Test
 +  public void testSelectAll() throws Exception {
 +    runSimpleTests();
 +  }
 +
 +  @SimpleTest
 +  @Test
 +  public void testSelectLimit() throws Exception {
 +    runSimpleTests();
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/tajo/blob/e3a92621/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectAll.result
----------------------------------------------------------------------
diff --cc tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectAll.result
index 8d66d30,0000000..6649940
mode 100644,000000..100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectAll.result
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectAll.result
@@@ -1,7 -1,0 +1,7 @@@
 +l_orderkey,l_partkey,l_suppkey,l_linenumber,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag,l_linestatus,l_shipdate,l_commitdate,l_receiptdate,l_shipinstruct,l_shipmode,l_comment
 +-------------------------------
 +1,1,7706,1,17.0,21168.23,0.04,0.02,N,O,0096-02-03,0096-01-01,0096-02-05,DELIVER IN PERSON        ,TRUCK     ,egular courts above the
- 1,1,7311,2,36.0,45983.16,0.09,0.06,N,O,0096-03-05,0096-01-03,0096-03-06,TAKE BACK RETURN         ,MAIL      ,ly final dependencies: slyly bold
++1,1,7311,2,36.0,45983.16,0.09,0.06,N,O,0096-03-05,0096-01-03,0096-03-06,TAKE BACK RETURN         ,MAIL      ,ly final dependencies: slyly bold 
 +2,2,1191,1,38.0,44694.46,0.0,0.05,N,O,0096-12-02,0096-12-02,0096-12-31,TAKE BACK RETURN         ,RAIL      ,ven requests. deposits breach a
 +3,2,1798,1,45.0,54058.05,0.06,0.0,R,F,0094-01-03,0093-12-02,0094-01-03,NONE                     ,AIR       ,ongside of the furiously brave acco
 +3,3,6540,2,49.0,46796.47,0.1,0.0,R,F,0093-10-02,0093-11-01,0093-10-03,TAKE BACK RETURN         ,RAIL      , unusual accounts. eve

http://git-wip-us.apache.org/repos/asf/tajo/blob/e3a92621/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectLimit.result
----------------------------------------------------------------------
diff --cc tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectLimit.result
index 52c87f6,0000000..88116c8
mode 100644,000000..100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectLimit.result
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectLimit.result
@@@ -1,5 -1,0 +1,5 @@@
 +l_orderkey,l_partkey,l_suppkey,l_linenumber,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag,l_linestatus,l_shipdate,l_commitdate,l_receiptdate,l_shipinstruct,l_shipmode,l_comment
 +-------------------------------
 +1,1,7706,1,17.0,21168.23,0.04,0.02,N,O,0096-02-03,0096-01-01,0096-02-05,DELIVER IN PERSON        ,TRUCK     ,egular courts above the
- 1,1,7311,2,36.0,45983.16,0.09,0.06,N,O,0096-03-05,0096-01-03,0096-03-06,TAKE BACK RETURN         ,MAIL      ,ly final dependencies: slyly bold
++1,1,7311,2,36.0,45983.16,0.09,0.06,N,O,0096-03-05,0096-01-03,0096-03-06,TAKE BACK RETURN         ,MAIL      ,ly final dependencies: slyly bold 
 +2,2,1191,1,38.0,44694.46,0.0,0.05,N,O,0096-12-02,0096-12-02,0096-12-31,TAKE BACK RETURN         ,RAIL      ,ven requests. deposits breach a


[25/39] tajo git commit: Clean up TablespaceManager and Tablespace.

Posted by hy...@apache.org.
http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/region.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/region.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/region.sql
new file mode 100644
index 0000000..c47e26e
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/region.sql
@@ -0,0 +1,5 @@
+CREATE TABLE REGION  (
+  R_REGIONKEY  INTEGER NOT NULL,
+  R_NAME       CHAR(25) NOT NULL,
+  R_COMMENT    VARCHAR(152)
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/bf15ce7a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/supplier.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/supplier.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/supplier.sql
new file mode 100644
index 0000000..a4d35d3
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/supplier.sql
@@ -0,0 +1,9 @@
+CREATE TABLE SUPPLIER (
+  S_SUPPKEY     INTEGER NOT NULL,
+  S_NAME        CHAR(25) NOT NULL,
+  S_ADDRESS     VARCHAR(40) NOT NULL,
+  S_NATIONKEY   INTEGER NOT NULL,
+  S_PHONE       CHAR(15) NOT NULL,
+  S_ACCTBAL     DECIMAL(15,2) NOT NULL,
+  S_COMMENT     VARCHAR(101) NOT NULL
+);
\ No newline at end of file


[14/39] tajo git commit: add tpch schema for mysql.

Posted by hy...@apache.org.
add tpch schema for mysql.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/4803b35b
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/4803b35b
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/4803b35b

Branch: refs/heads/TAJO-1730
Commit: 4803b35b938049119a1d95a49ea7f2dd577d0356
Parents: 953e625
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sun Aug 16 11:09:01 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sun Aug 16 11:09:01 2015 +0900

----------------------------------------------------------------------
 tajo-project/pom.xml                            |  6 ++
 tajo-storage/tajo-storage-jdbc/pom.xml          |  9 +-
 .../storage/jdbc/JdbcTablespaceTestBase.java    | 25 +++++-
 tajo-storage/tajo-storage-mysql/pom.xml         | 14 +++
 .../storage/jdbc/TestMysqlJdbcTableSpace.java   | 89 ++++++++++----------
 .../src/test/resources/tpch/customer.sql        | 10 +++
 .../src/test/resources/tpch/lineitem.sql        | 18 ++++
 .../src/test/resources/tpch/nation.sql          |  6 ++
 .../src/test/resources/tpch/orders.sql          | 11 +++
 .../src/test/resources/tpch/part.sql            | 11 +++
 .../src/test/resources/tpch/partsupp.sql        |  7 ++
 .../src/test/resources/tpch/region.sql          |  5 ++
 .../src/test/resources/tpch/supplier.sql        |  9 ++
 13 files changed, 173 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/4803b35b/tajo-project/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-project/pom.xml b/tajo-project/pom.xml
index 1512103..afbc2ba 100644
--- a/tajo-project/pom.xml
+++ b/tajo-project/pom.xml
@@ -786,6 +786,12 @@
       </dependency>
       <dependency>
         <groupId>org.apache.tajo</groupId>
+        <artifactId>tajo-storage-jdbc</artifactId>
+        <version>${tajo.version}</version>
+        <type>test-jar</type>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.tajo</groupId>
         <artifactId>tajo-pullserver</artifactId>
         <version>${tajo.version}</version>
       </dependency>

http://git-wip-us.apache.org/repos/asf/tajo/blob/4803b35b/tajo-storage/tajo-storage-jdbc/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/pom.xml b/tajo-storage/tajo-storage-jdbc/pom.xml
index 11c827a..d45ec2f 100644
--- a/tajo-storage/tajo-storage-jdbc/pom.xml
+++ b/tajo-storage/tajo-storage-jdbc/pom.xml
@@ -63,8 +63,7 @@
         <artifactId>apache-rat-plugin</artifactId>
         <configuration>
           <excludes>
-            <exclude>src/main/resources/*.json</exclude>
-            <exclude>src/test/resources/*.json</exclude>
+            <exclude>src/test/resources/*.sql</exclude>
           </excludes>
         </configuration>
         <executions>
@@ -188,6 +187,12 @@
       <artifactId>tajo-storage-common</artifactId>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-cluster-tests</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
 
     <dependency>
       <groupId>com.google.protobuf</groupId>

http://git-wip-us.apache.org/repos/asf/tajo/blob/4803b35b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java
index 5dfe4c3..c8ebe7a 100644
--- a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java
+++ b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java
@@ -18,5 +18,28 @@
 
 package org.apache.tajo.storage.jdbc;
 
-public class JdbcTablespaceTestBase {
+import org.apache.tajo.QueryTestCaseBase;
+import org.apache.tajo.storage.TablespaceManager;
+import org.apache.tajo.util.FileUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+import java.io.IOException;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+public abstract class JdbcTablespaceTestBase extends QueryTestCaseBase {
+
+  @BeforeClass
+  public static void setUp() throws Exception {
+  }
+
+  @AfterClass
+  public static void tearDown() {
+  }
+
+  protected void prepareDefaultTables(Statement statement) throws IOException, SQLException {
+    statement.addBatch(FileUtil.readTextFileFromResource("table_ddl/all_types"));
+    statement.executeBatch();
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/4803b35b/tajo-storage/tajo-storage-mysql/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/pom.xml b/tajo-storage/tajo-storage-mysql/pom.xml
index c2157fa..f0a072d 100644
--- a/tajo-storage/tajo-storage-mysql/pom.xml
+++ b/tajo-storage/tajo-storage-mysql/pom.xml
@@ -54,6 +54,7 @@
           <excludes>
             <exclude>src/main/resources/*.json</exclude>
             <exclude>src/test/resources/*.json</exclude>
+            <exclude>src/test/resources/tpch/*.sql</exclude>
           </excludes>
         </configuration>
         <executions>
@@ -120,6 +121,19 @@
     <dependency>
       <groupId>org.apache.tajo</groupId>
       <artifactId>tajo-storage-jdbc</artifactId>
+      <type>jar</type>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-storage-jdbc</artifactId>
+      <type>test-jar</type>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-cluster-tests</artifactId>
+      <type>test-jar</type>
       <scope>provided</scope>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/tajo/blob/4803b35b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
index ed25d06..44eb6c4 100644
--- a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
+++ b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
@@ -27,28 +27,26 @@ import org.apache.tajo.catalog.TableDesc;
 import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.storage.TablespaceManager;
 import org.apache.tajo.storage.mysql.MySQLTablespace;
+import org.apache.tajo.util.FileUtil;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
+import java.io.IOException;
 import java.net.URI;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.Statement;
+import java.sql.*;
 import java.util.Set;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-public class TestMysqlJdbcTableSpace {
+public class TestMysqlJdbcTableSpace extends JdbcTablespaceTestBase {
 
   static TestingMySqlServer server;
 
-  @BeforeClass
-  public static void setUp() throws Exception {
+  public TestMysqlJdbcTableSpace() throws Exception {
     server = new TestingMySqlServer("testuser", "testpass",
-        "meta_test",
-        "create_table",
-        "drop_table"
+        "tpch"
     );
 
     MySQLTablespace mysqlTablespace = new MySQLTablespace("mysql_cluster", URI.create(server.getJdbcUrl()), null);
@@ -56,6 +54,23 @@ public class TestMysqlJdbcTableSpace {
     TablespaceManager.addTableSpaceForTest(mysqlTablespace);
   }
 
+  @BeforeClass
+  public static void setUp() throws IOException, SQLException {
+    prepareTables();
+  }
+
+  @Test
+  public void testGeneral() {
+    assertTrue(server.isRunning());
+    assertTrue(server.isReadyForConnections());
+    assertEquals(server.getMySqlVersion(), "5.5.9");
+    assertEquals(server.getDatabases(), ImmutableSet.of("basic"));
+    assertEquals(server.getUser(), "testuser");
+    assertEquals(server.getPassword(), "testpass");
+    assertEquals(server.getJdbcUrl().substring(0, 5), "jdbc:");
+    assertEquals(server.getPort(), URI.create(server.getJdbcUrl().substring(5)).getPort());
+  }
+
   @Test
   public void testTablespaceHandler() throws Exception {
     assertTrue((TablespaceManager.getByName("mysql_cluster").get()) instanceof MySQLTablespace);
@@ -67,45 +82,31 @@ public class TestMysqlJdbcTableSpace {
     assertEquals(server.getJdbcUrl(), TablespaceManager.get(server.getJdbcUrl()).get().getUri().toASCIIString());
   }
 
-  @Test
-  public void testMetadataProvider() throws Exception {
-
+  static final String [] TPCH_TABLES = {
+      "customer", "lineitem", "nation", "orders", "part", "partsupp", "region", "supplier"
+  };
 
-    try (TestingMySqlServer server = new TestingMySqlServer("testuser", "testpass", "db1", "db2")) {
-      assertTrue(server.isRunning());
-      assertTrue(server.isReadyForConnections());
-      assertEquals(server.getMySqlVersion(), "5.5.9");
-      assertEquals(server.getDatabases(), ImmutableSet.of("db1", "db2"));
-      assertEquals(server.getUser(), "testuser");
-      assertEquals(server.getPassword(), "testpass");
-      assertEquals(server.getJdbcUrl().substring(0, 5), "jdbc:");
-      assertEquals(server.getPort(), URI.create(server.getJdbcUrl().substring(5)).getPort());
-
-      try (Connection connection = DriverManager.getConnection(server.getJdbcUrl())) {
-        connection.setCatalog("db1");
-
-        try (Statement statement = connection.createStatement()) {
-          statement.execute("CREATE TABLE t1 (c1 bigint PRIMARY KEY)");
-          statement.execute("CREATE TABLE t2 (c1 int PRIMARY KEY, c2 VARCHAR(20), c3 TIME)");
-        }
+  private static void prepareTables() throws SQLException, IOException {
+    try (Connection connection = DriverManager.getConnection(server.getJdbcUrl())) {
+      connection.setCatalog("tpch");
+      try (Statement statement = connection.createStatement()) {
+        statement.executeUpdate(FileUtil.readTextFileFromResource("tpch/" + TPCH_TABLES + ".sql"));
       }
+    }
+  }
 
-      System.out.println(server.getJdbcUrl());
-      MySQLTablespace tablespace = new MySQLTablespace("mysql", URI.create(server.getJdbcUrl()), null);
-
-      URI uri = tablespace.getTableUri("abc", "table1");
-      ConnectionInfo c1 = ConnectionInfo.fromURI(uri);
-      assertEquals("table1", c1.table());
-
-      MetadataProvider provider = tablespace.getMetadataProvider();
-      Set<String> tables = Sets.newHashSet(provider.getTables(null, null));
-      assertEquals(Sets.newHashSet("t1", "t2"), tables);
+  @Test
+  public void testMetadataProvider() throws Exception {
+    MySQLTablespace tablespace = (MySQLTablespace) TablespaceManager.get(server.getJdbcUrl()).get();
+    MetadataProvider provider = tablespace.getMetadataProvider();
 
-      TableDesc desc = provider.getTableDescriptor("", "t2");
-      assertEquals(tablespace.getUri() + "&table=t2", desc.getUri().toASCIIString());
+    Set<String> tables = Sets.newHashSet(provider.getTables(null, null));
+    assertEquals(Sets.newHashSet(TPCH_TABLES), tables);
 
-      Schema schema = desc.getSchema();
-      System.out.println(">>> " + schema);
-    }
+//    TableDesc desc = provider.getTableDescriptor("", "t2");
+//    assertEquals(tablespace.getUri() + "&table=t2", desc.getUri().toASCIIString());
+//
+//    Schema schema = desc.getSchema();
+//    System.out.println(">>> " + schema);
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/4803b35b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/customer.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/customer.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/customer.sql
new file mode 100644
index 0000000..35b1861
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/customer.sql
@@ -0,0 +1,10 @@
+CREATE TABLE CUSTOMER (
+  C_CUSTKEY     INTEGER NOT NULL,
+  C_NAME        VARCHAR(25) NOT NULL,
+  C_ADDRESS     VARCHAR(40) NOT NULL,
+  C_NATIONKEY   INTEGER NOT NULL,
+  C_PHONE       CHAR(15) NOT NULL,
+  C_ACCTBAL     DECIMAL(15,2)   NOT NULL,
+  C_MKTSEGMENT  CHAR(10) NOT NULL,
+  C_COMMENT     VARCHAR(117) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/4803b35b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/lineitem.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/lineitem.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/lineitem.sql
new file mode 100644
index 0000000..a7f61bb
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/lineitem.sql
@@ -0,0 +1,18 @@
+CREATE TABLE LINEITEM (
+  L_ORDERKEY    INTEGER NOT NULL,
+  L_PARTKEY     INTEGER NOT NULL,
+  L_SUPPKEY     INTEGER NOT NULL,
+  L_LINENUMBER  INTEGER NOT NULL,
+  L_QUANTITY    DECIMAL(15,2) NOT NULL,
+  L_EXTENDEDPRICE  DECIMAL(15,2) NOT NULL,
+  L_DISCOUNT    DECIMAL(15,2) NOT NULL,
+  L_TAX         DECIMAL(15,2) NOT NULL,
+  L_RETURNFLAG  CHAR(1) NOT NULL,
+  L_LINESTATUS  CHAR(1) NOT NULL,
+  L_SHIPDATE    DATE NOT NULL,
+  L_COMMITDATE  DATE NOT NULL,
+  L_RECEIPTDATE DATE NOT NULL,
+  L_SHIPINSTRUCT CHAR(25) NOT NULL,
+  L_SHIPMODE     CHAR(10) NOT NULL,
+  L_COMMENT      VARCHAR(44) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/4803b35b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/nation.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/nation.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/nation.sql
new file mode 100644
index 0000000..f7ecda8
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/nation.sql
@@ -0,0 +1,6 @@
+CREATE TABLE NATION  (
+  N_NATIONKEY  INTEGER NOT NULL,
+  N_NAME       CHAR(25) NOT NULL,
+  N_REGIONKEY  INTEGER NOT NULL,
+  N_COMMENT    VARCHAR(152)
+);

http://git-wip-us.apache.org/repos/asf/tajo/blob/4803b35b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/orders.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/orders.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/orders.sql
new file mode 100644
index 0000000..220d576
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/orders.sql
@@ -0,0 +1,11 @@
+CREATE TABLE ORDERS  (
+  O_ORDERKEY       INTEGER NOT NULL,
+  O_CUSTKEY        INTEGER NOT NULL,
+  O_ORDERSTATUS    CHAR(1) NOT NULL,
+  O_TOTALPRICE     DECIMAL(15,2) NOT NULL,
+  O_ORDERDATE      DATE NOT NULL,
+  O_ORDERPRIORITY  CHAR(15) NOT NULL,
+  O_CLERK          CHAR(15) NOT NULL,
+  O_SHIPPRIORITY   INTEGER NOT NULL,
+  O_COMMENT        VARCHAR(79) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/4803b35b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/part.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/part.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/part.sql
new file mode 100644
index 0000000..e66f73c
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/part.sql
@@ -0,0 +1,11 @@
+CREATE TABLE PART (
+  P_PARTKEY     INTEGER NOT NULL,
+  P_NAME        VARCHAR(55) NOT NULL,
+  P_MFGR        CHAR(25) NOT NULL,
+  P_BRAND       CHAR(10) NOT NULL,
+  P_TYPE        VARCHAR(25) NOT NULL,
+  P_SIZE        INTEGER NOT NULL,
+  P_CONTAINER   CHAR(10) NOT NULL,
+  P_RETAILPRICE DECIMAL(15,2) NOT NULL,
+  P_COMMENT     VARCHAR(23) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/4803b35b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/partsupp.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/partsupp.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/partsupp.sql
new file mode 100644
index 0000000..1f61331
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/partsupp.sql
@@ -0,0 +1,7 @@
+CREATE TABLE PARTSUPP (
+  PS_PARTKEY     INTEGER NOT NULL,
+  PS_SUPPKEY     INTEGER NOT NULL,
+  PS_AVAILQTY    INTEGER NOT NULL,
+  PS_SUPPLYCOST  DECIMAL(15,2)  NOT NULL,
+  PS_COMMENT     VARCHAR(199) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/4803b35b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/region.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/region.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/region.sql
new file mode 100644
index 0000000..c47e26e
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/region.sql
@@ -0,0 +1,5 @@
+CREATE TABLE REGION  (
+  R_REGIONKEY  INTEGER NOT NULL,
+  R_NAME       CHAR(25) NOT NULL,
+  R_COMMENT    VARCHAR(152)
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/4803b35b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/supplier.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/supplier.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/supplier.sql
new file mode 100644
index 0000000..a4d35d3
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/supplier.sql
@@ -0,0 +1,9 @@
+CREATE TABLE SUPPLIER (
+  S_SUPPKEY     INTEGER NOT NULL,
+  S_NAME        CHAR(25) NOT NULL,
+  S_ADDRESS     VARCHAR(40) NOT NULL,
+  S_NATIONKEY   INTEGER NOT NULL,
+  S_PHONE       CHAR(15) NOT NULL,
+  S_ACCTBAL     DECIMAL(15,2) NOT NULL,
+  S_COMMENT     VARCHAR(101) NOT NULL
+);
\ No newline at end of file


[18/39] tajo git commit: Merge branch 'TAJO-1763' of https://github.com/hyunsik/tajo into TAJO-1730

Posted by hy...@apache.org.
Merge branch 'TAJO-1763' of https://github.com/hyunsik/tajo into TAJO-1730


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/88ec43f3
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/88ec43f3
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/88ec43f3

Branch: refs/heads/TAJO-1730
Commit: 88ec43f3bf5f72c14d3275b2948837ece09849dc
Parents: de9542e 030d669
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sun Aug 16 20:50:21 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sun Aug 16 20:50:21 2015 +0900

----------------------------------------------------------------------
 tajo-core-tests/pom.xml                                 |  1 +
 .../org/apache/tajo/engine/query/TestJoinQuery.java     | 12 ++++++------
 2 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------



[38/39] tajo git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730

Posted by hy...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/705bf9b4
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/705bf9b4
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/705bf9b4

Branch: refs/heads/TAJO-1730
Commit: 705bf9b41697d7084f1f1bfff48ef2937ab0e76d
Parents: 947736b ace0480
Author: Hyunsik Choi <hy...@apache.org>
Authored: Wed Sep 2 19:41:11 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Wed Sep 2 19:41:11 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |  11 +
 .../org/apache/tajo/catalog/AlterTableDesc.java |  18 +
 .../org/apache/tajo/catalog/CatalogUtil.java    |   9 +-
 .../src/main/proto/CatalogProtos.proto          |   1 +
 .../tajo-catalog-drivers/tajo-hive/pom.xml      |  15 +-
 .../tajo/catalog/store/HiveCatalogStore.java    |   7 +
 tajo-catalog/tajo-catalog-server/pom.xml        |  11 +-
 .../org/apache/tajo/catalog/CatalogServer.java  |   4 +
 .../tajo/catalog/store/AbstractDBStore.java     | 111 ++-
 .../apache/tajo/catalog/store/CatalogStore.java |   4 +-
 .../apache/tajo/catalog/store/DerbyStore.java   |  11 +-
 .../org/apache/tajo/catalog/store/MemStore.java | 785 -------------------
 .../src/main/resources/schemas/derby/derby.xml  |   3 +-
 .../main/resources/schemas/mariadb/mariadb.xml  |   3 +-
 .../src/main/resources/schemas/mysql/mysql.xml  |   3 +-
 .../main/resources/schemas/oracle/oracle.xml    |   3 +-
 .../resources/schemas/postgresql/postgresql.xml |   3 +-
 .../apache/tajo/catalog/CatalogTestingUtil.java |  91 +++
 .../org/apache/tajo/catalog/TestCatalog.java    |  54 +-
 .../tajo/catalog/TestLinkedMetadataManager.java |   3 +-
 .../apache/tajo/client/SessionConnection.java   |   9 +-
 tajo-cluster-tests/pom.xml                      |   3 +-
 .../org/apache/tajo/CatalogTestingUtil.java     |  92 +++
 .../org/apache/tajo/TajoTestingCluster.java     |  25 +-
 .../apache/tajo/exception/ErrorMessages.java    |   2 +
 .../apache/tajo/exception/ExceptionUtil.java    |   2 +
 .../tajo/exception/UnsupportedCatalogStore.java |  33 +
 tajo-common/src/main/proto/errors.proto         |   3 +
 tajo-core-tests/pom.xml                         |   5 +-
 .../apache/tajo/engine/eval/ExprTestBase.java   |   3 +-
 .../tajo/engine/planner/TestLogicalPlanner.java |   3 +-
 .../planner/physical/TestExternalSortExec.java  |  14 +-
 .../planner/physical/TestPhysicalPlanner.java   |   2 +-
 .../physical/TestProgressExternalSortExec.java  |  25 +-
 .../planner/physical/TestTupleSorter.java       |   4 +-
 .../tajo/engine/query/TestSelectQuery.java      |   7 +-
 tajo-core/pom.xml                               |   1 -
 .../org/apache/tajo/benchmark/BenchmarkSet.java |   5 +-
 .../engine/planner/PhysicalPlannerImpl.java     |  14 +-
 .../planner/physical/ExternalSortExec.java      |   5 -
 .../java/org/apache/tajo/master/TajoMaster.java |  16 +-
 .../apache/tajo/master/exec/DDLExecutor.java    |   5 +-
 .../apache/tajo/master/exec/QueryExecutor.java  |   4 +-
 .../tajo/querymaster/AbstractTaskScheduler.java |   6 +
 .../tajo/querymaster/DefaultTaskScheduler.java  |  38 +-
 .../java/org/apache/tajo/worker/TajoWorker.java |   3 +
 .../src/main/resources/python/controller.py     |  26 +-
 tajo-jdbc/pom.xml                               |  10 +
 .../src/main/proto/master_metrics.proto         |   8 +-
 .../org/apache/tajo/plan/LogicalPlanner.java    |  45 +-
 .../plan/exprrewrite/rules/ConstantFolding.java |   4 +-
 .../function/python/PythonScriptEngine.java     | 138 ++--
 .../plan/rewrite/rules/AccessPathRewriter.java  |   2 +-
 tajo-project/pom.xml                            |   2 +-
 tajo-storage/tajo-storage-common/pom.xml        |   2 +-
 tajo-storage/tajo-storage-hbase/pom.xml         |   2 +-
 tajo-storage/tajo-storage-hdfs/pom.xml          |   2 +-
 57 files changed, 633 insertions(+), 1087 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/705bf9b4/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/705bf9b4/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/store/AbstractDBStore.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/705bf9b4/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestLinkedMetadataManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/705bf9b4/tajo-cluster-tests/src/test/java/org/apache/tajo/TajoTestingCluster.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/705bf9b4/tajo-common/src/main/java/org/apache/tajo/exception/ExceptionUtil.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/705bf9b4/tajo-core/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/705bf9b4/tajo-core/src/main/java/org/apache/tajo/master/TajoMaster.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/705bf9b4/tajo-core/src/main/java/org/apache/tajo/master/exec/QueryExecutor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/705bf9b4/tajo-jdbc/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/705bf9b4/tajo-plan/src/main/java/org/apache/tajo/plan/exprrewrite/rules/ConstantFolding.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/705bf9b4/tajo-project/pom.xml
----------------------------------------------------------------------


[32/39] tajo git commit: Basic pushdown to PostgreSQL has been completed.

Posted by hy...@apache.org.
http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MysqlJdbcScanner.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MysqlJdbcScanner.java b/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MysqlJdbcScanner.java
new file mode 100644
index 0000000..836ecd9
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MysqlJdbcScanner.java
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.mysql;
+
+import org.apache.tajo.catalog.Schema;
+import org.apache.tajo.catalog.TableMeta;
+import org.apache.tajo.exception.TajoRuntimeException;
+import org.apache.tajo.storage.VTuple;
+import org.apache.tajo.storage.jdbc.JdbcFragment;
+import org.apache.tajo.storage.jdbc.JdbcScanner;
+import org.apache.tajo.storage.jdbc.SQLBuilder;
+
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+
+public class MySQLJdbcScanner extends JdbcScanner {
+
+  public MySQLJdbcScanner(DatabaseMetaData dbMetaData,
+                          Schema tableSchema,
+                          TableMeta tableMeta,
+                          JdbcFragment fragment) {
+    super(dbMetaData, tableSchema, tableMeta, fragment);
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/EmbedMySQLServer.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/EmbedMySQLServer.java b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/EmbedMySQLServer.java
index 119ae56..4321895 100644
--- a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/EmbedMySQLServer.java
+++ b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/EmbedMySQLServer.java
@@ -24,7 +24,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.storage.TablespaceManager;
-import org.apache.tajo.util.FileUtil;
+import org.apache.tajo.util.JavaResourceUtil;
 
 import java.io.IOException;
 import java.net.URI;
@@ -76,7 +76,7 @@ public class EmbedMySQLServer {
 
       try (Statement statement = connection.createStatement()) {
         for (String tableName : TPCH_TABLES) {
-          String sql = FileUtil.readTextFileFromResource("tpch/" + tableName + ".sql");
+          String sql = JavaResourceUtil.readTextFromResource("tpch/" + tableName + ".sql");
           statement.addBatch(sql);
         }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMySQLMetadataProvider.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMySQLMetadataProvider.java b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMySQLMetadataProvider.java
index bd3fcaf..21854f9 100644
--- a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMySQLMetadataProvider.java
+++ b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMySQLMetadataProvider.java
@@ -65,7 +65,7 @@ public class TestMySQLMetadataProvider {
     assertTrue(provider.getSchemas().isEmpty());
   }
 
-  @Test
+  //@Test
   public void testGetTables() throws Exception {
     Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
     MetadataProvider provider = tablespace.getMetadataProvider();
@@ -81,7 +81,7 @@ public class TestMySQLMetadataProvider {
     assertEquals(Sets.newHashSet(EmbedMySQLServer.TPCH_TABLES), found);
   }
 
-  @Test
+  //@Test
   public void testGetTableDescriptor() throws Exception {
     Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
     MetadataProvider provider = tablespace.getMetadataProvider();

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/customer.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/customer.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/customer.sql
deleted file mode 100644
index 35b1861..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/customer.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-CREATE TABLE CUSTOMER (
-  C_CUSTKEY     INTEGER NOT NULL,
-  C_NAME        VARCHAR(25) NOT NULL,
-  C_ADDRESS     VARCHAR(40) NOT NULL,
-  C_NATIONKEY   INTEGER NOT NULL,
-  C_PHONE       CHAR(15) NOT NULL,
-  C_ACCTBAL     DECIMAL(15,2)   NOT NULL,
-  C_MKTSEGMENT  CHAR(10) NOT NULL,
-  C_COMMENT     VARCHAR(117) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/lineitem.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/lineitem.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/lineitem.sql
deleted file mode 100644
index a7f61bb..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/lineitem.sql
+++ /dev/null
@@ -1,18 +0,0 @@
-CREATE TABLE LINEITEM (
-  L_ORDERKEY    INTEGER NOT NULL,
-  L_PARTKEY     INTEGER NOT NULL,
-  L_SUPPKEY     INTEGER NOT NULL,
-  L_LINENUMBER  INTEGER NOT NULL,
-  L_QUANTITY    DECIMAL(15,2) NOT NULL,
-  L_EXTENDEDPRICE  DECIMAL(15,2) NOT NULL,
-  L_DISCOUNT    DECIMAL(15,2) NOT NULL,
-  L_TAX         DECIMAL(15,2) NOT NULL,
-  L_RETURNFLAG  CHAR(1) NOT NULL,
-  L_LINESTATUS  CHAR(1) NOT NULL,
-  L_SHIPDATE    DATE NOT NULL,
-  L_COMMITDATE  DATE NOT NULL,
-  L_RECEIPTDATE DATE NOT NULL,
-  L_SHIPINSTRUCT CHAR(25) NOT NULL,
-  L_SHIPMODE     CHAR(10) NOT NULL,
-  L_COMMENT      VARCHAR(44) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/customer.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/customer.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/customer.sql
new file mode 100644
index 0000000..35b1861
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/customer.sql
@@ -0,0 +1,10 @@
+CREATE TABLE CUSTOMER (
+  C_CUSTKEY     INTEGER NOT NULL,
+  C_NAME        VARCHAR(25) NOT NULL,
+  C_ADDRESS     VARCHAR(40) NOT NULL,
+  C_NATIONKEY   INTEGER NOT NULL,
+  C_PHONE       CHAR(15) NOT NULL,
+  C_ACCTBAL     DECIMAL(15,2)   NOT NULL,
+  C_MKTSEGMENT  CHAR(10) NOT NULL,
+  C_COMMENT     VARCHAR(117) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/lineitem.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/lineitem.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/lineitem.sql
new file mode 100644
index 0000000..a7f61bb
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/lineitem.sql
@@ -0,0 +1,18 @@
+CREATE TABLE LINEITEM (
+  L_ORDERKEY    INTEGER NOT NULL,
+  L_PARTKEY     INTEGER NOT NULL,
+  L_SUPPKEY     INTEGER NOT NULL,
+  L_LINENUMBER  INTEGER NOT NULL,
+  L_QUANTITY    DECIMAL(15,2) NOT NULL,
+  L_EXTENDEDPRICE  DECIMAL(15,2) NOT NULL,
+  L_DISCOUNT    DECIMAL(15,2) NOT NULL,
+  L_TAX         DECIMAL(15,2) NOT NULL,
+  L_RETURNFLAG  CHAR(1) NOT NULL,
+  L_LINESTATUS  CHAR(1) NOT NULL,
+  L_SHIPDATE    DATE NOT NULL,
+  L_COMMITDATE  DATE NOT NULL,
+  L_RECEIPTDATE DATE NOT NULL,
+  L_SHIPINSTRUCT CHAR(25) NOT NULL,
+  L_SHIPMODE     CHAR(10) NOT NULL,
+  L_COMMENT      VARCHAR(44) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/nation.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/nation.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/nation.sql
new file mode 100644
index 0000000..f7ecda8
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/nation.sql
@@ -0,0 +1,6 @@
+CREATE TABLE NATION  (
+  N_NATIONKEY  INTEGER NOT NULL,
+  N_NAME       CHAR(25) NOT NULL,
+  N_REGIONKEY  INTEGER NOT NULL,
+  N_COMMENT    VARCHAR(152)
+);

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/orders.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/orders.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/orders.sql
new file mode 100644
index 0000000..220d576
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/orders.sql
@@ -0,0 +1,11 @@
+CREATE TABLE ORDERS  (
+  O_ORDERKEY       INTEGER NOT NULL,
+  O_CUSTKEY        INTEGER NOT NULL,
+  O_ORDERSTATUS    CHAR(1) NOT NULL,
+  O_TOTALPRICE     DECIMAL(15,2) NOT NULL,
+  O_ORDERDATE      DATE NOT NULL,
+  O_ORDERPRIORITY  CHAR(15) NOT NULL,
+  O_CLERK          CHAR(15) NOT NULL,
+  O_SHIPPRIORITY   INTEGER NOT NULL,
+  O_COMMENT        VARCHAR(79) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/part.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/part.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/part.sql
new file mode 100644
index 0000000..e66f73c
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/part.sql
@@ -0,0 +1,11 @@
+CREATE TABLE PART (
+  P_PARTKEY     INTEGER NOT NULL,
+  P_NAME        VARCHAR(55) NOT NULL,
+  P_MFGR        CHAR(25) NOT NULL,
+  P_BRAND       CHAR(10) NOT NULL,
+  P_TYPE        VARCHAR(25) NOT NULL,
+  P_SIZE        INTEGER NOT NULL,
+  P_CONTAINER   CHAR(10) NOT NULL,
+  P_RETAILPRICE DECIMAL(15,2) NOT NULL,
+  P_COMMENT     VARCHAR(23) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/partsupp.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/partsupp.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/partsupp.sql
new file mode 100644
index 0000000..1f61331
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/partsupp.sql
@@ -0,0 +1,7 @@
+CREATE TABLE PARTSUPP (
+  PS_PARTKEY     INTEGER NOT NULL,
+  PS_SUPPKEY     INTEGER NOT NULL,
+  PS_AVAILQTY    INTEGER NOT NULL,
+  PS_SUPPLYCOST  DECIMAL(15,2)  NOT NULL,
+  PS_COMMENT     VARCHAR(199) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/region.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/region.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/region.sql
new file mode 100644
index 0000000..c47e26e
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/region.sql
@@ -0,0 +1,5 @@
+CREATE TABLE REGION  (
+  R_REGIONKEY  INTEGER NOT NULL,
+  R_NAME       CHAR(25) NOT NULL,
+  R_COMMENT    VARCHAR(152)
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/supplier.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/supplier.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/supplier.sql
new file mode 100644
index 0000000..a4d35d3
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/mysql/supplier.sql
@@ -0,0 +1,9 @@
+CREATE TABLE SUPPLIER (
+  S_SUPPKEY     INTEGER NOT NULL,
+  S_NAME        CHAR(25) NOT NULL,
+  S_ADDRESS     VARCHAR(40) NOT NULL,
+  S_NATIONKEY   INTEGER NOT NULL,
+  S_PHONE       CHAR(15) NOT NULL,
+  S_ACCTBAL     DECIMAL(15,2) NOT NULL,
+  S_COMMENT     VARCHAR(101) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/nation.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/nation.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/nation.sql
deleted file mode 100644
index f7ecda8..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/nation.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-CREATE TABLE NATION  (
-  N_NATIONKEY  INTEGER NOT NULL,
-  N_NAME       CHAR(25) NOT NULL,
-  N_REGIONKEY  INTEGER NOT NULL,
-  N_COMMENT    VARCHAR(152)
-);

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/orders.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/orders.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/orders.sql
deleted file mode 100644
index 220d576..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/orders.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-CREATE TABLE ORDERS  (
-  O_ORDERKEY       INTEGER NOT NULL,
-  O_CUSTKEY        INTEGER NOT NULL,
-  O_ORDERSTATUS    CHAR(1) NOT NULL,
-  O_TOTALPRICE     DECIMAL(15,2) NOT NULL,
-  O_ORDERDATE      DATE NOT NULL,
-  O_ORDERPRIORITY  CHAR(15) NOT NULL,
-  O_CLERK          CHAR(15) NOT NULL,
-  O_SHIPPRIORITY   INTEGER NOT NULL,
-  O_COMMENT        VARCHAR(79) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/part.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/part.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/part.sql
deleted file mode 100644
index e66f73c..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/part.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-CREATE TABLE PART (
-  P_PARTKEY     INTEGER NOT NULL,
-  P_NAME        VARCHAR(55) NOT NULL,
-  P_MFGR        CHAR(25) NOT NULL,
-  P_BRAND       CHAR(10) NOT NULL,
-  P_TYPE        VARCHAR(25) NOT NULL,
-  P_SIZE        INTEGER NOT NULL,
-  P_CONTAINER   CHAR(10) NOT NULL,
-  P_RETAILPRICE DECIMAL(15,2) NOT NULL,
-  P_COMMENT     VARCHAR(23) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/partsupp.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/partsupp.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/partsupp.sql
deleted file mode 100644
index 1f61331..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/partsupp.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE TABLE PARTSUPP (
-  PS_PARTKEY     INTEGER NOT NULL,
-  PS_SUPPKEY     INTEGER NOT NULL,
-  PS_AVAILQTY    INTEGER NOT NULL,
-  PS_SUPPLYCOST  DECIMAL(15,2)  NOT NULL,
-  PS_COMMENT     VARCHAR(199) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/region.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/region.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/region.sql
deleted file mode 100644
index c47e26e..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/region.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-CREATE TABLE REGION  (
-  R_REGIONKEY  INTEGER NOT NULL,
-  R_NAME       CHAR(25) NOT NULL,
-  R_COMMENT    VARCHAR(152)
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/supplier.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/supplier.sql b/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/supplier.sql
deleted file mode 100644
index a4d35d3..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/resources/tpch/supplier.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-CREATE TABLE SUPPLIER (
-  S_SUPPKEY     INTEGER NOT NULL,
-  S_NAME        CHAR(25) NOT NULL,
-  S_ADDRESS     VARCHAR(40) NOT NULL,
-  S_NATIONKEY   INTEGER NOT NULL,
-  S_PHONE       CHAR(15) NOT NULL,
-  S_ACCTBAL     DECIMAL(15,2) NOT NULL,
-  S_COMMENT     VARCHAR(101) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLJdbcScanner.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLJdbcScanner.java b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLJdbcScanner.java
new file mode 100644
index 0000000..c0de726
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLJdbcScanner.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.pgsql;
+
+import org.apache.tajo.catalog.Schema;
+import org.apache.tajo.catalog.TableMeta;
+import org.apache.tajo.storage.jdbc.JdbcFragment;
+import org.apache.tajo.storage.jdbc.JdbcScanner;
+
+import java.sql.DatabaseMetaData;
+
+public class PgSQLJdbcScanner extends JdbcScanner {
+
+  public PgSQLJdbcScanner(DatabaseMetaData dbMetaData,
+                          Schema tableSchema,
+                          TableMeta tableMeta,
+                          JdbcFragment fragment) {
+    super(dbMetaData, tableSchema, tableMeta, fragment);
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
index 8ab290c..af314a1 100644
--- a/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
+++ b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
@@ -20,9 +20,18 @@ package org.apache.tajo.storage.pgsql;
 
 import net.minidev.json.JSONObject;
 import org.apache.tajo.catalog.MetadataProvider;
+import org.apache.tajo.catalog.Schema;
+import org.apache.tajo.catalog.TableMeta;
+import org.apache.tajo.exception.TajoInternalError;
+import org.apache.tajo.storage.NullScanner;
+import org.apache.tajo.storage.Scanner;
 import org.apache.tajo.storage.TablespaceManager;
+import org.apache.tajo.storage.fragment.Fragment;
+import org.apache.tajo.storage.jdbc.JdbcFragment;
 import org.apache.tajo.storage.jdbc.JdbcTablespace;
 
+import javax.annotation.Nullable;
+import java.io.IOException;
 import java.net.URI;
 
 /**
@@ -43,4 +52,27 @@ public class PgSQLTablespace extends JdbcTablespace {
   public MetadataProvider getMetadataProvider() {
     return new PgSQLMetadataProvider(this, database);
   }
+
+  @Override
+  public Scanner getScanner(TableMeta meta,
+                            Schema schema,
+                            Fragment fragment,
+                            @Nullable Schema target) throws IOException {
+    if (!(fragment instanceof JdbcFragment)) {
+      throw new TajoInternalError("fragment must be JdbcFragment");
+    }
+
+    if (target == null) {
+      target = schema;
+    }
+
+    if (fragment.isEmpty()) {
+      Scanner scanner = new NullScanner(conf, schema, meta, fragment);
+      scanner.setTarget(target.toArray());
+
+      return scanner;
+    }
+
+    return new PgSQLJdbcScanner(getDatabaseMetaData(), schema, meta, (JdbcFragment) fragment);
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java
index bb4f5e7..a30a1cd 100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java
@@ -22,9 +22,12 @@ import io.airlift.testing.postgresql.TestingPostgreSqlServer;
 import net.minidev.json.JSONObject;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.fs.Path;
 import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.storage.TablespaceManager;
+import org.apache.tajo.util.CommonTestingUtil;
 import org.apache.tajo.util.FileUtil;
+import org.apache.tajo.util.JavaResourceUtil;
 
 import java.io.IOException;
 import java.net.URI;
@@ -71,20 +74,33 @@ public class EmbedPgSQLServer {
   }
 
   private void loadTPCHTables() throws SQLException, IOException {
-    try (Connection connection = DriverManager.getConnection(server.getJdbcUrl())) {
+    Path testPath = CommonTestingUtil.getTestDir();
+
+    try (Connection connection = DriverManager.getConnection(getJdbcUrlForAdmin(), "postgres", null)) {
       connection.setCatalog("tpch");
 
       try (Statement statement = connection.createStatement()) {
+
         for (String tableName : TPCH_TABLES) {
-          String sql = FileUtil.readTextFileFromResource("tpch/" + tableName + ".sql");
+          String sql = JavaResourceUtil.readTextFromResource("tpch/pgsql/" + tableName + ".sql");
           statement.addBatch(sql);
         }
 
-        try {
-          statement.executeBatch();
-        } catch (SQLException e) {
-          LOG.error(e);
+        statement.executeBatch();
+
+        for (String tableName : TPCH_TABLES) {
+          String table = JavaResourceUtil.readTextFromResource("tpch/" + tableName + ".tbl");
+          Path filePath = new Path(testPath, tableName + ".tbl");
+          FileUtil.writeTextToFile(table, filePath);
+
+          String copyCommand =
+              "COPY " + tableName + " FROM '" + filePath.toUri().getPath() + "' WITH (FORMAT csv, DELIMITER '|');";
+          statement.executeUpdate(copyCommand);
         }
+
+      } catch (Throwable t) {
+        t.printStackTrace();
+        throw t;
       }
     }
   }
@@ -97,14 +113,20 @@ public class EmbedPgSQLServer {
     configMap.put(TablespaceManager.TABLESPACE_SPEC_CONFIGS_KEY, configElements);
     JSONObject config = new JSONObject(configMap);
 
-    PgSQLTablespace tablespace = new PgSQLTablespace(SPACENAME, URI.create(server.getJdbcUrl()), config);
+    PgSQLTablespace tablespace = new PgSQLTablespace(SPACENAME, URI.create(getJdbcUrlForAdmin()), config);
     tablespace.init(new TajoConf());
 
     TablespaceManager.addTableSpaceForTest(tablespace);
   }
 
   public String getJdbcUrl() {
-    return server.getJdbcUrl();
+    return server.getJdbcUrl() + "&connectTimeout=5&socketTimeout=5";
+  }
+
+  public String getJdbcUrlForAdmin() {
+    String url = server.getJdbcUrl().split("\\?")[0];
+    url += "?user=postgres&connectTimeout=5&socketTimeout=5";
+    return url;
   }
 
   public TestingPostgreSqlServer getServer() {

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java
index aa0db26..2b54a62 100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.tajo.storage.pgsql;
 
 import com.google.common.collect.Sets;
@@ -15,7 +33,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 public class TestPgSQLEndPointTests extends QueryTestCaseBase {
-  private static final String jdbcUrl = EmbedPgSQLServer.getInstance().getJdbcUrl();
+  private static final String jdbcUrl = EmbedPgSQLServer.getInstance().getJdbcUrlForAdmin();
   private static TajoClient client;
 
 
@@ -30,19 +48,19 @@ public class TestPgSQLEndPointTests extends QueryTestCaseBase {
     client.close();
   }
 
-  @Test
+  @Test(timeout = 5000)
   public void testGetAllDatabaseNames() {
     Set<String> retrieved = Sets.newHashSet(client.getAllDatabaseNames());
     assertTrue(retrieved.contains(EmbedPgSQLServer.DATABASE_NAME));
   }
 
-  @Test
+  @Test(timeout = 5000)
   public void testGetTableList() {
     Set<String> retrieved = Sets.newHashSet(client.getTableList("tpch"));
     assertEquals(Sets.newHashSet(EmbedPgSQLServer.TPCH_TABLES), retrieved);
   }
 
-  @Test
+  @Test(timeout = 5000)
   public void testGetTable() throws UndefinedTableException {
     for (String tableName: EmbedPgSQLServer.TPCH_TABLES) {
       TableDesc retrieved = client.getTableDesc(EmbedPgSQLServer.DATABASE_NAME + "." + tableName);

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLQueryTests.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLQueryTests.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLQueryTests.java
index ab725e4..7bfb80e 100644
--- a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLQueryTests.java
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLQueryTests.java
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.tajo.storage.pgsql;
 
 import org.apache.tajo.QueryTestCaseBase;
@@ -5,13 +23,20 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 
 public class TestPgSQLQueryTests extends QueryTestCaseBase {
+  private static final String jdbcUrl = EmbedPgSQLServer.getInstance().getJdbcUrl();
+
+  public TestPgSQLQueryTests() {
+    super(EmbedPgSQLServer.DATABASE_NAME);
+  }
+
   @BeforeClass
-  public void setUp() {
+  public static void setUp() {
     QueryTestCaseBase.testingCluster.getMaster().refresh();
   }
 
+  @SimpleTest
   @Test
-  public void testSelectAll() {
-    //executeString()
+  public void testSimpleFilter() throws Exception {
+    runSimpleTests();
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLSimpleQueryTests.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLSimpleQueryTests.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLSimpleQueryTests.java
new file mode 100644
index 0000000..3971bbc
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLSimpleQueryTests.java
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.pgsql;
+
+import org.apache.tajo.QueryTestCaseBase;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class TestPgSQLSimpleQueryTests extends QueryTestCaseBase {
+
+  public TestPgSQLSimpleQueryTests() {
+    super(EmbedPgSQLServer.DATABASE_NAME);
+  }
+
+  @BeforeClass
+  public static void setUp() {
+    QueryTestCaseBase.testingCluster.getMaster().refresh();
+  }
+
+  @SimpleTest
+  @Test
+  public void testSelectAll() throws Exception {
+    runSimpleTests();
+  }
+
+  @SimpleTest
+  @Test
+  public void testSelectLimit() throws Exception {
+    runSimpleTests();
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/select_all.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/select_all.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/select_all.sql
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testSimpleFilter.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testSimpleFilter.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testSimpleFilter.sql
new file mode 100644
index 0000000..a5eccc5
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/testSimpleFilter.sql
@@ -0,0 +1 @@
+SELECT * FROM LINEITEM WHERE L_ORDERKEY > 1;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLSimpleQueryTests/testSelectAll.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLSimpleQueryTests/testSelectAll.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLSimpleQueryTests/testSelectAll.sql
new file mode 100644
index 0000000..1ec1bf7
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLSimpleQueryTests/testSelectAll.sql
@@ -0,0 +1 @@
+SELECT * FROM LINEITEM;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLSimpleQueryTests/testSelectLimit.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLSimpleQueryTests/testSelectLimit.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLSimpleQueryTests/testSelectLimit.sql
new file mode 100644
index 0000000..7173101
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLSimpleQueryTests/testSelectLimit.sql
@@ -0,0 +1 @@
+SELECT * FROM LINEITEM LIMIT 3;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/select_all.result
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/select_all.result b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/select_all.result
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testSimpleFilter.result
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testSimpleFilter.result b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testSimpleFilter.result
new file mode 100644
index 0000000..a484704
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/testSimpleFilter.result
@@ -0,0 +1,5 @@
+l_orderkey,l_partkey,l_suppkey,l_linenumber,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag,l_linestatus,l_shipdate,l_commitdate,l_receiptdate,l_shipinstruct,l_shipmode,l_comment
+-------------------------------
+2,2,1191,1,38.0,44694.46,0.0,0.05,N,O,0096-12-02,0096-12-02,0096-12-31,TAKE BACK RETURN         ,RAIL      ,ven requests. deposits breach a
+3,2,1798,1,45.0,54058.05,0.06,0.0,R,F,0094-01-03,0093-12-02,0094-01-03,NONE                     ,AIR       ,ongside of the furiously brave acco
+3,3,6540,2,49.0,46796.47,0.1,0.0,R,F,0093-10-02,0093-11-01,0093-10-03,TAKE BACK RETURN         ,RAIL      , unusual accounts. eve

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectAll.result
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectAll.result b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectAll.result
new file mode 100644
index 0000000..8d66d30
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectAll.result
@@ -0,0 +1,7 @@
+l_orderkey,l_partkey,l_suppkey,l_linenumber,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag,l_linestatus,l_shipdate,l_commitdate,l_receiptdate,l_shipinstruct,l_shipmode,l_comment
+-------------------------------
+1,1,7706,1,17.0,21168.23,0.04,0.02,N,O,0096-02-03,0096-01-01,0096-02-05,DELIVER IN PERSON        ,TRUCK     ,egular courts above the
+1,1,7311,2,36.0,45983.16,0.09,0.06,N,O,0096-03-05,0096-01-03,0096-03-06,TAKE BACK RETURN         ,MAIL      ,ly final dependencies: slyly bold
+2,2,1191,1,38.0,44694.46,0.0,0.05,N,O,0096-12-02,0096-12-02,0096-12-31,TAKE BACK RETURN         ,RAIL      ,ven requests. deposits breach a
+3,2,1798,1,45.0,54058.05,0.06,0.0,R,F,0094-01-03,0093-12-02,0094-01-03,NONE                     ,AIR       ,ongside of the furiously brave acco
+3,3,6540,2,49.0,46796.47,0.1,0.0,R,F,0093-10-02,0093-11-01,0093-10-03,TAKE BACK RETURN         ,RAIL      , unusual accounts. eve

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectLimit.result
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectLimit.result b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectLimit.result
new file mode 100644
index 0000000..52c87f6
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLSimpleQueryTests/testSelectLimit.result
@@ -0,0 +1,5 @@
+l_orderkey,l_partkey,l_suppkey,l_linenumber,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag,l_linestatus,l_shipdate,l_commitdate,l_receiptdate,l_shipinstruct,l_shipmode,l_comment
+-------------------------------
+1,1,7706,1,17.0,21168.23,0.04,0.02,N,O,0096-02-03,0096-01-01,0096-02-05,DELIVER IN PERSON        ,TRUCK     ,egular courts above the
+1,1,7311,2,36.0,45983.16,0.09,0.06,N,O,0096-03-05,0096-01-03,0096-03-06,TAKE BACK RETURN         ,MAIL      ,ly final dependencies: slyly bold
+2,2,1191,1,38.0,44694.46,0.0,0.05,N,O,0096-12-02,0096-12-02,0096-12-31,TAKE BACK RETURN         ,RAIL      ,ven requests. deposits breach a

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/customer.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/customer.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/customer.sql
deleted file mode 100644
index 35b1861..0000000
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/customer.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-CREATE TABLE CUSTOMER (
-  C_CUSTKEY     INTEGER NOT NULL,
-  C_NAME        VARCHAR(25) NOT NULL,
-  C_ADDRESS     VARCHAR(40) NOT NULL,
-  C_NATIONKEY   INTEGER NOT NULL,
-  C_PHONE       CHAR(15) NOT NULL,
-  C_ACCTBAL     DECIMAL(15,2)   NOT NULL,
-  C_MKTSEGMENT  CHAR(10) NOT NULL,
-  C_COMMENT     VARCHAR(117) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/lineitem.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/lineitem.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/lineitem.sql
deleted file mode 100644
index a7f61bb..0000000
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/lineitem.sql
+++ /dev/null
@@ -1,18 +0,0 @@
-CREATE TABLE LINEITEM (
-  L_ORDERKEY    INTEGER NOT NULL,
-  L_PARTKEY     INTEGER NOT NULL,
-  L_SUPPKEY     INTEGER NOT NULL,
-  L_LINENUMBER  INTEGER NOT NULL,
-  L_QUANTITY    DECIMAL(15,2) NOT NULL,
-  L_EXTENDEDPRICE  DECIMAL(15,2) NOT NULL,
-  L_DISCOUNT    DECIMAL(15,2) NOT NULL,
-  L_TAX         DECIMAL(15,2) NOT NULL,
-  L_RETURNFLAG  CHAR(1) NOT NULL,
-  L_LINESTATUS  CHAR(1) NOT NULL,
-  L_SHIPDATE    DATE NOT NULL,
-  L_COMMITDATE  DATE NOT NULL,
-  L_RECEIPTDATE DATE NOT NULL,
-  L_SHIPINSTRUCT CHAR(25) NOT NULL,
-  L_SHIPMODE     CHAR(10) NOT NULL,
-  L_COMMENT      VARCHAR(44) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/nation.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/nation.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/nation.sql
deleted file mode 100644
index f7ecda8..0000000
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/nation.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-CREATE TABLE NATION  (
-  N_NATIONKEY  INTEGER NOT NULL,
-  N_NAME       CHAR(25) NOT NULL,
-  N_REGIONKEY  INTEGER NOT NULL,
-  N_COMMENT    VARCHAR(152)
-);

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/orders.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/orders.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/orders.sql
deleted file mode 100644
index 220d576..0000000
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/orders.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-CREATE TABLE ORDERS  (
-  O_ORDERKEY       INTEGER NOT NULL,
-  O_CUSTKEY        INTEGER NOT NULL,
-  O_ORDERSTATUS    CHAR(1) NOT NULL,
-  O_TOTALPRICE     DECIMAL(15,2) NOT NULL,
-  O_ORDERDATE      DATE NOT NULL,
-  O_ORDERPRIORITY  CHAR(15) NOT NULL,
-  O_CLERK          CHAR(15) NOT NULL,
-  O_SHIPPRIORITY   INTEGER NOT NULL,
-  O_COMMENT        VARCHAR(79) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/part.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/part.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/part.sql
deleted file mode 100644
index e66f73c..0000000
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/part.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-CREATE TABLE PART (
-  P_PARTKEY     INTEGER NOT NULL,
-  P_NAME        VARCHAR(55) NOT NULL,
-  P_MFGR        CHAR(25) NOT NULL,
-  P_BRAND       CHAR(10) NOT NULL,
-  P_TYPE        VARCHAR(25) NOT NULL,
-  P_SIZE        INTEGER NOT NULL,
-  P_CONTAINER   CHAR(10) NOT NULL,
-  P_RETAILPRICE DECIMAL(15,2) NOT NULL,
-  P_COMMENT     VARCHAR(23) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/partsupp.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/partsupp.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/partsupp.sql
deleted file mode 100644
index 1f61331..0000000
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/partsupp.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE TABLE PARTSUPP (
-  PS_PARTKEY     INTEGER NOT NULL,
-  PS_SUPPKEY     INTEGER NOT NULL,
-  PS_AVAILQTY    INTEGER NOT NULL,
-  PS_SUPPLYCOST  DECIMAL(15,2)  NOT NULL,
-  PS_COMMENT     VARCHAR(199) NOT NULL
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/customer.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/customer.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/customer.sql
new file mode 100644
index 0000000..35b1861
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/customer.sql
@@ -0,0 +1,10 @@
+CREATE TABLE CUSTOMER (
+  C_CUSTKEY     INTEGER NOT NULL,
+  C_NAME        VARCHAR(25) NOT NULL,
+  C_ADDRESS     VARCHAR(40) NOT NULL,
+  C_NATIONKEY   INTEGER NOT NULL,
+  C_PHONE       CHAR(15) NOT NULL,
+  C_ACCTBAL     DECIMAL(15,2)   NOT NULL,
+  C_MKTSEGMENT  CHAR(10) NOT NULL,
+  C_COMMENT     VARCHAR(117) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/lineitem.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/lineitem.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/lineitem.sql
new file mode 100644
index 0000000..a7f61bb
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/lineitem.sql
@@ -0,0 +1,18 @@
+CREATE TABLE LINEITEM (
+  L_ORDERKEY    INTEGER NOT NULL,
+  L_PARTKEY     INTEGER NOT NULL,
+  L_SUPPKEY     INTEGER NOT NULL,
+  L_LINENUMBER  INTEGER NOT NULL,
+  L_QUANTITY    DECIMAL(15,2) NOT NULL,
+  L_EXTENDEDPRICE  DECIMAL(15,2) NOT NULL,
+  L_DISCOUNT    DECIMAL(15,2) NOT NULL,
+  L_TAX         DECIMAL(15,2) NOT NULL,
+  L_RETURNFLAG  CHAR(1) NOT NULL,
+  L_LINESTATUS  CHAR(1) NOT NULL,
+  L_SHIPDATE    DATE NOT NULL,
+  L_COMMITDATE  DATE NOT NULL,
+  L_RECEIPTDATE DATE NOT NULL,
+  L_SHIPINSTRUCT CHAR(25) NOT NULL,
+  L_SHIPMODE     CHAR(10) NOT NULL,
+  L_COMMENT      VARCHAR(44) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/nation.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/nation.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/nation.sql
new file mode 100644
index 0000000..f7ecda8
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/nation.sql
@@ -0,0 +1,6 @@
+CREATE TABLE NATION  (
+  N_NATIONKEY  INTEGER NOT NULL,
+  N_NAME       CHAR(25) NOT NULL,
+  N_REGIONKEY  INTEGER NOT NULL,
+  N_COMMENT    VARCHAR(152)
+);

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/orders.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/orders.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/orders.sql
new file mode 100644
index 0000000..220d576
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/orders.sql
@@ -0,0 +1,11 @@
+CREATE TABLE ORDERS  (
+  O_ORDERKEY       INTEGER NOT NULL,
+  O_CUSTKEY        INTEGER NOT NULL,
+  O_ORDERSTATUS    CHAR(1) NOT NULL,
+  O_TOTALPRICE     DECIMAL(15,2) NOT NULL,
+  O_ORDERDATE      DATE NOT NULL,
+  O_ORDERPRIORITY  CHAR(15) NOT NULL,
+  O_CLERK          CHAR(15) NOT NULL,
+  O_SHIPPRIORITY   INTEGER NOT NULL,
+  O_COMMENT        VARCHAR(79) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/part.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/part.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/part.sql
new file mode 100644
index 0000000..e66f73c
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/part.sql
@@ -0,0 +1,11 @@
+CREATE TABLE PART (
+  P_PARTKEY     INTEGER NOT NULL,
+  P_NAME        VARCHAR(55) NOT NULL,
+  P_MFGR        CHAR(25) NOT NULL,
+  P_BRAND       CHAR(10) NOT NULL,
+  P_TYPE        VARCHAR(25) NOT NULL,
+  P_SIZE        INTEGER NOT NULL,
+  P_CONTAINER   CHAR(10) NOT NULL,
+  P_RETAILPRICE DECIMAL(15,2) NOT NULL,
+  P_COMMENT     VARCHAR(23) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/partsupp.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/partsupp.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/partsupp.sql
new file mode 100644
index 0000000..1f61331
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/partsupp.sql
@@ -0,0 +1,7 @@
+CREATE TABLE PARTSUPP (
+  PS_PARTKEY     INTEGER NOT NULL,
+  PS_SUPPKEY     INTEGER NOT NULL,
+  PS_AVAILQTY    INTEGER NOT NULL,
+  PS_SUPPLYCOST  DECIMAL(15,2)  NOT NULL,
+  PS_COMMENT     VARCHAR(199) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/region.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/region.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/region.sql
new file mode 100644
index 0000000..c47e26e
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/region.sql
@@ -0,0 +1,5 @@
+CREATE TABLE REGION  (
+  R_REGIONKEY  INTEGER NOT NULL,
+  R_NAME       CHAR(25) NOT NULL,
+  R_COMMENT    VARCHAR(152)
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/supplier.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/supplier.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/supplier.sql
new file mode 100644
index 0000000..a4d35d3
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/pgsql/supplier.sql
@@ -0,0 +1,9 @@
+CREATE TABLE SUPPLIER (
+  S_SUPPKEY     INTEGER NOT NULL,
+  S_NAME        CHAR(25) NOT NULL,
+  S_ADDRESS     VARCHAR(40) NOT NULL,
+  S_NATIONKEY   INTEGER NOT NULL,
+  S_PHONE       CHAR(15) NOT NULL,
+  S_ACCTBAL     DECIMAL(15,2) NOT NULL,
+  S_COMMENT     VARCHAR(101) NOT NULL
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/region.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/region.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/region.sql
deleted file mode 100644
index c47e26e..0000000
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/region.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-CREATE TABLE REGION  (
-  R_REGIONKEY  INTEGER NOT NULL,
-  R_NAME       CHAR(25) NOT NULL,
-  R_COMMENT    VARCHAR(152)
-);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/fa819881/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/supplier.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/supplier.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/supplier.sql
deleted file mode 100644
index a4d35d3..0000000
--- a/tajo-storage/tajo-storage-pgsql/src/test/resources/tpch/supplier.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-CREATE TABLE SUPPLIER (
-  S_SUPPKEY     INTEGER NOT NULL,
-  S_NAME        CHAR(25) NOT NULL,
-  S_ADDRESS     VARCHAR(40) NOT NULL,
-  S_NATIONKEY   INTEGER NOT NULL,
-  S_PHONE       CHAR(15) NOT NULL,
-  S_ACCTBAL     DECIMAL(15,2) NOT NULL,
-  S_COMMENT     VARCHAR(101) NOT NULL
-);
\ No newline at end of file


[28/39] tajo git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730

Posted by hy...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/177291d7
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/177291d7
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/177291d7

Branch: refs/heads/TAJO-1730
Commit: 177291d7ece85b9c6ffe6277e48f12895fff4259
Parents: faf12b1 45ca499
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sat Aug 22 00:56:52 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sat Aug 22 00:56:52 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |   2 +
 .../tajo/engine/query/TestHBaseTable.java       |  14 +-
 .../tajo/engine/query/TestSimpleQuery.java      | 179 +++++++++++++++++++
 .../results/TestSimpleQuery/testLimit.result    |   3 +
 .../results/TestSimpleQuery/testNoWhere.result  |   7 +
 .../testPartitionColumnWhere.result             |   4 +
 .../results/TestSimpleQuery/testWhere.result    |   4 +
 .../exec/NonForwardQueryResultFileScanner.java  |  94 +++-------
 .../exec/NonForwardQueryResultScanner.java      |  10 +-
 .../apache/tajo/master/exec/QueryExecutor.java  |  15 +-
 .../ws/rs/resources/QueryResultResource.java    |   3 +-
 .../org/apache/tajo/plan/expr/EvalTreeUtil.java |  34 +---
 .../plan/rewrite/rules/AccessPathRewriter.java  |   1 +
 .../rewrite/rules/PartitionedTableRewriter.java |   1 +
 .../org/apache/tajo/plan/util/PlannerUtil.java  |  23 +--
 .../org/apache/tajo/storage/Tablespace.java     |  12 --
 .../tajo/storage/hbase/HBaseTablespace.java     |  83 ---------
 .../org/apache/tajo/storage/FileTablespace.java | 145 ---------------
 18 files changed, 252 insertions(+), 382 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/177291d7/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestHBaseTable.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/177291d7/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
----------------------------------------------------------------------
diff --cc tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
index ff7ee47,d131d9e..83ae935
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
@@@ -128,21 -128,8 +128,9 @@@ public abstract class Tablespace 
     * @return The list of input fragments.
     * @throws java.io.IOException
     */
 -  public abstract List<Fragment> getSplits(String fragmentId, TableDesc tableDesc,
 -                                           ScanNode scanNode) throws IOException, TajoException;
 +  public abstract List<Fragment> getSplits(String inputSourceId,
 +                                           TableDesc tableDesc,
 +                                           @Nullable EvalNode filterCondition) throws IOException, TajoException;
- 
-   /**
-    * It returns the splits that will serve as input for the non-forward query scanner such as 'select * from table1'.
-    * The result list should be small. If there is many fragments for scanning, TajoMaster uses the paging navigation.
-    * @param tableDesc The table description for the target data.
-    * @param currentPage The current page number within the entire list.
-    * @param numFragments The number of fragments in the result.
-    * @return The list of input fragments.
-    * @throws java.io.IOException
-    */
-   public abstract List<Fragment> getNonForwardSplit(TableDesc tableDesc, int currentPage, int numFragments)
-       throws IOException;
  
    /**
     * It returns the storage property.

http://git-wip-us.apache.org/repos/asf/tajo/blob/177291d7/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tajo/blob/177291d7/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
----------------------------------------------------------------------


[06/39] tajo git commit: Implement the base.

Posted by hy...@apache.org.
Implement the base.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/39e7bd8e
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/39e7bd8e
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/39e7bd8e

Branch: refs/heads/TAJO-1730
Commit: 39e7bd8e3f98565eae47eb8eae10888d655c11b9
Parents: 9b26ccc
Author: Hyunsik Choi <hy...@apache.org>
Authored: Thu Aug 13 23:16:06 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Thu Aug 13 23:16:06 2015 +0900

----------------------------------------------------------------------
 .../main/java/org/apache/tajo/util/UriUtil.java |  32 ++++++
 tajo-storage/tajo-storage-common/pom.xml        |   4 +-
 .../apache/tajo/storage/TablespaceManager.java  |  13 ++-
 .../src/main/resources/storage-default.json     |  12 +-
 .../tajo/storage/jdbc/ConnectionInfo.java       | 112 +++++++++++++++++++
 .../tajo/storage/jdbc/JdbcConnectionInfo.java   |  92 ---------------
 .../storage/jdbc/JdbcMetadataProviderBase.java  |   9 +-
 .../tajo/storage/jdbc/TestConnectionInfo.java   |  50 +++++++++
 .../storage/jdbc/TestJdbcConnectionInfo.java    |  50 ---------
 tajo-storage/tajo-storage-mysql/pom.xml         |  13 +--
 .../storage/jdbc/TestMysqlJdbcTableSpace.java   |  47 ++++----
 11 files changed, 245 insertions(+), 189 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/39e7bd8e/tajo-common/src/main/java/org/apache/tajo/util/UriUtil.java
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/java/org/apache/tajo/util/UriUtil.java b/tajo-common/src/main/java/org/apache/tajo/util/UriUtil.java
new file mode 100644
index 0000000..c0ee853
--- /dev/null
+++ b/tajo-common/src/main/java/org/apache/tajo/util/UriUtil.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.util;
+
+import java.net.URI;
+
+public class UriUtil {
+
+  public static String getScheme(URI uri) {
+    return getScheme(uri.toASCIIString());
+  }
+
+  public static String getScheme(String uri) {
+    return uri.substring(0, uri.indexOf(":/"));
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/39e7bd8e/tajo-storage/tajo-storage-common/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/pom.xml b/tajo-storage/tajo-storage-common/pom.xml
index f1d3438..ef0dc3a 100644
--- a/tajo-storage/tajo-storage-common/pom.xml
+++ b/tajo-storage/tajo-storage-common/pom.xml
@@ -50,8 +50,8 @@ limitations under the License.
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
-          <source>1.6</source>
-          <target>1.6</target>
+          <source>1.7</source>
+          <target>1.7</target>
           <encoding>${project.build.sourceEncoding}</encoding>
         </configuration>
       </plugin>

http://git-wip-us.apache.org/repos/asf/tajo/blob/39e7bd8e/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
index 63cd502..ae3654d 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
@@ -21,7 +21,6 @@ package org.apache.tajo.storage;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Function;
 import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
 import com.google.common.base.Predicate;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.Maps;
@@ -37,6 +36,7 @@ import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.storage.fragment.Fragment;
 import org.apache.tajo.util.FileUtil;
 import org.apache.tajo.util.Pair;
+import org.apache.tajo.util.UriUtil;
 
 import javax.annotation.Nullable;
 import java.io.IOException;
@@ -98,7 +98,7 @@ public class TablespaceManager implements StorageService {
   }
 
   private void addLocalFsTablespace() {
-    if (TABLE_SPACES.headMap(LOCAL_FS_URI, true).firstEntry() == null) {
+    if (TABLE_SPACES.headMap(LOCAL_FS_URI, true).firstEntry() == null && TABLE_SPACE_HANDLERS.containsKey("file")) {
       String tmpName = UUID.randomUUID().toString();
       registerTableSpace(tmpName, LOCAL_FS_URI, null, false, false);
     }
@@ -273,8 +273,7 @@ public class TablespaceManager implements StorageService {
   public static final String KEY_SPACES = "spaces";
 
   private static Tablespace initializeTableSpace(String spaceName, URI uri, JSONObject spaceDesc) {
-    Preconditions.checkNotNull(uri.getScheme(), "URI must include scheme, but it was " + uri);
-    Class<? extends Tablespace> clazz = TABLE_SPACE_HANDLERS.get(uri.getScheme());
+    Class<? extends Tablespace> clazz = TABLE_SPACE_HANDLERS.get(UriUtil.getScheme(uri));
 
     if (clazz == null) {
       throw new RuntimeException("There is no tablespace for " + uri.toString());
@@ -300,6 +299,12 @@ public class TablespaceManager implements StorageService {
   public static Optional<Tablespace> addTableSpaceForTest(Tablespace space) {
     Tablespace existing;
     synchronized (SPACES_URIS_MAP) {
+
+      String scheme = UriUtil.getScheme(space.getUri());
+      if (!TABLE_SPACE_HANDLERS.containsKey(scheme)) {
+        TABLE_SPACE_HANDLERS.put(scheme, space.getClass());
+      }
+
       // Remove existing one
       SPACES_URIS_MAP.remove(space.getName());
       existing = TABLE_SPACES.remove(space.getUri());

http://git-wip-us.apache.org/repos/asf/tajo/blob/39e7bd8e/tajo-storage/tajo-storage-common/src/main/resources/storage-default.json
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/resources/storage-default.json b/tajo-storage/tajo-storage-common/src/main/resources/storage-default.json
index 16d20db..6060d50 100644
--- a/tajo-storage/tajo-storage-common/src/main/resources/storage-default.json
+++ b/tajo-storage/tajo-storage-common/src/main/resources/storage-default.json
@@ -12,13 +12,17 @@
       "handler": "org.apache.tajo.storage.FileTablespace",
       "default-format": "text"
     },
-    "hbase": {
+    "hbase:zk": {
       "handler": "org.apache.tajo.storage.hbase.HBaseTablespace",
       "default-format": "hbase"
     },
-    "jdbc": {
-      "handler": "org.apache.tajo.storage.jdbc.JdbcTablespace",
-      "default-format": "hbase"
+    "jdbc:mysql": {
+      "handler": "org.apache.tajo.storage.mysql.MySQLTablespace",
+      "default-format": "rowstore"
+    },
+    "jdbc:postgresql": {
+      "handler": "org.apache.tajo.storage.pgsql.PgSQLTablespace",
+      "default-format": "rowstore"
     }
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/39e7bd8e/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/ConnectionInfo.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/ConnectionInfo.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/ConnectionInfo.java
new file mode 100644
index 0000000..9a42b0d
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/ConnectionInfo.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+import org.apache.tajo.exception.TajoInternalError;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ConnectionInfo {
+  String scheme;
+  String dbName;
+  String tableName;
+  String user;
+  String password;
+  Map<String, String> params;
+
+  public String scheme() {
+    return scheme;
+  }
+
+  public String database() {
+    return dbName;
+  }
+
+  public String table() {
+    return tableName;
+  }
+
+  public String user() {
+    return user;
+  }
+
+  public String password() {
+    return password;
+  }
+
+  public static ConnectionInfo fromURI(String originalUri) {
+    return fromURI(URI.create(originalUri));
+  }
+
+  public static ConnectionInfo fromURI(URI originalUri) {
+    final String uriStr = originalUri.toASCIIString();
+    URI uri = originalUri;
+
+    final ConnectionInfo connInfo = new ConnectionInfo();
+    connInfo.scheme = uriStr.substring(0, uriStr.indexOf("://"));
+
+    if (connInfo.scheme.split(":").length > 1) {
+      int idx = uriStr.indexOf(':');
+      uri = URI.create(uriStr.substring(idx + 1));
+    }
+
+    String path = uri.getPath();
+    if (path != null && !path.isEmpty()) {
+      String [] pathElements = path.substring(1).split("/");
+      if (pathElements.length != 1) {
+        throw new TajoInternalError("Invalid JDBC path: " + path);
+      }
+      connInfo.dbName = pathElements[0];
+    }
+
+    Map<String, String> params = new HashMap<>();
+
+    int paramIndex = uriStr.indexOf("?");
+    if (paramIndex > 0) {
+      String parameterPart = uriStr.substring(paramIndex+1, uriStr.length());
+
+      String [] eachParam = parameterPart.split("&");
+
+      for (String each: eachParam) {
+        String [] keyValues = each.split("=");
+        if (keyValues.length != 2) {
+          throw new TajoInternalError("Invalid URI Parameters: " + parameterPart);
+        }
+        params.put(keyValues[0], keyValues[1]);
+      }
+    }
+
+    if (params.containsKey("table")) {
+      connInfo.tableName = params.remove("table");
+    }
+
+    if (params.containsKey("user")) {
+      connInfo.user = params.remove("user");
+    }
+    if (params.containsKey("password")) {
+      connInfo.password = params.remove("password");
+    }
+
+    connInfo.params = params;
+
+    return connInfo;
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/39e7bd8e/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcConnectionInfo.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcConnectionInfo.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcConnectionInfo.java
deleted file mode 100644
index 255aa84..0000000
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcConnectionInfo.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.jdbc;
-
-import org.apache.tajo.exception.TajoInternalError;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
-public class JdbcConnectionInfo {
-  String scheme;
-  String dbName;
-  String tableName;
-  String user;
-  String password;
-  Map<String, String> params;
-
-  public static JdbcConnectionInfo fromURI(String originalUri) {
-    return fromURI(URI.create(originalUri));
-  }
-
-  public static JdbcConnectionInfo fromURI(URI originalUri) {
-    final String uriStr = originalUri.toASCIIString();
-    URI uri = originalUri;
-
-    final JdbcConnectionInfo connInfo = new JdbcConnectionInfo();
-    connInfo.scheme = uriStr.substring(0, uriStr.indexOf("://"));
-
-    if (connInfo.scheme.split(":").length > 1) {
-      int idx = uriStr.indexOf(':');
-      uri = URI.create(uriStr.substring(idx + 1));
-    }
-
-    String path = uri.getPath();
-    if (path != null && !path.isEmpty()) {
-      String [] pathElements = path.substring(1).split("/");
-      if (pathElements.length != 1) {
-        throw new TajoInternalError("Invalid JDBC path: " + path);
-      }
-      connInfo.dbName = pathElements[0];
-    }
-
-    Map<String, String> params = new HashMap<>();
-
-    int paramIndex = uriStr.indexOf("?");
-    if (paramIndex > 0) {
-      String parameterPart = uriStr.substring(paramIndex+1, uriStr.length());
-
-      String [] eachParam = parameterPart.split("&");
-
-      for (String each: eachParam) {
-        String [] keyValues = each.split("=");
-        if (keyValues.length != 2) {
-          throw new TajoInternalError("Invalid URI Parameters: " + parameterPart);
-        }
-        params.put(keyValues[0], keyValues[1]);
-      }
-    }
-
-    if (params.containsKey("table")) {
-      connInfo.tableName = params.remove("table");
-    }
-
-    if (params.containsKey("user")) {
-      connInfo.user = params.remove("user");
-    }
-    if (params.containsKey("password")) {
-      connInfo.password = params.remove("password");
-    }
-
-    connInfo.params = params;
-
-    return connInfo;
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/39e7bd8e/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
index 172b444..834643b 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
@@ -57,15 +57,14 @@ public abstract class JdbcMetadataProviderBase implements MetadataProvider {
     this.space = space;
     this.databaseName = dbName;
 
-    JdbcConnectionInfo connInfo = JdbcConnectionInfo.fromURI(space.getUri());
+    ConnectionInfo connInfo = ConnectionInfo.fromURI(space.getUri());
     this.jdbcUri  = space.getUri().toASCIIString();
-    this.username = connInfo.user;
-    this.password = connInfo.password;
+    this.username = connInfo.user();
+    this.password = connInfo.password();
 
-//    String jdbcDriver = getJdbcDriverName();
     try {
       Class.forName(getJdbcDriverName()).newInstance();
-      LOG.info("Loaded JDBC driver (" + "com.mysql.jdbc.Driver" + ")");
+      LOG.info(getJdbcDriverName() + " is loaded...");
     } catch (Exception e) {
       throw new TajoInternalError(e);
     }

http://git-wip-us.apache.org/repos/asf/tajo/blob/39e7bd8e/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestConnectionInfo.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestConnectionInfo.java b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestConnectionInfo.java
new file mode 100644
index 0000000..1ccd322
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestConnectionInfo.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+public class TestConnectionInfo {
+  @Test
+  public final void testGetConnectionInfoType1() {
+    ConnectionInfo c1 = ConnectionInfo.fromURI("jdbc:mysql://localhost:55840?user=testuser&password=testpass");
+    assertEquals("jdbc:mysql", c1.scheme);
+    assertEquals("testuser", c1.user);
+    assertEquals("testpass", c1.password);
+    assertNull(c1.dbName);
+    assertNull(c1.tableName);
+    assertEquals(0, c1.params.size());
+  }
+
+  @Test
+  public final void testGetConnectionInfoType2() {
+    ConnectionInfo c1 = ConnectionInfo.fromURI(
+        "jdbc:mysql://localhost:55840/db1?table=tb1&user=testuser&password=testpass&TZ=GMT+9");
+    assertEquals("jdbc:mysql", c1.scheme);
+    assertEquals("testuser", c1.user);
+    assertEquals("testpass", c1.password);
+    assertEquals("db1", c1.dbName);
+    assertEquals("tb1", c1.tableName);
+    assertEquals(1, c1.params.size());
+    assertEquals("GMT+9", c1.params.get("TZ"));
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/39e7bd8e/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestJdbcConnectionInfo.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestJdbcConnectionInfo.java b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestJdbcConnectionInfo.java
deleted file mode 100644
index 9a340aa..0000000
--- a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestJdbcConnectionInfo.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.jdbc;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-public class TestJdbcConnectionInfo {
-  @Test
-  public final void testGetConnectionInfoType1() {
-    JdbcConnectionInfo c1 = JdbcConnectionInfo.fromURI("jdbc:mysql://localhost:55840?user=testuser&password=testpass");
-    assertEquals("jdbc:mysql", c1.scheme);
-    assertEquals("testuser", c1.user);
-    assertEquals("testpass", c1.password);
-    assertNull(c1.dbName);
-    assertNull(c1.tableName);
-    assertEquals(0, c1.params.size());
-  }
-
-  @Test
-  public final void testGetConnectionInfoType2() {
-    JdbcConnectionInfo c1 = JdbcConnectionInfo.fromURI(
-        "jdbc:mysql://localhost:55840/db1?table=tb1&user=testuser&password=testpass&TZ=GMT+9");
-    assertEquals("jdbc:mysql", c1.scheme);
-    assertEquals("testuser", c1.user);
-    assertEquals("testpass", c1.password);
-    assertEquals("db1", c1.dbName);
-    assertEquals("tb1", c1.tableName);
-    assertEquals(1, c1.params.size());
-    assertEquals("GMT+9", c1.params.get("TZ"));
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/39e7bd8e/tajo-storage/tajo-storage-mysql/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/pom.xml b/tajo-storage/tajo-storage-mysql/pom.xml
index 3cca4f5..0294745 100644
--- a/tajo-storage/tajo-storage-mysql/pom.xml
+++ b/tajo-storage/tajo-storage-mysql/pom.xml
@@ -114,6 +114,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-storage-hdfs</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
       <artifactId>tajo-storage-jdbc</artifactId>
       <scope>provided</scope>
     </dependency>
@@ -236,14 +241,6 @@
       <version>0.1</version>
       <scope>test</scope>
     </dependency>
-    <!--
-    <dependency>
-      <groupId>io.airlift</groupId>
-      <artifactId>testing-postgresql-server</artifactId>
-      <version>0.3</version>
-      <scope>test</scope>
-    </dependency>
-    -->
     <dependency>
       <groupId>com.google.guava</groupId>
       <artifactId>guava</artifactId>

http://git-wip-us.apache.org/repos/asf/tajo/blob/39e7bd8e/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
index 0e3fb91..ed25d06 100644
--- a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
+++ b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
@@ -30,7 +30,6 @@ import org.apache.tajo.storage.mysql.MySQLTablespace;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.io.IOException;
 import java.net.URI;
 import java.sql.Connection;
 import java.sql.DriverManager;
@@ -41,37 +40,37 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 public class TestMysqlJdbcTableSpace {
+
+  static TestingMySqlServer server;
+
   @BeforeClass
-  public static void setUp() throws IOException {
-    String mysqlUri = "jdbc:mysql://host1:2171/db1";
-    MySQLTablespace mysqlTablespace = new MySQLTablespace("cluster2", URI.create(mysqlUri), null);
+  public static void setUp() throws Exception {
+    server = new TestingMySqlServer("testuser", "testpass",
+        "meta_test",
+        "create_table",
+        "drop_table"
+    );
+
+    MySQLTablespace mysqlTablespace = new MySQLTablespace("mysql_cluster", URI.create(server.getJdbcUrl()), null);
     mysqlTablespace.init(new TajoConf());
     TablespaceManager.addTableSpaceForTest(mysqlTablespace);
   }
 
   @Test
   public void testTablespaceHandler() throws Exception {
-    assertTrue((TablespaceManager.getByName("cluster2").get()) instanceof MySQLTablespace);
-    assertEquals("cluster2", (TablespaceManager.getByName("cluster2").get().getName()));
-    assertTrue((TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get()) instanceof MySQLTablespace);
-    assertTrue((TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1?table=xyz")).get())
-        instanceof MySQLTablespace);
-
-    assertEquals(URI.create("jdbc:mysql://host1:2171/db1"),
-        TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get().getUri());
-
-    assertTrue((TablespaceManager.getByName("cluster3").get()) instanceof MySQLTablespace);
-    assertEquals("cluster3", (TablespaceManager.getByName("cluster3").get().getName()));
-    assertTrue((TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get()) instanceof MySQLTablespace);
-    assertTrue((TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2?table=xyz")).get())
-        instanceof MySQLTablespace);
-
-    assertEquals(URI.create("jdbc:postgres://host1:2615/db2"),
-        TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get().getUri());
+    assertTrue((TablespaceManager.getByName("mysql_cluster").get()) instanceof MySQLTablespace);
+    assertEquals("mysql_cluster", (TablespaceManager.getByName("mysql_cluster").get().getName()));
+
+    assertTrue((TablespaceManager.get(server.getJdbcUrl()).get()) instanceof MySQLTablespace);
+    assertTrue((TablespaceManager.get(server.getJdbcUrl() + "&table=tb1").get()) instanceof MySQLTablespace);
+
+    assertEquals(server.getJdbcUrl(), TablespaceManager.get(server.getJdbcUrl()).get().getUri().toASCIIString());
   }
 
   @Test
-  public void test() throws Exception {
+  public void testMetadataProvider() throws Exception {
+
+
     try (TestingMySqlServer server = new TestingMySqlServer("testuser", "testpass", "db1", "db2")) {
       assertTrue(server.isRunning());
       assertTrue(server.isReadyForConnections());
@@ -95,8 +94,8 @@ public class TestMysqlJdbcTableSpace {
       MySQLTablespace tablespace = new MySQLTablespace("mysql", URI.create(server.getJdbcUrl()), null);
 
       URI uri = tablespace.getTableUri("abc", "table1");
-      JdbcConnectionInfo c1 = JdbcConnectionInfo.fromURI(uri);
-      assertEquals("table1", c1.tableName);
+      ConnectionInfo c1 = ConnectionInfo.fromURI(uri);
+      assertEquals("table1", c1.table());
 
       MetadataProvider provider = tablespace.getMetadataProvider();
       Set<String> tables = Sets.newHashSet(provider.getTables(null, null));


[08/39] tajo git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730

Posted by hy...@apache.org.
http://git-wip-us.apache.org/repos/asf/tajo/blob/77dfbbdf/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestHBaseTable.java
----------------------------------------------------------------------
diff --cc tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestHBaseTable.java
index 0000000,4ff5e3e..801998f
mode 000000,100644..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
@@@ -1,0 -1,1408 +1,1408 @@@
+ /**
+  * Licensed to the Apache Software Foundation (ASF) under one
+  * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
+  * regarding copyright ownership.  The ASF licenses this file
+  * to you under the Apache License, Version 2.0 (the
+  * "License"); you may not use this file except in compliance
+  * with the License.  You may obtain a copy of the License at
+  *
+  *     http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+ 
+ 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;
+ import org.apache.hadoop.hbase.HColumnDescriptor;
+ import org.apache.hadoop.hbase.HConstants;
+ import org.apache.hadoop.hbase.HTableDescriptor;
+ import org.apache.hadoop.hbase.TableName;
+ import org.apache.hadoop.hbase.client.*;
+ import org.apache.hadoop.hbase.filter.Filter;
+ import org.apache.hadoop.hbase.filter.InclusiveStopFilter;
+ import org.apache.tajo.IntegrationTest;
+ import org.apache.tajo.QueryTestCaseBase;
+ import org.apache.tajo.TajoTestingCluster;
+ import org.apache.tajo.catalog.Schema;
+ import org.apache.tajo.catalog.TableDesc;
+ import org.apache.tajo.common.TajoDataTypes.Type;
+ import org.apache.tajo.conf.TajoConf;
+ import org.apache.tajo.datum.TextDatum;
+ import org.apache.tajo.error.Errors.ResultCode;
+ import org.apache.tajo.exception.TajoException;
+ 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.apache.tajo.util.TUtil;
+ import org.junit.AfterClass;
+ import org.junit.BeforeClass;
+ import org.junit.Test;
+ import org.junit.experimental.categories.Category;
+ 
+ import java.io.IOException;
+ import java.net.InetAddress;
+ import java.net.URI;
+ import java.sql.ResultSet;
+ import java.text.DecimalFormat;
+ import java.util.ArrayList;
+ import java.util.HashMap;
+ import java.util.List;
+ import java.util.Map;
+ 
+ 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;
+ 
+   @BeforeClass
+   public static void beforeClass() throws IOException {
+     try {
+       testingCluster.getHBaseUtil().startHBaseCluster();
+       hostName = InetAddress.getLocalHost().getHostName();
+       zkPort = testingCluster.getHBaseUtil().getConf().get(HConstants.ZOOKEEPER_CLIENT_PORT);
+       assertNotNull(hostName);
+       assertNotNull(zkPort);
+     } catch (Exception e) {
+       e.printStackTrace();
+     }
+ 
+     tableSpaceUri = "hbase:zk://" + hostName + ":" + zkPort;
 -    HBaseTablespace hBaseTablespace = new HBaseTablespace("cluster1", URI.create(tableSpaceUri));
++    HBaseTablespace hBaseTablespace = new HBaseTablespace("cluster1", URI.create(tableSpaceUri), null);
+     hBaseTablespace.init(new TajoConf(testingCluster.getHBaseUtil().getConf()));
+     TablespaceManager.addTableSpaceForTest(hBaseTablespace);
+   }
+ 
+   @AfterClass
+   public static void afterClass() {
+     try {
+       testingCluster.getHBaseUtil().stopHBaseCluster();
+     } catch (Exception e) {
+       e.printStackTrace();
+     }
+   }
+ 
+   @Test
+   public void testVerifyCreateHBaseTableRequiredMeta() throws Exception {
+     try {
+       executeString("CREATE TABLE hbase_mapped_table1 (col1 text, col2 text) TABLESPACE cluster1 USING hbase").close();
+       fail("hbase table must have 'table' meta");
+     } catch (TajoException e) {
+       assertEquals(e.getErrorCode(), ResultCode.MISSING_TABLE_PROPERTY);
+     }
+ 
+     try {
+       executeString("CREATE TABLE hbase_mapped_table1 (col1 text, col2 text) TABLESPACE cluster1 " +
+           "USING hbase " +
+           "WITH ('table'='hbase_table')").close();
+ 
+       fail("hbase table must have 'columns' meta");
+     } catch (TajoException e) {
+       assertEquals(e.getErrorCode(), ResultCode.MISSING_TABLE_PROPERTY);
+     }
+   }
+ 
+   @Test
+   public void testCreateHBaseTable() throws Exception {
+     executeString(
+         "CREATE TABLE hbase_mapped_table1 (col1 text, col2 text, col3 text, col4 text) TABLESPACE cluster1 " +
+         "USING hbase WITH ('table'='hbase_table', 'columns'=':key,col2:a,col3:,col2:b')").close();
+ 
+     assertTableExists("hbase_mapped_table1");
+ 
+     HTableDescriptor hTableDesc = testingCluster.getHBaseUtil().getTableDescriptor("hbase_table");
+     assertNotNull(hTableDesc);
+     assertEquals("hbase_table", hTableDesc.getNameAsString());
+ 
+     HColumnDescriptor[] hColumns = hTableDesc.getColumnFamilies();
+     // col1 is mapped to rowkey
+     assertEquals(2, hColumns.length);
+     assertEquals("col2", hColumns[0].getNameAsString());
+     assertEquals("col3", hColumns[1].getNameAsString());
+ 
+     executeString("DROP TABLE hbase_mapped_table1 PURGE").close();
+ 
+     HBaseAdmin hAdmin =  new HBaseAdmin(testingCluster.getHBaseUtil().getConf());
+     try {
+       assertFalse(hAdmin.tableExists("hbase_table"));
+     } finally {
+       hAdmin.close();
+     }
+   }
+ 
+   @Test
+   public void testCreateNotExistsExternalHBaseTable() throws Exception {
+     String sql = String.format(
+         "CREATE EXTERNAL TABLE external_hbase_mapped_table1 (col1 text, col2 text, col3 text, col4 text) " +
+         "USING hbase WITH ('table'='external_hbase_table', 'columns'=':key,col2:a,col3:,col2:b') " +
+             "LOCATION '%s/external_hbase_table'", tableSpaceUri);
+     try {
+       executeString(sql).close();
+       fail("External table should be a existed table.");
+     } catch (Throwable e) {
+       assertTrue(e.getMessage().indexOf("External table should be a existed table.") >= 0);
+     }
+   }
+ 
+   @Test
+   public void testCreateRowFieldWithNonText() throws Exception {
+     try {
+       executeString("CREATE TABLE hbase_mapped_table2 (rk1 int4, rk2 text, col3 text, col4 text) " +
+           "TABLESPACE cluster1 USING hbase WITH ('table'='hbase_table', 'columns'='0:key#b,1:key,col3:,col2:b', " +
+           "'hbase.rowkey.delimiter'='_')").close();
+       fail("Key field type should be TEXT type");
+     } catch (Exception e) {
+       assertTrue(e.getMessage().indexOf("Key field type should be TEXT type") >= 0);
+     }
+   }
+ 
+   @Test
+   public void testCreateExternalHBaseTable() throws Exception {
+     HTableDescriptor hTableDesc = new HTableDescriptor(TableName.valueOf("external_hbase_table_not_purge"));
+     hTableDesc.addFamily(new HColumnDescriptor("col1"));
+     hTableDesc.addFamily(new HColumnDescriptor("col2"));
+     hTableDesc.addFamily(new HColumnDescriptor("col3"));
+     testingCluster.getHBaseUtil().createTable(hTableDesc);
+ 
+     String sql = String.format(
+         "CREATE EXTERNAL TABLE external_hbase_mapped_table (rk text, col1 text, col2 text, col3 text) " +
+         "USING hbase WITH ('table'='external_hbase_table_not_purge', 'columns'=':key,col1:a,col2:,col3:b') " +
+         "LOCATION '%s/external_hbase_table'", tableSpaceUri);
+     executeString(sql).close();
+ 
+     assertTableExists("external_hbase_mapped_table");
+ 
+     executeString("DROP TABLE external_hbase_mapped_table").close();
+ 
+     HBaseAdmin hAdmin =  new HBaseAdmin(testingCluster.getHBaseUtil().getConf());
+     try {
+       assertTrue(hAdmin.tableExists("external_hbase_table_not_purge"));
+       hAdmin.disableTable("external_hbase_table_not_purge");
+       hAdmin.deleteTable("external_hbase_table_not_purge");
+     } finally {
+       hAdmin.close();
+     }
+   }
+ 
+   @Test
+   public void testSimpleSelectQuery() throws Exception {
+     HTableDescriptor hTableDesc = new HTableDescriptor(TableName.valueOf("external_hbase_table"));
+     hTableDesc.addFamily(new HColumnDescriptor("col1"));
+     hTableDesc.addFamily(new HColumnDescriptor("col2"));
+     hTableDesc.addFamily(new HColumnDescriptor("col3"));
+     testingCluster.getHBaseUtil().createTable(hTableDesc);
+ 
+     String sql = String.format(
+         "CREATE EXTERNAL TABLE external_hbase_mapped_table (rk text, col1 text, col2 text, col3 text) " +
+         "USING hbase WITH ('table'='external_hbase_table', 'columns'=':key,col1:a,col2:,col3:b') " +
+         "LOCATION '%s/external_hbase_table'", tableSpaceUri);
+     executeString(sql).close();
+ 
+     assertTableExists("external_hbase_mapped_table");
+ 
+     HBaseTablespace space = (HBaseTablespace) TablespaceManager.getByName("cluster1").get();
+     HConnection hconn = space.getConnection();
+     HTableInterface htable = hconn.getTable("external_hbase_table");
+ 
+     try {
+       for (int i = 0; i < 100; i++) {
+         Put put = new Put(String.valueOf(i).getBytes());
+         put.add("col1".getBytes(), "a".getBytes(), ("a-" + i).getBytes());
+         put.add("col1".getBytes(), "b".getBytes(), ("b-" + i).getBytes());
+         put.add("col2".getBytes(), "k1".getBytes(), ("k1-" + i).getBytes());
+         put.add("col2".getBytes(), "k2".getBytes(), ("k2-" + i).getBytes());
+         put.add("col3".getBytes(), "b".getBytes(), ("b-" + i).getBytes());
+         htable.put(put);
+       }
+ 
+       ResultSet res = executeString("select * from external_hbase_mapped_table where rk > '20'");
+       assertResultSet(res);
+       cleanupQuery(res);
+     } finally {
+       executeString("DROP TABLE external_hbase_mapped_table PURGE").close();
+       htable.close();
+     }
+   }
+ 
+   @Test
+   public void testBinaryMappedQuery() throws Exception {
+     HTableDescriptor hTableDesc = new HTableDescriptor(TableName.valueOf("external_hbase_table"));
+     hTableDesc.addFamily(new HColumnDescriptor("col1"));
+     hTableDesc.addFamily(new HColumnDescriptor("col2"));
+     hTableDesc.addFamily(new HColumnDescriptor("col3"));
+     testingCluster.getHBaseUtil().createTable(hTableDesc);
+ 
+     String sql = String.format(
+         "CREATE EXTERNAL TABLE external_hbase_mapped_table (rk int8, col1 text, col2 text, col3 int4)\n " +
+         "USING hbase WITH ('table'='external_hbase_table', 'columns'=':key#b,col1:a,col2:,col3:b#b') " +
+         "LOCATION '%s/external_hbase_table'", tableSpaceUri);
+     executeString(sql).close();
+ 
+     assertTableExists("external_hbase_mapped_table");
+ 
+     HBaseTablespace space = (HBaseTablespace) TablespaceManager.getByName("cluster1").get();
+     HConnection hconn = space.getConnection();
+     HTableInterface htable = hconn.getTable("external_hbase_table");
+ 
+     try {
+       for (int i = 0; i < 100; i++) {
+         Put put = new Put(Bytes.toBytes((long) i));
+         put.add("col1".getBytes(), "a".getBytes(), ("a-" + i).getBytes());
+         put.add("col1".getBytes(), "b".getBytes(), ("b-" + i).getBytes());
+         put.add("col2".getBytes(), "k1".getBytes(), ("k1-" + i).getBytes());
+         put.add("col2".getBytes(), "k2".getBytes(), ("k2-" + i).getBytes());
+         put.add("col3".getBytes(), "b".getBytes(), Bytes.toBytes(i));
+         htable.put(put);
+       }
+ 
+       ResultSet res = executeString("select * from external_hbase_mapped_table where rk > 20");
+       assertResultSet(res);
+       res.close();
+ 
+       //Projection
+       res = executeString("select col3, col2, rk from external_hbase_mapped_table where rk > 95");
+ 
+       String expected = "col3,col2,rk\n" +
+           "-------------------------------\n" +
+           "96,{\"k1\":\"k1-96\", \"k2\":\"k2-96\"},96\n" +
+           "97,{\"k1\":\"k1-97\", \"k2\":\"k2-97\"},97\n" +
+           "98,{\"k1\":\"k1-98\", \"k2\":\"k2-98\"},98\n" +
+           "99,{\"k1\":\"k1-99\", \"k2\":\"k2-99\"},99\n";
+ 
+       assertEquals(expected, resultSetToString(res));
+       res.close();
+ 
+     } finally {
+       executeString("DROP TABLE external_hbase_mapped_table PURGE").close();
+       htable.close();
+     }
+   }
+ 
+   @Test
+   public void testColumnKeyValueSelectQuery() throws Exception {
+     HTableDescriptor hTableDesc = new HTableDescriptor(TableName.valueOf("external_hbase_table"));
+     hTableDesc.addFamily(new HColumnDescriptor("col2"));
+     hTableDesc.addFamily(new HColumnDescriptor("col3"));
+     testingCluster.getHBaseUtil().createTable(hTableDesc);
+ 
+     String sql = String.format(
+         "CREATE EXTERNAL TABLE external_hbase_mapped_table (rk1 text, col2_key text, col2_value text, col3 text) " +
+         "USING hbase WITH ('table'='external_hbase_table', 'columns'=':key,col2:key:,col2:value:,col3:', " +
+         "'hbase.rowkey.delimiter'='_') LOCATION '%s/external_hbase_table'", tableSpaceUri);
+     executeString(sql).close();
+ 
+     assertTableExists("external_hbase_mapped_table");
+ 
+     HBaseTablespace space = (HBaseTablespace) TablespaceManager.getByName("cluster1").get();
+     HConnection hconn = space.getConnection();
+     HTableInterface htable = hconn.getTable("external_hbase_table");
+ 
+     try {
+       for (int i = 0; i < 10; i++) {
+         Put put = new Put(Bytes.toBytes("rk-" + i));
+         for (int j = 0; j < 5; j++) {
+           put.add("col2".getBytes(), ("key-" + j).getBytes(), Bytes.toBytes("value-" + j));
+         }
+         put.add("col3".getBytes(), "".getBytes(), ("col3-value-" + i).getBytes());
+         htable.put(put);
+       }
+ 
+       ResultSet res = executeString("select * from external_hbase_mapped_table where rk1 >= 'rk-0'");
+       assertResultSet(res);
+       cleanupQuery(res);
+     } finally {
+       executeString("DROP TABLE external_hbase_mapped_table PURGE").close();
+       htable.close();
+     }
+   }
+ 
+   @Test
+   public void testRowFieldSelectQuery() throws Exception {
+     HTableDescriptor hTableDesc = new HTableDescriptor(TableName.valueOf("external_hbase_table"));
+     hTableDesc.addFamily(new HColumnDescriptor("col3"));
+     testingCluster.getHBaseUtil().createTable(hTableDesc);
+ 
+     String sql = String.format(
+         "CREATE EXTERNAL TABLE external_hbase_mapped_table (rk1 text, rk2 text, col3 text) " +
+         "USING hbase WITH ('table'='external_hbase_table', 'columns'='0:key,1:key,col3:a', " +
+         "'hbase.rowkey.delimiter'='_') LOCATION '%s/external_hbase_table'", tableSpaceUri);
+     executeString(sql).close();
+ 
+     assertTableExists("external_hbase_mapped_table");
+ 
+     HBaseTablespace space = (HBaseTablespace) TablespaceManager.getByName("cluster1").get();
+     HConnection hconn = space.getConnection();
+     HTableInterface htable = hconn.getTable("external_hbase_table");
+ 
+     try {
+       for (int i = 0; i < 100; i++) {
+         Put put = new Put(("field1-" + i + "_field2-" + i).getBytes());
+         put.add("col3".getBytes(), "a".getBytes(), ("a-" + i).getBytes());
+         htable.put(put);
+       }
+ 
+       ResultSet res = executeString("select * from external_hbase_mapped_table where rk1 > 'field1-20'");
+       assertResultSet(res);
+       cleanupQuery(res);
+     } finally {
+       executeString("DROP TABLE external_hbase_mapped_table PURGE").close();
+       htable.close();
+     }
+   }
+ 
+   @Test
+   public void testIndexPredication() throws Exception {
+     String sql =
+         "CREATE TABLE hbase_mapped_table (rk text, col1 text, col2 text, col3 text) " +
+         "TABLESPACE cluster1 USING hbase WITH ('table'='hbase_table', 'columns'=':key,col1:a,col2:,col3:b', " +
+         "'hbase.split.rowkeys'='010,040,060,080') ";
+     executeString(sql).close();
+ 
+ 
+     assertTableExists("hbase_mapped_table");
+     HBaseAdmin hAdmin = new HBaseAdmin(testingCluster.getHBaseUtil().getConf());
+     hAdmin.tableExists("hbase_table");
+ 
+     HTable htable = new HTable(testingCluster.getHBaseUtil().getConf(), "hbase_table");
+     try {
+       org.apache.hadoop.hbase.util.Pair<byte[][], byte[][]> keys = htable.getStartEndKeys();
+       assertEquals(5, keys.getFirst().length);
+ 
+       DecimalFormat df = new DecimalFormat("000");
+       for (int i = 0; i < 100; i++) {
+         Put put = new Put(String.valueOf(df.format(i)).getBytes());
+         put.add("col1".getBytes(), "a".getBytes(), ("a-" + i).getBytes());
+         put.add("col1".getBytes(), "b".getBytes(), ("b-" + i).getBytes());
+         put.add("col2".getBytes(), "k1".getBytes(), ("k1-" + i).getBytes());
+         put.add("col2".getBytes(), "k2".getBytes(), ("k2-" + i).getBytes());
+         put.add("col3".getBytes(), "b".getBytes(), ("b-" + i).getBytes());
+         htable.put(put);
+       }
+       assertIndexPredication(false);
+ 
+       ResultSet res = executeString("select * from hbase_mapped_table where rk >= '020' and rk <= '055'");
+       assertResultSet(res);
+       res.close();
+ 
+       res = executeString("select * from hbase_mapped_table where rk = '021'");
+       String expected = "rk,col1,col2,col3\n" +
+           "-------------------------------\n" +
+           "021,a-21,{\"k1\":\"k1-21\", \"k2\":\"k2-21\"},b-21\n";
+ 
+       assertEquals(expected, resultSetToString(res));
+       res.close();
+     } finally {
+       executeString("DROP TABLE hbase_mapped_table PURGE").close();
+       htable.close();
+       hAdmin.close();
+     }
+   }
+ 
+   @Test
+   public void testCompositeRowIndexPredication() throws Exception {
+ 
+     executeString("CREATE TABLE hbase_mapped_table (rk text, rk2 text, col1 text, col2 text, col3 text) " +
+         "TABLESPACE cluster1 USING hbase WITH ('table'='hbase_table', 'columns'='0:key,1:key,col1:a,col2:,col3:b', " +
+         "'hbase.split.rowkeys'='010,040,060,080', " +
+         "'hbase.rowkey.delimiter'='_')").close();
+ 
+     assertTableExists("hbase_mapped_table");
+     HBaseAdmin hAdmin = new HBaseAdmin(testingCluster.getHBaseUtil().getConf());
+     hAdmin.tableExists("hbase_table");
+ 
+     HTable htable = new HTable(testingCluster.getHBaseUtil().getConf(), "hbase_table");
+     try {
+       org.apache.hadoop.hbase.util.Pair<byte[][], byte[][]> keys = htable.getStartEndKeys();
+       assertEquals(5, keys.getFirst().length);
+ 
+       DecimalFormat df = new DecimalFormat("000");
+       for (int i = 0; i < 100; i++) {
+         Put put = new Put((df.format(i) + "_" + df.format(i)).getBytes());
+         put.add("col1".getBytes(), "a".getBytes(), ("a-" + i).getBytes());
+         put.add("col1".getBytes(), "b".getBytes(), ("b-" + i).getBytes());
+         put.add("col2".getBytes(), "k1".getBytes(), ("k1-" + i).getBytes());
+         put.add("col2".getBytes(), "k2".getBytes(), ("k2-" + i).getBytes());
+         put.add("col3".getBytes(), "b".getBytes(), ("b-" + i).getBytes());
+         htable.put(put);
+       }
+ 
+       Scan scan = new Scan();
+       scan.setStartRow("021".getBytes());
+       scan.setStopRow(("021_" + new String(new char[]{Character.MAX_VALUE})).getBytes());
+       Filter filter = new InclusiveStopFilter(scan.getStopRow());
+       scan.setFilter(filter);
+ 
+       ResultScanner scanner = htable.getScanner(scan);
+       Result result = scanner.next();
+       assertNotNull(result);
+       assertEquals("021_021", new String(result.getRow()));
+       scanner.close();
+ 
+       assertIndexPredication(true);
+ 
+       ResultSet res = executeString("select * from hbase_mapped_table where rk = '021'");
+       String expected = "rk,rk2,col1,col2,col3\n" +
+           "-------------------------------\n" +
+           "021,021,a-21,{\"k1\":\"k1-21\", \"k2\":\"k2-21\"},b-21\n";
+ 
+       assertEquals(expected, resultSetToString(res));
+       res.close();
+     } finally {
+       executeString("DROP TABLE hbase_mapped_table PURGE").close();
+       htable.close();
+       hAdmin.close();
+     }
+   }
+ 
+   private void assertIndexPredication(boolean isCompositeRowKey) throws Exception {
+     String postFix = isCompositeRowKey ? "_" + new String(new char[]{Character.MAX_VALUE}) : "";
+     TableDesc tableDesc = catalog.getTableDesc(getCurrentDatabase(), "hbase_mapped_table");
+ 
+     ScanNode scanNode = new ScanNode(1);
+ 
+     // where rk = '021'
+     EvalNode evalNodeEq = new BinaryEval(EvalType.EQUAL, new FieldEval(tableDesc.getLogicalSchema().getColumn("rk")),
+         new ConstEval(new TextDatum("021")));
+     scanNode.setQual(evalNodeEq);
+     Tablespace tablespace = TablespaceManager.getByName("cluster1").get();
+     List<Fragment> fragments = tablespace.getSplits("hbase_mapped_table", tableDesc, scanNode);
+     assertEquals(1, fragments.size());
+     assertEquals("021", new String(((HBaseFragment)fragments.get(0)).getStartRow()));
+     assertEquals("021" + postFix, new String(((HBaseFragment)fragments.get(0)).getStopRow()));
+ 
+     // where rk >= '020' and rk <= '055'
+     EvalNode evalNode1 = new BinaryEval(EvalType.GEQ, new FieldEval(tableDesc.getLogicalSchema().getColumn("rk")),
+         new ConstEval(new TextDatum("020")));
+     EvalNode evalNode2 = new BinaryEval(EvalType.LEQ, new FieldEval(tableDesc.getLogicalSchema().getColumn("rk")),
+         new ConstEval(new TextDatum("055")));
+     EvalNode evalNodeA = new BinaryEval(EvalType.AND, evalNode1, evalNode2);
+     scanNode.setQual(evalNodeA);
+ 
+     fragments = tablespace.getSplits("hbase_mapped_table", tableDesc, scanNode);
+     assertEquals(2, fragments.size());
+     HBaseFragment fragment1 = (HBaseFragment) fragments.get(0);
+     assertEquals("020", new String(fragment1.getStartRow()));
+     assertEquals("040", new String(fragment1.getStopRow()));
+ 
+     HBaseFragment fragment2 = (HBaseFragment) fragments.get(1);
+     assertEquals("040", new String(fragment2.getStartRow()));
+     assertEquals("055" + postFix, new String(fragment2.getStopRow()));
+ 
+     // where (rk >= '020' and rk <= '055') or rk = '075'
+     EvalNode evalNode3 = new BinaryEval(EvalType.EQUAL, new FieldEval(tableDesc.getLogicalSchema().getColumn("rk")),
+         new ConstEval(new TextDatum("075")));
+     EvalNode evalNodeB = new BinaryEval(EvalType.OR, evalNodeA, evalNode3);
+     scanNode.setQual(evalNodeB);
+     fragments = tablespace.getSplits("hbase_mapped_table", tableDesc, scanNode);
+     assertEquals(3, fragments.size());
+     fragment1 = (HBaseFragment) fragments.get(0);
+     assertEquals("020", new String(fragment1.getStartRow()));
+     assertEquals("040", new String(fragment1.getStopRow()));
+ 
+     fragment2 = (HBaseFragment) fragments.get(1);
+     assertEquals("040", new String(fragment2.getStartRow()));
+     assertEquals("055" + postFix, new String(fragment2.getStopRow()));
+ 
+     HBaseFragment fragment3 = (HBaseFragment) fragments.get(2);
+     assertEquals("075", new String(fragment3.getStartRow()));
+     assertEquals("075" + postFix, new String(fragment3.getStopRow()));
+ 
+ 
+     // where (rk >= '020' and rk <= '055') or (rk >= '072' and rk <= '078')
+     EvalNode evalNode4 = new BinaryEval(EvalType.GEQ, new FieldEval(tableDesc.getLogicalSchema().getColumn("rk")),
+         new ConstEval(new TextDatum("072")));
+     EvalNode evalNode5 = new BinaryEval(EvalType.LEQ, new FieldEval(tableDesc.getLogicalSchema().getColumn("rk")),
+         new ConstEval(new TextDatum("078")));
+     EvalNode evalNodeC = new BinaryEval(EvalType.AND, evalNode4, evalNode5);
+     EvalNode evalNodeD = new BinaryEval(EvalType.OR, evalNodeA, evalNodeC);
+     scanNode.setQual(evalNodeD);
+     fragments = tablespace.getSplits("hbase_mapped_table", tableDesc, scanNode);
+     assertEquals(3, fragments.size());
+ 
+     fragment1 = (HBaseFragment) fragments.get(0);
+     assertEquals("020", new String(fragment1.getStartRow()));
+     assertEquals("040", new String(fragment1.getStopRow()));
+ 
+     fragment2 = (HBaseFragment) fragments.get(1);
+     assertEquals("040", new String(fragment2.getStartRow()));
+     assertEquals("055" + postFix, new String(fragment2.getStopRow()));
+ 
+     fragment3 = (HBaseFragment) fragments.get(2);
+     assertEquals("072", new String(fragment3.getStartRow()));
+     assertEquals("078" + postFix, new String(fragment3.getStopRow()));
+ 
+     // where (rk >= '020' and rk <= '055') or (rk >= '057' and rk <= '059')
+     evalNode4 = new BinaryEval(EvalType.GEQ, new FieldEval(tableDesc.getLogicalSchema().getColumn("rk")),
+         new ConstEval(new TextDatum("057")));
+     evalNode5 = new BinaryEval(EvalType.LEQ, new FieldEval(tableDesc.getLogicalSchema().getColumn("rk")),
+         new ConstEval(new TextDatum("059")));
+     evalNodeC = new BinaryEval(EvalType.AND, evalNode4, evalNode5);
+     evalNodeD = new BinaryEval(EvalType.OR, evalNodeA, evalNodeC);
+     scanNode.setQual(evalNodeD);
+     fragments = tablespace.getSplits("hbase_mapped_table", tableDesc, scanNode);
+     assertEquals(2, fragments.size());
+ 
+     fragment1 = (HBaseFragment) fragments.get(0);
+     assertEquals("020", new String(fragment1.getStartRow()));
+     assertEquals("040", new String(fragment1.getStopRow()));
+ 
+     fragment2 = (HBaseFragment) fragments.get(1);
+     assertEquals("040", new String(fragment2.getStartRow()));
+     assertEquals("059" + postFix, new String(fragment2.getStopRow()));
+   }
+ 
+   @Test
+   public void testNonForwardQuery() throws Exception {
+     executeString("CREATE TABLE hbase_mapped_table (rk text, col1 text, col2 text, col3 int) " +
+         "TABLESPACE cluster1 USING hbase WITH ('table'='hbase_table', 'columns'=':key,col1:a,col2:,col3:#b', " +
+         "'hbase.split.rowkeys'='010,040,060,080')").close();
+ 
+     assertTableExists("hbase_mapped_table");
+     HBaseAdmin hAdmin =  new HBaseAdmin(testingCluster.getHBaseUtil().getConf());
+     HTable htable = null;
+     try {
+       hAdmin.tableExists("hbase_table");
+       htable = new HTable(testingCluster.getHBaseUtil().getConf(), "hbase_table");
+       org.apache.hadoop.hbase.util.Pair<byte[][], byte[][]> keys = htable.getStartEndKeys();
+       assertEquals(5, keys.getFirst().length);
+ 
+       DecimalFormat df = new DecimalFormat("000");
+       for (int i = 0; i < 100; i++) {
+         Put put = new Put(String.valueOf(df.format(i)).getBytes());
+         put.add("col1".getBytes(), "a".getBytes(), ("a-" + i).getBytes());
+         put.add("col1".getBytes(), "b".getBytes(), ("b-" + i).getBytes());
+         put.add("col2".getBytes(), "k1".getBytes(), ("k1-" + i).getBytes());
+         put.add("col2".getBytes(), "k2".getBytes(), ("k2-" + i).getBytes());
+         put.add("col3".getBytes(), "".getBytes(), Bytes.toBytes(i));
+         htable.put(put);
+       }
+ 
+       ResultSet res = executeString("select * from hbase_mapped_table");
+       assertResultSet(res);
+       res.close();
+     } finally {
+       executeString("DROP TABLE hbase_mapped_table PURGE").close();
+       hAdmin.close();
+       if (htable == null) {
+         htable.close();
+       }
+     }
+   }
+ 
+   @Test
+   public void testJoin() throws Exception {
+     executeString("CREATE TABLE hbase_mapped_table (rk text, col1 text, col2 text, col3 int8) " +
+         "TABLESPACE cluster1 USING hbase WITH ('table'='hbase_table', 'columns'=':key,col1:a,col2:,col3:b#b', " +
+         "'hbase.split.rowkeys'='010,040,060,080')").close();
+ 
+     assertTableExists("hbase_mapped_table");
+     HBaseAdmin hAdmin =  new HBaseAdmin(testingCluster.getHBaseUtil().getConf());
+     HTable htable = null;
+     try {
+       hAdmin.tableExists("hbase_table");
+       htable = new HTable(testingCluster.getHBaseUtil().getConf(), "hbase_table");
+       org.apache.hadoop.hbase.util.Pair<byte[][], byte[][]> keys = htable.getStartEndKeys();
+       assertEquals(5, keys.getFirst().length);
+ 
+       DecimalFormat df = new DecimalFormat("000");
+       for (int i = 0; i < 100; i++) {
+         Put put = new Put(String.valueOf(df.format(i)).getBytes());
+         put.add("col1".getBytes(), "a".getBytes(), ("a-" + i).getBytes());
+         put.add("col1".getBytes(), "b".getBytes(), ("b-" + i).getBytes());
+         put.add("col2".getBytes(), "k1".getBytes(), ("k1-" + i).getBytes());
+         put.add("col2".getBytes(), "k2".getBytes(), ("k2-" + i).getBytes());
+         put.add("col3".getBytes(), "b".getBytes(), Bytes.toBytes((long) i));
+         htable.put(put);
+       }
+ 
+       ResultSet res = executeString("select a.rk, a.col1, a.col2, a.col3, b.l_orderkey, b.l_linestatus " +
+           "from hbase_mapped_table a " +
+           "join default.lineitem b on a.col3 = b.l_orderkey");
+       assertResultSet(res);
+       res.close();
+     } finally {
+       executeString("DROP TABLE hbase_mapped_table PURGE").close();
+       hAdmin.close();
+       if (htable != null) {
+         htable.close();
+       }
+     }
+   }
+ 
+   @Test
+   public void testInsertInto() throws Exception {
+     executeString("CREATE TABLE hbase_mapped_table (rk text, col1 text, col2 text, col3 int4) " +
+         "TABLESPACE cluster1 USING hbase WITH ('table'='hbase_table', 'columns'=':key,col1:a,col2:,col3:b#b')").close();
+ 
+     assertTableExists("hbase_mapped_table");
+     TableDesc tableDesc = catalog.getTableDesc(getCurrentDatabase(), "hbase_mapped_table");
+ 
+     executeString("insert into hbase_mapped_table " +
+         "select l_orderkey::text, l_shipdate, l_returnflag, l_suppkey from default.lineitem ").close();
+ 
+     HTable htable = null;
+     ResultScanner scanner = null;
+     try {
+       htable = new HTable(testingCluster.getHBaseUtil().getConf(), "hbase_table");
+ 
+       Scan scan = new Scan();
+       scan.addFamily(Bytes.toBytes("col1"));
+       scan.addFamily(Bytes.toBytes("col2"));
+       scan.addFamily(Bytes.toBytes("col3"));
+       scanner = htable.getScanner(scan);
+ 
+       assertStrings(resultSetToString(scanner,
+           new byte[][]{null, Bytes.toBytes("col1"), Bytes.toBytes("col2"), Bytes.toBytes("col3")},
+           new byte[][]{null, Bytes.toBytes("a"), null, Bytes.toBytes("b")},
+           new boolean[]{false, false, false, true}, tableDesc.getSchema()));
+ 
+     } finally {
+       executeString("DROP TABLE hbase_mapped_table PURGE").close();
+ 
+       if (scanner != null) {
+         scanner.close();
+       }
+ 
+       if (htable != null) {
+         htable.close();
+       }
+     }
+   }
+ 
+   @Test
+   public void testInsertValues1() throws Exception {
+     executeString("CREATE TABLE hbase_mapped_table (rk text, col1 text, col2 text, col3 int4) " +
+         "TABLESPACE cluster1 USING hbase WITH ('table'='hbase_table', 'columns'=':key,col1:a,col2:,col3:b#b')").close();
+ 
+     assertTableExists("hbase_mapped_table");
+     TableDesc tableDesc = catalog.getTableDesc(getCurrentDatabase(), "hbase_mapped_table");
+ 
+     executeString("insert into hbase_mapped_table select 'aaa', 'a12', 'a34', 1").close();
+     executeString("insert into hbase_mapped_table select 'bbb', 'b12', 'b34', 2").close();
+     executeString("insert into hbase_mapped_table select 'ccc', 'c12', 'c34', 3").close();
+     executeString("insert into hbase_mapped_table select 'ddd', 'd12', 'd34', 4").close();
+ 
+     HTable htable = null;
+     ResultScanner scanner = null;
+     try {
+       htable = new HTable(testingCluster.getHBaseUtil().getConf(), "hbase_table");
+ 
+       Scan scan = new Scan();
+       scan.addFamily(Bytes.toBytes("col1"));
+       scan.addFamily(Bytes.toBytes("col2"));
+       scan.addFamily(Bytes.toBytes("col3"));
+       scanner = htable.getScanner(scan);
+ 
+       assertStrings(resultSetToString(scanner,
+           new byte[][]{null, Bytes.toBytes("col1"), Bytes.toBytes("col2"), Bytes.toBytes("col3")},
+           new byte[][]{null, Bytes.toBytes("a"), null, Bytes.toBytes("b")},
+           new boolean[]{false, false, false, true}, tableDesc.getSchema()));
+ 
+     } finally {
+       executeString("DROP TABLE hbase_mapped_table PURGE").close();
+ 
+       if (scanner != null) {
+         scanner.close();
+       }
+ 
+       if (htable != null) {
+         htable.close();
+       }
+     }
+   }
+ 
+   @Test
+   public void testInsertIntoMultiRegion() throws Exception {
+     executeString("CREATE TABLE hbase_mapped_table (rk text, col1 text) TABLESPACE cluster1 " +
+         "USING hbase WITH ('table'='hbase_table', 'columns'=':key,col1:a', " +
+         "'hbase.split.rowkeys'='010,040,060,080')").close();
+ 
+     assertTableExists("hbase_mapped_table");
+     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 = new Schema();
+     schema.addColumn("id", Type.TEXT);
+     schema.addColumn("name", Type.TEXT);
+     List<String> datas = new ArrayList<String>();
+     DecimalFormat df = new DecimalFormat("000");
+     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[]{}), 2);
+ 
+     executeString("insert into hbase_mapped_table " +
+         "select id, name from base_table ").close();
+ 
+     HTable htable = null;
+     ResultScanner scanner = null;
+     try {
+       htable = new HTable(testingCluster.getHBaseUtil().getConf(), "hbase_table");
+ 
+       Scan scan = new Scan();
+       scan.addFamily(Bytes.toBytes("col1"));
+       scanner = htable.getScanner(scan);
+ 
+       assertStrings(resultSetToString(scanner,
+           new byte[][]{null, Bytes.toBytes("col1")},
+           new byte[][]{null, Bytes.toBytes("a")},
+           new boolean[]{false, false}, tableDesc.getSchema()));
+ 
+     } finally {
+       executeString("DROP TABLE base_table PURGE").close();
+       executeString("DROP TABLE hbase_mapped_table PURGE").close();
+ 
+       if (scanner != null) {
+         scanner.close();
+       }
+ 
+       if (htable != null) {
+         htable.close();
+       }
+     }
+   }
+ 
+   @Test
+   public void testInsertIntoMultiRegion2() throws Exception {
+     executeString("CREATE TABLE hbase_mapped_table (rk text, col1 text) TABLESPACE cluster1 " +
+         "USING hbase WITH ('table'='hbase_table', 'columns'=':key,col1:a', " +
+         "'hbase.split.rowkeys'='1,2,3,4,5,6,7,8,9')").close();
+ 
+     assertTableExists("hbase_mapped_table");
+     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 = new Schema();
+     schema.addColumn("id", Type.TEXT);
+     schema.addColumn("name", Type.TEXT);
+     List<String> datas = new ArrayList<String>();
+     for (int i = 99; i >= 0; i--) {
+       datas.add(i + "|value" + i);
+     }
+     TajoTestingCluster.createTable(getCurrentDatabase() + ".base_table",
+         schema, tableOptions, datas.toArray(new String[]{}), 2);
+ 
+     executeString("insert into hbase_mapped_table " +
+         "select id, name from base_table ").close();
+ 
+     HTable htable = null;
+     ResultScanner scanner = null;
+     try {
+       htable = new HTable(testingCluster.getHBaseUtil().getConf(), "hbase_table");
+ 
+       Scan scan = new Scan();
+       scan.addFamily(Bytes.toBytes("col1"));
+       scanner = htable.getScanner(scan);
+ 
+       assertStrings(resultSetToString(scanner,
+           new byte[][]{null, Bytes.toBytes("col1")},
+           new byte[][]{null, Bytes.toBytes("a")},
+           new boolean[]{false, false}, tableDesc.getSchema()));
+ 
+     } finally {
+       executeString("DROP TABLE base_table PURGE").close();
+       executeString("DROP TABLE hbase_mapped_table PURGE").close();
+ 
+       if (scanner != null) {
+         scanner.close();
+       }
+ 
+       if (htable != null) {
+         htable.close();
+       }
+     }
+   }
+ 
+   @Test
+   public void testInsertIntoMultiRegionWithSplitFile() throws Exception {
+     String splitFilePath = currentDatasetPath + "/splits.data";
+ 
+     executeString(
+         "CREATE TABLE hbase_mapped_table (rk text, col1 text) TABLESPACE cluster1 " +
+         "USING hbase WITH ('table'='hbase_table', 'columns'=':key,col1:a', " +
+         "'hbase.split.rowkeys.file'='" + splitFilePath + "')").close();
+ 
+     assertTableExists("hbase_mapped_table");
+     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 = new Schema();
+     schema.addColumn("id", Type.TEXT);
+     schema.addColumn("name", Type.TEXT);
+     List<String> datas = new ArrayList<String>();
+     DecimalFormat df = new DecimalFormat("000");
+     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[]{}), 2);
+ 
+     executeString("insert into hbase_mapped_table " +
+         "select id, name from base_table ").close();
+ 
+     HTable htable = null;
+     ResultScanner scanner = null;
+     try {
+       htable = new HTable(testingCluster.getHBaseUtil().getConf(), "hbase_table");
+ 
+       Scan scan = new Scan();
+       scan.addFamily(Bytes.toBytes("col1"));
+       scanner = htable.getScanner(scan);
+ 
+       assertStrings(resultSetToString(scanner,
+           new byte[][]{null, Bytes.toBytes("col1")},
+           new byte[][]{null, Bytes.toBytes("a")},
+           new boolean[]{false, false}, tableDesc.getSchema()));
+ 
+     } finally {
+       executeString("DROP TABLE base_table PURGE").close();
+       executeString("DROP TABLE hbase_mapped_table PURGE").close();
+ 
+       if (scanner != null) {
+         scanner.close();
+       }
+ 
+       if (htable != null) {
+         htable.close();
+       }
+     }
+   }
+ 
+   @Test
+   public void testInsertIntoMultiRegionMultiRowFields() throws Exception {
+     executeString(
+         "CREATE TABLE hbase_mapped_table (rk1 text, rk2 text, col1 text) TABLESPACE cluster1 " +
+         "USING hbase WITH ('table'='hbase_table', 'columns'='0:key,1:key,col1:a', " +
+         "'hbase.split.rowkeys'='001,002,003,004,005,006,007,008,009', " +
+         "'hbase.rowkey.delimiter'='_')").close();
+ 
+     assertTableExists("hbase_mapped_table");
+     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 = new Schema();
+     schema.addColumn("id1", Type.TEXT);
+     schema.addColumn("id2", Type.TEXT);
+     schema.addColumn("name", Type.TEXT);
+     DecimalFormat df = new DecimalFormat("000");
+     List<String> datas = new ArrayList<String>();
+     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[]{}), 2);
+ 
+     executeString("insert into hbase_mapped_table " +
+         "select id1, id2, name from base_table ").close();
+ 
+     HTable htable = null;
+     ResultScanner scanner = null;
+     try {
+       htable = new HTable(testingCluster.getHBaseUtil().getConf(), "hbase_table");
+ 
+       Scan scan = new Scan();
+       scan.addFamily(Bytes.toBytes("col1"));
+       scanner = htable.getScanner(scan);
+ 
+       assertStrings(resultSetToString(scanner,
+           new byte[][]{null, null, Bytes.toBytes("col1")},
+           new byte[][]{null, null, Bytes.toBytes("a")},
+           new boolean[]{false, false, false}, tableDesc.getSchema()));
+ 
+     } finally {
+       executeString("DROP TABLE base_table PURGE").close();
+       executeString("DROP TABLE hbase_mapped_table PURGE").close();
+ 
+       if (scanner != null) {
+         scanner.close();
+       }
+ 
+       if (htable != null) {
+         htable.close();
+       }
+     }
+   }
+ 
+   @Test
+   public void testInsertIntoBinaryMultiRegion() throws Exception {
+     executeString("CREATE TABLE hbase_mapped_table (rk int4, col1 text) TABLESPACE cluster1 " +
+         "USING hbase WITH ('table'='hbase_table', 'columns'=':key#b,col1:a', " +
+         "'hbase.split.rowkeys'='1,2,3,4,5,6,7,8,9')").close();
+ 
+     assertTableExists("hbase_mapped_table");
+     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 = new Schema();
+     schema.addColumn("id", Type.INT4);
+     schema.addColumn("name", Type.TEXT);
+     List<String> datas = new ArrayList<String>();
+     for (int i = 99; i >= 0; i--) {
+       datas.add(i + "|value" + i);
+     }
+     TajoTestingCluster.createTable(getCurrentDatabase() + ".base_table",
+         schema, tableOptions, datas.toArray(new String[]{}), 2);
+ 
+     executeString("insert into hbase_mapped_table " +
+         "select id, name from base_table ").close();
+ 
+     HTable htable = null;
+     ResultScanner scanner = null;
+     try {
+       htable = new HTable(testingCluster.getHBaseUtil().getConf(), "hbase_table");
+ 
+       Scan scan = new Scan();
+       scan.addFamily(Bytes.toBytes("col1"));
+       scanner = htable.getScanner(scan);
+ 
+       assertStrings(resultSetToString(scanner,
+           new byte[][]{null, Bytes.toBytes("col1")},
+           new byte[][]{null, Bytes.toBytes("a")},
+           new boolean[]{true, false}, tableDesc.getSchema()));
+ 
+     } finally {
+       executeString("DROP TABLE base_table PURGE").close();
+       executeString("DROP TABLE hbase_mapped_table PURGE").close();
+ 
+       if (scanner != null) {
+         scanner.close();
+       }
+ 
+       if (htable != null) {
+         htable.close();
+       }
+     }
+   }
+ 
+   @Test
+   public void testInsertIntoColumnKeyValue() throws Exception {
+     executeString(
+         "CREATE TABLE hbase_mapped_table (rk text, col2_key text, col2_value text, col3 text) TABLESPACE cluster1 " +
+         "USING hbase WITH ('table'='hbase_table', 'columns'=':key,col2:key:,col2:value:,col3:', " +
+         "'hbase.rowkey.delimiter'='_')").close();
+ 
+     assertTableExists("hbase_mapped_table");
+     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 = new Schema();
+     schema.addColumn("rk", Type.TEXT);
+     schema.addColumn("col2_key", Type.TEXT);
+     schema.addColumn("col2_value", Type.TEXT);
+     schema.addColumn("col3", Type.TEXT);
+     List<String> datas = new ArrayList<String>();
+     for (int i = 20; i >= 0; i--) {
+       for (int j = 0; j < 3; j++) {
+         datas.add(i + "|ck-" + j + "|value-" + j + "|col3-" + i);
+       }
+     }
+     TajoTestingCluster.createTable(getCurrentDatabase() + ".base_table",
+         schema, tableOptions, datas.toArray(new String[]{}), 2);
+ 
+     executeString("insert into hbase_mapped_table " +
+         "select rk, col2_key, col2_value, col3 from base_table ").close();
+ 
+     HTable htable = null;
+     ResultScanner scanner = null;
+     try {
+       htable = new HTable(testingCluster.getHBaseUtil().getConf(), "hbase_table");
+ 
+       Scan scan = new Scan();
+       scan.addFamily(Bytes.toBytes("col2"));
+       scan.addFamily(Bytes.toBytes("col3"));
+       scanner = htable.getScanner(scan);
+ 
+       assertStrings(resultSetToString(scanner,
+           new byte[][]{null, Bytes.toBytes("col2"), Bytes.toBytes("col3")},
+           new byte[][]{null, null, null},
+           new boolean[]{false, false, false}, tableDesc.getSchema()));
+ 
+       ResultSet res = executeString("select * from hbase_mapped_table");
+ 
+       String expected = "rk,col2_key,col2_value,col3\n" +
+           "-------------------------------\n" +
+           "0,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-0\n" +
+           "1,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-1\n" +
+           "10,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-10\n" +
+           "11,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-11\n" +
+           "12,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-12\n" +
+           "13,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-13\n" +
+           "14,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-14\n" +
+           "15,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-15\n" +
+           "16,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-16\n" +
+           "17,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-17\n" +
+           "18,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-18\n" +
+           "19,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-19\n" +
+           "2,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-2\n" +
+           "20,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-20\n" +
+           "3,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-3\n" +
+           "4,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-4\n" +
+           "5,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-5\n" +
+           "6,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-6\n" +
+           "7,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-7\n" +
+           "8,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-8\n" +
+           "9,[\"ck-0\", \"ck-1\", \"ck-2\"],[\"value-0\", \"value-1\", \"value-2\"],col3-9\n";
+ 
+       assertEquals(expected, resultSetToString(res));
+       res.close();
+ 
+     } finally {
+       executeString("DROP TABLE base_table PURGE").close();
+       executeString("DROP TABLE hbase_mapped_table PURGE").close();
+ 
+       if (scanner != null) {
+         scanner.close();
+       }
+ 
+       if (htable != null) {
+         htable.close();
+       }
+     }
+   }
+ 
+   @Test
+   public void testInsertIntoDifferentType() throws Exception {
+     executeString(
+         "CREATE TABLE hbase_mapped_table (rk text, col1 text) TABLESPACE cluster1 " +
+         "USING hbase WITH ('table'='hbase_table', 'columns'=':key,col1:a', " +
+         "'hbase.split.rowkeys'='1,2,3,4,5,6,7,8,9')").close();
+ 
+     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 = new Schema();
+     schema.addColumn("id", Type.INT4);
+     schema.addColumn("name", Type.TEXT);
+     List<String> datas = new ArrayList<String>();
+     for (int i = 99; i >= 0; i--) {
+       datas.add(i + "|value" + i);
+     }
+     TajoTestingCluster.createTable(getCurrentDatabase() + ".base_table",
+         schema, tableOptions, datas.toArray(new String[]{}), 2);
+ 
+     try {
+       executeString("insert into hbase_mapped_table " +
+           "select id, name from base_table ").close();
+       fail("If inserting data type different with target table data type, should throw exception");
+     } catch (TajoException e) {
+       assertEquals(ResultCode.DATATYPE_MISMATCH, e.getErrorCode());
+     } finally {
+       executeString("DROP TABLE base_table PURGE").close();
+       executeString("DROP TABLE hbase_mapped_table PURGE").close();
+     }
+   }
+ 
+   @Test
+   public void testInsertIntoRowField() throws Exception {
+     executeString(
+         "CREATE TABLE hbase_mapped_table (rk1 text, rk2 text, col1 text, col2 text, col3 text) TABLESPACE cluster1 " +
+         "USING hbase WITH ('table'='hbase_table', 'columns'='0:key,1:key,col1:a,col2:,col3:b', " +
+         "'hbase.rowkey.delimiter'='_')").close();
+ 
+ 
+     assertTableExists("hbase_mapped_table");
+     TableDesc tableDesc = catalog.getTableDesc(getCurrentDatabase(), "hbase_mapped_table");
+ 
+     executeString("insert into hbase_mapped_table " +
+         "select l_orderkey::text, l_partkey::text, l_shipdate, l_returnflag, l_suppkey::text from default.lineitem ");
+ 
+     HTable htable = null;
+     ResultScanner scanner = null;
+     try {
+       htable = new HTable(testingCluster.getHBaseUtil().getConf(), "hbase_table");
+ 
+       Scan scan = new Scan();
+       scan.addFamily(Bytes.toBytes("col1"));
+       scan.addFamily(Bytes.toBytes("col2"));
+       scan.addFamily(Bytes.toBytes("col3"));
+       scanner = htable.getScanner(scan);
+ 
+       assertStrings(resultSetToString(scanner,
+           new byte[][]{null, Bytes.toBytes("col1"), Bytes.toBytes("col2"), Bytes.toBytes("col3")},
+           new byte[][]{null, Bytes.toBytes("a"), Bytes.toBytes(""), Bytes.toBytes("b")},
+           new boolean[]{false, false, false, false}, tableDesc.getSchema()));
+ 
+     } finally {
+       executeString("DROP TABLE hbase_mapped_table PURGE").close();
+ 
+       if (scanner != null) {
+         scanner.close();
+       }
+ 
+       if (htable != null) {
+         htable.close();
+       }
+     }
+   }
+ 
+   @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 = new Schema();
+     schema.addColumn("id", Type.TEXT);
+     schema.addColumn("name", Type.TEXT);
+     List<String> datas = new ArrayList<>();
+     DecimalFormat df = new DecimalFormat("000");
+     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[]{}), 2);
+ 
+     executeString(
+         "CREATE TABLE hbase_mapped_table (rk text, col1 text) TABLESPACE cluster1 " +
+         "USING hbase WITH ('table'='hbase_table', 'columns'=':key,col1:a', " +
+         "'hbase.split.rowkeys'='010,040,060,080') as" +
+         " select id, name from base_table"
+     ).close();
+ 
+     assertTableExists("hbase_mapped_table");
+     TableDesc tableDesc = catalog.getTableDesc(getCurrentDatabase(), "hbase_mapped_table");
+ 
+     HTable htable = null;
+     ResultScanner scanner = null;
+     try {
+       htable = new HTable(testingCluster.getHBaseUtil().getConf(), "hbase_table");
+ 
+       Scan scan = new Scan();
+       scan.addFamily(Bytes.toBytes("col1"));
+       scanner = htable.getScanner(scan);
+ 
+       assertStrings(resultSetToString(scanner,
+           new byte[][]{null, Bytes.toBytes("col1")},
+           new byte[][]{null, Bytes.toBytes("a")},
+           new boolean[]{false, false}, tableDesc.getSchema()));
+ 
+     } finally {
+       executeString("DROP TABLE base_table PURGE").close();
+       executeString("DROP TABLE hbase_mapped_table PURGE").close();
+ 
+       if (scanner != null) {
+         scanner.close();
+       }
+ 
+       if (htable != null) {
+         htable.close();
+       }
+ 
+       // TODO - rollback should support its corresponding hbase table
+       HBaseAdmin hAdmin = new HBaseAdmin(testingCluster.getHBaseUtil().getConf());
+       if (hAdmin.tableExists("hbase_table")) {
+         hAdmin.disableTable("hbase_table");
+         hAdmin.deleteTable("hbase_table");
+       }
+     }
+   }
+ 
+   @Test
+   public void testInsertIntoUsingPut() throws Exception {
+     executeString(
+         "CREATE TABLE hbase_mapped_table (rk text, col1 text, col2 text, col3 int4) TABLESPACE cluster1 " +
+         "USING hbase WITH ('table'='hbase_table', 'columns'=':key,col1:a,col2:,col3:b#b')").close();
+ 
+     assertTableExists("hbase_mapped_table");
+     TableDesc tableDesc = catalog.getTableDesc(getCurrentDatabase(), "hbase_mapped_table");
+ 
+     Map<String, String> sessions = new HashMap<>();
+     sessions.put(HBaseStorageConstants.INSERT_PUT_MODE, "true");
+     client.updateSessionVariables(sessions);
+ 
+     HTable htable = null;
+     ResultScanner scanner = null;
+     try {
+       executeString(
+           "insert into hbase_mapped_table " +
+           "select l_orderkey::text, l_shipdate, l_returnflag, l_suppkey from default.lineitem"
+       ).close();
+ 
+       htable = new HTable(testingCluster.getHBaseUtil().getConf(), "hbase_table");
+ 
+       Scan scan = new Scan();
+       scan.addFamily(Bytes.toBytes("col1"));
+       scan.addFamily(Bytes.toBytes("col2"));
+       scan.addFamily(Bytes.toBytes("col3"));
+       scanner = htable.getScanner(scan);
+ 
+       // result is dirrerent with testInsertInto because l_orderkey is not unique.
+       assertStrings(resultSetToString(scanner,
+           new byte[][]{null, Bytes.toBytes("col1"), Bytes.toBytes("col2"), Bytes.toBytes("col3")},
+           new byte[][]{null, Bytes.toBytes("a"), null, Bytes.toBytes("b")},
+           new boolean[]{false, false, false, true}, tableDesc.getSchema()));
+ 
+     } finally {
+       executeString("DROP TABLE hbase_mapped_table PURGE").close();
+ 
+       client.unsetSessionVariables(TUtil.newList(HBaseStorageConstants.INSERT_PUT_MODE));
+ 
+       if (scanner != null) {
+         scanner.close();
+       }
+ 
+       if (htable != null) {
+         htable.close();
+       }
+     }
+   }
+ 
+   @Test
+   public void testInsertIntoLocation() throws Exception {
+     executeString(
+         "CREATE TABLE hbase_mapped_table (rk text, col1 text, col2 text) TABLESPACE cluster1 " +
+         "USING hbase WITH ('table'='hbase_table', 'columns'=':key,col1:a,col2:', " +
+         "'hbase.split.rowkeys'='010,040,060,080')").close();
+ 
+     assertTableExists("hbase_mapped_table");
+ 
+     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 = new Schema();
+       schema.addColumn("id", Type.TEXT);
+       schema.addColumn("name", Type.TEXT);
+       schema.addColumn("comment", Type.TEXT);
+       List<String> datas = new ArrayList<>();
+       DecimalFormat df = new DecimalFormat("000");
+       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[]{}), 2);
+ 
+       executeString("insert into location '/tmp/hfile_test' " +
+           "select id, name, comment from base_table ").close();
+ 
+       FileSystem fs = testingCluster.getDefaultFileSystem();
+       Path path = new Path("/tmp/hfile_test");
+       assertTrue(fs.exists(path));
+ 
+       FileStatus[] files = fs.listStatus(path);
+       assertNotNull(files);
+       assertEquals(2, files.length);
+ 
+       int index = 0;
+       for (FileStatus eachFile: files) {
+         assertEquals("/tmp/hfile_test/part-01-00000" + index + "-00" + index, eachFile.getPath().toUri().getPath());
+         for (FileStatus subFile: fs.listStatus(eachFile.getPath())) {
+           assertTrue(subFile.isFile());
+           assertTrue(subFile.getLen() > 0);
+         }
+         index++;
+       }
+     } finally {
+       executeString("DROP TABLE base_table PURGE").close();
+       executeString("DROP TABLE hbase_mapped_table PURGE").close();
+     }
+   }
+ 
+   private String resultSetToString(ResultScanner scanner, byte[][] cfNames, byte[][] qualifiers,
+                                    boolean [] binaries, Schema schema) throws Exception {
+     StringBuilder sb = new StringBuilder();
+     Result result = null;
+     while ( (result = scanner.next()) != null ) {
+       if (binaries[0]) {
+         sb.append(HBaseBinarySerializerDeserializer.deserialize(schema.getColumn(0), result.getRow()).asChar());
+       } else {
+         sb.append(new String(result.getRow()));
+       }
+ 
+       for (int i = 0; i < cfNames.length; i++) {
+         if (cfNames[i] == null) {
+           //rowkey
+           continue;
+         }
+         if (qualifiers[i] == null) {
+           Map<byte[], byte[]> values = result.getFamilyMap(cfNames[i]);
+           if (values == null) {
+             sb.append(", null");
+           } else {
+             sb.append(", {");
+             String delim = "";
+             for (Map.Entry<byte[], byte[]> valueEntry: values.entrySet()) {
+               byte[] keyBytes = valueEntry.getKey();
+               byte[] valueBytes = valueEntry.getValue();
+ 
+               if (binaries[i]) {
+                 sb.append(delim).append("\"").append(keyBytes == null ? "" : Bytes.toLong(keyBytes)).append("\"");
+                 sb.append(": \"").append(HBaseBinarySerializerDeserializer.deserialize(schema.getColumn(i), valueBytes)).append("\"");
+               } else {
+                 sb.append(delim).append("\"").append(keyBytes == null ? "" : new String(keyBytes)).append("\"");
+                 sb.append(": \"").append(HBaseTextSerializerDeserializer.deserialize(schema.getColumn(i), valueBytes)).append("\"");
+               }
+               delim = ", ";
+             }
+             sb.append("}");
+           }
+         } else {
+           byte[] value = result.getValue(cfNames[i], qualifiers[i]);
+           if (value == null) {
+             sb.append(", null");
+           } else {
+             if (binaries[i]) {
+               sb.append(", ").append(HBaseBinarySerializerDeserializer.deserialize(schema.getColumn(i), value));
+             } else {
+               sb.append(", ").append(HBaseTextSerializerDeserializer.deserialize(schema.getColumn(i), value));
+             }
+           }
+         }
+       }
+       sb.append("\n");
+     }
+ 
+     return sb.toString();
+   }
+ }

http://git-wip-us.apache.org/repos/asf/tajo/blob/77dfbbdf/tajo-project/pom.xml
----------------------------------------------------------------------


[17/39] tajo git commit: Fix rat filure.

Posted by hy...@apache.org.
Fix rat filure.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/030d6690
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/030d6690
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/030d6690

Branch: refs/heads/TAJO-1730
Commit: 030d6690a7fc6ff6a3ba09950e2826bd0e81f3b4
Parents: 6a50c5f
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sun Aug 16 20:43:25 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sun Aug 16 20:43:25 2015 +0900

----------------------------------------------------------------------
 tajo-core-tests/pom.xml | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/030d6690/tajo-core-tests/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-core-tests/pom.xml b/tajo-core-tests/pom.xml
index ec2c146..efc878c 100644
--- a/tajo-core-tests/pom.xml
+++ b/tajo-core-tests/pom.xml
@@ -61,6 +61,7 @@
             <exclude>src/test/resources/dataset/**</exclude>
             <exclude>src/test/resources/queries/**</exclude>
             <exclude>src/test/resources/results/**</exclude>
+            <exclude>src/test/resources/tpch/**</exclude>
             <exclude>src/main/resources/META-INF/services/*</exclude>
             <exclude>src/main/resources/webapps/static/js/*</exclude>
           </excludes>


[27/39] tajo git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730

Posted by hy...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tajo into TAJO-1730


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/faf12b19
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/faf12b19
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/faf12b19

Branch: refs/heads/TAJO-1730
Commit: faf12b194b69d9e1dc5bbed6417ed2b4af6b41d5
Parents: bf15ce7 f21d5d6
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sat Aug 22 00:09:54 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sat Aug 22 00:09:54 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |  2 +
 .../org/apache/tajo/master/QueryManager.java    |  3 +-
 .../src/main/resources/python/controller.py     |  3 -
 .../function/python/PythonScriptEngine.java     | 97 ++++++++++++++------
 4 files changed, 75 insertions(+), 30 deletions(-)
----------------------------------------------------------------------



[19/39] tajo git commit: Fix version.

Posted by hy...@apache.org.
Fix version.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/0c8a9f70
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/0c8a9f70
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/0c8a9f70

Branch: refs/heads/TAJO-1730
Commit: 0c8a9f708cf85e5ddeacc1163fabf326e3af2f3b
Parents: 88ec43f
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sun Aug 16 21:34:16 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sun Aug 16 21:34:16 2015 +0900

----------------------------------------------------------------------
 pom.xml                                 | 2 +-
 tajo-storage/tajo-storage-jdbc/pom.xml  | 4 ++--
 tajo-storage/tajo-storage-mysql/pom.xml | 2 +-
 tajo-storage/tajo-storage-pgsql/pom.xml | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/0c8a9f70/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f26fd6c..605160a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
   </parent>
   <groupId>org.apache.tajo</groupId>
   <artifactId>tajo-main</artifactId>
-  <version>0.12.0</version>
+  <version>0.12.0-SNAPSHOT</version>
   <description>Tajo Main</description>
   <name>Tajo Main</name>
   <packaging>pom</packaging>

http://git-wip-us.apache.org/repos/asf/tajo/blob/0c8a9f70/tajo-storage/tajo-storage-jdbc/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/pom.xml b/tajo-storage/tajo-storage-jdbc/pom.xml
index d45ec2f..f086f24 100644
--- a/tajo-storage/tajo-storage-jdbc/pom.xml
+++ b/tajo-storage/tajo-storage-jdbc/pom.xml
@@ -23,7 +23,7 @@
   <parent>
     <artifactId>tajo-project</artifactId>
     <groupId>org.apache.tajo</groupId>
-    <version>0.11.0-SNAPSHOT</version>
+    <version>0.12.0-SNAPSHOT</version>
     <relativePath>../../tajo-project</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>
@@ -191,7 +191,7 @@
       <groupId>org.apache.tajo</groupId>
       <artifactId>tajo-cluster-tests</artifactId>
       <type>test-jar</type>
-      <scope>test</scope>
+      <scope>provided</scope>
     </dependency>
 
     <dependency>

http://git-wip-us.apache.org/repos/asf/tajo/blob/0c8a9f70/tajo-storage/tajo-storage-mysql/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/pom.xml b/tajo-storage/tajo-storage-mysql/pom.xml
index f0a072d..ff68b59 100644
--- a/tajo-storage/tajo-storage-mysql/pom.xml
+++ b/tajo-storage/tajo-storage-mysql/pom.xml
@@ -23,7 +23,7 @@
   <parent>
     <artifactId>tajo-project</artifactId>
     <groupId>org.apache.tajo</groupId>
-    <version>0.11.0-SNAPSHOT</version>
+    <version>0.12.0-SNAPSHOT</version>
     <relativePath>../../tajo-project</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>

http://git-wip-us.apache.org/repos/asf/tajo/blob/0c8a9f70/tajo-storage/tajo-storage-pgsql/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/pom.xml b/tajo-storage/tajo-storage-pgsql/pom.xml
index 9d13442..c24562d 100644
--- a/tajo-storage/tajo-storage-pgsql/pom.xml
+++ b/tajo-storage/tajo-storage-pgsql/pom.xml
@@ -23,7 +23,7 @@
   <parent>
     <artifactId>tajo-project</artifactId>
     <groupId>org.apache.tajo</groupId>
-    <version>0.11.0-SNAPSHOT</version>
+    <version>0.12.0-SNAPSHOT</version>
     <relativePath>../../tajo-project</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>


[05/39] tajo git commit: Add base implementation for mysql and pgsql storages.

Posted by hy...@apache.org.
Add base implementation for mysql and pgsql storages.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/9b26ccc0
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/9b26ccc0
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/9b26ccc0

Branch: refs/heads/TAJO-1730
Commit: 9b26ccc0478162ef2c723bab299296d5c6ce618c
Parents: 920e8a4
Author: Hyunsik Choi <hy...@apache.org>
Authored: Tue Aug 11 07:17:28 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Tue Aug 11 07:17:28 2015 +0900

----------------------------------------------------------------------
 .../org/apache/tajo/catalog/CatalogServer.java  |   2 +-
 .../tajo/catalog/LinkedMetadataManager.java     |  28 +-
 .../tajo/catalog/TestLinkedMetadataManager.java |   4 +-
 .../java/org/apache/tajo/master/TajoMaster.java |   9 +-
 .../org/apache/tajo/TajoTestingCluster.java     |   2 +-
 .../tajo/engine/query/TestHBaseTable.java       |  15 +-
 tajo-project/pom.xml                            |   5 +
 tajo-storage/pom.xml                            |   2 +
 .../apache/tajo/storage/OldStorageManager.java  |   2 +-
 .../org/apache/tajo/storage/Tablespace.java     |  14 +-
 .../apache/tajo/storage/TablespaceManager.java  |  48 ++-
 .../tajo/storage/hbase/HBaseTablespace.java     |  13 +-
 .../tajo/storage/hbase/TestHBaseTableSpace.java |   2 +-
 .../org/apache/tajo/storage/FileTablespace.java |  17 +-
 .../apache/tajo/storage/TestFileTablespace.java |   6 +-
 tajo-storage/tajo-storage-jdbc/pom.xml          |   2 +
 .../tajo/storage/jdbc/JdbcConnectionInfo.java   |  92 ++++++
 .../storage/jdbc/JdbcMetadataProviderBase.java  |  25 +-
 .../tajo/storage/jdbc/JdbcTablespace.java       |  24 +-
 .../storage/jdbc/TestJdbcConnectionInfo.java    |  50 ++++
 .../tajo/storage/jdbc/TestJdbcTableSpace.java   |  98 -------
 .../storage/jdbc/TestMysqlJdbcTableSpace.java   |  95 ------
 .../storage/jdbc/TestPgSQLJdbcTableSpace.java   |  87 ------
 tajo-storage/tajo-storage-mysql/pom.xml         | 292 +++++++++++++++++++
 .../storage/mysql/MySQLMetadataProvider.java    |  34 +++
 .../tajo/storage/mysql/MySQLTablespace.java     |  57 ++++
 .../storage/jdbc/TestMysqlJdbcTableSpace.java   | 112 +++++++
 tajo-storage/tajo-storage-pgsql/pom.xml         | 286 ++++++++++++++++++
 .../storage/pgsql/PgSQLMetadataProvider.java    |  33 +++
 .../tajo/storage/pgsql/PgSQLTablespace.java     |  42 +++
 .../storage/pgsql/TestPgSQLJdbcTableSpace.java  |  87 ++++++
 31 files changed, 1200 insertions(+), 385 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
index a7e8348..a668d63 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
@@ -108,7 +108,7 @@ public class CatalogServer extends AbstractService {
     this.builtingFuncs = new ArrayList<FunctionDesc>();
   }
 
-  public CatalogServer(Set<MetadataProvider> metadataProviders, Collection<FunctionDesc> sqlFuncs) throws IOException {
+  public CatalogServer(Collection<MetadataProvider> metadataProviders, Collection<FunctionDesc> sqlFuncs) throws IOException {
     super(CatalogServer.class.getName());
     this.handler = new CatalogProtocolHandler();
     this.linkedMetadataManager = new LinkedMetadataManager(metadataProviders);

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/LinkedMetadataManager.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/LinkedMetadataManager.java b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/LinkedMetadataManager.java
index dc438e8..ab5d59d 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/LinkedMetadataManager.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/LinkedMetadataManager.java
@@ -165,21 +165,21 @@ public class LinkedMetadataManager {
    */
   public Collection<String> getTableNames(String dbName,
                                           @Nullable final String schemaPattern,
-                                          final String tablePattern) throws UndefinedDatabaseException {
+                                          @Nullable final String tablePattern) throws UndefinedDatabaseException {
     ensureIfDBExists(dbName);
 
-    if (tablePattern == null) { // all tables in this database
-      return providerMap.get(dbName).getTables("null");
-
-    } else {
-      final Pattern pattern = Pattern.compile(tablePattern);
-      return filter(providerMap.get(dbName).getTables(schemaPattern), new Predicate<String>() {
-        @Override
-        public boolean apply(@Nullable String input) {
-          return pattern.matcher(tablePattern).matches();
-        }
-      });
-    }
+//    if (tablePattern == null) { // all tables in this database
+      return providerMap.get(dbName).getTables(schemaPattern, tablePattern);
+//
+//    } else {
+//      final Pattern pattern = Pattern.compile(tablePattern);
+//      return filter(providerMap.get(dbName).getTables(schemaPattern, tablePattern), new Predicate<String>() {
+//        @Override
+//        public boolean apply(@Nullable String input) {
+//          return pattern.matcher(tablePattern).matches();
+//        }
+//      });
+//    }
   }
 
   /**
@@ -217,7 +217,7 @@ public class LinkedMetadataManager {
    */
   public boolean existsTable(String dbName, String schemaName, String tableName) {
     if (providerMap.containsKey(dbName)) {
-      return providerMap.get(dbName).getTables(schemaName).contains(tableName);
+      return providerMap.get(dbName).getTables(schemaName, tableName).contains(tableName);
     }
 
     return false;

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestLinkedMetadataManager.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestLinkedMetadataManager.java b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestLinkedMetadataManager.java
index 95550b6..48fbfed 100644
--- a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestLinkedMetadataManager.java
+++ b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestLinkedMetadataManager.java
@@ -94,7 +94,7 @@ public class TestLinkedMetadataManager {
     }
 
     @Override
-    public Collection<String> getTables(@Nullable String schemaPattern) {
+    public Collection<String> getTables(@Nullable String schemaPattern, @Nullable String tablePattern) {
       return Lists.newArrayList("table1", "table2");
     }
 
@@ -133,7 +133,7 @@ public class TestLinkedMetadataManager {
     }
 
     @Override
-    public Collection<String> getTables(@Nullable String schemaPattern) {
+    public Collection<String> getTables(@Nullable String schemaPattern, @Nullable String tablePattern) {
       return Lists.newArrayList("table3", "table4");
     }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-core/src/main/java/org/apache/tajo/master/TajoMaster.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/master/TajoMaster.java b/tajo-core/src/main/java/org/apache/tajo/master/TajoMaster.java
index 27aabfc..b1c77a5 100644
--- a/tajo-core/src/main/java/org/apache/tajo/master/TajoMaster.java
+++ b/tajo-core/src/main/java/org/apache/tajo/master/TajoMaster.java
@@ -56,6 +56,7 @@ import org.apache.tajo.rule.SelfDiagnosisRuleSession;
 import org.apache.tajo.service.ServiceTracker;
 import org.apache.tajo.service.ServiceTrackerFactory;
 import org.apache.tajo.session.SessionManager;
+import org.apache.tajo.storage.TablespaceManager;
 import org.apache.tajo.util.*;
 import org.apache.tajo.util.history.HistoryReader;
 import org.apache.tajo.util.history.HistoryWriter;
@@ -176,11 +177,11 @@ public class TajoMaster extends CompositeService {
     this.dispatcher = new AsyncDispatcher();
     addIfService(dispatcher);
 
-      // check the system directory and create if they are not created.
-      checkAndInitializeSystemDirectories();
-      diagnoseTajoMaster();
+    // check the system directory and create if they are not created.
+    checkAndInitializeSystemDirectories();
+    diagnoseTajoMaster();
 
-    catalogServer = new CatalogServer(Collections.EMPTY_SET, loadFunctions());
+    catalogServer = new CatalogServer(TablespaceManager.getMetadataProviders(), loadFunctions());
     addIfService(catalogServer);
     catalog = new LocalCatalogWrapper(catalogServer, systemConf);
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-core/src/test/java/org/apache/tajo/TajoTestingCluster.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/TajoTestingCluster.java b/tajo-core/src/test/java/org/apache/tajo/TajoTestingCluster.java
index 71ef0ea..a0f1280 100644
--- a/tajo-core/src/test/java/org/apache/tajo/TajoTestingCluster.java
+++ b/tajo-core/src/test/java/org/apache/tajo/TajoTestingCluster.java
@@ -343,7 +343,7 @@ public class TajoTestingCluster {
 
       URI defaultTsUri = TajoConf.getWarehouseDir(c).toUri();
       FileTablespace defaultTableSpace =
-          new FileTablespace(TablespaceManager.DEFAULT_TABLESPACE_NAME, defaultTsUri);
+          new FileTablespace(TablespaceManager.DEFAULT_TABLESPACE_NAME, defaultTsUri, null);
       defaultTableSpace.init(conf);
       TablespaceManager.addTableSpaceForTest(defaultTableSpace);
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-core/src/test/java/org/apache/tajo/engine/query/TestHBaseTable.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestHBaseTable.java b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestHBaseTable.java
index 7adb237..693a916 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestHBaseTable.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestHBaseTable.java
@@ -23,7 +23,10 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.*;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.*;
 import org.apache.hadoop.hbase.filter.Filter;
 import org.apache.hadoop.hbase.filter.InclusiveStopFilter;
@@ -38,8 +41,8 @@ import org.apache.tajo.datum.TextDatum;
 import org.apache.tajo.plan.expr.*;
 import org.apache.tajo.plan.logical.ScanNode;
 import org.apache.tajo.storage.StorageConstants;
-import org.apache.tajo.storage.TablespaceManager;
 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;
@@ -55,10 +58,12 @@ import java.net.InetAddress;
 import java.net.URI;
 import java.sql.ResultSet;
 import java.text.DecimalFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 import static org.junit.Assert.*;
-import static org.junit.Assert.assertEquals;
 
 @Category(IntegrationTest.class)
 public class TestHBaseTable extends QueryTestCaseBase {
@@ -80,7 +85,7 @@ public class TestHBaseTable extends QueryTestCaseBase {
     }
 
     tableSpaceUri = "hbase:zk://" + hostName + ":" + zkPort;
-    HBaseTablespace hBaseTablespace = new HBaseTablespace("cluster1", URI.create(tableSpaceUri));
+    HBaseTablespace hBaseTablespace = new HBaseTablespace("cluster1", URI.create(tableSpaceUri), null);
     hBaseTablespace.init(new TajoConf(testingCluster.getHBaseUtil().getConf()));
     TablespaceManager.addTableSpaceForTest(hBaseTablespace);
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-project/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-project/pom.xml b/tajo-project/pom.xml
index 63dc9e3..86ccec2 100644
--- a/tajo-project/pom.xml
+++ b/tajo-project/pom.xml
@@ -781,6 +781,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.tajo</groupId>
+        <artifactId>tajo-storage-jdbc</artifactId>
+        <version>${tajo.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.tajo</groupId>
         <artifactId>tajo-pullserver</artifactId>
         <version>${tajo.version}</version>
       </dependency>

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/pom.xml b/tajo-storage/pom.xml
index 9e2fda4..dbf4ae5 100644
--- a/tajo-storage/pom.xml
+++ b/tajo-storage/pom.xml
@@ -38,6 +38,8 @@
     <module>tajo-storage-hdfs</module>
     <module>tajo-storage-hbase</module>
     <module>tajo-storage-jdbc</module>
+    <module>tajo-storage-mysql</module>
+    <module>tajo-storage-pgsql</module>
   </modules>
 
   <build>

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/OldStorageManager.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/OldStorageManager.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/OldStorageManager.java
index d12c6bd..2e00bc9 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/OldStorageManager.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/OldStorageManager.java
@@ -161,7 +161,7 @@ public class OldStorageManager {
             constructor.setAccessible(true);
             CONSTRUCTOR_CACHE.put(storageManagerClass, constructor);
           }
-          manager = constructor.newInstance(new Object[]{"noname", uri});
+          manager = constructor.newInstance(new Object[]{"noname", uri, null});
         } catch (Exception e) {
           throw new RuntimeException(e);
         }

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
index 9da48f4..444c36c 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
@@ -18,6 +18,7 @@
 
 package org.apache.tajo.storage;
 
+import net.minidev.json.JSONObject;
 import org.apache.hadoop.fs.Path;
 import org.apache.tajo.ExecutionBlockId;
 import org.apache.tajo.OverridableConf;
@@ -35,10 +36,7 @@ import org.apache.tajo.storage.fragment.FragmentConvertor;
 
 import java.io.IOException;
 import java.net.URI;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 /**
  * Tablespace manages the functions of storing and reading data.
@@ -50,14 +48,16 @@ public abstract class Tablespace {
 
   protected final String name;
   protected final URI uri;
+  protected final JSONObject spec;
   /** this space is visible or not. */
   protected boolean visible = true;
 
   protected TajoConf conf;
 
-  public Tablespace(String name, URI uri) {
+  public Tablespace(String name, URI uri, JSONObject spec) {
     this.name = name;
     this.uri = uri;
+    this.spec = spec;
   }
 
   public void setVisible(boolean visible) {
@@ -86,10 +86,6 @@ public abstract class Tablespace {
     return visible;
   }
 
-  public abstract void setConfig(String name, String value);
-
-  public abstract void setConfigs(Map<String, String> configs);
-
   public String toString() {
     return name + "=" + uri.toString();
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
index 26af769..63cd502 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
@@ -19,8 +19,11 @@
 package org.apache.tajo.storage;
 
 import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Function;
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
 import com.google.common.collect.Maps;
 import net.minidev.json.JSONObject;
 import net.minidev.json.parser.JSONParser;
@@ -29,6 +32,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.fs.Path;
 import org.apache.tajo.TajoConstants;
+import org.apache.tajo.catalog.MetadataProvider;
 import org.apache.tajo.conf.TajoConf;
 import org.apache.tajo.storage.fragment.Fragment;
 import org.apache.tajo.util.FileUtil;
@@ -38,6 +42,7 @@ import javax.annotation.Nullable;
 import java.io.IOException;
 import java.lang.reflect.Constructor;
 import java.net.URI;
+import java.util.Collection;
 import java.util.Map;
 import java.util.TreeMap;
 import java.util.UUID;
@@ -70,7 +75,7 @@ public class TablespaceManager implements StorageService {
   protected static final Map<Class<?>, Constructor<?>> CONSTRUCTORS = Maps.newHashMap();
   protected static final Map<String, Class<? extends Tablespace>> TABLE_SPACE_HANDLERS = Maps.newHashMap();
 
-  public static final Class [] TABLESPACE_PARAM = new Class [] {String.class, URI.class};
+  public static final Class [] TABLESPACE_PARAM = new Class [] {String.class, URI.class, JSONObject.class};
 
   static {
     instance = new TablespaceManager();
@@ -183,24 +188,29 @@ public class TablespaceManager implements StorageService {
 
     if (spaces != null) {
       for (Map.Entry<String, Object> entry : spaces.entrySet()) {
-        AddTableSpace(entry.getKey(), (JSONObject) entry.getValue(), override);
+        JSONObject spaceDetail = (JSONObject) entry.getValue();
+        AddTableSpace(
+            entry.getKey(),
+            URI.create(spaceDetail.getAsString("uri")),
+            Boolean.parseBoolean(spaceDetail.getAsString("default")),
+            (JSONObject) spaceDetail.get("configs"),
+            override);
       }
     }
   }
 
-  public static void AddTableSpace(String spaceName, JSONObject spaceDesc, boolean override) {
-    boolean defaultSpace = Boolean.parseBoolean(spaceDesc.getAsString("default"));
-    URI spaceUri = URI.create(spaceDesc.getAsString("uri"));
+  public static void AddTableSpace(String spaceName, URI uri, boolean isDefault, JSONObject configs, boolean override) {
 
-    if (defaultSpace) {
-      registerTableSpace(DEFAULT_TABLESPACE_NAME, spaceUri, spaceDesc, true, override);
+
+    if (isDefault) {
+      registerTableSpace(DEFAULT_TABLESPACE_NAME, uri, configs, true, override);
     }
-    registerTableSpace(spaceName, spaceUri, spaceDesc, true, override);
+    registerTableSpace(spaceName, uri, configs, true, override);
   }
 
   private static void registerTableSpace(String spaceName, URI uri, JSONObject spaceDesc,
                                          boolean visible, boolean override) {
-    Tablespace tableSpace = initializeTableSpace(spaceName, uri, visible);
+    Tablespace tableSpace = initializeTableSpace(spaceName, uri, spaceDesc);
     tableSpace.setVisible(visible);
 
     try {
@@ -262,7 +272,7 @@ public class TablespaceManager implements StorageService {
 
   public static final String KEY_SPACES = "spaces";
 
-  private static Tablespace initializeTableSpace(String spaceName, URI uri, boolean visible) {
+  private static Tablespace initializeTableSpace(String spaceName, URI uri, JSONObject spaceDesc) {
     Preconditions.checkNotNull(uri.getScheme(), "URI must include scheme, but it was " + uri);
     Class<? extends Tablespace> clazz = TABLE_SPACE_HANDLERS.get(uri.getScheme());
 
@@ -280,7 +290,7 @@ public class TablespaceManager implements StorageService {
         CONSTRUCTORS.put(clazz, constructor);
       }
 
-      return constructor.newInstance(new Object[]{spaceName, uri});
+      return constructor.newInstance(new Object[]{spaceName, uri, spaceDesc});
     } catch (Exception e) {
       throw new RuntimeException(e);
     }
@@ -387,4 +397,20 @@ public class TablespaceManager implements StorageService {
   public static Iterable<Tablespace> getAllTablespaces() {
     return TABLE_SPACES.values();
   }
+
+  public static Collection<MetadataProvider> getMetadataProviders() {
+    Collection<Tablespace> filteredSpace = Collections2.filter(TABLE_SPACES.values(), new Predicate<Tablespace>() {
+      @Override
+      public boolean apply(@Nullable Tablespace space) {
+        return space.getProperty().isMetadataProvided();
+      }
+    });
+
+    return Collections2.transform(filteredSpace, new Function<Tablespace, MetadataProvider>() {
+      @Override
+      public MetadataProvider apply(@Nullable Tablespace space) {
+        return space.getMetadataProvider();
+      }
+    });
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java b/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java
index c15d91f..d7b4082 100644
--- a/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java
+++ b/tajo-storage/tajo-storage-hbase/src/main/java/org/apache/tajo/storage/hbase/HBaseTablespace.java
@@ -19,6 +19,7 @@
 package org.apache.tajo.storage.hbase;
 
 import com.google.common.collect.Sets;
+import net.minidev.json.JSONObject;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
@@ -77,8 +78,8 @@ public class HBaseTablespace extends Tablespace {
 
   private Map<HConnectionKey, HConnection> connMap = new HashMap<HConnectionKey, HConnection>();
 
-  public HBaseTablespace(String spaceName, URI uri) {
-    super(spaceName, uri);
+  public HBaseTablespace(String spaceName, URI uri, JSONObject config) {
+    super(spaceName, uri, config);
   }
 
   @Override
@@ -90,14 +91,6 @@ public class HBaseTablespace extends Tablespace {
     hbaseConf.set(HConstants.ZOOKEEPER_CLIENT_PORT, splits[1]);
   }
 
-  @Override
-  public void setConfig(String name, String value) {
-  }
-
-  @Override
-  public void setConfigs(Map<String, String> configs) {
-  }
-
   public Configuration getHbaseConf() {
     return hbaseConf;
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-hbase/src/test/java/org/apache/tajo/storage/hbase/TestHBaseTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hbase/src/test/java/org/apache/tajo/storage/hbase/TestHBaseTableSpace.java b/tajo-storage/tajo-storage-hbase/src/test/java/org/apache/tajo/storage/hbase/TestHBaseTableSpace.java
index f0c8f15..3af1d8d 100644
--- a/tajo-storage/tajo-storage-hbase/src/test/java/org/apache/tajo/storage/hbase/TestHBaseTableSpace.java
+++ b/tajo-storage/tajo-storage-hbase/src/test/java/org/apache/tajo/storage/hbase/TestHBaseTableSpace.java
@@ -43,7 +43,7 @@ public class TestHBaseTableSpace {
   @BeforeClass
   public static void setUp() throws IOException {
     String tableSpaceUri = "hbase:zk://host1:2171";
-    HBaseTablespace hBaseTablespace = new HBaseTablespace("cluster1", URI.create(tableSpaceUri));
+    HBaseTablespace hBaseTablespace = new HBaseTablespace("cluster1", URI.create(tableSpaceUri), null);
     hBaseTablespace.init(new TajoConf());
     TablespaceManager.addTableSpaceForTest(hBaseTablespace);
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
index b6e58b8..42b41d8 100644
--- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
+++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/FileTablespace.java
@@ -22,6 +22,7 @@ import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
+import net.minidev.json.JSONObject;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
@@ -104,8 +105,8 @@ public class FileTablespace extends Tablespace {
   protected boolean blocksMetadataEnabled;
   private static final HdfsVolumeId zeroVolumeId = new HdfsVolumeId(Bytes.toBytes(0));
 
-  public FileTablespace(String spaceName, URI uri) {
-    super(spaceName, uri);
+  public FileTablespace(String spaceName, URI uri, JSONObject config) {
+    super(spaceName, uri, config);
   }
 
   @Override
@@ -124,18 +125,6 @@ public class FileTablespace extends Tablespace {
   }
 
   @Override
-  public void setConfig(String name, String value) {
-    conf.set(name, value);
-  }
-
-  @Override
-  public void setConfigs(Map<String, String> configs) {
-    for (Map.Entry<String, String> c : configs.entrySet()) {
-      conf.set(c.getKey(), c.getValue());
-    }
-  }
-
-  @Override
   public long getTableVolume(URI uri) throws IOException {
     Path path = new Path(uri);
     ContentSummary summary = fs.getContentSummary(path);

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestFileTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestFileTablespace.java b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestFileTablespace.java
index 37fbfe4..9fa26ca 100644
--- a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestFileTablespace.java
+++ b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestFileTablespace.java
@@ -128,7 +128,7 @@ public class TestFileTablespace {
       }
 
       assertTrue(fs.exists(tablePath));
-      FileTablespace space = new FileTablespace("testGetSplit", fs.getUri());
+      FileTablespace space = new FileTablespace("testGetSplit", fs.getUri(), null);
       space.init(new TajoConf(conf));
       assertEquals(fs.getUri(), space.getUri());
 
@@ -184,7 +184,7 @@ public class TestFileTablespace {
       }
       assertTrue(fs.exists(tablePath));
 
-      FileTablespace sm = new FileTablespace("testGetSplitWithBlockStorageLocationsBatching", fs.getUri());
+      FileTablespace sm = new FileTablespace("testGetSplitWithBlockStorageLocationsBatching", fs.getUri(), null);
       sm.init(new TajoConf(conf));
 
       assertEquals(fs.getUri(), sm.getUri());
@@ -227,7 +227,7 @@ public class TestFileTablespace {
       FileTablespace space = TablespaceManager.getLocalFs();
       assertEquals(localFs.getUri(), space.getFileSystem().getUri());
 
-      FileTablespace distTablespace = new FileTablespace("testGetFileTablespace", uri);
+      FileTablespace distTablespace = new FileTablespace("testGetFileTablespace", uri, null);
       distTablespace.init(conf);
       existingTs = TablespaceManager.addTableSpaceForTest(distTablespace);
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-jdbc/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/pom.xml b/tajo-storage/tajo-storage-jdbc/pom.xml
index 40978ea..7882fb4 100644
--- a/tajo-storage/tajo-storage-jdbc/pom.xml
+++ b/tajo-storage/tajo-storage-jdbc/pom.xml
@@ -312,12 +312,14 @@
       <version>0.1</version>
       <scope>test</scope>
     </dependency>
+    <!--
     <dependency>
       <groupId>io.airlift</groupId>
       <artifactId>testing-postgresql-server</artifactId>
       <version>0.3</version>
       <scope>test</scope>
     </dependency>
+    -->
     <dependency>
       <groupId>com.google.guava</groupId>
       <artifactId>guava</artifactId>

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcConnectionInfo.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcConnectionInfo.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcConnectionInfo.java
new file mode 100644
index 0000000..255aa84
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcConnectionInfo.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+import org.apache.tajo.exception.TajoInternalError;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+public class JdbcConnectionInfo {
+  String scheme;
+  String dbName;
+  String tableName;
+  String user;
+  String password;
+  Map<String, String> params;
+
+  public static JdbcConnectionInfo fromURI(String originalUri) {
+    return fromURI(URI.create(originalUri));
+  }
+
+  public static JdbcConnectionInfo fromURI(URI originalUri) {
+    final String uriStr = originalUri.toASCIIString();
+    URI uri = originalUri;
+
+    final JdbcConnectionInfo connInfo = new JdbcConnectionInfo();
+    connInfo.scheme = uriStr.substring(0, uriStr.indexOf("://"));
+
+    if (connInfo.scheme.split(":").length > 1) {
+      int idx = uriStr.indexOf(':');
+      uri = URI.create(uriStr.substring(idx + 1));
+    }
+
+    String path = uri.getPath();
+    if (path != null && !path.isEmpty()) {
+      String [] pathElements = path.substring(1).split("/");
+      if (pathElements.length != 1) {
+        throw new TajoInternalError("Invalid JDBC path: " + path);
+      }
+      connInfo.dbName = pathElements[0];
+    }
+
+    Map<String, String> params = new HashMap<>();
+
+    int paramIndex = uriStr.indexOf("?");
+    if (paramIndex > 0) {
+      String parameterPart = uriStr.substring(paramIndex+1, uriStr.length());
+
+      String [] eachParam = parameterPart.split("&");
+
+      for (String each: eachParam) {
+        String [] keyValues = each.split("=");
+        if (keyValues.length != 2) {
+          throw new TajoInternalError("Invalid URI Parameters: " + parameterPart);
+        }
+        params.put(keyValues[0], keyValues[1]);
+      }
+    }
+
+    if (params.containsKey("table")) {
+      connInfo.tableName = params.remove("table");
+    }
+
+    if (params.containsKey("user")) {
+      connInfo.user = params.remove("user");
+    }
+    if (params.containsKey("password")) {
+      connInfo.password = params.remove("password");
+    }
+
+    connInfo.params = params;
+
+    return connInfo;
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
index 1658b46..172b444 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
@@ -21,13 +21,10 @@ package org.apache.tajo.storage.jdbc;
 import com.facebook.presto.hive.shaded.com.google.common.base.Function;
 import com.facebook.presto.hive.shaded.com.google.common.collect.Collections2;
 import com.facebook.presto.hive.shaded.com.google.common.collect.Lists;
-import com.google.common.base.Preconditions;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.tajo.catalog.*;
 import org.apache.tajo.catalog.exception.UndefinedTablespaceException;
-import org.apache.tajo.common.TajoDataTypes;
-import org.apache.tajo.common.TajoDataTypes.DataType;
 import org.apache.tajo.common.TajoDataTypes.Type;
 import org.apache.tajo.exception.TajoInternalError;
 import org.apache.tajo.exception.UnsupportedException;
@@ -60,14 +57,15 @@ public abstract class JdbcMetadataProviderBase implements MetadataProvider {
     this.space = space;
     this.databaseName = dbName;
 
-    this.jdbcUri  = "";
-    this.username = "";
-    this.password = "";
+    JdbcConnectionInfo connInfo = JdbcConnectionInfo.fromURI(space.getUri());
+    this.jdbcUri  = space.getUri().toASCIIString();
+    this.username = connInfo.user;
+    this.password = connInfo.password;
 
-    String jdbcDriver = getJdbcDriverName();
+//    String jdbcDriver = getJdbcDriverName();
     try {
-      Class.forName(jdbcDriver).newInstance();
-      LOG.info("Loaded JDBC driver (" + jdbcDriver + ")");
+      Class.forName(getJdbcDriverName()).newInstance();
+      LOG.info("Loaded JDBC driver (" + "com.mysql.jdbc.Driver" + ")");
     } catch (Exception e) {
       throw new TajoInternalError(e);
     }
@@ -161,12 +159,12 @@ public abstract class JdbcMetadataProviderBase implements MetadataProvider {
     case Types.NCLOB:
     case Types.LONGVARCHAR:
     case Types.LONGNVARCHAR:
-      new TypeDesc(newSimpleDataType(Type.TEXT));
+      return new TypeDesc(newSimpleDataType(Type.TEXT));
 
     case Types.BINARY:
     case Types.VARBINARY:
     case Types.BLOB:
-      new TypeDesc(newSimpleDataType(Type.BLOB));
+      return new TypeDesc(newSimpleDataType(Type.BLOB));
 
     default:
       throw new UnsupportedException("DATA_TYPE(" + typeId + ")");
@@ -181,8 +179,11 @@ public abstract class JdbcMetadataProviderBase implements MetadataProvider {
 
       // get table name
       resultForTable = connection.getMetaData().getTables(databaseName, schemaName, tableName, new String[]{});
+
+      if (!resultForTable.next()) {
+        throw new UndefinedTablespaceException(tableName);
+      }
       final String name = resultForTable.getString("TABLE_NAME");
-      Preconditions.checkState(tableName.equals(name));
 
       // get columns
       resultForColumns = connection.getMetaData().getColumns(databaseName, schemaName, tableName, null);

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
index 0cb13fc..f958358 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
@@ -18,6 +18,7 @@
 
 package org.apache.tajo.storage.jdbc;
 
+import net.minidev.json.JSONObject;
 import org.apache.hadoop.fs.Path;
 import org.apache.tajo.ExecutionBlockId;
 import org.apache.tajo.OverridableConf;
@@ -43,26 +44,17 @@ import java.util.Map;
  *   <li>jdbc:mysql//primaryhost,secondaryhost1,secondaryhost2/test?profileSQL=true</li>
  * </ul>
  */
-public class JdbcTablespace extends Tablespace {
+public abstract class JdbcTablespace extends Tablespace {
 
   static final StorageProperty STORAGE_PROPERTY = new StorageProperty("rowstore", false, true, false, true);
 
-  public JdbcTablespace(String name, URI uri) {
-    super(name, uri);
-  }
-
-  @Override
-  protected void storageInit() throws IOException {
 
+  public JdbcTablespace(String name, URI uri, JSONObject config) {
+    super(name, uri, config);
   }
 
   @Override
-  public void setConfig(String name, String value) {
-
-  }
-
-  @Override
-  public void setConfigs(Map<String, String> configs) {
+  protected void storageInit() throws IOException {
 
   }
 
@@ -73,7 +65,7 @@ public class JdbcTablespace extends Tablespace {
 
   @Override
   public URI getTableUri(String databaseName, String tableName) {
-    return null;
+    return URI.create(getUri() + "&table=" + tableName);
   }
 
   @Override
@@ -145,7 +137,5 @@ public class JdbcTablespace extends Tablespace {
     return null;
   }
 
-  public MetadataProvider getMetadataProvider() {
-    throw new UnsupportedException("Linked Metadata Provider for " + name);
-  }
+  public abstract MetadataProvider getMetadataProvider();
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestJdbcConnectionInfo.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestJdbcConnectionInfo.java b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestJdbcConnectionInfo.java
new file mode 100644
index 0000000..9a340aa
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestJdbcConnectionInfo.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+public class TestJdbcConnectionInfo {
+  @Test
+  public final void testGetConnectionInfoType1() {
+    JdbcConnectionInfo c1 = JdbcConnectionInfo.fromURI("jdbc:mysql://localhost:55840?user=testuser&password=testpass");
+    assertEquals("jdbc:mysql", c1.scheme);
+    assertEquals("testuser", c1.user);
+    assertEquals("testpass", c1.password);
+    assertNull(c1.dbName);
+    assertNull(c1.tableName);
+    assertEquals(0, c1.params.size());
+  }
+
+  @Test
+  public final void testGetConnectionInfoType2() {
+    JdbcConnectionInfo c1 = JdbcConnectionInfo.fromURI(
+        "jdbc:mysql://localhost:55840/db1?table=tb1&user=testuser&password=testpass&TZ=GMT+9");
+    assertEquals("jdbc:mysql", c1.scheme);
+    assertEquals("testuser", c1.user);
+    assertEquals("testpass", c1.password);
+    assertEquals("db1", c1.dbName);
+    assertEquals("tb1", c1.tableName);
+    assertEquals(1, c1.params.size());
+    assertEquals("GMT+9", c1.params.get("TZ"));
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestJdbcTableSpace.java b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestJdbcTableSpace.java
deleted file mode 100644
index 997a419..0000000
--- a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestJdbcTableSpace.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.jdbc;
-
-import com.google.common.collect.ImmutableSet;
-import io.airlift.testing.mysql.TestingMySqlServer;
-import org.apache.tajo.conf.TajoConf;
-import org.apache.tajo.storage.TablespaceManager;
-import org.apache.tajo.storage.jdbc.JdbcTablespace;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.net.URI;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.Statement;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-public class TestJdbcTableSpace {
-  @BeforeClass
-  public static void setUp() throws IOException {
-    String mysqlUri = "jdbc:mysql://host1:2171/db1";
-    JdbcTablespace mysqlTablespace = new JdbcTablespace("cluster2", URI.create(mysqlUri));
-    mysqlTablespace.init(new TajoConf());
-    TablespaceManager.addTableSpaceForTest(mysqlTablespace);
-
-    String pgsqlUri = "jdbc:postgres://host1:2615/db2";
-    JdbcTablespace pgSQLTablespace = new JdbcTablespace("cluster3", URI.create(pgsqlUri));
-    pgSQLTablespace.init(new TajoConf());
-    TablespaceManager.addTableSpaceForTest(pgSQLTablespace);
-  }
-
-  @Test
-  public void testTablespaceHandler() throws Exception {
-    assertTrue((TablespaceManager.getByName("cluster2").get()) instanceof JdbcTablespace);
-    assertEquals("cluster2", (TablespaceManager.getByName("cluster2").get().getName()));
-    assertTrue((TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get()) instanceof JdbcTablespace);
-    assertEquals(URI.create("jdbc:mysql://host1:2171/db1"),
-        TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get().getUri());
-
-    assertTrue((TablespaceManager.getByName("cluster3").get()) instanceof JdbcTablespace);
-    assertEquals("cluster3", (TablespaceManager.getByName("cluster3").get().getName()));
-    assertTrue((TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get()) instanceof JdbcTablespace);
-
-    assertEquals(URI.create("jdbc:postgres://host1:2615/db2"),
-        TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get().getUri());
-  }
-
-  @Test
-  public void test() throws Exception {
-    try (TestingMySqlServer server = new TestingMySqlServer("testuser", "testpass", "db1", "db2")) {
-      assertTrue(server.isRunning());
-      assertTrue(server.isReadyForConnections());
-      assertEquals(server.getMySqlVersion(), "5.5.9");
-      assertEquals(server.getDatabases(), ImmutableSet.of("db1", "db2"));
-      assertEquals(server.getUser(), "testuser");
-      assertEquals(server.getPassword(), "testpass");
-      assertEquals(server.getJdbcUrl().substring(0, 5), "jdbc:");
-      assertEquals(server.getPort(), URI.create(server.getJdbcUrl().substring(5)).getPort());
-
-      for (String database : server.getDatabases()) {
-        try (Connection connection = DriverManager.getConnection(server.getJdbcUrl())) {
-          connection.setCatalog(database);
-          try (Statement statement = connection.createStatement()) {
-            statement.execute("CREATE TABLE test_table (c1 bigint PRIMARY KEY)");
-            statement.execute("INSERT INTO test_table (c1) VALUES (1)");
-            try (ResultSet resultSet = statement.executeQuery("SELECT count(*) FROM test_table")) {
-              assertTrue(resultSet.next());
-              assertEquals(resultSet.getLong(1), 1L);
-              assertFalse(resultSet.next());
-            }
-          }
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
deleted file mode 100644
index 966fa8b..0000000
--- a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.jdbc;
-
-import com.google.common.collect.ImmutableSet;
-import io.airlift.testing.mysql.TestingMySqlServer;
-import org.apache.tajo.conf.TajoConf;
-import org.apache.tajo.storage.TablespaceManager;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.net.URI;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.Statement;
-
-import static org.junit.Assert.*;
-
-public class TestMysqlJdbcTableSpace {
-  @BeforeClass
-  public static void setUp() throws IOException {
-    String mysqlUri = "jdbc:mysql://host1:2171/db1";
-    JdbcTablespace mysqlTablespace = new JdbcTablespace("cluster2", URI.create(mysqlUri));
-    mysqlTablespace.init(new TajoConf());
-    TablespaceManager.addTableSpaceForTest(mysqlTablespace);
-
-    String pgsqlUri = "jdbc:postgres://host1:2615/db2";
-    JdbcTablespace pgSQLTablespace = new JdbcTablespace("cluster3", URI.create(pgsqlUri));
-    pgSQLTablespace.init(new TajoConf());
-    TablespaceManager.addTableSpaceForTest(pgSQLTablespace);
-  }
-
-  @Test
-  public void testTablespaceHandler() throws Exception {
-    assertTrue((TablespaceManager.getByName("cluster2").get()) instanceof JdbcTablespace);
-    assertEquals("cluster2", (TablespaceManager.getByName("cluster2").get().getName()));
-    assertTrue((TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get()) instanceof JdbcTablespace);
-    assertEquals(URI.create("jdbc:mysql://host1:2171/db1"),
-        TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get().getUri());
-
-    assertTrue((TablespaceManager.getByName("cluster3").get()) instanceof JdbcTablespace);
-    assertEquals("cluster3", (TablespaceManager.getByName("cluster3").get().getName()));
-    assertTrue((TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get()) instanceof JdbcTablespace);
-
-    assertEquals(URI.create("jdbc:postgres://host1:2615/db2"),
-        TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get().getUri());
-  }
-
-  @Test
-  public void test() throws Exception {
-    try (TestingMySqlServer server = new TestingMySqlServer("testuser", "testpass", "db1", "db2")) {
-      assertTrue(server.isRunning());
-      assertTrue(server.isReadyForConnections());
-      assertEquals(server.getMySqlVersion(), "5.5.9");
-      assertEquals(server.getDatabases(), ImmutableSet.of("db1", "db2"));
-      assertEquals(server.getUser(), "testuser");
-      assertEquals(server.getPassword(), "testpass");
-      assertEquals(server.getJdbcUrl().substring(0, 5), "jdbc:");
-      assertEquals(server.getPort(), URI.create(server.getJdbcUrl().substring(5)).getPort());
-
-      for (String database : server.getDatabases()) {
-        try (Connection connection = DriverManager.getConnection(server.getJdbcUrl())) {
-          connection.setCatalog(database);
-          try (Statement statement = connection.createStatement()) {
-            statement.execute("CREATE TABLE test_table (c1 bigint PRIMARY KEY)");
-            statement.execute("INSERT INTO test_table (c1) VALUES (1)");
-            try (ResultSet resultSet = statement.executeQuery("SELECT count(*) FROM test_table")) {
-              assertTrue(resultSet.next());
-              assertEquals(resultSet.getLong(1), 1L);
-              assertFalse(resultSet.next());
-            }
-          }
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestPgSQLJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestPgSQLJdbcTableSpace.java b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestPgSQLJdbcTableSpace.java
deleted file mode 100644
index aef70a9..0000000
--- a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestPgSQLJdbcTableSpace.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.jdbc;
-
-import io.airlift.testing.postgresql.TestingPostgreSqlServer;
-import org.apache.tajo.conf.TajoConf;
-import org.apache.tajo.storage.TablespaceManager;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.net.URI;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.Statement;
-
-import static org.junit.Assert.*;
-
-public class TestPgSQLJdbcTableSpace {
-  @BeforeClass
-  public static void setUp() throws IOException {
-    String mysqlUri = "jdbc:mysql://host1:2171/db1";
-    JdbcTablespace mysqlTablespace = new JdbcTablespace("cluster2", URI.create(mysqlUri));
-    mysqlTablespace.init(new TajoConf());
-    TablespaceManager.addTableSpaceForTest(mysqlTablespace);
-
-    String pgsqlUri = "jdbc:postgres://host1:2615/db2";
-    JdbcTablespace pgSQLTablespace = new JdbcTablespace("cluster3", URI.create(pgsqlUri));
-    pgSQLTablespace.init(new TajoConf());
-    TablespaceManager.addTableSpaceForTest(pgSQLTablespace);
-  }
-
-  @Test
-  public void testTablespaceHandler() throws Exception {
-    assertTrue((TablespaceManager.getByName("cluster2").get()) instanceof JdbcTablespace);
-    assertEquals("cluster2", (TablespaceManager.getByName("cluster2").get().getName()));
-    assertTrue((TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get()) instanceof JdbcTablespace);
-    assertEquals(URI.create("jdbc:mysql://host1:2171/db1"),
-        TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get().getUri());
-
-    assertTrue((TablespaceManager.getByName("cluster3").get()) instanceof JdbcTablespace);
-    assertEquals("cluster3", (TablespaceManager.getByName("cluster3").get().getName()));
-    assertTrue((TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get()) instanceof JdbcTablespace);
-
-    assertEquals(URI.create("jdbc:postgres://host1:2615/db2"),
-        TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get().getUri());
-  }
-
-  @Test
-  public void test() throws Exception {
-    try (TestingPostgreSqlServer server = new TestingPostgreSqlServer("testuser", "testdb")) {
-      assertEquals(server.getUser(), "testuser");
-      assertEquals(server.getDatabase(), "testdb");
-      assertEquals(server.getJdbcUrl().substring(0, 5), "jdbc:");
-      assertEquals(server.getPort(), URI.create(server.getJdbcUrl().substring(5)).getPort());
-
-      try (Connection connection = DriverManager.getConnection(server.getJdbcUrl())) {
-        try (Statement statement = connection.createStatement()) {
-          statement.execute("CREATE TABLE test_table (c1 bigint PRIMARY KEY)");
-          statement.execute("INSERT INTO test_table (c1) VALUES (1)");
-          try (ResultSet resultSet = statement.executeQuery("SELECT count(*) FROM test_table")) {
-            assertTrue(resultSet.next());
-            assertEquals(resultSet.getLong(1), 1L);
-            assertFalse(resultSet.next());
-          }
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-mysql/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/pom.xml b/tajo-storage/tajo-storage-mysql/pom.xml
new file mode 100644
index 0000000..3cca4f5
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/pom.xml
@@ -0,0 +1,292 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>tajo-project</artifactId>
+    <groupId>org.apache.tajo</groupId>
+    <version>0.11.0-SNAPSHOT</version>
+    <relativePath>../../tajo-project</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>tajo-storage-mysql</artifactId>
+  <packaging>jar</packaging>
+  <name>Tajo MySQL JDBC storage</name>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.7</source>
+          <target>1.7</target>
+          <encoding>${project.build.sourceEncoding}</encoding>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.rat</groupId>
+        <artifactId>apache-rat-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>src/main/resources/*.json</exclude>
+            <exclude>src/test/resources/*.json</exclude>
+          </excludes>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>verify</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <systemProperties>
+            <tajo.test>TRUE</tajo.test>
+          </systemProperties>
+          <argLine>-Xms512m -Xmx1024m -XX:MaxPermSize=128m -Dfile.encoding=UTF-8</argLine>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>2.4</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-common</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-catalog-common</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-plan</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-storage-common</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-storage-jdbc</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-common</artifactId>
+      <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <artifactId>zookeeper</artifactId>
+          <groupId>org.apache.zookeeper</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>slf4j-api</artifactId>
+          <groupId>org.slf4j</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>jersey-json</artifactId>
+          <groupId>com.sun.jersey</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdfs</artifactId>
+      <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-el</groupId>
+          <artifactId>commons-el</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-runtime</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-compiler</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.mortbay.jetty</groupId>
+          <artifactId>jsp-2.1-jetty</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.sun.jersey.jersey-test-framework</groupId>
+          <artifactId>jersey-test-framework-grizzly2</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-minicluster</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-el</groupId>
+          <artifactId>commons-el</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-runtime</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-compiler</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.mortbay.jetty</groupId>
+          <artifactId>jsp-2.1-jetty</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.sun.jersey.jersey-test-framework</groupId>
+          <artifactId>jersey-test-framework-grizzly2</artifactId>
+        </exclusion>
+        <exclusion>
+          <artifactId>hadoop-yarn-server-tests</artifactId>
+          <groupId>org.apache.hadoop</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>hadoop-mapreduce-client-jobclient</artifactId>
+          <groupId>org.apache.hadoop</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>hadoop-mapreduce-client-app</artifactId>
+          <groupId>org.apache.hadoop</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>hadoop-yarn-api</artifactId>
+          <groupId>org.apache.hadoop</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>hadoop-mapreduce-client-hs</artifactId>
+          <groupId>org.apache.hadoop</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>hadoop-mapreduce-client-core</artifactId>
+          <groupId>org.apache.hadoop</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-mapreduce-client-core</artifactId>
+      <version>${hadoop.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.google.protobuf</groupId>
+      <artifactId>protobuf-java</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>io.airlift</groupId>
+      <artifactId>testing-mysql-server</artifactId>
+      <version>0.1</version>
+      <scope>test</scope>
+    </dependency>
+    <!--
+    <dependency>
+      <groupId>io.airlift</groupId>
+      <artifactId>testing-postgresql-server</artifactId>
+      <version>0.3</version>
+      <scope>test</scope>
+    </dependency>
+    -->
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+    </dependency>
+  </dependencies>
+
+  <profiles>
+    <profile>
+      <id>docs</id>
+      <activation>
+        <activeByDefault>false</activeByDefault>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-javadoc-plugin</artifactId>
+            <executions>
+              <execution>
+                <!-- build javadoc jars per jar for publishing to maven -->
+                <id>module-javadocs</id>
+                <phase>package</phase>
+                <goals>
+                  <goal>jar</goal>
+                </goals>
+                <configuration>
+                  <destDir>${project.build.directory}</destDir>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-report-plugin</artifactId>
+        <version>2.15</version>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLMetadataProvider.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLMetadataProvider.java b/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLMetadataProvider.java
new file mode 100644
index 0000000..33edb5c
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLMetadataProvider.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.mysql;
+
+import org.apache.tajo.storage.jdbc.JdbcMetadataProviderBase;
+
+public class MySQLMetadataProvider extends JdbcMetadataProviderBase {
+
+
+  public MySQLMetadataProvider(MySQLTablespace space, String dbName) {
+    super(space, dbName);
+  }
+
+  @Override
+  protected String getJdbcDriverName() {
+    return "com.mysql.jdbc.Driver";
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java b/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java
new file mode 100644
index 0000000..93815b0
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.mysql;
+
+import net.minidev.json.JSONObject;
+import org.apache.hadoop.fs.Path;
+import org.apache.tajo.ExecutionBlockId;
+import org.apache.tajo.OverridableConf;
+import org.apache.tajo.catalog.*;
+import org.apache.tajo.exception.UnsupportedException;
+import org.apache.tajo.plan.LogicalPlan;
+import org.apache.tajo.plan.logical.LogicalNode;
+import org.apache.tajo.plan.logical.ScanNode;
+import org.apache.tajo.storage.FormatProperty;
+import org.apache.tajo.storage.StorageProperty;
+import org.apache.tajo.storage.Tablespace;
+import org.apache.tajo.storage.TupleRange;
+import org.apache.tajo.storage.fragment.Fragment;
+import org.apache.tajo.storage.jdbc.*;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <h3>URI Examples:</h3>
+ * <ul>
+ *   <li>jdbc:mysql//primaryhost,secondaryhost1,secondaryhost2/test?profileSQL=true</li>
+ * </ul>
+ */
+public class MySQLTablespace extends JdbcTablespace {
+
+  public MySQLTablespace(String name, URI uri, JSONObject config) {
+    super(name, uri, config);
+  }
+
+  public MetadataProvider getMetadataProvider() {
+    return new MySQLMetadataProvider(this, "db1");
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
new file mode 100644
index 0000000..0e3fb91
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.jdbc;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
+import io.airlift.testing.mysql.TestingMySqlServer;
+import org.apache.tajo.catalog.MetadataProvider;
+import org.apache.tajo.catalog.Schema;
+import org.apache.tajo.catalog.TableDesc;
+import org.apache.tajo.conf.TajoConf;
+import org.apache.tajo.storage.TablespaceManager;
+import org.apache.tajo.storage.mysql.MySQLTablespace;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.net.URI;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.Statement;
+import java.util.Set;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class TestMysqlJdbcTableSpace {
+  @BeforeClass
+  public static void setUp() throws IOException {
+    String mysqlUri = "jdbc:mysql://host1:2171/db1";
+    MySQLTablespace mysqlTablespace = new MySQLTablespace("cluster2", URI.create(mysqlUri), null);
+    mysqlTablespace.init(new TajoConf());
+    TablespaceManager.addTableSpaceForTest(mysqlTablespace);
+  }
+
+  @Test
+  public void testTablespaceHandler() throws Exception {
+    assertTrue((TablespaceManager.getByName("cluster2").get()) instanceof MySQLTablespace);
+    assertEquals("cluster2", (TablespaceManager.getByName("cluster2").get().getName()));
+    assertTrue((TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get()) instanceof MySQLTablespace);
+    assertTrue((TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1?table=xyz")).get())
+        instanceof MySQLTablespace);
+
+    assertEquals(URI.create("jdbc:mysql://host1:2171/db1"),
+        TablespaceManager.get(URI.create("jdbc:mysql://host1:2171/db1")).get().getUri());
+
+    assertTrue((TablespaceManager.getByName("cluster3").get()) instanceof MySQLTablespace);
+    assertEquals("cluster3", (TablespaceManager.getByName("cluster3").get().getName()));
+    assertTrue((TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get()) instanceof MySQLTablespace);
+    assertTrue((TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2?table=xyz")).get())
+        instanceof MySQLTablespace);
+
+    assertEquals(URI.create("jdbc:postgres://host1:2615/db2"),
+        TablespaceManager.get(URI.create("jdbc:postgres://host1:2615/db2")).get().getUri());
+  }
+
+  @Test
+  public void test() throws Exception {
+    try (TestingMySqlServer server = new TestingMySqlServer("testuser", "testpass", "db1", "db2")) {
+      assertTrue(server.isRunning());
+      assertTrue(server.isReadyForConnections());
+      assertEquals(server.getMySqlVersion(), "5.5.9");
+      assertEquals(server.getDatabases(), ImmutableSet.of("db1", "db2"));
+      assertEquals(server.getUser(), "testuser");
+      assertEquals(server.getPassword(), "testpass");
+      assertEquals(server.getJdbcUrl().substring(0, 5), "jdbc:");
+      assertEquals(server.getPort(), URI.create(server.getJdbcUrl().substring(5)).getPort());
+
+      try (Connection connection = DriverManager.getConnection(server.getJdbcUrl())) {
+        connection.setCatalog("db1");
+
+        try (Statement statement = connection.createStatement()) {
+          statement.execute("CREATE TABLE t1 (c1 bigint PRIMARY KEY)");
+          statement.execute("CREATE TABLE t2 (c1 int PRIMARY KEY, c2 VARCHAR(20), c3 TIME)");
+        }
+      }
+
+      System.out.println(server.getJdbcUrl());
+      MySQLTablespace tablespace = new MySQLTablespace("mysql", URI.create(server.getJdbcUrl()), null);
+
+      URI uri = tablespace.getTableUri("abc", "table1");
+      JdbcConnectionInfo c1 = JdbcConnectionInfo.fromURI(uri);
+      assertEquals("table1", c1.tableName);
+
+      MetadataProvider provider = tablespace.getMetadataProvider();
+      Set<String> tables = Sets.newHashSet(provider.getTables(null, null));
+      assertEquals(Sets.newHashSet("t1", "t2"), tables);
+
+      TableDesc desc = provider.getTableDescriptor("", "t2");
+      assertEquals(tablespace.getUri() + "&table=t2", desc.getUri().toASCIIString());
+
+      Schema schema = desc.getSchema();
+      System.out.println(">>> " + schema);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-pgsql/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/pom.xml b/tajo-storage/tajo-storage-pgsql/pom.xml
new file mode 100644
index 0000000..1faf812
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/pom.xml
@@ -0,0 +1,286 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>tajo-project</artifactId>
+    <groupId>org.apache.tajo</groupId>
+    <version>0.11.0-SNAPSHOT</version>
+    <relativePath>../../tajo-project</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>tajo-storage-pgsql</artifactId>
+  <packaging>jar</packaging>
+  <name>Tajo PostgreSQL JDBC storage</name>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.7</source>
+          <target>1.7</target>
+          <encoding>${project.build.sourceEncoding}</encoding>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.rat</groupId>
+        <artifactId>apache-rat-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>src/main/resources/*.json</exclude>
+            <exclude>src/test/resources/*.json</exclude>
+          </excludes>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>verify</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <systemProperties>
+            <tajo.test>TRUE</tajo.test>
+          </systemProperties>
+          <argLine>-Xms512m -Xmx1024m -XX:MaxPermSize=128m -Dfile.encoding=UTF-8</argLine>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>2.4</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-common</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-catalog-common</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-plan</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-storage-common</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-storage-jdbc</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-common</artifactId>
+      <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <artifactId>zookeeper</artifactId>
+          <groupId>org.apache.zookeeper</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>slf4j-api</artifactId>
+          <groupId>org.slf4j</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>jersey-json</artifactId>
+          <groupId>com.sun.jersey</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdfs</artifactId>
+      <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-el</groupId>
+          <artifactId>commons-el</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-runtime</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-compiler</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.mortbay.jetty</groupId>
+          <artifactId>jsp-2.1-jetty</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.sun.jersey.jersey-test-framework</groupId>
+          <artifactId>jersey-test-framework-grizzly2</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-minicluster</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-el</groupId>
+          <artifactId>commons-el</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-runtime</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-compiler</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.mortbay.jetty</groupId>
+          <artifactId>jsp-2.1-jetty</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.sun.jersey.jersey-test-framework</groupId>
+          <artifactId>jersey-test-framework-grizzly2</artifactId>
+        </exclusion>
+        <exclusion>
+          <artifactId>hadoop-yarn-server-tests</artifactId>
+          <groupId>org.apache.hadoop</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>hadoop-mapreduce-client-jobclient</artifactId>
+          <groupId>org.apache.hadoop</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>hadoop-mapreduce-client-app</artifactId>
+          <groupId>org.apache.hadoop</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>hadoop-yarn-api</artifactId>
+          <groupId>org.apache.hadoop</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>hadoop-mapreduce-client-hs</artifactId>
+          <groupId>org.apache.hadoop</groupId>
+        </exclusion>
+        <exclusion>
+          <artifactId>hadoop-mapreduce-client-core</artifactId>
+          <groupId>org.apache.hadoop</groupId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-mapreduce-client-core</artifactId>
+      <version>${hadoop.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.google.protobuf</groupId>
+      <artifactId>protobuf-java</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>io.airlift</groupId>
+      <artifactId>testing-postgresql-server</artifactId>
+      <version>0.3</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+      <version>15.0</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <profiles>
+    <profile>
+      <id>docs</id>
+      <activation>
+        <activeByDefault>false</activeByDefault>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-javadoc-plugin</artifactId>
+            <executions>
+              <execution>
+                <!-- build javadoc jars per jar for publishing to maven -->
+                <id>module-javadocs</id>
+                <phase>package</phase>
+                <goals>
+                  <goal>jar</goal>
+                </goals>
+                <configuration>
+                  <destDir>${project.build.directory}</destDir>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-report-plugin</artifactId>
+        <version>2.15</version>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>

http://git-wip-us.apache.org/repos/asf/tajo/blob/9b26ccc0/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLMetadataProvider.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLMetadataProvider.java b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLMetadataProvider.java
new file mode 100644
index 0000000..60a1cdd
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLMetadataProvider.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.pgsql;
+
+import org.apache.tajo.storage.jdbc.JdbcMetadataProviderBase;
+
+public class PgSQLMetadataProvider extends JdbcMetadataProviderBase {
+
+  public PgSQLMetadataProvider(PgSQLTablespace space, String dbName) {
+    super(space, dbName);
+  }
+
+  @Override
+  protected String getJdbcDriverName() {
+    return "org.postgresql.Driver";
+  }
+}


[11/39] tajo git commit: Fixed compilation error and removed unnecessary dependencies from pom.xml files.

Posted by hy...@apache.org.
Fixed compilation error and removed unnecessary dependencies from pom.xml files.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/f476bbd3
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/f476bbd3
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/f476bbd3

Branch: refs/heads/TAJO-1730
Commit: f476bbd35059d5031c51c74f384e70d193b50049
Parents: 77dfbbd
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sat Aug 15 00:21:13 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sat Aug 15 00:21:13 2015 +0900

----------------------------------------------------------------------
 .../storage/jdbc/JdbcMetadataProviderBase.java  |   6 +-
 .../tajo/storage/jdbc/JdbcTablespace.java       |   4 +-
 tajo-storage/tajo-storage-mysql/pom.xml         | 108 -------------------
 tajo-storage/tajo-storage-pgsql/pom.xml         | 103 ------------------
 4 files changed, 4 insertions(+), 217 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/f476bbd3/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
index 834643b..87da6c7 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
@@ -24,9 +24,9 @@ import com.facebook.presto.hive.shaded.com.google.common.collect.Lists;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.tajo.catalog.*;
-import org.apache.tajo.catalog.exception.UndefinedTablespaceException;
 import org.apache.tajo.common.TajoDataTypes.Type;
 import org.apache.tajo.exception.TajoInternalError;
+import org.apache.tajo.exception.UndefinedTablespaceException;
 import org.apache.tajo.exception.UnsupportedException;
 import org.apache.tajo.util.KeyValueSet;
 import org.apache.tajo.util.Pair;
@@ -194,9 +194,9 @@ public abstract class JdbcMetadataProviderBase implements MetadataProvider {
         final String qualifier = resultForColumns.getString("TABLE_NAME");
         final String columnName = resultForColumns.getString("COLUMN_NAME");
         final TypeDesc type = convertDataType(resultForColumns);
-        Column c = new Column(CatalogUtil.buildFQName(qualifier, columnName), type);
+        final Column c = new Column(CatalogUtil.buildFQName(qualifier, columnName), type);
 
-        columns.add(new Pair<Integer, Column>(ordinalPos, c));
+        columns.add(new Pair<>(ordinalPos, c));
       }
 
       // sort columns in an order of ordinal position

http://git-wip-us.apache.org/repos/asf/tajo/blob/f476bbd3/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
index f958358..619445a 100644
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
@@ -23,7 +23,6 @@ import org.apache.hadoop.fs.Path;
 import org.apache.tajo.ExecutionBlockId;
 import org.apache.tajo.OverridableConf;
 import org.apache.tajo.catalog.*;
-import org.apache.tajo.exception.UnsupportedException;
 import org.apache.tajo.plan.LogicalPlan;
 import org.apache.tajo.plan.logical.LogicalNode;
 import org.apache.tajo.plan.logical.ScanNode;
@@ -36,7 +35,6 @@ import org.apache.tajo.storage.fragment.Fragment;
 import java.io.IOException;
 import java.net.URI;
 import java.util.List;
-import java.util.Map;
 
 /**
  * <h3>URI Examples:</h3>
@@ -103,7 +101,7 @@ public abstract class JdbcTablespace extends Tablespace {
   }
 
   @Override
-  public void verifySchemaToWrite(TableDesc tableDesc, Schema outSchema) throws IOException {
+  public void verifySchemaToWrite(TableDesc tableDesc, Schema outSchema) {
 
   }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/f476bbd3/tajo-storage/tajo-storage-mysql/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/pom.xml b/tajo-storage/tajo-storage-mysql/pom.xml
index 0294745..c2157fa 100644
--- a/tajo-storage/tajo-storage-mysql/pom.xml
+++ b/tajo-storage/tajo-storage-mysql/pom.xml
@@ -122,114 +122,6 @@
       <artifactId>tajo-storage-jdbc</artifactId>
       <scope>provided</scope>
     </dependency>
-
-    <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-common</artifactId>
-      <scope>provided</scope>
-      <exclusions>
-        <exclusion>
-          <artifactId>zookeeper</artifactId>
-          <groupId>org.apache.zookeeper</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>slf4j-api</artifactId>
-          <groupId>org.slf4j</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>jersey-json</artifactId>
-          <groupId>com.sun.jersey</groupId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-hdfs</artifactId>
-      <scope>provided</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>commons-el</groupId>
-          <artifactId>commons-el</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>tomcat</groupId>
-          <artifactId>jasper-runtime</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>tomcat</groupId>
-          <artifactId>jasper-compiler</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.mortbay.jetty</groupId>
-          <artifactId>jsp-2.1-jetty</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>com.sun.jersey.jersey-test-framework</groupId>
-          <artifactId>jersey-test-framework-grizzly2</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-minicluster</artifactId>
-      <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>commons-el</groupId>
-          <artifactId>commons-el</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>tomcat</groupId>
-          <artifactId>jasper-runtime</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>tomcat</groupId>
-          <artifactId>jasper-compiler</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.mortbay.jetty</groupId>
-          <artifactId>jsp-2.1-jetty</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>com.sun.jersey.jersey-test-framework</groupId>
-          <artifactId>jersey-test-framework-grizzly2</artifactId>
-        </exclusion>
-        <exclusion>
-          <artifactId>hadoop-yarn-server-tests</artifactId>
-          <groupId>org.apache.hadoop</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>hadoop-mapreduce-client-jobclient</artifactId>
-          <groupId>org.apache.hadoop</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>hadoop-mapreduce-client-app</artifactId>
-          <groupId>org.apache.hadoop</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>hadoop-yarn-api</artifactId>
-          <groupId>org.apache.hadoop</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>hadoop-mapreduce-client-hs</artifactId>
-          <groupId>org.apache.hadoop</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>hadoop-mapreduce-client-core</artifactId>
-          <groupId>org.apache.hadoop</groupId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-mapreduce-client-core</artifactId>
-      <version>${hadoop.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.google.protobuf</groupId>
-      <artifactId>protobuf-java</artifactId>
-    </dependency>
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>

http://git-wip-us.apache.org/repos/asf/tajo/blob/f476bbd3/tajo-storage/tajo-storage-pgsql/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/pom.xml b/tajo-storage/tajo-storage-pgsql/pom.xml
index 1faf812..9d13442 100644
--- a/tajo-storage/tajo-storage-pgsql/pom.xml
+++ b/tajo-storage/tajo-storage-pgsql/pom.xml
@@ -119,109 +119,6 @@
     </dependency>
 
     <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-common</artifactId>
-      <scope>provided</scope>
-      <exclusions>
-        <exclusion>
-          <artifactId>zookeeper</artifactId>
-          <groupId>org.apache.zookeeper</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>slf4j-api</artifactId>
-          <groupId>org.slf4j</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>jersey-json</artifactId>
-          <groupId>com.sun.jersey</groupId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-hdfs</artifactId>
-      <scope>provided</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>commons-el</groupId>
-          <artifactId>commons-el</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>tomcat</groupId>
-          <artifactId>jasper-runtime</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>tomcat</groupId>
-          <artifactId>jasper-compiler</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.mortbay.jetty</groupId>
-          <artifactId>jsp-2.1-jetty</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>com.sun.jersey.jersey-test-framework</groupId>
-          <artifactId>jersey-test-framework-grizzly2</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-minicluster</artifactId>
-      <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>commons-el</groupId>
-          <artifactId>commons-el</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>tomcat</groupId>
-          <artifactId>jasper-runtime</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>tomcat</groupId>
-          <artifactId>jasper-compiler</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>org.mortbay.jetty</groupId>
-          <artifactId>jsp-2.1-jetty</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>com.sun.jersey.jersey-test-framework</groupId>
-          <artifactId>jersey-test-framework-grizzly2</artifactId>
-        </exclusion>
-        <exclusion>
-          <artifactId>hadoop-yarn-server-tests</artifactId>
-          <groupId>org.apache.hadoop</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>hadoop-mapreduce-client-jobclient</artifactId>
-          <groupId>org.apache.hadoop</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>hadoop-mapreduce-client-app</artifactId>
-          <groupId>org.apache.hadoop</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>hadoop-yarn-api</artifactId>
-          <groupId>org.apache.hadoop</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>hadoop-mapreduce-client-hs</artifactId>
-          <groupId>org.apache.hadoop</groupId>
-        </exclusion>
-        <exclusion>
-          <artifactId>hadoop-mapreduce-client-core</artifactId>
-          <groupId>org.apache.hadoop</groupId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-mapreduce-client-core</artifactId>
-      <version>${hadoop.version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
       <groupId>com.google.protobuf</groupId>
       <artifactId>protobuf-java</artifactId>
     </dependency>


[24/39] tajo git commit: Completed initial implementations.

Posted by hy...@apache.org.
Completed initial implementations.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/2cf88d02
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/2cf88d02
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/2cf88d02

Branch: refs/heads/TAJO-1730
Commit: 2cf88d02a83eafeaebcffe2f5c0692a99f6a139b
Parents: ccd1860
Author: Hyunsik Choi <hy...@apache.org>
Authored: Fri Aug 21 17:55:21 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Fri Aug 21 17:55:21 2015 +0900

----------------------------------------------------------------------
 .../java/org/apache/tajo/QueryTestCaseBase.java |   4 +
 tajo-jdbc/pom.xml                               |   6 +-
 .../org/apache/tajo/storage/Tablespace.java     |  17 +-
 .../apache/tajo/storage/TablespaceManager.java  |   6 +-
 tajo-storage/tajo-storage-jdbc/pom.xml          |  14 +-
 .../tajo/storage/jdbc/ConnectionInfo.java       | 112 ---------
 .../storage/jdbc/JdbcMetadataProviderBase.java  | 244 -------------------
 .../tajo/storage/jdbc/JdbcTablespace.java       | 139 -----------
 .../tajo/storage/mysql/ConnectionInfo.java      | 112 +++++++++
 .../storage/mysql/JdbcMetadataProviderBase.java | 244 +++++++++++++++++++
 .../tajo/storage/mysql/JdbcTablespace.java      | 139 +++++++++++
 .../storage/jdbc/JdbcTablespaceTestBase.java    |  45 ----
 .../tajo/storage/jdbc/TestConnectionInfo.java   |  50 ----
 .../storage/mysql/JdbcTablespaceTestBase.java   |  43 ++++
 .../tajo/storage/mysql/TestConnectionInfo.java  |  50 ++++
 tajo-storage/tajo-storage-mysql/pom.xml         |  70 +++++-
 .../storage/mysql/MySQLMetadataProvider.java    |   2 -
 .../tajo/storage/mysql/MySQLTablespace.java     |  21 +-
 .../storage/jdbc/TestMysqlJdbcTableSpace.java   | 112 ---------
 .../tajo/storage/mysql/EmbedMySQLServer.java    | 117 +++++++++
 .../mysql/TestMySQLMetadataProvider.java        |  95 ++++++++
 .../storage/mysql/TestMysqlJdbcTableSpace.java  |  64 +++++
 tajo-storage/tajo-storage-pgsql/pom.xml         |  71 +++++-
 .../storage/pgsql/PgSQLMetadataProvider.java    |  10 +-
 .../tajo/storage/pgsql/PgSQLTablespace.java     |   8 +-
 .../tajo/storage/pgsql/EmbedPgSQLServer.java    |  95 ++++++++
 .../storage/pgsql/TestPgSQLJdbcTableSpace.java  |  64 +----
 .../pgsql/TestPgSQLMetadataProvider.java        |  81 ++++++
 28 files changed, 1228 insertions(+), 807 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-cluster-tests/src/test/java/org/apache/tajo/QueryTestCaseBase.java
----------------------------------------------------------------------
diff --git a/tajo-cluster-tests/src/test/java/org/apache/tajo/QueryTestCaseBase.java b/tajo-cluster-tests/src/test/java/org/apache/tajo/QueryTestCaseBase.java
index 8200cec..6796921 100644
--- a/tajo-cluster-tests/src/test/java/org/apache/tajo/QueryTestCaseBase.java
+++ b/tajo-cluster-tests/src/test/java/org/apache/tajo/QueryTestCaseBase.java
@@ -19,6 +19,7 @@
 package org.apache.tajo;
 
 import com.google.common.base.Function;
+import com.google.common.base.Preconditions;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.Lists;
 import com.google.protobuf.ServiceException;
@@ -204,10 +205,13 @@ public class QueryTestCaseBase {
     client = testBase.getTestingCluster().newTajoClient();
 
     URL datasetBaseURL = ClassLoader.getSystemResource("dataset");
+    Preconditions.checkNotNull(datasetBaseURL, "dataset directory is absent.");
     datasetBasePath = new Path(datasetBaseURL.toString());
     URL queryBaseURL = ClassLoader.getSystemResource("queries");
+    Preconditions.checkNotNull(queryBaseURL, "queries directory is absent.");
     queryBasePath = new Path(queryBaseURL.toString());
     URL resultBaseURL = ClassLoader.getSystemResource("results");
+    Preconditions.checkNotNull(resultBaseURL, "results directory is absent.");
     resultBasePath = new Path(resultBaseURL.toString());
   }
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-jdbc/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-jdbc/pom.xml b/tajo-jdbc/pom.xml
index f73a4bd..c80e342 100644
--- a/tajo-jdbc/pom.xml
+++ b/tajo-jdbc/pom.xml
@@ -110,7 +110,7 @@
     <dependency>
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-common</artifactId>
-      <scope>test</scope>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
@@ -164,10 +164,6 @@
           <groupId>com.sun.jersey.jersey-test-framework</groupId>
           <artifactId>jersey-test-framework-grizzly2</artifactId>
         </exclusion>
-        <exclusion>
-          <artifactId>netty-all</artifactId>
-          <groupId>io.netty</groupId>
-        </exclusion>
       </exclusions>
     </dependency>
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
index de2ffe9..ae749e6 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/Tablespace.java
@@ -49,16 +49,20 @@ public abstract class Tablespace {
 
   protected final String name;
   protected final URI uri;
-  protected final JSONObject spec;
+  protected final JSONObject config;
   /** this space is visible or not. */
   protected boolean visible = true;
 
   protected TajoConf conf;
 
-  public Tablespace(String name, URI uri, JSONObject spec) {
+  public Tablespace(String name, URI uri, JSONObject config) {
     this.name = name;
     this.uri = uri;
-    this.spec = spec;
+    this.config = config;
+  }
+
+  public JSONObject getConfig() {
+    return config;
   }
 
   public void setVisible(boolean visible) {
@@ -107,8 +111,9 @@ public abstract class Tablespace {
   /**
    * Get Table URI
    *
-   * @param tableName
-   * @return
+   * @param databaseName Database name
+   * @param tableName Table name
+   * @return Table URI
    */
   public abstract URI getTableUri(String databaseName, String tableName);
 
@@ -420,6 +425,6 @@ public abstract class Tablespace {
   }
 
   public MetadataProvider getMetadataProvider() {
-    throw new UnsupportedException("Linked Metadata Provider for " + name);
+    throw new TajoRuntimeException(new UnsupportedException("Linked Metadata Provider for " + name));
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
index ae3654d..17f03a0 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/TablespaceManager.java
@@ -77,6 +77,8 @@ public class TablespaceManager implements StorageService {
 
   public static final Class [] TABLESPACE_PARAM = new Class [] {String.class, URI.class, JSONObject.class};
 
+  public static final String TABLESPACE_SPEC_CONFIGS_KEY = "configs";
+
   static {
     instance = new TablespaceManager();
   }
@@ -193,7 +195,7 @@ public class TablespaceManager implements StorageService {
             entry.getKey(),
             URI.create(spaceDetail.getAsString("uri")),
             Boolean.parseBoolean(spaceDetail.getAsString("default")),
-            (JSONObject) spaceDetail.get("configs"),
+            (JSONObject) spaceDetail.get(TABLESPACE_SPEC_CONFIGS_KEY),
             override);
       }
     }
@@ -310,7 +312,7 @@ public class TablespaceManager implements StorageService {
       existing = TABLE_SPACES.remove(space.getUri());
 
       // Add anotherone for test
-      registerTableSpace(space.name, space.uri, null, true, true);
+      registerTableSpace(space.name, space.uri, space.getConfig(), true, true);
     }
     // if there is an existing one, return it.
     return Optional.fromNullable(existing);

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-jdbc/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/pom.xml b/tajo-storage/tajo-storage-jdbc/pom.xml
index f086f24..24a518d 100644
--- a/tajo-storage/tajo-storage-jdbc/pom.xml
+++ b/tajo-storage/tajo-storage-jdbc/pom.xml
@@ -187,22 +187,18 @@
       <artifactId>tajo-storage-common</artifactId>
       <scope>provided</scope>
     </dependency>
+
     <dependency>
-      <groupId>org.apache.tajo</groupId>
-      <artifactId>tajo-cluster-tests</artifactId>
-      <type>test-jar</type>
-      <scope>provided</scope>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
     </dependency>
 
     <dependency>
       <groupId>com.google.protobuf</groupId>
       <artifactId>protobuf-java</artifactId>
     </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
+
   </dependencies>
 
   <profiles>

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/ConnectionInfo.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/ConnectionInfo.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/ConnectionInfo.java
deleted file mode 100644
index 9a42b0d..0000000
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/ConnectionInfo.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.jdbc;
-
-import org.apache.tajo.exception.TajoInternalError;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
-public class ConnectionInfo {
-  String scheme;
-  String dbName;
-  String tableName;
-  String user;
-  String password;
-  Map<String, String> params;
-
-  public String scheme() {
-    return scheme;
-  }
-
-  public String database() {
-    return dbName;
-  }
-
-  public String table() {
-    return tableName;
-  }
-
-  public String user() {
-    return user;
-  }
-
-  public String password() {
-    return password;
-  }
-
-  public static ConnectionInfo fromURI(String originalUri) {
-    return fromURI(URI.create(originalUri));
-  }
-
-  public static ConnectionInfo fromURI(URI originalUri) {
-    final String uriStr = originalUri.toASCIIString();
-    URI uri = originalUri;
-
-    final ConnectionInfo connInfo = new ConnectionInfo();
-    connInfo.scheme = uriStr.substring(0, uriStr.indexOf("://"));
-
-    if (connInfo.scheme.split(":").length > 1) {
-      int idx = uriStr.indexOf(':');
-      uri = URI.create(uriStr.substring(idx + 1));
-    }
-
-    String path = uri.getPath();
-    if (path != null && !path.isEmpty()) {
-      String [] pathElements = path.substring(1).split("/");
-      if (pathElements.length != 1) {
-        throw new TajoInternalError("Invalid JDBC path: " + path);
-      }
-      connInfo.dbName = pathElements[0];
-    }
-
-    Map<String, String> params = new HashMap<>();
-
-    int paramIndex = uriStr.indexOf("?");
-    if (paramIndex > 0) {
-      String parameterPart = uriStr.substring(paramIndex+1, uriStr.length());
-
-      String [] eachParam = parameterPart.split("&");
-
-      for (String each: eachParam) {
-        String [] keyValues = each.split("=");
-        if (keyValues.length != 2) {
-          throw new TajoInternalError("Invalid URI Parameters: " + parameterPart);
-        }
-        params.put(keyValues[0], keyValues[1]);
-      }
-    }
-
-    if (params.containsKey("table")) {
-      connInfo.tableName = params.remove("table");
-    }
-
-    if (params.containsKey("user")) {
-      connInfo.user = params.remove("user");
-    }
-    if (params.containsKey("password")) {
-      connInfo.password = params.remove("password");
-    }
-
-    connInfo.params = params;
-
-    return connInfo;
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
deleted file mode 100644
index b3e9474..0000000
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcMetadataProviderBase.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.jdbc;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.Lists;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.tajo.catalog.*;
-import org.apache.tajo.common.TajoDataTypes.Type;
-import org.apache.tajo.exception.TajoInternalError;
-import org.apache.tajo.exception.UndefinedTablespaceException;
-import org.apache.tajo.exception.UnsupportedException;
-import org.apache.tajo.util.KeyValueSet;
-import org.apache.tajo.util.Pair;
-
-import javax.annotation.Nullable;
-import java.net.URI;
-import java.sql.*;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import static org.apache.tajo.catalog.CatalogUtil.newSimpleDataType;
-
-public abstract class JdbcMetadataProviderBase implements MetadataProvider {
-  protected static final Log LOG = LogFactory.getLog(JdbcMetadataProviderBase.class);
-
-  protected final JdbcTablespace space;
-  protected final String databaseName;
-
-  protected final String jdbcUri;
-  protected final String username;
-  protected final String password;
-
-  protected final Connection connection;
-
-  public JdbcMetadataProviderBase(JdbcTablespace space, String dbName) {
-    this.space = space;
-    this.databaseName = dbName;
-
-    ConnectionInfo connInfo = ConnectionInfo.fromURI(space.getUri());
-    this.jdbcUri  = space.getUri().toASCIIString();
-    this.username = connInfo.user();
-    this.password = connInfo.password();
-
-    try {
-      Class.forName(getJdbcDriverName()).newInstance();
-      LOG.info(getJdbcDriverName() + " is loaded...");
-    } catch (Exception e) {
-      throw new TajoInternalError(e);
-    }
-
-    try {
-      connection = DriverManager.getConnection(jdbcUri, this.username, this.password);
-    } catch (SQLException e) {
-      throw new TajoInternalError(e);
-    }
-  }
-
-  @Override
-  public String getTablespaceName() {
-    return space.getName();
-  }
-
-  @Override
-  public URI getTablespaceUri() {
-    return space.getUri();
-  }
-
-  @Override
-  public String getDatabaseName() {
-    return databaseName;
-  }
-
-  @Override
-  public Collection<String> getSchemas() {
-    return Collections.EMPTY_SET;
-  }
-
-  @Override
-  public Collection<String> getTables(@Nullable String schemaPattern, @Nullable String tablePattern) {
-    ResultSet res = null;
-    List<String> tableNames = Lists.newArrayList();
-    try {
-      res = connection.getMetaData().getTables(databaseName, schemaPattern, tablePattern, new String [] {});
-      while(res.next()) {
-        tableNames.add(res.getString("TABLE_NAME"));
-      }
-    } catch (SQLException e) {
-      throw new TajoInternalError(e);
-    } finally {
-      try {
-        if (res != null) {
-          res.close();
-        }
-      } catch (SQLException e) {
-        LOG.warn(e);
-      }
-    }
-
-    return tableNames;
-  }
-
-  private TypeDesc convertDataType(ResultSet res) throws SQLException {
-    final int typeId = res.getInt("DATA_TYPE");
-
-    switch (typeId ) {
-    case Types.BOOLEAN:
-      return new TypeDesc(newSimpleDataType(Type.BOOLEAN));
-
-    case Types.TINYINT:
-    case Types.SMALLINT:
-    case Types.INTEGER:
-      return new TypeDesc(newSimpleDataType(Type.INT4));
-
-    case Types.BIGINT:
-      return new TypeDesc(newSimpleDataType(Type.INT8));
-
-    case Types.FLOAT:
-      return new TypeDesc(newSimpleDataType(Type.FLOAT4));
-
-    case Types.DOUBLE:
-      return new TypeDesc(newSimpleDataType(Type.FLOAT8));
-
-    case Types.DATE:
-      return new TypeDesc(newSimpleDataType(Type.DATE));
-
-    case Types.TIME:
-      return new TypeDesc(newSimpleDataType(Type.TIME));
-
-    case Types.TIMESTAMP:
-      return new TypeDesc(newSimpleDataType(Type.TIMESTAMP));
-
-    case Types.CHAR:
-    case Types.NCHAR:
-    case Types.VARCHAR:
-    case Types.NVARCHAR:
-    case Types.CLOB:
-    case Types.NCLOB:
-    case Types.LONGVARCHAR:
-    case Types.LONGNVARCHAR:
-      return new TypeDesc(newSimpleDataType(Type.TEXT));
-
-    case Types.BINARY:
-    case Types.VARBINARY:
-    case Types.BLOB:
-      return new TypeDesc(newSimpleDataType(Type.BLOB));
-
-    default:
-      throw new UnsupportedException("DATA_TYPE(" + typeId + ")");
-    }
-  }
-
-  @Override
-  public TableDesc getTableDescriptor(String schemaName, String tableName) throws UndefinedTablespaceException {
-    ResultSet resultForTable = null;
-    ResultSet resultForColumns = null;
-    try {
-
-      // get table name
-      resultForTable = connection.getMetaData().getTables(databaseName, schemaName, tableName, new String[]{});
-
-      if (!resultForTable.next()) {
-        throw new UndefinedTablespaceException(tableName);
-      }
-      final String name = resultForTable.getString("TABLE_NAME");
-
-      // get columns
-      resultForColumns = connection.getMetaData().getColumns(databaseName, schemaName, tableName, null);
-
-      List<Pair<Integer, Column>> columns = Lists.newArrayList();
-
-      while(resultForColumns.next()) {
-        final int ordinalPos = resultForColumns.getInt("ORDINAL_POSITION");
-        final String qualifier = resultForColumns.getString("TABLE_NAME");
-        final String columnName = resultForColumns.getString("COLUMN_NAME");
-        final TypeDesc type = convertDataType(resultForColumns);
-        final Column c = new Column(CatalogUtil.buildFQName(qualifier, columnName), type);
-
-        columns.add(new Pair<>(ordinalPos, c));
-      }
-
-      // sort columns in an order of ordinal position
-      Collections.sort(columns, new Comparator<Pair<Integer, Column>>() {
-        @Override
-        public int compare(Pair<Integer, Column> o1, Pair<Integer, Column> o2) {
-          return o1.getFirst() - o2.getFirst();
-        }
-      });
-
-      // transform the pair list into collection for columns
-      Schema schema = new Schema(Collections2.transform(columns, new Function<Pair<Integer,Column>, Column>() {
-        @Override
-        public Column apply(@Nullable Pair<Integer, Column> columnPair) {
-          return columnPair.getSecond();
-        }
-      }));
-
-      return new TableDesc(
-          CatalogUtil.buildFQName(databaseName, name),
-          schema,
-          new TableMeta("rowstore", new KeyValueSet()),
-          space.getTableUri(databaseName, name)
-      );
-
-    } catch (SQLException e) {
-      throw new TajoInternalError(e);
-    } finally {
-      try {
-        if (resultForTable != null) {
-          resultForTable.close();
-        }
-
-        if (resultForColumns != null) {
-          resultForColumns.close();
-        }
-
-      } catch (SQLException e) {
-        LOG.warn(e);
-      }
-    }
-  }
-
-  protected abstract String getJdbcDriverName();
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
deleted file mode 100644
index 619445a..0000000
--- a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/jdbc/JdbcTablespace.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.jdbc;
-
-import net.minidev.json.JSONObject;
-import org.apache.hadoop.fs.Path;
-import org.apache.tajo.ExecutionBlockId;
-import org.apache.tajo.OverridableConf;
-import org.apache.tajo.catalog.*;
-import org.apache.tajo.plan.LogicalPlan;
-import org.apache.tajo.plan.logical.LogicalNode;
-import org.apache.tajo.plan.logical.ScanNode;
-import org.apache.tajo.storage.FormatProperty;
-import org.apache.tajo.storage.StorageProperty;
-import org.apache.tajo.storage.Tablespace;
-import org.apache.tajo.storage.TupleRange;
-import org.apache.tajo.storage.fragment.Fragment;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.List;
-
-/**
- * <h3>URI Examples:</h3>
- * <ul>
- *   <li>jdbc:mysql//primaryhost,secondaryhost1,secondaryhost2/test?profileSQL=true</li>
- * </ul>
- */
-public abstract class JdbcTablespace extends Tablespace {
-
-  static final StorageProperty STORAGE_PROPERTY = new StorageProperty("rowstore", false, true, false, true);
-
-
-  public JdbcTablespace(String name, URI uri, JSONObject config) {
-    super(name, uri, config);
-  }
-
-  @Override
-  protected void storageInit() throws IOException {
-
-  }
-
-  @Override
-  public long getTableVolume(URI uri) throws IOException {
-    return 0;
-  }
-
-  @Override
-  public URI getTableUri(String databaseName, String tableName) {
-    return URI.create(getUri() + "&table=" + tableName);
-  }
-
-  @Override
-  public List<Fragment> getSplits(String fragmentId, TableDesc tableDesc, ScanNode scanNode) throws IOException {
-    return null;
-  }
-
-  @Override
-  public List<Fragment> getNonForwardSplit(TableDesc tableDesc, int currentPage, int numFragments) throws IOException {
-    return null;
-  }
-
-  @Override
-  public StorageProperty getProperty() {
-    return STORAGE_PROPERTY;
-  }
-
-  @Override
-  public FormatProperty getFormatProperty(TableMeta meta) {
-    return null;
-  }
-
-  @Override
-  public void close() {
-
-  }
-
-  @Override
-  public TupleRange[] getInsertSortRanges(OverridableConf queryContext,
-                                          TableDesc tableDesc,
-                                          Schema inputSchema,
-                                          SortSpec[] sortSpecs,
-                                          TupleRange dataRange) throws IOException {
-    return new TupleRange[0];
-  }
-
-  @Override
-  public void verifySchemaToWrite(TableDesc tableDesc, Schema outSchema) {
-
-  }
-
-  @Override
-  public void createTable(TableDesc tableDesc, boolean ifNotExists) throws IOException {
-  }
-
-  @Override
-  public void purgeTable(TableDesc tableDesc) throws IOException {
-
-  }
-
-  @Override
-  public void prepareTable(LogicalNode node) throws IOException {
-
-  }
-
-  @Override
-  public Path commitTable(OverridableConf queryContext, ExecutionBlockId finalEbId, LogicalPlan plan, Schema schema,
-                          TableDesc tableDesc) throws IOException {
-    return null;
-  }
-
-  @Override
-  public void rollbackTable(LogicalNode node) throws IOException {
-
-  }
-
-  @Override
-  public URI getStagingUri(OverridableConf context, String queryId, TableMeta meta) throws IOException {
-    return null;
-  }
-
-  public abstract MetadataProvider getMetadataProvider();
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/ConnectionInfo.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/ConnectionInfo.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/ConnectionInfo.java
new file mode 100644
index 0000000..520e221
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/ConnectionInfo.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.mysql;
+
+import org.apache.tajo.exception.TajoInternalError;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ConnectionInfo {
+  String scheme;
+  String dbName;
+  String tableName;
+  String user;
+  String password;
+  Map<String, String> params;
+
+  public String scheme() {
+    return scheme;
+  }
+
+  public String database() {
+    return dbName;
+  }
+
+  public String table() {
+    return tableName;
+  }
+
+  public String user() {
+    return user;
+  }
+
+  public String password() {
+    return password;
+  }
+
+  public static ConnectionInfo fromURI(String originalUri) {
+    return fromURI(URI.create(originalUri));
+  }
+
+  public static ConnectionInfo fromURI(URI originalUri) {
+    final String uriStr = originalUri.toASCIIString();
+    URI uri = originalUri;
+
+    final ConnectionInfo connInfo = new ConnectionInfo();
+    connInfo.scheme = uriStr.substring(0, uriStr.indexOf("://"));
+
+    if (connInfo.scheme.split(":").length > 1) {
+      int idx = uriStr.indexOf(':');
+      uri = URI.create(uriStr.substring(idx + 1));
+    }
+
+    String path = uri.getPath();
+    if (path != null && !path.isEmpty()) {
+      String [] pathElements = path.substring(1).split("/");
+      if (pathElements.length != 1) {
+        throw new TajoInternalError("Invalid JDBC path: " + path);
+      }
+      connInfo.dbName = pathElements[0];
+    }
+
+    Map<String, String> params = new HashMap<>();
+
+    int paramIndex = uriStr.indexOf("?");
+    if (paramIndex > 0) {
+      String parameterPart = uriStr.substring(paramIndex+1, uriStr.length());
+
+      String [] eachParam = parameterPart.split("&");
+
+      for (String each: eachParam) {
+        String [] keyValues = each.split("=");
+        if (keyValues.length != 2) {
+          throw new TajoInternalError("Invalid URI Parameters: " + parameterPart);
+        }
+        params.put(keyValues[0], keyValues[1]);
+      }
+    }
+
+    if (params.containsKey("table")) {
+      connInfo.tableName = params.remove("table");
+    }
+
+    if (params.containsKey("user")) {
+      connInfo.user = params.remove("user");
+    }
+    if (params.containsKey("password")) {
+      connInfo.password = params.remove("password");
+    }
+
+    connInfo.params = params;
+
+    return connInfo;
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/JdbcMetadataProviderBase.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/JdbcMetadataProviderBase.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/JdbcMetadataProviderBase.java
new file mode 100644
index 0000000..89de790
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/JdbcMetadataProviderBase.java
@@ -0,0 +1,244 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.mysql;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.tajo.catalog.*;
+import org.apache.tajo.common.TajoDataTypes.Type;
+import org.apache.tajo.exception.*;
+import org.apache.tajo.util.KeyValueSet;
+import org.apache.tajo.util.Pair;
+
+import javax.annotation.Nullable;
+import java.net.URI;
+import java.sql.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import static org.apache.tajo.catalog.CatalogUtil.newSimpleDataType;
+
+public abstract class JdbcMetadataProviderBase implements MetadataProvider {
+  protected static final Log LOG = LogFactory.getLog(JdbcMetadataProviderBase.class);
+
+  protected final JdbcTablespace space;
+  protected final String databaseName;
+
+  protected final String jdbcUri;
+  protected final String username;
+  protected final String password;
+
+  protected final Connection connection;
+
+  public JdbcMetadataProviderBase(JdbcTablespace space, String dbName) {
+    this.space = space;
+    this.databaseName = dbName;
+
+    ConnectionInfo connInfo = ConnectionInfo.fromURI(space.getUri());
+    this.jdbcUri  = space.getUri().toASCIIString();
+    this.username = connInfo.user();
+    this.password = connInfo.password();
+
+    try {
+      Class.forName(getJdbcDriverName()).newInstance();
+      LOG.info(getJdbcDriverName() + " is loaded...");
+    } catch (Exception e) {
+      throw new TajoInternalError(e);
+    }
+
+    try {
+      connection = DriverManager.getConnection(jdbcUri, this.username, this.password);
+    } catch (SQLException e) {
+      throw new TajoInternalError(e);
+    }
+  }
+
+  @Override
+  public String getTablespaceName() {
+    return space.getName();
+  }
+
+  @Override
+  public URI getTablespaceUri() {
+    return space.getUri();
+  }
+
+  @Override
+  public String getDatabaseName() {
+    return databaseName;
+  }
+
+  @Override
+  public Collection<String> getSchemas() {
+    return Collections.EMPTY_SET;
+  }
+
+  @Override
+  public Collection<String> getTables(@Nullable String schemaPattern, @Nullable String tablePattern) {
+    ResultSet res = null;
+    List<String> tableNames = Lists.newArrayList();
+    try {
+      res = connection.getMetaData().getTables(databaseName, schemaPattern, tablePattern, null);
+      while(res.next()) {
+        tableNames.add(res.getString("TABLE_NAME"));
+      }
+    } catch (SQLException e) {
+      throw new TajoInternalError(e);
+    } finally {
+      try {
+        if (res != null) {
+          res.close();
+        }
+      } catch (SQLException e) {
+        LOG.warn(e);
+      }
+    }
+
+    return tableNames;
+  }
+
+  private TypeDesc convertDataType(ResultSet res) throws SQLException {
+    final int typeId = res.getInt("DATA_TYPE");
+
+    switch (typeId ) {
+    case Types.BOOLEAN:
+      return new TypeDesc(newSimpleDataType(Type.BOOLEAN));
+
+    case Types.TINYINT:
+    case Types.SMALLINT:
+    case Types.INTEGER:
+      return new TypeDesc(newSimpleDataType(Type.INT4));
+
+    case Types.BIGINT:
+      return new TypeDesc(newSimpleDataType(Type.INT8));
+
+    case Types.FLOAT:
+      return new TypeDesc(newSimpleDataType(Type.FLOAT4));
+
+    case Types.NUMERIC:
+    case Types.DECIMAL:
+    case Types.DOUBLE:
+      return new TypeDesc(newSimpleDataType(Type.FLOAT8));
+
+    case Types.DATE:
+      return new TypeDesc(newSimpleDataType(Type.DATE));
+
+    case Types.TIME:
+      return new TypeDesc(newSimpleDataType(Type.TIME));
+
+    case Types.TIMESTAMP:
+      return new TypeDesc(newSimpleDataType(Type.TIMESTAMP));
+
+    case Types.CHAR:
+    case Types.NCHAR:
+    case Types.VARCHAR:
+    case Types.NVARCHAR:
+    case Types.CLOB:
+    case Types.NCLOB:
+    case Types.LONGVARCHAR:
+    case Types.LONGNVARCHAR:
+      return new TypeDesc(newSimpleDataType(Type.TEXT));
+
+    case Types.BINARY:
+    case Types.VARBINARY:
+    case Types.BLOB:
+      return new TypeDesc(newSimpleDataType(Type.BLOB));
+
+    default:
+      throw SQLExceptionUtil.toSQLException(new UnsupportedDataTypeException(typeId + ""));
+    }
+  }
+
+  @Override
+  public TableDesc getTableDescriptor(String schemaName, String tableName) throws UndefinedTablespaceException {
+    ResultSet resultForTable = null;
+    ResultSet resultForColumns = null;
+    try {
+
+      // get table name
+      resultForTable = connection.getMetaData().getTables(databaseName, schemaName, tableName, null);
+
+      if (!resultForTable.next()) {
+        throw new UndefinedTablespaceException(tableName);
+      }
+      final String name = resultForTable.getString("TABLE_NAME");
+
+      // get columns
+      resultForColumns = connection.getMetaData().getColumns(databaseName, schemaName, tableName, null);
+
+      List<Pair<Integer, Column>> columns = Lists.newArrayList();
+
+      while(resultForColumns.next()) {
+        final int ordinalPos = resultForColumns.getInt("ORDINAL_POSITION");
+        final String qualifier = resultForColumns.getString("TABLE_NAME");
+        final String columnName = resultForColumns.getString("COLUMN_NAME");
+        final TypeDesc type = convertDataType(resultForColumns);
+        final Column c = new Column(CatalogUtil.buildFQName(qualifier, columnName), type);
+
+        columns.add(new Pair<>(ordinalPos, c));
+      }
+
+      // sort columns in an order of ordinal position
+      Collections.sort(columns, new Comparator<Pair<Integer, Column>>() {
+        @Override
+        public int compare(Pair<Integer, Column> o1, Pair<Integer, Column> o2) {
+          return o1.getFirst() - o2.getFirst();
+        }
+      });
+
+      // transform the pair list into collection for columns
+      Schema schema = new Schema(Collections2.transform(columns, new Function<Pair<Integer,Column>, Column>() {
+        @Override
+        public Column apply(@Nullable Pair<Integer, Column> columnPair) {
+          return columnPair.getSecond();
+        }
+      }));
+
+      return new TableDesc(
+          CatalogUtil.buildFQName(databaseName, name),
+          schema,
+          new TableMeta("rowstore", new KeyValueSet()),
+          space.getTableUri(databaseName, name)
+      );
+
+    } catch (SQLException e) {
+      throw new TajoInternalError(e);
+    } finally {
+      try {
+        if (resultForTable != null) {
+          resultForTable.close();
+        }
+
+        if (resultForColumns != null) {
+          resultForColumns.close();
+        }
+
+      } catch (SQLException e) {
+        LOG.warn(e);
+      }
+    }
+  }
+
+  protected abstract String getJdbcDriverName();
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/JdbcTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/JdbcTablespace.java b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/JdbcTablespace.java
new file mode 100644
index 0000000..555a6ae
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/main/java/org/apache/tajo/storage/mysql/JdbcTablespace.java
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.mysql;
+
+import net.minidev.json.JSONObject;
+import org.apache.hadoop.fs.Path;
+import org.apache.tajo.ExecutionBlockId;
+import org.apache.tajo.OverridableConf;
+import org.apache.tajo.catalog.*;
+import org.apache.tajo.plan.LogicalPlan;
+import org.apache.tajo.plan.logical.LogicalNode;
+import org.apache.tajo.plan.logical.ScanNode;
+import org.apache.tajo.storage.FormatProperty;
+import org.apache.tajo.storage.StorageProperty;
+import org.apache.tajo.storage.Tablespace;
+import org.apache.tajo.storage.TupleRange;
+import org.apache.tajo.storage.fragment.Fragment;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.List;
+
+/**
+ * <h3>URI Examples:</h3>
+ * <ul>
+ *   <li>jdbc:mysql//primaryhost,secondaryhost1,secondaryhost2/test?profileSQL=true</li>
+ * </ul>
+ */
+public abstract class JdbcTablespace extends Tablespace {
+
+  static final StorageProperty STORAGE_PROPERTY = new StorageProperty("rowstore", false, true, false, true);
+
+
+  public JdbcTablespace(String name, URI uri, JSONObject config) {
+    super(name, uri, config);
+  }
+
+  @Override
+  protected void storageInit() throws IOException {
+
+  }
+
+  @Override
+  public long getTableVolume(URI uri) throws IOException {
+    return 0;
+  }
+
+  @Override
+  public URI getTableUri(String databaseName, String tableName) {
+    return URI.create(getUri() + "&table=" + tableName);
+  }
+
+  @Override
+  public List<Fragment> getSplits(String fragmentId, TableDesc tableDesc, ScanNode scanNode) throws IOException {
+    return null;
+  }
+
+  @Override
+  public List<Fragment> getNonForwardSplit(TableDesc tableDesc, int currentPage, int numFragments) throws IOException {
+    return null;
+  }
+
+  @Override
+  public StorageProperty getProperty() {
+    return STORAGE_PROPERTY;
+  }
+
+  @Override
+  public FormatProperty getFormatProperty(TableMeta meta) {
+    return null;
+  }
+
+  @Override
+  public void close() {
+
+  }
+
+  @Override
+  public TupleRange[] getInsertSortRanges(OverridableConf queryContext,
+                                          TableDesc tableDesc,
+                                          Schema inputSchema,
+                                          SortSpec[] sortSpecs,
+                                          TupleRange dataRange) throws IOException {
+    return new TupleRange[0];
+  }
+
+  @Override
+  public void verifySchemaToWrite(TableDesc tableDesc, Schema outSchema) {
+
+  }
+
+  @Override
+  public void createTable(TableDesc tableDesc, boolean ifNotExists) throws IOException {
+  }
+
+  @Override
+  public void purgeTable(TableDesc tableDesc) throws IOException {
+
+  }
+
+  @Override
+  public void prepareTable(LogicalNode node) throws IOException {
+
+  }
+
+  @Override
+  public Path commitTable(OverridableConf queryContext, ExecutionBlockId finalEbId, LogicalPlan plan, Schema schema,
+                          TableDesc tableDesc) throws IOException {
+    return null;
+  }
+
+  @Override
+  public void rollbackTable(LogicalNode node) throws IOException {
+
+  }
+
+  @Override
+  public URI getStagingUri(OverridableConf context, String queryId, TableMeta meta) throws IOException {
+    return null;
+  }
+
+  public abstract MetadataProvider getMetadataProvider();
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java
deleted file mode 100644
index c8ebe7a..0000000
--- a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/JdbcTablespaceTestBase.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.jdbc;
-
-import org.apache.tajo.QueryTestCaseBase;
-import org.apache.tajo.storage.TablespaceManager;
-import org.apache.tajo.util.FileUtil;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-import java.io.IOException;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-public abstract class JdbcTablespaceTestBase extends QueryTestCaseBase {
-
-  @BeforeClass
-  public static void setUp() throws Exception {
-  }
-
-  @AfterClass
-  public static void tearDown() {
-  }
-
-  protected void prepareDefaultTables(Statement statement) throws IOException, SQLException {
-    statement.addBatch(FileUtil.readTextFileFromResource("table_ddl/all_types"));
-    statement.executeBatch();
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestConnectionInfo.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestConnectionInfo.java b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestConnectionInfo.java
deleted file mode 100644
index 1ccd322..0000000
--- a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/jdbc/TestConnectionInfo.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.jdbc;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-public class TestConnectionInfo {
-  @Test
-  public final void testGetConnectionInfoType1() {
-    ConnectionInfo c1 = ConnectionInfo.fromURI("jdbc:mysql://localhost:55840?user=testuser&password=testpass");
-    assertEquals("jdbc:mysql", c1.scheme);
-    assertEquals("testuser", c1.user);
-    assertEquals("testpass", c1.password);
-    assertNull(c1.dbName);
-    assertNull(c1.tableName);
-    assertEquals(0, c1.params.size());
-  }
-
-  @Test
-  public final void testGetConnectionInfoType2() {
-    ConnectionInfo c1 = ConnectionInfo.fromURI(
-        "jdbc:mysql://localhost:55840/db1?table=tb1&user=testuser&password=testpass&TZ=GMT+9");
-    assertEquals("jdbc:mysql", c1.scheme);
-    assertEquals("testuser", c1.user);
-    assertEquals("testpass", c1.password);
-    assertEquals("db1", c1.dbName);
-    assertEquals("tb1", c1.tableName);
-    assertEquals(1, c1.params.size());
-    assertEquals("GMT+9", c1.params.get("TZ"));
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/mysql/JdbcTablespaceTestBase.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/mysql/JdbcTablespaceTestBase.java b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/mysql/JdbcTablespaceTestBase.java
new file mode 100644
index 0000000..1e4343d
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/mysql/JdbcTablespaceTestBase.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.mysql;
+
+import org.apache.tajo.util.FileUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+import java.io.IOException;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+public abstract class JdbcTablespaceTestBase {
+
+  @BeforeClass
+  public static void setUp() throws Exception {
+  }
+
+  @AfterClass
+  public static void tearDown() {
+  }
+
+  protected void prepareDefaultTables(Statement statement) throws IOException, SQLException {
+    statement.addBatch(FileUtil.readTextFileFromResource("table_ddl/all_types"));
+    statement.executeBatch();
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/mysql/TestConnectionInfo.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/mysql/TestConnectionInfo.java b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/mysql/TestConnectionInfo.java
new file mode 100644
index 0000000..9da73d9
--- /dev/null
+++ b/tajo-storage/tajo-storage-jdbc/src/test/java/org/apache/tajo/storage/mysql/TestConnectionInfo.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.mysql;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+public class TestConnectionInfo {
+  @Test
+  public final void testGetConnectionInfoType1() {
+    ConnectionInfo c1 = ConnectionInfo.fromURI("jdbc:mysql://localhost:55840?user=testuser&password=testpass");
+    assertEquals("jdbc:mysql", c1.scheme);
+    assertEquals("testuser", c1.user);
+    assertEquals("testpass", c1.password);
+    assertNull(c1.dbName);
+    assertNull(c1.tableName);
+    assertEquals(0, c1.params.size());
+  }
+
+  @Test
+  public final void testGetConnectionInfoType2() {
+    ConnectionInfo c1 = ConnectionInfo.fromURI(
+        "jdbc:mysql://localhost:55840/db1?table=tb1&user=testuser&password=testpass&TZ=GMT+9");
+    assertEquals("jdbc:mysql", c1.scheme);
+    assertEquals("testuser", c1.user);
+    assertEquals("testpass", c1.password);
+    assertEquals("db1", c1.dbName);
+    assertEquals("tb1", c1.tableName);
+    assertEquals(1, c1.params.size());
+    assertEquals("GMT+9", c1.params.get("TZ"));
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-mysql/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/pom.xml b/tajo-storage/tajo-storage-mysql/pom.xml
index ff68b59..0484213 100644
--- a/tajo-storage/tajo-storage-mysql/pom.xml
+++ b/tajo-storage/tajo-storage-mysql/pom.xml
@@ -52,9 +52,10 @@
         <artifactId>apache-rat-plugin</artifactId>
         <configuration>
           <excludes>
-            <exclude>src/main/resources/*.json</exclude>
-            <exclude>src/test/resources/*.json</exclude>
-            <exclude>src/test/resources/tpch/*.sql</exclude>
+            <exclude>src/test/resources/dataset/**</exclude>
+            <exclude>src/test/resources/queries/**</exclude>
+            <exclude>src/test/resources/results/**</exclude>
+            <exclude>src/test/resources/tpch/**</exclude>
           </excludes>
         </configuration>
         <executions>
@@ -128,15 +129,76 @@
       <groupId>org.apache.tajo</groupId>
       <artifactId>tajo-storage-jdbc</artifactId>
       <type>test-jar</type>
-      <scope>provided</scope>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.tajo</groupId>
       <artifactId>tajo-cluster-tests</artifactId>
       <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-common</artifactId>
       <scope>provided</scope>
     </dependency>
     <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-minicluster</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-el</groupId>
+          <artifactId>commons-el</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-runtime</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-compiler</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.mortbay.jetty</groupId>
+          <artifactId>jsp-2.1-jetty</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.sun.jersey.jersey-test-framework</groupId>
+          <artifactId>jersey-test-framework-grizzly2</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdfs</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-el</groupId>
+          <artifactId>commons-el</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-runtime</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-compiler</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.mortbay.jetty</groupId>
+          <artifactId>jsp-2.1-jetty</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.sun.jersey.jersey-test-framework</groupId>
+          <artifactId>jersey-test-framework-grizzly2</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLMetadataProvider.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLMetadataProvider.java b/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLMetadataProvider.java
index 33edb5c..2d94460 100644
--- a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLMetadataProvider.java
+++ b/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLMetadataProvider.java
@@ -18,8 +18,6 @@
 
 package org.apache.tajo.storage.mysql;
 
-import org.apache.tajo.storage.jdbc.JdbcMetadataProviderBase;
-
 public class MySQLMetadataProvider extends JdbcMetadataProviderBase {
 
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java b/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java
index 93815b0..95d860d 100644
--- a/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java
+++ b/tajo-storage/tajo-storage-mysql/src/main/java/org/apache/tajo/storage/mysql/MySQLTablespace.java
@@ -19,25 +19,10 @@
 package org.apache.tajo.storage.mysql;
 
 import net.minidev.json.JSONObject;
-import org.apache.hadoop.fs.Path;
-import org.apache.tajo.ExecutionBlockId;
-import org.apache.tajo.OverridableConf;
 import org.apache.tajo.catalog.*;
-import org.apache.tajo.exception.UnsupportedException;
-import org.apache.tajo.plan.LogicalPlan;
-import org.apache.tajo.plan.logical.LogicalNode;
-import org.apache.tajo.plan.logical.ScanNode;
-import org.apache.tajo.storage.FormatProperty;
-import org.apache.tajo.storage.StorageProperty;
-import org.apache.tajo.storage.Tablespace;
-import org.apache.tajo.storage.TupleRange;
-import org.apache.tajo.storage.fragment.Fragment;
-import org.apache.tajo.storage.jdbc.*;
+import org.apache.tajo.storage.*;
 
-import java.io.IOException;
 import java.net.URI;
-import java.util.List;
-import java.util.Map;
 
 /**
  * <h3>URI Examples:</h3>
@@ -46,12 +31,14 @@ import java.util.Map;
  * </ul>
  */
 public class MySQLTablespace extends JdbcTablespace {
+  private final String database;
 
   public MySQLTablespace(String name, URI uri, JSONObject config) {
     super(name, uri, config);
+    database = ((JSONObject)config.get(TablespaceManager.TABLESPACE_SPEC_CONFIGS_KEY)).getAsString("database");
   }
 
   public MetadataProvider getMetadataProvider() {
-    return new MySQLMetadataProvider(this, "db1");
+    return new MySQLMetadataProvider(this, database);
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
deleted file mode 100644
index 44eb6c4..0000000
--- a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/jdbc/TestMysqlJdbcTableSpace.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tajo.storage.jdbc;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-import io.airlift.testing.mysql.TestingMySqlServer;
-import org.apache.tajo.catalog.MetadataProvider;
-import org.apache.tajo.catalog.Schema;
-import org.apache.tajo.catalog.TableDesc;
-import org.apache.tajo.conf.TajoConf;
-import org.apache.tajo.storage.TablespaceManager;
-import org.apache.tajo.storage.mysql.MySQLTablespace;
-import org.apache.tajo.util.FileUtil;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.net.URI;
-import java.sql.*;
-import java.util.Set;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-public class TestMysqlJdbcTableSpace extends JdbcTablespaceTestBase {
-
-  static TestingMySqlServer server;
-
-  public TestMysqlJdbcTableSpace() throws Exception {
-    server = new TestingMySqlServer("testuser", "testpass",
-        "tpch"
-    );
-
-    MySQLTablespace mysqlTablespace = new MySQLTablespace("mysql_cluster", URI.create(server.getJdbcUrl()), null);
-    mysqlTablespace.init(new TajoConf());
-    TablespaceManager.addTableSpaceForTest(mysqlTablespace);
-  }
-
-  @BeforeClass
-  public static void setUp() throws IOException, SQLException {
-    prepareTables();
-  }
-
-  @Test
-  public void testGeneral() {
-    assertTrue(server.isRunning());
-    assertTrue(server.isReadyForConnections());
-    assertEquals(server.getMySqlVersion(), "5.5.9");
-    assertEquals(server.getDatabases(), ImmutableSet.of("basic"));
-    assertEquals(server.getUser(), "testuser");
-    assertEquals(server.getPassword(), "testpass");
-    assertEquals(server.getJdbcUrl().substring(0, 5), "jdbc:");
-    assertEquals(server.getPort(), URI.create(server.getJdbcUrl().substring(5)).getPort());
-  }
-
-  @Test
-  public void testTablespaceHandler() throws Exception {
-    assertTrue((TablespaceManager.getByName("mysql_cluster").get()) instanceof MySQLTablespace);
-    assertEquals("mysql_cluster", (TablespaceManager.getByName("mysql_cluster").get().getName()));
-
-    assertTrue((TablespaceManager.get(server.getJdbcUrl()).get()) instanceof MySQLTablespace);
-    assertTrue((TablespaceManager.get(server.getJdbcUrl() + "&table=tb1").get()) instanceof MySQLTablespace);
-
-    assertEquals(server.getJdbcUrl(), TablespaceManager.get(server.getJdbcUrl()).get().getUri().toASCIIString());
-  }
-
-  static final String [] TPCH_TABLES = {
-      "customer", "lineitem", "nation", "orders", "part", "partsupp", "region", "supplier"
-  };
-
-  private static void prepareTables() throws SQLException, IOException {
-    try (Connection connection = DriverManager.getConnection(server.getJdbcUrl())) {
-      connection.setCatalog("tpch");
-      try (Statement statement = connection.createStatement()) {
-        statement.executeUpdate(FileUtil.readTextFileFromResource("tpch/" + TPCH_TABLES + ".sql"));
-      }
-    }
-  }
-
-  @Test
-  public void testMetadataProvider() throws Exception {
-    MySQLTablespace tablespace = (MySQLTablespace) TablespaceManager.get(server.getJdbcUrl()).get();
-    MetadataProvider provider = tablespace.getMetadataProvider();
-
-    Set<String> tables = Sets.newHashSet(provider.getTables(null, null));
-    assertEquals(Sets.newHashSet(TPCH_TABLES), tables);
-
-//    TableDesc desc = provider.getTableDescriptor("", "t2");
-//    assertEquals(tablespace.getUri() + "&table=t2", desc.getUri().toASCIIString());
-//
-//    Schema schema = desc.getSchema();
-//    System.out.println(">>> " + schema);
-  }
-}

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/EmbedMySQLServer.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/EmbedMySQLServer.java b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/EmbedMySQLServer.java
new file mode 100644
index 0000000..119ae56
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/EmbedMySQLServer.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.mysql;
+
+import io.airlift.testing.mysql.TestingMySqlServer;
+import net.minidev.json.JSONObject;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.tajo.conf.TajoConf;
+import org.apache.tajo.storage.TablespaceManager;
+import org.apache.tajo.util.FileUtil;
+
+import java.io.IOException;
+import java.net.URI;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+
+public class EmbedMySQLServer {
+  private static final Log LOG = LogFactory.getLog(EmbedMySQLServer.class);
+
+  private static EmbedMySQLServer instance;
+
+  public static final String [] TPCH_TABLES = {
+      "customer", "lineitem", "nation", "orders", "part", "partsupp", "region", "supplier"
+  };
+
+  public static final String SPACENAME = "mysql_cluster";
+  public static final String DATABASE_NAME = "tpch";
+
+  private TestingMySqlServer server;
+
+  static {
+    try {
+      instance = new EmbedMySQLServer();
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  public static EmbedMySQLServer getInstance() {
+    return instance;
+  }
+
+  private EmbedMySQLServer() throws Exception {
+    server = new TestingMySqlServer("testuser", "testpass",
+        "tpch"
+    );
+
+    loadTPCHTables();
+    registerTablespace();
+  }
+
+  private void loadTPCHTables() throws SQLException, IOException {
+    try (Connection connection = DriverManager.getConnection(server.getJdbcUrl())) {
+      connection.setCatalog("tpch");
+
+      try (Statement statement = connection.createStatement()) {
+        for (String tableName : TPCH_TABLES) {
+          String sql = FileUtil.readTextFileFromResource("tpch/" + tableName + ".sql");
+          statement.addBatch(sql);
+        }
+
+        try {
+          statement.executeBatch();
+        } catch (SQLException e) {
+          LOG.error(e);
+        }
+      }
+    }
+  }
+
+  private void registerTablespace() throws IOException {
+    JSONObject configElements = new JSONObject();
+    configElements.put("database", DATABASE_NAME);
+
+    Map<String, JSONObject> configMap = new HashMap<>();
+    configMap.put(TablespaceManager.TABLESPACE_SPEC_CONFIGS_KEY, configElements);
+    JSONObject config = new JSONObject(configMap);
+
+    MySQLTablespace mysqlTablespace = new MySQLTablespace(SPACENAME, URI.create(server.getJdbcUrl()), config);
+    mysqlTablespace.init(new TajoConf());
+
+    TablespaceManager.addTableSpaceForTest(mysqlTablespace);
+  }
+
+  public boolean isRunning() {
+    return server.isRunning();
+  }
+
+  public String getJdbcUrl() {
+    return server.getJdbcUrl();
+  }
+
+  public TestingMySqlServer getServer() {
+    return server;
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMySQLMetadataProvider.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMySQLMetadataProvider.java b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMySQLMetadataProvider.java
new file mode 100644
index 0000000..bd3fcaf
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMySQLMetadataProvider.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.mysql;
+
+import com.facebook.presto.hive.shaded.com.google.common.base.Function;
+import com.facebook.presto.hive.shaded.com.google.common.collect.Collections2;
+import com.facebook.presto.hive.shaded.com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import org.apache.tajo.catalog.MetadataProvider;
+import org.apache.tajo.catalog.TableDesc;
+import org.apache.tajo.storage.Tablespace;
+import org.apache.tajo.storage.TablespaceManager;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+public class TestMySQLMetadataProvider {
+  static final String jdbcUrl = EmbedMySQLServer.getInstance().getJdbcUrl();
+
+  @BeforeClass
+  public static void setUp() throws Exception {
+  }
+
+  @Test
+  public void testGetTablespaceName() throws Exception {
+    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
+    MetadataProvider provider = tablespace.getMetadataProvider();
+    assertEquals("mysql_cluster", provider.getTablespaceName());
+  }
+
+  @Test
+  public void testGetDatabaseName() throws Exception {
+    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
+    MetadataProvider provider = tablespace.getMetadataProvider();
+    assertEquals("tpch", provider.getDatabaseName());
+  }
+
+  @Test
+  public void testGetSchemas() throws Exception {
+    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
+    MetadataProvider provider = tablespace.getMetadataProvider();
+    assertTrue(provider.getSchemas().isEmpty());
+  }
+
+  @Test
+  public void testGetTables() throws Exception {
+    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
+    MetadataProvider provider = tablespace.getMetadataProvider();
+
+    List<String> tables = Lists.newArrayList(provider.getTables(null, null));
+    Collection<String> uppercases = Collections2.transform(tables, new Function<String, String>() {
+      @Override
+      public String apply(String s) {
+        return s.toLowerCase();
+      }
+    });
+    Set<String> found = Sets.newHashSet(uppercases);
+    assertEquals(Sets.newHashSet(EmbedMySQLServer.TPCH_TABLES), found);
+  }
+
+  @Test
+  public void testGetTableDescriptor() throws Exception {
+    Tablespace tablespace = TablespaceManager.get(jdbcUrl).get();
+    MetadataProvider provider = tablespace.getMetadataProvider();
+
+    for (String tableName : EmbedMySQLServer.TPCH_TABLES) {
+      TableDesc table = provider.getTableDescriptor(null, tableName.toUpperCase());
+      assertEquals("tpch." + tableName.toUpperCase(), table.getName());
+      assertEquals(jdbcUrl + "&table=" + tableName.toUpperCase(), table.getUri().toASCIIString());
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMysqlJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMysqlJdbcTableSpace.java b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMysqlJdbcTableSpace.java
new file mode 100644
index 0000000..df377b6
--- /dev/null
+++ b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMysqlJdbcTableSpace.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tajo.storage.mysql;
+
+import com.google.common.collect.ImmutableSet;
+import io.airlift.testing.mysql.TestingMySqlServer;
+import org.apache.tajo.storage.TablespaceManager;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.net.URI;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class TestMysqlJdbcTableSpace {
+  static String jdbcUrl = EmbedMySQLServer.getInstance().getJdbcUrl();
+
+
+  @BeforeClass
+  public static void setUp() throws Exception {
+  }
+
+  @Test
+  public void testGeneral() {
+    TestingMySqlServer server = EmbedMySQLServer.getInstance().getServer();
+    assertTrue(server.isRunning());
+    assertTrue(server.isReadyForConnections());
+    assertEquals(server.getMySqlVersion(), "5.5.9");
+    assertEquals(server.getDatabases(), ImmutableSet.of("tpch"));
+    assertEquals(server.getUser(), "testuser");
+    assertEquals(server.getPassword(), "testpass");
+    assertEquals(server.getJdbcUrl().substring(0, 5), "jdbc:");
+    assertEquals(server.getPort(), URI.create(server.getJdbcUrl().substring(5)).getPort());
+  }
+
+  @Test
+  public void testTablespace() throws Exception {
+    assertTrue((TablespaceManager.getByName("mysql_cluster").get()) instanceof MySQLTablespace);
+    assertEquals("mysql_cluster", (TablespaceManager.getByName("mysql_cluster").get().getName()));
+
+    assertTrue((TablespaceManager.get(jdbcUrl).get()) instanceof MySQLTablespace);
+    assertTrue((TablespaceManager.get(jdbcUrl + "&table=tb1").get()) instanceof MySQLTablespace);
+
+    assertEquals(jdbcUrl, TablespaceManager.get(jdbcUrl).get().getUri().toASCIIString());
+    assertTrue(TablespaceManager.get(jdbcUrl).get().getMetadataProvider() instanceof MySQLMetadataProvider);
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-pgsql/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/pom.xml b/tajo-storage/tajo-storage-pgsql/pom.xml
index c24562d..69b5c55 100644
--- a/tajo-storage/tajo-storage-pgsql/pom.xml
+++ b/tajo-storage/tajo-storage-pgsql/pom.xml
@@ -52,8 +52,10 @@
         <artifactId>apache-rat-plugin</artifactId>
         <configuration>
           <excludes>
-            <exclude>src/main/resources/*.json</exclude>
-            <exclude>src/test/resources/*.json</exclude>
+            <exclude>src/test/resources/dataset/**</exclude>
+            <exclude>src/test/resources/queries/**</exclude>
+            <exclude>src/test/resources/results/**</exclude>
+            <exclude>src/test/resources/tpch/**</exclude>
           </excludes>
         </configuration>
         <executions>
@@ -114,11 +116,76 @@
     </dependency>
     <dependency>
       <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-storage-hdfs</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
       <artifactId>tajo-storage-jdbc</artifactId>
       <scope>provided</scope>
     </dependency>
 
     <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-common</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-minicluster</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-el</groupId>
+          <artifactId>commons-el</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-runtime</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-compiler</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.mortbay.jetty</groupId>
+          <artifactId>jsp-2.1-jetty</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.sun.jersey.jersey-test-framework</groupId>
+          <artifactId>jersey-test-framework-grizzly2</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdfs</artifactId>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-el</groupId>
+          <artifactId>commons-el</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-runtime</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>tomcat</groupId>
+          <artifactId>jasper-compiler</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.mortbay.jetty</groupId>
+          <artifactId>jsp-2.1-jetty</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.sun.jersey.jersey-test-framework</groupId>
+          <artifactId>jersey-test-framework-grizzly2</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
       <groupId>com.google.protobuf</groupId>
       <artifactId>protobuf-java</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLMetadataProvider.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLMetadataProvider.java b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLMetadataProvider.java
index 60a1cdd..abb9bab 100644
--- a/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLMetadataProvider.java
+++ b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLMetadataProvider.java
@@ -18,7 +18,10 @@
 
 package org.apache.tajo.storage.pgsql;
 
-import org.apache.tajo.storage.jdbc.JdbcMetadataProviderBase;
+import org.apache.tajo.storage.mysql.JdbcMetadataProviderBase;
+
+import javax.annotation.Nullable;
+import java.util.Collection;
 
 public class PgSQLMetadataProvider extends JdbcMetadataProviderBase {
 
@@ -30,4 +33,9 @@ public class PgSQLMetadataProvider extends JdbcMetadataProviderBase {
   protected String getJdbcDriverName() {
     return "org.postgresql.Driver";
   }
+
+  @Override
+  public Collection<String> getTables(@Nullable String schemaPattern, @Nullable String tablePattern) {
+    return super.getTables("public", tablePattern);
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
index 6ccc288..2237cce 100644
--- a/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
+++ b/tajo-storage/tajo-storage-pgsql/src/main/java/org/apache/tajo/storage/pgsql/PgSQLTablespace.java
@@ -20,7 +20,8 @@ package org.apache.tajo.storage.pgsql;
 
 import net.minidev.json.JSONObject;
 import org.apache.tajo.catalog.MetadataProvider;
-import org.apache.tajo.storage.jdbc.JdbcTablespace;
+import org.apache.tajo.storage.TablespaceManager;
+import org.apache.tajo.storage.mysql.JdbcTablespace;
 
 import java.net.URI;
 
@@ -31,12 +32,15 @@ import java.net.URI;
  * </ul>
  */
 public class PgSQLTablespace extends JdbcTablespace {
+  private final String database;
+
 
   public PgSQLTablespace(String name, URI uri, JSONObject config) {
     super(name, uri, config);
+    database = ((JSONObject)config.get(TablespaceManager.TABLESPACE_SPEC_CONFIGS_KEY)).getAsString("database");
   }
 
   public MetadataProvider getMetadataProvider() {
-    return new PgSQLMetadataProvider(this, "db1");
+    return new PgSQLMetadataProvider(this, database);
   }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/2cf88d02/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java
new file mode 100644
index 0000000..dfdfc74
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/EmbedPgSQLServer.java
@@ -0,0 +1,95 @@
+package org.apache.tajo.storage.pgsql;
+
+import io.airlift.testing.postgresql.TestingPostgreSqlServer;
+import net.minidev.json.JSONObject;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.tajo.conf.TajoConf;
+import org.apache.tajo.storage.TablespaceManager;
+import org.apache.tajo.util.FileUtil;
+
+import java.io.IOException;
+import java.net.URI;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Map;
+
+public class EmbedPgSQLServer {
+  private static final Log LOG = LogFactory.getLog(EmbedPgSQLServer.class);
+
+  private static EmbedPgSQLServer instance;
+
+  public static final String [] TPCH_TABLES = {
+      "customer", "lineitem", "nation", "orders", "part", "partsupp", "region", "supplier"
+  };
+
+  public static final String SPACENAME = "pgsql_cluster";
+  public static final String DATABASE_NAME = "tpch";
+
+  private TestingPostgreSqlServer server;
+
+  static {
+    try {
+      instance = new EmbedPgSQLServer();
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  public static EmbedPgSQLServer getInstance() {
+    return instance;
+  }
+
+  private EmbedPgSQLServer() throws Exception {
+    server = new TestingPostgreSqlServer("testuser",
+        "tpch"
+    );
+
+    loadTPCHTables();
+    registerTablespace();
+  }
+
+  private void loadTPCHTables() throws SQLException, IOException {
+    try (Connection connection = DriverManager.getConnection(server.getJdbcUrl())) {
+      connection.setCatalog("tpch");
+
+      try (Statement statement = connection.createStatement()) {
+        for (String tableName : TPCH_TABLES) {
+          String sql = FileUtil.readTextFileFromResource("tpch/" + tableName + ".sql");
+          statement.addBatch(sql);
+        }
+
+        try {
+          statement.executeBatch();
+        } catch (SQLException e) {
+          LOG.error(e);
+        }
+      }
+    }
+  }
+
+  private void registerTablespace() throws IOException {
+    JSONObject configElements = new JSONObject();
+    configElements.put("database", DATABASE_NAME);
+
+    Map<String, JSONObject> configMap = new HashMap<>();
+    configMap.put(TablespaceManager.TABLESPACE_SPEC_CONFIGS_KEY, configElements);
+    JSONObject config = new JSONObject(configMap);
+
+    PgSQLTablespace tablespace = new PgSQLTablespace(SPACENAME, URI.create(server.getJdbcUrl()), config);
+    tablespace.init(new TajoConf());
+
+    TablespaceManager.addTableSpaceForTest(tablespace);
+  }
+
+  public String getJdbcUrl() {
+    return server.getJdbcUrl();
+  }
+
+  public TestingPostgreSqlServer getServer() {
+    return server;
+  }
+}


[30/39] tajo git commit: Add PgSQLEndPointsTests.

Posted by hy...@apache.org.
Add PgSQLEndPointsTests.


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/0ca28025
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/0ca28025
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/0ca28025

Branch: refs/heads/TAJO-1730
Commit: 0ca28025c6048c4aa847a5b905430e153375d866
Parents: 8b76167
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sat Aug 22 01:30:46 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sat Aug 22 01:30:46 2015 +0900

----------------------------------------------------------------------
 .../org/apache/tajo/catalog/CatalogServer.java  |  8 ++-
 .../java/org/apache/tajo/master/TajoMaster.java |  9 ++++
 .../exec/NonForwardQueryResultFileScanner.java  |  2 +-
 .../storage/mysql/TestMysqlJdbcTableSpace.java  |  2 +-
 tajo-storage/tajo-storage-pgsql/pom.xml         |  6 +++
 .../storage/pgsql/TestPgSQLEndPointTests.java   | 53 ++++++++++++++++++++
 .../tajo/storage/pgsql/TestPgSQLQueryTests.java | 17 +++++++
 .../dataset/TestPgSQLQueryTests/lineitem.csv    |  0
 .../queries/TestPgSQLQueryTests/select_all.sql  |  0
 .../TestPgSQLQueryTests/select_all.result       |  0
 10 files changed, 94 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/0ca28025/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
index 7ec4b7e..88e788c 100644
--- a/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
+++ b/tajo-catalog/tajo-catalog-server/src/main/java/org/apache/tajo/catalog/CatalogServer.java
@@ -18,6 +18,7 @@
 
 package org.apache.tajo.catalog;
 
+import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Function;
 import com.google.common.base.Objects;
 import com.google.common.base.Optional;
@@ -84,7 +85,7 @@ public class CatalogServer extends AbstractService {
   private Map<String, List<FunctionDescProto>> functions = new ConcurrentHashMap<String,
       List<FunctionDescProto>>();
 
-  private final LinkedMetadataManager linkedMetadataManager;
+  private LinkedMetadataManager linkedMetadataManager;
   private final InfoSchemaMetadataDictionary metaDictionary = new InfoSchemaMetadataDictionary();
 
   // RPC variables
@@ -188,6 +189,11 @@ public class CatalogServer extends AbstractService {
     super.serviceStop();
   }
 
+  @VisibleForTesting
+  public void refresh(Collection<MetadataProvider> metadataProviders) {
+    this.linkedMetadataManager = new LinkedMetadataManager(metadataProviders);
+  }
+
   public CatalogProtocolHandler getHandler() {
     return this.handler;
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/0ca28025/tajo-core/src/main/java/org/apache/tajo/master/TajoMaster.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/master/TajoMaster.java b/tajo-core/src/main/java/org/apache/tajo/master/TajoMaster.java
index cb6168e..e6bf94b 100644
--- a/tajo-core/src/main/java/org/apache/tajo/master/TajoMaster.java
+++ b/tajo-core/src/main/java/org/apache/tajo/master/TajoMaster.java
@@ -19,6 +19,7 @@
 package org.apache.tajo.master;
 
 import com.codahale.metrics.Gauge;
+import com.google.common.annotations.VisibleForTesting;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
@@ -407,6 +408,14 @@ public class TajoMaster extends CompositeService {
     LOG.info("Tajo Master main thread exiting");
   }
 
+  /**
+   * This is only for unit tests.
+   */
+  @VisibleForTesting
+  public void refresh() {
+    catalogServer.refresh(TablespaceManager.getMetadataProviders());
+  }
+
   public EventHandler getEventHandler() {
     return dispatcher.getEventHandler();
   }

http://git-wip-us.apache.org/repos/asf/tajo/blob/0ca28025/tajo-core/src/main/java/org/apache/tajo/master/exec/NonForwardQueryResultFileScanner.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/master/exec/NonForwardQueryResultFileScanner.java b/tajo-core/src/main/java/org/apache/tajo/master/exec/NonForwardQueryResultFileScanner.java
index 877e32b..5cd4e26 100644
--- a/tajo-core/src/main/java/org/apache/tajo/master/exec/NonForwardQueryResultFileScanner.java
+++ b/tajo-core/src/main/java/org/apache/tajo/master/exec/NonForwardQueryResultFileScanner.java
@@ -81,7 +81,7 @@ public class NonForwardQueryResultFileScanner implements NonForwardQueryResultSc
       FileTablespace fileTablespace = TUtil.checkTypeAndGet(tablespace, FileTablespace.class);
       fragments.addAll(Repartitioner.getFragmentsFromPartitionedTable(fileTablespace, scanNode, tableDesc));
     } else {
-      fragments.addAll(tablespace.getSplits(tableDesc.getName(), tableDesc, scanNode));
+      fragments.addAll(tablespace.getSplits(tableDesc.getName(), tableDesc, scanNode.getQual()));
     }
 
     if (!fragments.isEmpty()) {

http://git-wip-us.apache.org/repos/asf/tajo/blob/0ca28025/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMysqlJdbcTableSpace.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMysqlJdbcTableSpace.java b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMysqlJdbcTableSpace.java
index 6d2ad1b..f940abc 100644
--- a/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMysqlJdbcTableSpace.java
+++ b/tajo-storage/tajo-storage-mysql/src/test/java/org/apache/tajo/storage/mysql/TestMysqlJdbcTableSpace.java
@@ -30,7 +30,7 @@ import java.net.URI;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-public class TestMysqlJdbcTableSpace {
+public class TestMySQLJdbcTableSpace {
   static String jdbcUrl = EmbedMySQLServer.getInstance().getJdbcUrl();
 
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/0ca28025/tajo-storage/tajo-storage-pgsql/pom.xml
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/pom.xml b/tajo-storage/tajo-storage-pgsql/pom.xml
index 69b5c55..074950c 100644
--- a/tajo-storage/tajo-storage-pgsql/pom.xml
+++ b/tajo-storage/tajo-storage-pgsql/pom.xml
@@ -124,6 +124,12 @@
       <artifactId>tajo-storage-jdbc</artifactId>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.tajo</groupId>
+      <artifactId>tajo-cluster-tests</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
 
     <dependency>
       <groupId>org.apache.hadoop</groupId>

http://git-wip-us.apache.org/repos/asf/tajo/blob/0ca28025/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java
new file mode 100644
index 0000000..cd48ffd
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLEndPointTests.java
@@ -0,0 +1,53 @@
+package org.apache.tajo.storage.pgsql;
+
+import com.facebook.presto.hive.shaded.com.google.common.collect.Sets;
+import org.apache.tajo.QueryTestCaseBase;
+import org.apache.tajo.catalog.TableDesc;
+import org.apache.tajo.client.TajoClient;
+import org.apache.tajo.exception.UndefinedTableException;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.util.Set;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class TestPgSQLEndPointTests extends QueryTestCaseBase {
+  private static final String jdbcUrl = EmbedPgSQLServer.getInstance().getJdbcUrl();
+  private static TajoClient client;
+
+
+  @BeforeClass
+  public static void setUp() throws Exception {
+    QueryTestCaseBase.testingCluster.getMaster().refresh();
+    client = QueryTestCaseBase.testingCluster.newTajoClient();
+  }
+
+  @AfterClass
+  public static void tearDown() {
+    client.close();
+  }
+
+  @Test
+  public void testGetAllDatabaseNames() {
+    Set<String> retrieved = Sets.newHashSet(client.getAllDatabaseNames());
+    assertTrue(retrieved.contains(EmbedPgSQLServer.DATABASE_NAME));
+  }
+
+  @Test
+  public void testGetTableList() {
+    Set<String> retrieved = Sets.newHashSet(client.getTableList("tpch"));
+    assertEquals(Sets.newHashSet(EmbedPgSQLServer.TPCH_TABLES), retrieved);
+  }
+
+  @Test
+  public void testGetTable() throws UndefinedTableException {
+    for (String tableName: EmbedPgSQLServer.TPCH_TABLES) {
+      TableDesc retrieved = client.getTableDesc(EmbedPgSQLServer.DATABASE_NAME + "." + tableName);
+      assertEquals(EmbedPgSQLServer.DATABASE_NAME + "." + tableName, retrieved.getName());
+      assertEquals(jdbcUrl + "&table=" + tableName, retrieved.getUri().toASCIIString());
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/0ca28025/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLQueryTests.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLQueryTests.java b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLQueryTests.java
new file mode 100644
index 0000000..ab725e4
--- /dev/null
+++ b/tajo-storage/tajo-storage-pgsql/src/test/java/org/apache/tajo/storage/pgsql/TestPgSQLQueryTests.java
@@ -0,0 +1,17 @@
+package org.apache.tajo.storage.pgsql;
+
+import org.apache.tajo.QueryTestCaseBase;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class TestPgSQLQueryTests extends QueryTestCaseBase {
+  @BeforeClass
+  public void setUp() {
+    QueryTestCaseBase.testingCluster.getMaster().refresh();
+  }
+
+  @Test
+  public void testSelectAll() {
+    //executeString()
+  }
+}

http://git-wip-us.apache.org/repos/asf/tajo/blob/0ca28025/tajo-storage/tajo-storage-pgsql/src/test/resources/dataset/TestPgSQLQueryTests/lineitem.csv
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/dataset/TestPgSQLQueryTests/lineitem.csv b/tajo-storage/tajo-storage-pgsql/src/test/resources/dataset/TestPgSQLQueryTests/lineitem.csv
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/tajo/blob/0ca28025/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/select_all.sql
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/select_all.sql b/tajo-storage/tajo-storage-pgsql/src/test/resources/queries/TestPgSQLQueryTests/select_all.sql
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/tajo/blob/0ca28025/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/select_all.result
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/select_all.result b/tajo-storage/tajo-storage-pgsql/src/test/resources/results/TestPgSQLQueryTests/select_all.result
new file mode 100644
index 0000000..e69de29


[16/39] tajo git commit: Removed absolute paths

Posted by hy...@apache.org.
Removed absolute paths


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/6a50c5f4
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/6a50c5f4
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/6a50c5f4

Branch: refs/heads/TAJO-1730
Commit: 6a50c5f42fdf3ad791c57227f8201da8d902d7e8
Parents: d49449a
Author: Hyunsik Choi <hy...@apache.org>
Authored: Sun Aug 16 14:38:05 2015 +0900
Committer: Hyunsik Choi <hy...@apache.org>
Committed: Sun Aug 16 14:38:05 2015 +0900

----------------------------------------------------------------------
 .../org/apache/tajo/engine/query/TestJoinQuery.java     | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/6a50c5f4/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 2fddbfa..c3d928e 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
@@ -245,12 +245,12 @@ public class TestJoinQuery extends QueryTestCaseBase {
     TableMeta tableMeta = table.getMeta();
     Schema schema = table.getLogicalSchema();
 
-    File file = new File("src/test/tpch/" + tableName + ".tbl");
-
-    if (!file.exists()) {
-      file = new File(System.getProperty("user.dir") + "/tajo-core/src/test/tpch/" + tableName + ".tbl");
-    }
-    String[] rows = FileUtil.readTextFile(file).split("\n");
+//    File file = new File("src/test/tpch/" + tableName + ".tbl");
+//
+//    if (!file.exists()) {
+//      file = new File(System.getProperty("user.dir") + "/tajo-core/src/test/tpch/" + tableName + ".tbl");
+//    }
+    String[] rows = FileUtil.readTextFileFromResource("tpch/" + tableName + ".tbl").split("\n");
 
     assertTrue(rows.length > 0);