Skip to content

Commit

Permalink
#2367 delete copy from MysqlCatalog
Browse files Browse the repository at this point in the history
  • Loading branch information
laglangyue committed Aug 6, 2022
1 parent 8f20254 commit 3d56c06
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 69 deletions.
1 change: 0 additions & 1 deletion seatunnel-connectors-v2/connector-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver18</artifactId>
<version>8.1.2.141</version>
<scope>provided</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,77 +159,13 @@ public CatalogTable getTable(TablePath tablePath) throws CatalogException, Table
* @see ResultSetImpl#getObjectStoredProc(int, int)
*/
private SeaTunnelDataType<?> fromJdbcType(ResultSetMetaData metadata, int colIndex) throws SQLException {
MysqlType mysqlType = MysqlType.getByName(metadata.getColumnTypeName(colIndex));
switch (mysqlType) {
case NULL:
return BasicType.VOID_TYPE;
case BOOLEAN:
return BasicType.BOOLEAN_TYPE;
case BIT:
case TINYINT:
return BasicType.BYTE_TYPE;
case TINYINT_UNSIGNED:
case SMALLINT:
return BasicType.SHORT_TYPE;
case SMALLINT_UNSIGNED:
case INT:
case MEDIUMINT:
case MEDIUMINT_UNSIGNED:
return BasicType.INT_TYPE;
case INT_UNSIGNED:
case BIGINT:
return BasicType.LONG_TYPE;
case FLOAT:
case FLOAT_UNSIGNED:
return BasicType.FLOAT_TYPE;
case DOUBLE:
case DOUBLE_UNSIGNED:
return BasicType.DOUBLE_TYPE;
case TIME:
return LocalTimeType.LOCAL_TIME_TYPE;
case DATE:
return LocalTimeType.LOCAL_DATE_TYPE;
case TIMESTAMP:
case DATETIME:
return LocalTimeType.LOCAL_DATE_TIME_TYPE;
// TODO: to confirm
case CHAR:
case VARCHAR:
case TINYTEXT:
case TEXT:
case MEDIUMTEXT:
case LONGTEXT:
case JSON:
case ENUM:
return BasicType.STRING_TYPE;
case BINARY:
case VARBINARY:
case TINYBLOB:
case BLOB:
case MEDIUMBLOB:
case LONGBLOB:
case GEOMETRY:
return PrimitiveByteArrayType.INSTANCE;
case BIGINT_UNSIGNED:
case DECIMAL:
case DECIMAL_UNSIGNED:
int precision = metadata.getPrecision(colIndex);
int scale = metadata.getScale(colIndex);
return new DecimalType(precision, scale);
// TODO: support 'SET' & 'YEAR' type
default:
throw new UnsupportedOperationException(String.format("Doesn't support MySQL type '%s' yet", mysqlType.getName()));
}
// todo:
return null;
}

@SuppressWarnings("MagicNumber")
private Map<String, String> buildConnectorOptions(TablePath tablePath) {
Map<String, String> options = new HashMap<>(8);
options.put("connector", "jdbc");
options.put("url", baseUrl + tablePath.getDatabaseName());
options.put("table-name", tablePath.getFullName());
options.put("username", username);
options.put("password", pwd);
return options;
// todo:
return null;
}
}

0 comments on commit 3d56c06

Please sign in to comment.