Skip to content

Commit

Permalink
fix jdbc catalog NPE issue when query have filter (StarRocks#20549)
Browse files Browse the repository at this point in the history
Signed-off-by: leoyy0316 <571684903@qq.com>
Fixes StarRocks#20548
  • Loading branch information
leoyy0316 authored Apr 3, 2023
1 parent 17ad317 commit 51eb712
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions fe/fe-core/src/main/java/com/starrocks/catalog/JDBCTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public String getJdbcTable() {
return jdbcTable;
}

public String getProperty(String propertyKey) {
return properties.get(propertyKey);
}

private void validate(Map<String, String> properties) throws DdlException {
if (properties == null) {
throw new DdlException("Please set properties of jdbc table, they are: table and resource");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ private void createJDBCTableFilters() {
}
JDBCResource resource = (JDBCResource) GlobalStateMgr.getCurrentState().getResourceMgr()
.getResource(table.getResourceName());
String jdbcURI = resource.getProperty(JDBCResource.URI);
// Compatible with jdbc catalog
String jdbcURI = resource != null ? resource.getProperty(JDBCResource.URI) : table.getProperty(JDBCResource.URI);
boolean isMySQL = jdbcURI.startsWith("jdbc:mysql");
ArrayList<Expr> mysqlConjuncts = Expr.cloneList(conjuncts, sMap);
for (Expr p : mysqlConjuncts) {
Expand Down

0 comments on commit 51eb712

Please sign in to comment.