You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tw...@apache.org on 2018/05/24 13:41:14 UTC

flink git commit: [FLINK-8511] [table] Remove legacy code for the TableType annotation

Repository: flink
Updated Branches:
  refs/heads/master 9bdd70cad -> 355ec15cb


[FLINK-8511] [table] Remove legacy code for the TableType annotation

This closes #6055.


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

Branch: refs/heads/master
Commit: 355ec15cb7b2e1e16a95e77495a6cc05de58680d
Parents: 9bdd70c
Author: blueszheng <ki...@163.com>
Authored: Tue May 22 20:52:35 2018 +0800
Committer: Timo Walther <tw...@apache.org>
Committed: Thu May 24 15:40:20 2018 +0200

----------------------------------------------------------------------
 flink-libraries/flink-table/pom.xml             |  61 +----
 .../flink/table/annotation/TableType.java       |  48 ----
 .../resources/tableSourceConverter.properties   |  36 ---
 .../org/apache/flink/table/api/exceptions.scala |  39 ---
 .../table/catalog/ExternalCatalogTable.scala    | 261 -------------------
 .../table/catalog/ExternalTableSourceUtil.scala | 195 ++------------
 .../table/catalog/TableSourceConverter.scala    |  55 ----
 .../table/sources/CsvTableSourceConverter.scala |  77 ------
 .../catalog/ExternalCatalogSchemaTest.scala     |   9 +-
 .../catalog/ExternalTableSourceUtilTest.scala   |  68 -----
 .../catalog/InMemoryExternalCatalogTest.scala   |  28 +-
 .../table/runtime/utils/CommonTestData.scala    |  75 +++---
 12 files changed, 93 insertions(+), 859 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/355ec15c/flink-libraries/flink-table/pom.xml
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-table/pom.xml b/flink-libraries/flink-table/pom.xml
index 9c693a8..77d3650 100644
--- a/flink-libraries/flink-table/pom.xml
+++ b/flink-libraries/flink-table/pom.xml
@@ -40,24 +40,12 @@ under the License.
 				<artifactId>guava</artifactId>
 				<version>19.0</version>
 			</dependency>
-			<!-- Common dependency among commons-configuration -->
-			<dependency>
-				<groupId>commons-beanutils</groupId>
-				<artifactId>commons-beanutils</artifactId>
-				<version>1.8.3</version>
-			</dependency>
 			<!-- Common dependency of calcite-core and janino -->
 			<dependency>
 				<groupId>org.codehaus.janino</groupId>
 				<artifactId>commons-compiler</artifactId>
 				<version>3.0.7</version>
 			</dependency>
-			<!-- Common dependency of aggdesigner-algorithm and commons-configuration -->
-			<dependency>
-				<groupId>commons-lang</groupId>
-				<artifactId>commons-lang</artifactId>
-				<version>2.6</version>
-			</dependency>
 			<!-- Common dependency of calcite-core and flink-table -->
 			<dependency>
 				<groupId>org.codehaus.janino</groupId>
@@ -84,17 +72,6 @@ under the License.
 			<scope>provided</scope>
 		</dependency>
 
-		<!-- Used for TableType configuration -->
-		<dependency>
-			<groupId>commons-configuration</groupId>
-			<artifactId>commons-configuration</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.slf4j</groupId>
-			<artifactId>jcl-over-slf4j</artifactId>
-			<version>${slf4j.version}</version>
-		</dependency>
-
 		<!-- Used for base64 encoding of UDFs -->
 		<dependency>
 			<groupId>commons-codec</groupId>
@@ -156,24 +133,6 @@ under the License.
 			</exclusions>
 		</dependency>
 
-		<!-- Used for TableType classpath discovery -->
-		<dependency>
-			<groupId>org.reflections</groupId>
-			<artifactId>reflections</artifactId>
-			<version>0.9.10</version>
-			<exclusions>
-				<exclusion>
-					<groupId>com.google.code.findbugs</groupId>
-					<artifactId>annotations</artifactId>
-				</exclusion>
-				<exclusion>
-					<groupId>com.google.guava</groupId>
-					<artifactId>guava</artifactId>
-				</exclusion>
-			</exclusions>
-			<scope>compile</scope>
-		</dependency>
-
 		<!-- Used for date/time formatting -->
 		<dependency>
 			<groupId>joda-time</groupId>
@@ -299,16 +258,12 @@ under the License.
 									<include>com.google.guava:guava</include>
 									<include>net.hydromatic:*</include>
 									<include>com.esri.geometry:*</include>
+									<include>commons-lang:*</include>
 
 									<!-- flink-table dependencies -->
-									<include>commons-configuration:*</include>
-									<include>org.slf4j:jcl-over-slf4j</include>
-									<include>commons-lang:*</include>
 									<include>commons-codec:*</include>
-									<include>commons-collections:*</include>
 									<include>org.apache.commons:commons-lang3</include>
 									<include>org.codehaus.janino:*</include>
-									<include>org.reflections:*</include>
 									<include>joda-time:*</include>
 								</includes>
 							</artifactSet>
@@ -335,14 +290,6 @@ under the License.
 
 								<!-- flink-table dependencies -->
 								<relocation>
-									<pattern>org.apache.commons</pattern>
-									<shadedPattern>org.apache.flink.table.shaded.org.apache.commons</shadedPattern>
-								</relocation>
-								<relocation>
-									<pattern>org.reflections</pattern>
-									<shadedPattern>org.apache.flink.table.shaded.org.reflections</shadedPattern>
-								</relocation>
-								<relocation>
 									<pattern>org.joda.time</pattern>
 									<shadedPattern>org.apache.flink.table.shaded.org.joda.time</shadedPattern>
 								</relocation>
@@ -351,6 +298,12 @@ under the License.
 									<pattern>org.codehaus</pattern>
 									<shadedPattern>org.apache.flink.table.shaded.org.codehaus</shadedPattern>
 								</relocation>-->
+
+								<!-- commons-codec, commons-lang3, and commons-lang (from Calcite) -->
+								<relocation>
+									<pattern>org.apache.commons</pattern>
+									<shadedPattern>org.apache.flink.table.shaded.org.apache.commons</shadedPattern>
+								</relocation>
 							</relocations>
 						</configuration>
 					</execution>

http://git-wip-us.apache.org/repos/asf/flink/blob/355ec15c/flink-libraries/flink-table/src/main/java/org/apache/flink/table/annotation/TableType.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-table/src/main/java/org/apache/flink/table/annotation/TableType.java b/flink-libraries/flink-table/src/main/java/org/apache/flink/table/annotation/TableType.java
deleted file mode 100644
index c564528..0000000
--- a/flink-libraries/flink-table/src/main/java/org/apache/flink/table/annotation/TableType.java
+++ /dev/null
@@ -1,48 +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.flink.table.annotation;
-
-import org.apache.flink.table.catalog.TableSourceConverter;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotates a table type of a {@link TableSourceConverter}.
- *
- * @deprecated Use the more generic [[org.apache.flink.table.sources.TableSourceFactory]] interface
- * with Java service loaders instead.
- */
-@Documented
-@Target(ElementType.TYPE)
-@Retention(RetentionPolicy.RUNTIME)
-@Deprecated
-public @interface TableType {
-
-	/**
-	 * Returns the table type of a {@link TableSourceConverter}.
-	 *
-	 * @return The table type of the {@link TableSourceConverter}.
-	 */
-	String value();
-
-}

http://git-wip-us.apache.org/repos/asf/flink/blob/355ec15c/flink-libraries/flink-table/src/main/resources/tableSourceConverter.properties
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-table/src/main/resources/tableSourceConverter.properties b/flink-libraries/flink-table/src/main/resources/tableSourceConverter.properties
deleted file mode 100644
index ec46579..0000000
--- a/flink-libraries/flink-table/src/main/resources/tableSourceConverter.properties
+++ /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.
-################################################################################
-
-################################################################################
-# NOTE: THIS APPROACH IS DEPRECATED AND WILL BE REMOVED IN FUTURE VERSIONS!
-#
-# We recommend to use a org.apache.flink.table.sources.TableSourceFactory
-# instead. They allow to define new factories by using Java Service Providers.
-################################################################################
-
-################################################################################
-# The config file is used to specify the packages of current module where
-# to find TableSourceConverter implementation class annotated with TableType.
-# If there are multiple packages to scan, put those packages together into a
-# string separated with ',', for example, org.package1,org.package2.
-# Please notice:
-# It's better to have a tableSourceConverter.properties in each connector Module
-# which offers converters instead of put all information into the
-# tableSourceConverter.properties of flink-table module.
-################################################################################
-scan.packages=org.apache.flink.table.sources

http://git-wip-us.apache.org/repos/asf/flink/blob/355ec15c/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/exceptions.scala
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/exceptions.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/exceptions.scala
index cfc73e7..eb87c9d 100644
--- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/exceptions.scala
+++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/exceptions.scala
@@ -18,7 +18,6 @@
 
 package org.apache.flink.table.api
 
-import org.apache.flink.table.catalog.TableSourceConverter
 import org.apache.flink.table.descriptors.DescriptorProperties
 
 /**
@@ -181,44 +180,6 @@ case class AmbiguousTableSourceException(
 }
 
 /**
-  * Exception for not finding a [[TableSourceConverter]] for a given table type.
-  *
-  * @param tableType table type
-  * @param cause the cause
-  * @deprecated Use table source factories instead
-  *            (see [[org.apache.flink.table.sources.TableSourceFactory]]).
-  */
-@Deprecated
-@deprecated("Use table factories (see TableSourceFactory) instead.")
-case class NoMatchedTableSourceConverterException(
-    tableType: String,
-    cause: Throwable)
-    extends RuntimeException(s"Could not find a TableSourceConverter for table type $tableType.",
-      cause) {
-
-  def this(tableType: String) = this(tableType, null)
-}
-
-/**
-  * Exception for finding more than one [[TableSourceConverter]] for a given table type.
-  *
-  * @param tableType table type
-  * @param cause the cause
-  * @deprecated Use table source factories instead
-  *            (see [[org.apache.flink.table.sources.TableSourceFactory]]).
-  */
-@Deprecated
-@deprecated("Use table factories (see TableSourceFactory) instead.")
-case class AmbiguousTableSourceConverterException(
-    tableType: String,
-    cause: Throwable)
-    extends RuntimeException(s"More than one TableSourceConverter for table type $tableType.",
-      cause) {
-
-  def this(tableType: String) = this(tableType, null)
-}
-
-/**
   * Exception for operation on a nonexistent external catalog
   *
   * @param catalogName external catalog name

http://git-wip-us.apache.org/repos/asf/flink/blob/355ec15c/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/catalog/ExternalCatalogTable.scala
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/catalog/ExternalCatalogTable.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/catalog/ExternalCatalogTable.scala
index ef14b8a..c41a350 100644
--- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/catalog/ExternalCatalogTable.scala
+++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/catalog/ExternalCatalogTable.scala
@@ -18,25 +18,12 @@
 
 package org.apache.flink.table.catalog
 
-import java.lang.{Long => JLong}
-import java.util.{HashMap => JHashMap, Map => JMap}
-
-import org.apache.flink.table.api.{TableException, TableSchema}
-import org.apache.flink.table.catalog.ExternalCatalogTable._
-import org.apache.flink.table.descriptors.DescriptorProperties.toScala
-import org.apache.flink.table.descriptors.MetadataValidator.{METADATA_COMMENT, METADATA_CREATION_TIME, METADATA_LAST_ACCESS_TIME}
 import org.apache.flink.table.descriptors._
 import org.apache.flink.table.plan.stats.TableStats
 
-import scala.collection.JavaConverters._
-
 /**
   * Defines a table in an [[ExternalCatalog]].
   *
-  * For backwards compatibility this class supports both the legacy table type (see
-  * [[org.apache.flink.table.annotation.TableType]]) and the factory-based (see
-  * [[org.apache.flink.table.sources.TableSourceFactory]]) approach.
-  *
   * @param connectorDesc describes the system to connect to
   * @param formatDesc describes the data format of a connector
   * @param schemaDesc describes the schema of the result table
@@ -60,252 +47,4 @@ class ExternalCatalogTable(
   // expose statistics for external table source util
   override def getTableStats: Option[TableStats] = super.getTableStats
 
-  // ----------------------------------------------------------------------------------------------
-  // NOTE: the following code is used for backwards compatibility to the TableType approach
-  // ----------------------------------------------------------------------------------------------
-
-  /**
-    * Returns the legacy table type of an external catalog table.
-    *
-    * @deprecated for backwards compatibility.
-    */
-  @Deprecated
-  @deprecated("For backwards compatibility.")
-  lazy val tableType: String = {
-    val props = new DescriptorProperties()
-    connectorDesc.addProperties(props)
-    toScala(props.getOptionalString(CONNECTOR_LEGACY_TYPE))
-      .getOrElse(throw new TableException("Could not find a legacy table type to return."))
-  }
-
-  /**
-    * Returns the legacy schema of an external catalog table.
-    *
-    * @deprecated for backwards compatibility.
-    */
-  @Deprecated
-  @deprecated("For backwards compatibility.")
-  lazy val schema: TableSchema = {
-    val props = new DescriptorProperties()
-    connectorDesc.addProperties(props)
-    toScala(props.getOptionalTableSchema(CONNECTOR_LEGACY_SCHEMA))
-      .getOrElse(throw new TableException("Could not find a legacy schema to return."))
-  }
-
-  /**
-    * Returns the legacy properties of an external catalog table.
-    *
-    * @deprecated for backwards compatibility.
-    */
-  @Deprecated
-  @deprecated("For backwards compatibility.")
-  lazy val properties: JMap[String, String] = {
-    // skip normalization
-    val props = new DescriptorProperties(normalizeKeys = false)
-    val legacyProps = new JHashMap[String, String]()
-    connectorDesc.addProperties(props)
-    props.asMap.asScala.flatMap { case (k, v) =>
-      if (k.startsWith(CONNECTOR_LEGACY_PROPERTY)) {
-        // remove "connector.legacy-property-"
-        Some(legacyProps.put(k.substring(CONNECTOR_LEGACY_PROPERTY.length + 1), v))
-      } else {
-        None
-      }
-    }
-    legacyProps
-  }
-
-  /**
-    * Returns the legacy statistics of an external catalog table.
-    *
-    * @deprecated for backwards compatibility.
-    */
-  @Deprecated
-  @deprecated("For backwards compatibility.")
-  lazy val stats: TableStats = getTableStats.orNull
-
-  /**
-    * Returns the legacy comment of an external catalog table.
-    *
-    * @deprecated for backwards compatibility.
-    */
-  @Deprecated
-  @deprecated("For backwards compatibility.")
-  lazy val comment: String = {
-    val normalizedProps = new DescriptorProperties()
-
-    metadataDesc match {
-      case Some(meta) =>
-        meta.addProperties(normalizedProps)
-        normalizedProps.getOptionalString(METADATA_COMMENT).orElse(null)
-      case None =>
-        null
-    }
-  }
-
-  /**
-    * Returns the legacy creation time of an external catalog table.
-    *
-    * @deprecated for backwards compatibility.
-    */
-  @Deprecated
-  @deprecated("For backwards compatibility.")
-  lazy val createTime: JLong = {
-    val normalizedProps = new DescriptorProperties()
-
-    metadataDesc match {
-      case Some(meta) =>
-        meta.addProperties(normalizedProps)
-        normalizedProps.getOptionalLong(METADATA_CREATION_TIME).orElse(null)
-      case None =>
-        null
-    }
-  }
-
-  /**
-    * Returns the legacy last access time of an external catalog table.
-    *
-    * @deprecated for backwards compatibility.
-    */
-  @Deprecated
-  @deprecated("For backwards compatibility.")
-  lazy val lastAccessTime: JLong = {
-    val normalizedProps = new DescriptorProperties()
-
-    metadataDesc match {
-      case Some(meta) =>
-        meta.addProperties(normalizedProps)
-        normalizedProps.getOptionalLong(METADATA_LAST_ACCESS_TIME).orElse(null)
-      case None =>
-        null
-    }
-  }
-
-  /**
-    * Defines a table in an [[ExternalCatalog]].
-    *
-    * @param tableType            Table type, e.g csv, hbase, kafka
-    * @param schema               Schema of the table (column names and types)
-    * @param properties           Properties of the table
-    * @param stats                Statistics of the table
-    * @param comment              Comment of the table
-    * @param createTime           Create timestamp of the table
-    * @param lastAccessTime       Timestamp of last access of the table
-    * @deprecated Use a descriptor-based constructor instead.
-    */
-  @Deprecated
-  @deprecated("Use a descriptor-based constructor instead.")
-  def this(
-    tableType: String,
-    schema: TableSchema,
-    properties: JMap[String, String] = new JHashMap(),
-    stats: TableStats = null,
-    comment: String = null,
-    createTime: JLong = System.currentTimeMillis,
-    lastAccessTime: JLong = -1L) = {
-
-    this(
-      toConnectorDescriptor(tableType, schema, properties),
-      None,
-      None,
-      Some(toStatisticsDescriptor(stats)),
-      Some(toMetadataDescriptor(comment, createTime, lastAccessTime)))
-  }
-
-  /**
-    * Returns whether this external catalog table uses the legacy table type.
-    *
-    * @deprecated for backwards compatibility.
-    */
-  @Deprecated
-  @deprecated("For backwards compatibility.")
-  def isLegacyTableType: Boolean = connectorDesc.isInstanceOf[TableTypeConnector]
-}
-
-object ExternalCatalogTable {
-
-  val CONNECTOR_TYPE_VALUE = "legacy-table-type"
-  val CONNECTOR_LEGACY_TYPE = "connector.legacy-type"
-  val CONNECTOR_LEGACY_SCHEMA = "connector.legacy-schema"
-  val CONNECTOR_LEGACY_PROPERTY = "connector.legacy-property"
-
-  /**
-    * Defines a table in an [[ExternalCatalog]].
-    *
-    * @param tableType            Table type, e.g csv, hbase, kafka
-    * @param schema               Schema of the table (column names and types)
-    * @param properties           Properties of the table
-    * @param stats                Statistics of the table
-    * @param comment              Comment of the table
-    * @param createTime           Create timestamp of the table
-    * @param lastAccessTime       Timestamp of last access of the table
-    * @deprecated Use a descriptor-based constructor instead.
-    */
-  @Deprecated
-  @deprecated("Use a descriptor-based constructor instead.")
-  def apply(
-    tableType: String,
-    schema: TableSchema,
-    properties: JMap[String, String] = new JHashMap(),
-    stats: TableStats = null,
-    comment: String = null,
-    createTime: JLong = System.currentTimeMillis,
-    lastAccessTime: JLong = -1L): ExternalCatalogTable = {
-
-    new ExternalCatalogTable(
-      tableType,
-      schema,
-      properties,
-      stats,
-      comment,
-      createTime,
-      lastAccessTime)
-  }
-
-  class TableTypeConnector(
-      tableType: String,
-      schema: TableSchema,
-      legacyProperties: JMap[String, String])
-    extends ConnectorDescriptor(CONNECTOR_TYPE_VALUE, version = 1, formatNeeded = false) {
-
-    override protected def addConnectorProperties(properties: DescriptorProperties): Unit = {
-      properties.putString(CONNECTOR_LEGACY_TYPE, tableType)
-      properties.putTableSchema(CONNECTOR_LEGACY_SCHEMA, schema)
-      legacyProperties.asScala.foreach { case (k, v) =>
-          properties.putString(s"$CONNECTOR_LEGACY_PROPERTY-$k", v)
-      }
-    }
-  }
-
-  def toConnectorDescriptor(
-      tableType: String,
-      schema: TableSchema,
-      properties: JMap[String, String])
-    : ConnectorDescriptor = {
-
-    new TableTypeConnector(tableType, schema, properties)
-  }
-
-  def toStatisticsDescriptor(stats: TableStats): Statistics = {
-    val statsDesc = Statistics()
-    if (stats != null) {
-      statsDesc.tableStats(stats)
-    }
-    statsDesc
-  }
-
-  def toMetadataDescriptor(
-      comment: String,
-      createTime: JLong,
-      lastAccessTime: JLong)
-    : Metadata = {
-
-    val metadataDesc = Metadata()
-    if (comment != null) {
-      metadataDesc.comment(comment)
-    }
-    metadataDesc
-      .creationTime(createTime)
-      .lastAccessTime(lastAccessTime)
-  }
 }

http://git-wip-us.apache.org/repos/asf/flink/blob/355ec15c/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/catalog/ExternalTableSourceUtil.scala
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/catalog/ExternalTableSourceUtil.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/catalog/ExternalTableSourceUtil.scala
index 2288522..1182fc9 100644
--- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/catalog/ExternalTableSourceUtil.scala
+++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/catalog/ExternalTableSourceUtil.scala
@@ -18,21 +18,11 @@
 
 package org.apache.flink.table.catalog
 
-import java.net.URL
-
-import org.apache.commons.configuration.{ConfigurationException, ConversionException, PropertiesConfiguration}
-import org.apache.flink.annotation.VisibleForTesting
-import org.apache.flink.table.annotation.TableType
 import org.apache.flink.table.api._
 import org.apache.flink.table.plan.schema.{BatchTableSourceTable, StreamTableSourceTable, TableSourceTable}
 import org.apache.flink.table.plan.stats.FlinkStatistic
-import org.apache.flink.table.sources.{BatchTableSource, StreamTableSource, TableSource, TableSourceFactoryService}
+import org.apache.flink.table.sources.{BatchTableSource, StreamTableSource, TableSourceFactoryService}
 import org.apache.flink.table.util.Logging
-import org.apache.flink.util.InstantiationUtil
-import org.reflections.Reflections
-
-import _root_.scala.collection.JavaConverters._
-import _root_.scala.collection.mutable
 
 /**
   * The utility class is used to convert ExternalCatalogTable to TableSourceTable.
@@ -49,167 +39,32 @@ object ExternalTableSourceUtil extends Logging {
       tableEnv: TableEnvironment,
       externalCatalogTable: ExternalCatalogTable)
     : TableSourceTable[_] = {
-
-    // check for the legacy external catalog path
-    if (externalCatalogTable.isLegacyTableType) {
-      LOG.warn("External catalog tables based on TableType annotations are deprecated. " +
-        "Please consider updating them to TableSourceFactories.")
-      fromExternalCatalogTableType(externalCatalogTable)
-    }
-    // use the factory approach
-    else {
-      val source = TableSourceFactoryService.findAndCreateTableSource(externalCatalogTable)
-      tableEnv match {
-        // check for a batch table source in this batch environment
-        case _: BatchTableEnvironment =>
-          source match {
-            case bts: BatchTableSource[_] =>
-              new BatchTableSourceTable(
-                bts,
-                new FlinkStatistic(externalCatalogTable.getTableStats))
-            case _ => throw new TableException(
-              s"Found table source '${source.getClass.getCanonicalName}' is not applicable " +
-                s"in a batch environment.")
-          }
-        // check for a stream table source in this streaming environment
-        case _: StreamTableEnvironment =>
-          source match {
-            case sts: StreamTableSource[_] =>
-              new StreamTableSourceTable(
-                sts,
-                new FlinkStatistic(externalCatalogTable.getTableStats))
-            case _ => throw new TableException(
-              s"Found table source '${source.getClass.getCanonicalName}' is not applicable " +
-                s"in a streaming environment.")
-          }
-        case _ => throw new TableException("Unsupported table environment.")
-      }
-    }
-  }
-
-  // ----------------------------------------------------------------------------------------------
-  // NOTE: the following lines can be removed once we drop support for TableType
-  // ----------------------------------------------------------------------------------------------
-
-  // config file to specify scan package to search TableSourceConverter
-  private val tableSourceConverterConfigFileName = "tableSourceConverter.properties"
-
-  // registered table type with the TableSourceConverter.
-  // Key is table type name, Value is set of converter class.
-  private val tableTypeToTableSourceConvertersClazz = {
-    val registeredConverters =
-      new mutable.HashMap[String, mutable.Set[Class[_ <: TableSourceConverter[_]]]]
-          with mutable.MultiMap[String, Class[_ <: TableSourceConverter[_]]]
-    // scan all config files to find TableSourceConverters which are annotated with TableType.
-    val resourceUrls = getClass.getClassLoader.getResources(tableSourceConverterConfigFileName)
-    while (resourceUrls.hasMoreElements) {
-      val url = resourceUrls.nextElement()
-      val scanPackages = parseScanPackagesFromConfigFile(url)
-      scanPackages.foreach(scanPackage => {
-        val clazzWithAnnotations = new Reflections(scanPackage)
-            .getTypesAnnotatedWith(classOf[TableType])
-        clazzWithAnnotations.asScala.foreach(clazz =>
-          if (classOf[TableSourceConverter[_]].isAssignableFrom(clazz)) {
-            val errorInfo = InstantiationUtil.checkForInstantiationError(clazz)
-            if (errorInfo != null) {
-              LOG.warn(s"Class ${clazz.getName} is annotated with TableType, " +
-                  s"but is not instantiable because $errorInfo.")
-            } else {
-              val tableTypeAnnotation: TableType =
-                clazz.getAnnotation(classOf[TableType])
-              val tableType = tableTypeAnnotation.value()
-              val converterClazz = clazz.asInstanceOf[Class[_ <: TableSourceConverter[_]]]
-              registeredConverters.addBinding(tableType, converterClazz)
-              LOG.info(s"Registers the converter ${clazz.getName} to table type [$tableType]. ")
-            }
-          } else {
-            LOG.warn(
-              s"Class ${clazz.getName} is annotated with TableType, " +
-                  s"but does not implement the TableSourceConverter interface.")
-          }
-        )
-      })
-    }
-    registeredConverters
-  }
-
-  @VisibleForTesting
-  private[flink] def injectTableSourceConverter(
-    tableType: String,
-    converterClazz: Class[_ <: TableSourceConverter[_]]) = {
-    tableTypeToTableSourceConvertersClazz.addBinding(tableType, converterClazz)
-  }
-
-  /**
-    * Parses scan package set from input config file
-    *
-    * @param url url of config file
-    * @return scan package set
-    */
-  private def parseScanPackagesFromConfigFile(url: URL): Set[String] = {
-    try {
-      val config = new PropertiesConfiguration(url)
-      config.setListDelimiter(',')
-      config.getStringArray("scan.packages").filterNot(_.isEmpty).toSet
-    } catch {
-      case e: ConfigurationException =>
-        LOG.warn(s"Error happened while loading the properties file [$url]", e)
-        Set.empty
-      case e1: ConversionException =>
-        LOG.warn(s"Error happened while parsing 'scan.packages' field of properties file [$url]. " +
-            s"The value is not a String or List of Strings.", e1)
-        Set.empty
-    }
-  }
-
-  @VisibleForTesting
-  def fromExternalCatalogTableType(externalCatalogTable: ExternalCatalogTable)
-    : TableSourceTable[_] = {
-
-    val tableType = externalCatalogTable.tableType
-    val propertyKeys = externalCatalogTable.properties.keySet()
-    tableTypeToTableSourceConvertersClazz.get(tableType) match {
-      case Some(converterClasses) =>
-        val matchedConverters = converterClasses.map(InstantiationUtil.instantiate(_))
-        if (matchedConverters.isEmpty) {
-          LOG.error(s"Cannot find any TableSourceConverter binded to table type [$tableType]. " +
-              s"Register TableSourceConverter via externalCatalogTable.properties file.")
-          throw new NoMatchedTableSourceConverterException(tableType)
+    val source = TableSourceFactoryService.findAndCreateTableSource(externalCatalogTable)
+    tableEnv match {
+      // check for a batch table source in this batch environment
+      case _: BatchTableEnvironment =>
+        source match {
+          case bts: BatchTableSource[_] =>
+            new BatchTableSourceTable(
+              bts,
+              new FlinkStatistic(externalCatalogTable.getTableStats))
+          case _ => throw new TableException(
+            s"Found table source '${source.getClass.getCanonicalName}' is not applicable " +
+              s"in a batch environment.")
         }
-        val filteredMatchedConverters = matchedConverters.filter(
-          converter => propertyKeys.containsAll(converter.requiredProperties))
-        if(filteredMatchedConverters.isEmpty) {
-          LOG.error(s"Cannot find any matched TableSourceConverter for type [$tableType], " +
-              s"because the required properties does not match.")
-          throw new NoMatchedTableSourceConverterException(tableType)
-        } else if (filteredMatchedConverters.size > 1) {
-          LOG.error(s"Finds more than one matched TableSourceConverter for type [$tableType], " +
-              s"they are ${filteredMatchedConverters.map(_.getClass.getName)}")
-          throw new AmbiguousTableSourceConverterException(tableType)
-        } else {
-          val convertedTableSource: TableSource[_] = filteredMatchedConverters.head
-              .fromExternalCatalogTable(externalCatalogTable)
-              .asInstanceOf[TableSource[_]]
-          val flinkStatistic = if (externalCatalogTable.stats != null) {
-            FlinkStatistic.of(externalCatalogTable.stats)
-          } else {
-            FlinkStatistic.UNKNOWN
-          }
-
-          convertedTableSource match {
-            case s: StreamTableSource[_] =>
-              new StreamTableSourceTable(s, flinkStatistic)
-            case b: BatchTableSource[_] =>
-              new BatchTableSourceTable(b, flinkStatistic)
-            case _ =>
-              throw new TableException("Unknown TableSource type.")
-
-          }
+      // check for a stream table source in this streaming environment
+      case _: StreamTableEnvironment =>
+        source match {
+          case sts: StreamTableSource[_] =>
+            new StreamTableSourceTable(
+              sts,
+              new FlinkStatistic(externalCatalogTable.getTableStats))
+          case _ => throw new TableException(
+            s"Found table source '${source.getClass.getCanonicalName}' is not applicable " +
+              s"in a streaming environment.")
         }
-      case None =>
-        LOG.error(s"Cannot find any TableSourceConverter binded to table type [$tableType]. " +
-            s"Register TableSourceConverter via externalCatalogTable.properties file.")
-        throw new NoMatchedTableSourceConverterException(tableType)
+      case _ => throw new TableException("Unsupported table environment.")
     }
   }
+
 }

http://git-wip-us.apache.org/repos/asf/flink/blob/355ec15c/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/catalog/TableSourceConverter.scala
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/catalog/TableSourceConverter.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/catalog/TableSourceConverter.scala
deleted file mode 100644
index e6248b0..0000000
--- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/catalog/TableSourceConverter.scala
+++ /dev/null
@@ -1,55 +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.flink.table.catalog
-
-import java.util.{Set => JSet}
-
-import org.apache.flink.table.sources.TableSource
-
-/** Creates a [[org.apache.flink.table.sources.TableSource]] from the properties of an
-  * [[ExternalCatalogTable]].
-  *
-  * The [[org.apache.flink.table.annotation.TableType]] annotation defines which type of external
-  * table is supported.
-  *
-  * @tparam T The [[TableSource]] to be created by this converter.
-  *
-  * @deprecated Use the more generic [[org.apache.flink.table.sources.TableSourceFactory]] instead.
-  */
-@Deprecated
-@deprecated("Use the more generic table source factories instead.")
-trait TableSourceConverter[T <: TableSource[_]] {
-
-  /**
-    * Defines the properties that need to be provided by the [[ExternalCatalogTable]] to create
-    * the [[TableSource]].
-    *
-    * @return The required properties.
-    */
-  def requiredProperties: JSet[String]
-
-  /**
-    * Creates a [[TableSource]] for the given [[ExternalCatalogTable]].
-    *
-    * @param externalCatalogTable ExternalCatalogTable to create a TableSource from.
-    * @return The created TableSource.
-    */
-  def fromExternalCatalogTable(externalCatalogTable: ExternalCatalogTable): T
-
-}

http://git-wip-us.apache.org/repos/asf/flink/blob/355ec15c/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/sources/CsvTableSourceConverter.scala
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/sources/CsvTableSourceConverter.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/sources/CsvTableSourceConverter.scala
deleted file mode 100644
index ab984a6..0000000
--- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/sources/CsvTableSourceConverter.scala
+++ /dev/null
@@ -1,77 +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.flink.table.sources
-
-import org.apache.flink.table.annotation.TableType
-import org.apache.flink.table.catalog.{ExternalCatalogTable, TableSourceConverter}
-
-import scala.collection.JavaConverters._
-import java.util.{Set => JSet}
-
-import com.google.common.collect.ImmutableSet
-
-/**
-  * The class defines a converter used to convert [[CsvTableSource]] to
-  * or from [[ExternalCatalogTable]].
-  *
-  * @deprecated Use the more generic [[org.apache.flink.table.sources.TableSourceFactory]] instead.
-  */
-@Deprecated
-@deprecated("Use the more generic table source factories instead.")
-@TableType(value = "csv")
-class CsvTableSourceConverter extends TableSourceConverter[CsvTableSource] {
-
-  private val required: JSet[String] = ImmutableSet.of("path", "fieldDelim", "rowDelim")
-
-  override def requiredProperties: JSet[String] = required
-
-  override def fromExternalCatalogTable(
-      externalCatalogTable: ExternalCatalogTable): CsvTableSource = {
-    val params = externalCatalogTable.properties.asScala
-    val csvTableSourceBuilder = new CsvTableSource.Builder
-
-    params.get("path").foreach(csvTableSourceBuilder.path)
-    params.get("fieldDelim").foreach(csvTableSourceBuilder.fieldDelimiter)
-    params.get("rowDelim").foreach(csvTableSourceBuilder.lineDelimiter)
-    params.get("quoteCharacter").foreach(quoteStr =>
-      if (quoteStr.length != 1) {
-        throw new IllegalArgumentException("the value of param must only contain one character!")
-      } else {
-        csvTableSourceBuilder.quoteCharacter(quoteStr.charAt(0))
-      }
-    )
-    params.get("ignoreFirstLine").foreach(ignoreFirstLineStr =>
-        if(ignoreFirstLineStr.toBoolean) {
-          csvTableSourceBuilder.ignoreFirstLine()
-        }
-    )
-    params.get("ignoreComments").foreach(csvTableSourceBuilder.commentPrefix)
-    params.get("lenient").foreach(lenientStr =>
-        if(lenientStr.toBoolean) {
-          csvTableSourceBuilder.ignoreParseErrors
-        }
-    )
-    externalCatalogTable.schema.getColumnNames
-        .zip(externalCatalogTable.schema.getTypes)
-        .foreach(field => csvTableSourceBuilder.field(field._1, field._2))
-
-    csvTableSourceBuilder.build()
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/flink/blob/355ec15c/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/catalog/ExternalCatalogSchemaTest.scala
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/catalog/ExternalCatalogSchemaTest.scala b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/catalog/ExternalCatalogSchemaTest.scala
index e6d2458..4f7b90a 100644
--- a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/catalog/ExternalCatalogSchemaTest.scala
+++ b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/catalog/ExternalCatalogSchemaTest.scala
@@ -25,19 +25,18 @@ import org.apache.calcite.config.{CalciteConnectionConfigImpl, CalciteConnection
 import org.apache.calcite.jdbc.CalciteSchema
 import org.apache.calcite.prepare.CalciteCatalogReader
 import org.apache.calcite.schema.SchemaPlus
-import org.apache.calcite.sql.parser.SqlParser
 import org.apache.calcite.sql.validate.SqlMonikerType
-import org.apache.flink.table.calcite.{CalciteConfig, FlinkTypeFactory, FlinkTypeSystem}
+import org.apache.flink.table.calcite.{FlinkTypeFactory, FlinkTypeSystem}
 import org.apache.flink.table.plan.schema.TableSourceTable
 import org.apache.flink.table.runtime.utils.CommonTestData
 import org.apache.flink.table.sources.CsvTableSource
-import org.apache.flink.table.utils.MockTableEnvironment
+import org.apache.flink.table.utils.TableTestBase
 import org.junit.Assert._
 import org.junit.{Before, Test}
 
 import scala.collection.JavaConverters._
 
-class ExternalCatalogSchemaTest {
+class ExternalCatalogSchemaTest extends TableTestBase {
 
   private val schemaName: String = "test"
   private var externalCatalogSchema: SchemaPlus = _
@@ -50,7 +49,7 @@ class ExternalCatalogSchemaTest {
     val rootSchemaPlus: SchemaPlus = CalciteSchema.createRootSchema(true, false).plus()
     val catalog = CommonTestData.getInMemoryTestCatalog
     ExternalCatalogSchema.registerCatalog(
-      new MockTableEnvironment, rootSchemaPlus, schemaName, catalog)
+      streamTestUtil().tableEnv, rootSchemaPlus, schemaName, catalog)
     externalCatalogSchema = rootSchemaPlus.getSubSchema("schemaName")
     val typeFactory = new FlinkTypeFactory(new FlinkTypeSystem())
     val prop = new Properties()

http://git-wip-us.apache.org/repos/asf/flink/blob/355ec15c/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/catalog/ExternalTableSourceUtilTest.scala
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/catalog/ExternalTableSourceUtilTest.scala b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/catalog/ExternalTableSourceUtilTest.scala
deleted file mode 100644
index cdacce1..0000000
--- a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/catalog/ExternalTableSourceUtilTest.scala
+++ /dev/null
@@ -1,68 +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.flink.table.catalog
-
-import java.util.{Collections => JCollections, Set => JSet}
-
-import org.apache.flink.api.common.typeinfo.{BasicTypeInfo, TypeInformation}
-import org.apache.flink.streaming.api.datastream.DataStream
-import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
-import org.apache.flink.table.api.{TableSchema, Types}
-import org.apache.flink.table.plan.schema.StreamTableSourceTable
-import org.apache.flink.table.sources.StreamTableSource
-import org.apache.flink.table.utils.MockTableEnvironment
-import org.apache.flink.types.Row
-import org.junit.Assert.assertTrue
-import org.junit.{Before, Test}
-
-class ExternalTableSourceUtilTest {
-
-  @Before
-  def setUp() : Unit = {
-    ExternalTableSourceUtil.injectTableSourceConverter("mock", classOf[MockTableSourceConverter])
-  }
-
-  @Test
-  def testExternalStreamTable() = {
-    val schema = new TableSchema(Array("foo"), Array(BasicTypeInfo.INT_TYPE_INFO))
-    val table = ExternalCatalogTable("mock", schema)
-    val tableSource = ExternalTableSourceUtil.fromExternalCatalogTable(
-      new MockTableEnvironment, table)
-    assertTrue(tableSource.isInstanceOf[StreamTableSourceTable[_]])
-  }
-}
-
-class MockTableSourceConverter extends TableSourceConverter[StreamTableSource[Row]] {
-  override def requiredProperties: JSet[String] = JCollections.emptySet()
-  override def fromExternalCatalogTable(externalCatalogTable: ExternalCatalogTable)
-    : StreamTableSource[Row] = {
-    new StreamTableSource[Row] {
-      override def getDataStream(execEnv: StreamExecutionEnvironment): DataStream[Row] =
-        throw new UnsupportedOperationException
-
-      override def getReturnType: TypeInformation[Row] = {
-        val schema = externalCatalogTable.schema
-        Types.ROW(schema.getColumnNames, schema.getTypes)
-      }
-
-      override def getTableSchema: TableSchema = externalCatalogTable.schema
-
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/flink/blob/355ec15c/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/catalog/InMemoryExternalCatalogTest.scala
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/catalog/InMemoryExternalCatalogTest.scala b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/catalog/InMemoryExternalCatalogTest.scala
index 54d1510..ac2a729 100644
--- a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/catalog/InMemoryExternalCatalogTest.scala
+++ b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/catalog/InMemoryExternalCatalogTest.scala
@@ -20,6 +20,7 @@ package org.apache.flink.table.catalog
 
 import org.apache.flink.api.common.typeinfo.{BasicTypeInfo, TypeInformation}
 import org.apache.flink.table.api._
+import org.apache.flink.table.descriptors.{ConnectorDescriptor, DescriptorProperties, Schema}
 import org.junit.{Before, Test}
 import org.junit.Assert._
 
@@ -133,20 +134,27 @@ class InMemoryExternalCatalogTest {
   }
 
   private def createTableInstance(): ExternalCatalogTable = {
-    val schema = new TableSchema(
-      Array("first", "second"),
-      Array(
-        BasicTypeInfo.STRING_TYPE_INFO,
-        BasicTypeInfo.INT_TYPE_INFO
-      )
-    )
-    ExternalCatalogTable("csv", schema)
+    val connDesc = new TestConnectorDesc
+    val schemaDesc = new Schema()
+      .field("first", BasicTypeInfo.STRING_TYPE_INFO)
+      .field("second", BasicTypeInfo.INT_TYPE_INFO)
+    new ExternalCatalogTable(connDesc, None, Some(schemaDesc), None, None)
   }
 
   private def createTableInstance(
       fieldNames: Array[String],
       fieldTypes: Array[TypeInformation[_]]): ExternalCatalogTable = {
-    val schema = new TableSchema(fieldNames, fieldTypes)
-    ExternalCatalogTable("csv", schema)
+    val connDesc = new TestConnectorDesc
+    val schemaDesc = new Schema()
+    fieldNames.zipWithIndex.foreach { case (fieldName, index) =>
+      schemaDesc.field(fieldName, fieldTypes(index))
+    }
+    new ExternalCatalogTable(connDesc, None, Some(schemaDesc), None, None)
   }
+
+  class TestConnectorDesc extends ConnectorDescriptor("test", version = 1, formatNeeded = false) {
+    override protected def addConnectorProperties(properties: DescriptorProperties): Unit = {
+    }
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/flink/blob/355ec15c/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/utils/CommonTestData.scala
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/utils/CommonTestData.scala b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/utils/CommonTestData.scala
index e8a5cba..ac9894c 100644
--- a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/utils/CommonTestData.scala
+++ b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/utils/CommonTestData.scala
@@ -21,11 +21,12 @@ package org.apache.flink.table.runtime.utils
 import java.io.{File, FileOutputStream, OutputStreamWriter}
 import java.util
 
-import org.apache.flink.api.common.typeinfo.{BasicTypeInfo, TypeInformation}
+import org.apache.flink.api.common.typeinfo.{TypeInformation, Types}
 import org.apache.flink.api.java.typeutils.TypeExtractor
 import org.apache.flink.api.java.{DataSet, ExecutionEnvironment}
 import org.apache.flink.table.api.TableSchema
 import org.apache.flink.table.catalog._
+import org.apache.flink.table.descriptors.{Csv, FileSystem, Schema}
 import org.apache.flink.table.sources.{BatchTableSource, CsvTableSource}
 
 object CommonTestData {
@@ -49,10 +50,10 @@ object CommonTestData {
       tempFilePath,
       Array("first", "id", "score", "last"),
       Array(
-        BasicTypeInfo.STRING_TYPE_INFO,
-        BasicTypeInfo.INT_TYPE_INFO,
-        BasicTypeInfo.DOUBLE_TYPE_INFO,
-        BasicTypeInfo.STRING_TYPE_INFO
+        Types.STRING,
+        Types.INT,
+        Types.DOUBLE,
+        Types.STRING
       ),
       fieldDelim = "#",
       rowDelim = "$",
@@ -68,20 +69,20 @@ object CommonTestData {
       "3#2#Hello world"
     )
     val tempFilePath1 = writeToTempFile(csvRecord1.mkString("$"), "csv-test1", "tmp")
-    val properties1 = new util.HashMap[String, String]()
-    properties1.put("path", tempFilePath1)
-    properties1.put("fieldDelim", "#")
-    properties1.put("rowDelim", "$")
-    val externalCatalogTable1 = ExternalCatalogTable(
-      "csv",
-      new TableSchema(
-        Array("a", "b", "c"),
-        Array(
-          BasicTypeInfo.INT_TYPE_INFO,
-          BasicTypeInfo.LONG_TYPE_INFO,
-          BasicTypeInfo.STRING_TYPE_INFO)),
-      properties1
-    )
+
+    val connDesc1 = FileSystem().path(tempFilePath1)
+    val formatDesc1 = Csv()
+      .field("a", Types.INT)
+      .field("b", Types.LONG)
+      .field("c", Types.STRING)
+      .fieldDelimiter("#")
+      .lineDelimiter("$")
+    val schemaDesc1 = Schema()
+      .field("a", Types.INT)
+      .field("b", Types.LONG)
+      .field("c", Types.STRING)
+    val externalCatalogTable1 = new ExternalCatalogTable(
+      connDesc1, Some(formatDesc1), Some(schemaDesc1), None, None)
 
     val csvRecord2 = Seq(
       "1#1#0#Hallo#1",
@@ -101,23 +102,25 @@ object CommonTestData {
       "5#15#14#KLM#2"
     )
     val tempFilePath2 = writeToTempFile(csvRecord2.mkString("$"), "csv-test2", "tmp")
-    val properties2 = new util.HashMap[String, String]()
-    properties2.put("path", tempFilePath2)
-    properties2.put("fieldDelim", "#")
-    properties2.put("rowDelim", "$")
-    val externalCatalogTable2 = ExternalCatalogTable(
-      "csv",
-      new TableSchema(
-        Array("d", "e", "f", "g", "h"),
-        Array(
-          BasicTypeInfo.INT_TYPE_INFO,
-          BasicTypeInfo.LONG_TYPE_INFO,
-          BasicTypeInfo.INT_TYPE_INFO,
-          BasicTypeInfo.STRING_TYPE_INFO,
-          BasicTypeInfo.LONG_TYPE_INFO)
-      ),
-      properties2
-    )
+
+    val connDesc2 = FileSystem().path(tempFilePath2)
+    val formatDesc2 = Csv()
+      .field("d", Types.INT)
+      .field("e", Types.LONG)
+      .field("f", Types.INT)
+      .field("g", Types.STRING)
+      .field("h", Types.LONG)
+      .fieldDelimiter("#")
+      .lineDelimiter("$")
+    val schemaDesc2 = Schema()
+      .field("d", Types.INT)
+      .field("e", Types.LONG)
+      .field("f", Types.INT)
+      .field("g", Types.STRING)
+      .field("h", Types.LONG)
+    val externalCatalogTable2 = new ExternalCatalogTable(
+      connDesc2, Some(formatDesc2), Some(schemaDesc2), None, None)
+
     val catalog = new InMemoryExternalCatalog("test")
     val db1 = new InMemoryExternalCatalog("db1")
     val db2 = new InMemoryExternalCatalog("db2")