dataroaring commented on code in PR #36349:
URL: https://github.com/apache/doris/pull/36349#discussion_r1641897369
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Table.java:
##########
@@ -441,59 +442,61 @@ public TTableDescriptor toThrift() {
}
public static Table read(DataInput in) throws IOException {
- Table table = null;
- TableType type = TableType.valueOf(Text.readString(in));
- if (type == TableType.OLAP) {
- table = new OlapTable();
- } else if (type == TableType.MATERIALIZED_VIEW) {
- table = new MTMV();
- } else if (type == TableType.ODBC) {
- table = new OdbcTable();
- } else if (type == TableType.MYSQL) {
- table = new MysqlTable();
- } else if (type == TableType.VIEW) {
- table = new View();
- } else if (type == TableType.BROKER) {
- table = new BrokerTable();
- } else if (type == TableType.ELASTICSEARCH) {
- table = new EsTable();
- } else if (type == TableType.HIVE) {
- table = new HiveTable();
- } else if (type == TableType.JDBC) {
- table = new JdbcTable();
+ if (Env.getCurrentEnvJournalVersion() < FeMetaVersion.VERSION_136) {
+ Table table = null;
+ TableType type = TableType.valueOf(Text.readString(in));
+ if (type == TableType.OLAP) {
+ table = new OlapTable();
+ } else if (type == TableType.MATERIALIZED_VIEW) {
+ table = new MTMV();
+ } else if (type == TableType.ODBC) {
+ table = new OdbcTable();
+ } else if (type == TableType.MYSQL) {
+ table = new MysqlTable();
+ } else if (type == TableType.VIEW) {
+ table = new View();
+ } else if (type == TableType.BROKER) {
+ table = new BrokerTable();
+ } else if (type == TableType.ELASTICSEARCH) {
+ table = new EsTable();
+ } else if (type == TableType.HIVE) {
+ table = new HiveTable();
+ } else if (type == TableType.JDBC) {
+ table = new JdbcTable();
+ } else {
+ throw new IOException("Unknown table type: " + type.name());
+ }
+
+ table.setTypeRead(true);
+ table.readFields(in);
+ return table;
} else {
- throw new IOException("Unknown table type: " + type.name());
+ String json = Text.readString(in);
+ JsonObject jsonObject = GsonUtils.GSON.fromJson(json,
JsonObject.class);
+ TableType type =
TableType.valueOf(jsonObject.get("type").getAsString());
+ switch (type) {
+ case OLAP:
+ case MATERIALIZED_VIEW:
+ case ODBC:
+ case MYSQL:
+ case VIEW:
+ case BROKER:
+ case ELASTICSEARCH:
+ case HIVE:
+ case JDBC:
+ return GsonUtils.GSON.fromJson(json, Table.class);
+ default:
+ throw new IOException("Unknown table type: " +
type.name());
+ }
}
Review Comment:
hasCompoundKey too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]