Skip to content

Commit af7d32c

Browse files
committed
【解决Oracle元数据采集当某库中表数据为0时查询异常问题】【30332】
1 parent 412e6bd commit af7d32c

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

flinkx-metadata-oracle/flinkx-metadata-oracle-reader/src/main/java/com/dtstack/flinkx/metadataoracle/inputformat/MetadataoracleInputFormat.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.dtstack.flinkx.constants.ConstantValue;
2222
import com.dtstack.flinkx.metadata.inputformat.BaseMetadataInputFormat;
2323
import org.apache.commons.collections.CollectionUtils;
24+
import org.apache.commons.lang3.StringUtils;
2425

2526
import java.sql.ResultSet;
2627
import java.sql.SQLException;
@@ -105,7 +106,7 @@ protected Map<String, Object> queryMetaData(String tableName) throws SQLExceptio
105106

106107
Map<String, Map<String, String> > queryTableProperties() throws SQLException {
107108
Map<String, Map<String, String>> tablePropertiesMap = new HashMap<>(16);
108-
if(allTable==null){
109+
if(StringUtils.isBlank(allTable)){
109110
sql = String.format(SQL_QUERY_TABLE_PROPERTIES_TOTAL, quote(currentDb.get()));
110111
}else {
111112
sql = String.format(SQL_QUERY_TABLE_PROPERTIES, quote(currentDb.get()), allTable);
@@ -126,7 +127,7 @@ Map<String, Map<String, String> > queryTableProperties() throws SQLException {
126127

127128
Map<String, List<Map<String, String>>> queryIndexList() throws SQLException {
128129
Map<String, List<Map<String, String>>> indexListMap = new HashMap<>(16);
129-
if(allTable==null){
130+
if(StringUtils.isBlank(allTable)){
130131
sql = String.format(SQL_QUERY_INDEX_TOTAL, quote(currentDb.get()));
131132
}else {
132133
sql = String.format(SQL_QUERY_INDEX, quote(currentDb.get()), allTable);
@@ -152,7 +153,7 @@ Map<String, List<Map<String, String>>> queryIndexList() throws SQLException {
152153

153154
Map<String, List<Map<String, Object>>> queryColumnList() throws SQLException {
154155
Map<String, List<Map<String, Object>>> columnListMap = new HashMap<>(16);
155-
if(allTable==null){
156+
if(StringUtils.isBlank(allTable)){
156157
sql = String.format(SQL_QUERY_COLUMN_TOTAL, quote(currentDb.get()));
157158
}else {
158159
sql = String.format(SQL_QUERY_COLUMN, quote(currentDb.get()), allTable);

flinkx-metadata/flinkx-metadata-reader/src/main/java/com/dtstack/flinkx/metadata/inputformat/BaseMetadataInputFormat.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ protected void openInternal(InputSplit inputSplit) throws IOException {
8282
tableIterator.set(tableList.iterator());
8383
init();
8484
} catch (SQLException | ClassNotFoundException e) {
85-
LOG.error("获取table列表异常, dbUrl = {}, username = {}, inputSplit = {}, e = {}", dbUrl, username, inputSplit, ExceptionUtil.getErrorMessage(e));
86-
throw new IOException("获取table列表异常", e);
85+
String message = String.format("获取table列表异常, dbUrl = %s, username = %s, inputSplit = %s, e = %s", dbUrl, username, inputSplit, ExceptionUtil.getErrorMessage(e));
86+
LOG.error(message);
87+
throw new IOException(message, e);
8788
}
8889
}
8990

0 commit comments

Comments
 (0)