fix case where datset node.get("datasourceId") is null
@@ -240,14 +240,15 @@ public class DerivedDatasourceFactory {
// Extract properties from node
DatasourceDefinition datasourceDefinition = null;
final Map<String, String> properties = new HashMap<>();
+ String userDatasourceId = (String) node.get("datasourceId");
- if (node.get("datasourceId") == null || ((String) node.get("datasourceId")).equalsIgnoreCase("HIVE")) {
+ if ((userDatasourceId == null && node.get("dataset") == null) || (userDatasourceId != null && userDatasourceId.equalsIgnoreCase("HIVE"))) {
final String name = (String) node.get("name");
datasourceDefinition = hiveDefinition;
properties.put(HIVE_SCHEMA_KEY, StringUtils.trim(StringUtils.substringBefore(name, ".")));
properties.put(HIVE_TABLE_KEY, StringUtils.trim(StringUtils.substringAfterLast(name, ".")));
- } else {
- final Datasource datasource = datasourceProvider.getDatasource(datasourceProvider.resolve((String) node.get("datasourceId")));
+ } else if (userDatasourceId != null) {
+ final Datasource datasource = datasourceProvider.getDatasource(datasourceProvider.resolve(userDatasourceId));
if (datasource != null) {
datasourceDefinition = jdbcDefinition;
properties.put(JDBC_CONNECTION_KEY, datasource.getName());
