Skip to content

Commit

Permalink
fix SHOW COLUMNS FROM xxx add error tip
Browse files Browse the repository at this point in the history
  • Loading branch information
junwen12221 committed Jan 17, 2022
1 parent 2b2c9ca commit bb679a4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
6 changes: 2 additions & 4 deletions config/src/main/java/io/mycat/config/NormalTableConfig.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package io.mycat.config;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.*;

@AllArgsConstructor
@NoArgsConstructor
@Data
@EqualsAndHashCode
@ToString
public class NormalTableConfig {
String createTableSQL;
NormalBackEndTableInfoConfig locality = new NormalBackEndTableInfoConfig();
Expand Down
16 changes: 10 additions & 6 deletions hbt/src/main/java/io/mycat/MetadataManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -353,16 +353,20 @@ public void addNormalTable(String schemaName,
String createTableSQL = Optional.ofNullable(tableConfigEntry.getCreateTableSQL())
.orElseGet(() -> prototypeService.getCreateTableSQLByJDBC(schemaName, tableName, partitions).orElse(null));
if (createTableSQL != null) {
List<SimpleColumnInfo> columns = prototypeService.getColumnInfo(createTableSQL, schemaName, tableName);
Map<String, IndexInfo> indexInfos = getIndexInfo(createTableSQL, schemaName, columns);
removeTable(schemaName, tableName);
addLogicTable(LogicTable.createNormalTable(schemaName, tableName, partitions.get(0), columns, indexInfos, createTableSQL, tableConfigEntry));
return;
try {
List<SimpleColumnInfo> columns = prototypeService.getColumnInfo(createTableSQL, schemaName, tableName);
Map<String, IndexInfo> indexInfos = getIndexInfo(createTableSQL, schemaName, columns);
removeTable(schemaName, tableName);
addLogicTable(LogicTable.createNormalTable(schemaName, tableName, partitions.get(0), columns, indexInfos, createTableSQL, tableConfigEntry));
return;
}catch (Throwable throwable){
LOGGER.error("generate column fail {}", tableConfigEntry,throwable);
}
} else {
LOGGER.error("not found createTable SQL:{}", tableConfigEntry);
}
} catch (Throwable throwable) {
LOGGER.error("", throwable);
LOGGER.error("addNormalTable fail schemaName:{} tableName:{}",schemaName,tableName, throwable);
}
if (backupTable!=null){
addLogicTable(backupTable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2190,7 +2190,7 @@ public List<SimpleColumnInfo> getColumnInfo(String sql, String schema, String ta
}
return CalciteConvertors.getColumnInfo(Objects.requireNonNull(mycatRowMetaData));
} catch (Exception e) {
LOGGER.error("", e);
LOGGER.error("sql:{}",sql, e);
return getSimpleColumnInfos(schema, table);
}
}
Expand Down

0 comments on commit bb679a4

Please sign in to comment.