apache / seatunnel

SeaTunnel is a next-generation super high-performance, distributed, massive data integration tool.
https://seatunnel.apache.org/
Apache License 2.0
7.86k stars 1.77k forks source link

[Bug] [StarRocks] StarRocks JDBC Dialect confilect with StarRocks Connector #7551

Closed liunaijie closed 2 weeks ago

liunaijie commented 1 month ago

Search before asking

What happened

this pr https://github.com/apache/seatunnel/pull/7294 added StarRocks JDBC dialect.

It will has some issue when both JDBC connector and StarRocks connector exist.

image

jdbc catalog will use dialect.dialectName() as factoryIdentifier to load Catalog. StarRocks catalog in created in StarRocks connector, so if StarRocks connector exist, it will read an error Catalog get ClassCastException exception

If not exist, it will use loading tables from jdbc directly, the e2e test case is work because of this. image

Caused by: java.lang.ClassCastException: org.apache.seatunnel.connectors.seatunnel.starrocks.catalog.StarRocksCatalog cannot be cast to org.apache.seatunnel.connectors.seatunnel.jdbc.catalog.AbstractJdbcCatalog

    at org.apache.seatunnel.connectors.seatunnel.jdbc.utils.JdbcCatalogUtils.getTables(JdbcCatalogUtils.java:75) ~[?:?]

SeaTunnel Version

dev

SeaTunnel Config

jdbc {
compatible_mode = "starrocks"
}

Running Command

rest api to submit job

Error Exception

Caused by: java.lang.ClassCastException: org.apache.seatunnel.connectors.seatunnel.starrocks.catalog.StarRocksCatalog cannot be cast to org.apache.seatunnel.connectors.seatunnel.jdbc.catalog.AbstractJdbcCatalog

    at org.apache.seatunnel.connectors.seatunnel.jdbc.utils.JdbcCatalogUtils.getTables(JdbcCatalogUtils.java:75) ~[?:?]


### Zeta or Flink or Spark Version

_No response_

### Java or Scala Version

_No response_

### Screenshots

_No response_

### Are you willing to submit PR?

- [X] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
liunaijie commented 1 month ago

another thing we can improve is starrocks jdbc dialect use md5sum_numeric as hash function, maybe we can replace with murmur_hash3_32

Hisoka-X commented 1 month ago

We should fix it before 2.3.8 release.

Hisoka-X commented 1 month ago

How about change StarRocksDialect's dialet name? For example: Jdbc-StarRocks. Because the name of all dialet come from compatibleMode is useless.

liunaijie commented 1 month ago

How about change StarRocksDialect's dialet name? For example: Jdbc-StarRocks. Because the name of all dialet come from compatibleMode is useless.

In my hot fix, i delete the StarRocksDialect class's dialectName method implemention, then it will call parent MysqlDialect to create MySqlCatalog.

Change StarRocksDialect dialect name to Jdbc-StarRocks it need to create Jdbc-StarRocks catalog and extends MysqlCatalog

Hisoka-X commented 1 month ago

How about change StarRocksDialect's dialet name? For example: Jdbc-StarRocks. Because the name of all dialet come from compatibleMode is useless.

In my hot fix, i delete the StarRocksDialect class's dialectName method implemention, then it will call parent MysqlDialect to create MySqlCatalog.

Change StarRocksDialect dialect name to Jdbc-StarRocks it need to create Jdbc-StarRocks catalog and extends MysqlCatalog

oh. You are right.