Skip to content

Commit

Permalink
DimensionLookup transform fails with hop-run #4328
Browse files Browse the repository at this point in the history
  • Loading branch information
nadment committed Sep 18, 2024
1 parent d9a796a commit 5b3b4ca
Showing 1 changed file with 20 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,44 +281,32 @@ public void getFields(
}

try {
DatabaseMeta databaseMeta =
metadataProvider.getSerializer(DatabaseMeta.class).load(variables.resolve(connection));

try (Database db = new Database(loggingObject, variables, databaseMeta)) {
// Get the rows from the table...
IRowMeta extraFields = db.getTableFieldsMeta(schemaName, tableName);
// Get the rows from the table...
IRowMeta extraFields = getTableFields(variables);

for (DLField field : fields.fields) {
v = extraFields.searchValueMeta(field.getLookup());
if (v == null) {
String message =
BaseMessages.getString(
PKG,
"DimensionLookupMeta.Exception.UnableToFindReturnField",
field.getLookup());
logError(message);
throw new HopTransformException(message);
}
for (DLField field : fields.fields) {
v = extraFields.searchValueMeta(field.getLookup());
if (v == null) {
String message =
BaseMessages.getString(
PKG, "DimensionLookupMeta.Exception.UnableToFindReturnField", field.getLookup());
logError(message);
throw new HopTransformException(message);
}

// If the field needs to be renamed, rename
if (StringUtils.isNotEmpty(field.getName())) {
v.setName(field.getName());
}
v.setOrigin(name);
row.addValueMeta(v);
// If the field needs to be renamed, rename
if (StringUtils.isNotEmpty(field.getName())) {
v.setName(field.getName());
}
} catch (Exception e) {
String message =
BaseMessages.getString(
PKG, "DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField2");
logError(message);
throw new HopTransformException(message, e);
v.setOrigin(name);
row.addValueMeta(v);
}
} catch (HopException e) {
} catch (Exception e) {
String message =
BaseMessages.getString(PKG, "DimensionLookupMeta.Exception.DatabaseErrorOccurred")
+ e.getMessage();
BaseMessages.getString(
PKG, "DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField2");
logError(message);
throw new HopTransformException(message, e);
}
}

Expand Down

0 comments on commit 5b3b4ca

Please sign in to comment.