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:07:00 UTC
[37/39] tajo git commit: Removed mysql storage.
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