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
