Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Asset Manager OMAS updateSchemaAttribute does not update dataType #7147

Closed
1 task done
davidradl opened this issue Nov 29, 2022 · 5 comments
Closed
1 task done
Assignees
Labels
bug Something isn't working

Comments

@davidradl
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

If I issue a createSchemaAttribute in the SchemaExchangeRestServices, I supply SchemaAttributeRequestBody, this contains a schemaType that contains the datatype. For me this was a primitive schema attribute called age with a datatype called integer.

If I then issue an updateSchemaAttribute to the SchemaExchangeRestServices, I supply SchemaAttributeRequestBody with. schematype that has a datatype "string", the datatype is not updated.

Expected Behavior

Expect that the datatype is updated.

Steps To Reproduce

call updateSchemaAttribute to change the datatype. This can be done by using the Sample Lineage connector.

Environment

- Egeria:
- OS:
- Java:
- Browser (for UI issues):
- Additional connectors and integration:

Any Further Information?

No response

@davidradl davidradl added bug Something isn't working triage New bug/issue which needs checking & assigning labels Nov 29, 2022
@davidradl davidradl self-assigned this Nov 29, 2022
@davidradl
Copy link
Member Author

davidradl commented Nov 29, 2022

In the debugger I am comparing the createSchemaAttribute flow with the updateSchemaAttributeFlow of SchemaExchangeHandler.
I see that for create line 1214

SchemaAttributeBuilder schemaAttributeBuilder = this.getSchemaAttributeBuilder(userId,
                                                                                       schemaAttributeProperties,
                                                                                       methodName);

String schemaAttributeGUID = schemaAttributeHandler.createNestedSchemaAttribute(userId,
                                                                                        getExternalSourceGUID(correlationProperties, assetManagerIsHome),
                                                                                        getExternalSourceName(correlationProperties, assetManagerIsHome),
                                                                                        schemaElementGUID,
                                                                                        schemaElementGUIDParameterName,
                                                                                        schemaAttributeProperties.getQualifiedName(),
                                                                                        qualifiedNameParameterName,
                                                                                        schemaAttributeBuilder,
                                                                                        schemaAttributeProperties.getEffectiveFrom(),
                                                                                        schemaAttributeProperties.getEffectiveTo(),
                                                                                        forLineage,
                                                                                        forDuplicateProcessing,
                                                                                        effectiveTime,
                                                                                        methodName);

for update line 1457

SchemaAttributeBuilder schemaAttributeBuilder = this.getSchemaAttributeBuilder(userId,
                                                                                      schemaAttributeProperties,
                                                                                      methodName);

       schemaAttributeHandler.updateSchemaAttribute(userId,
                                                    getExternalSourceGUID(correlationProperties),
                                                    getExternalSourceName(correlationProperties),
                                                    schemaAttributeGUID,
                                                    schemaAttributeGUIDParameterName,
                                                    forLineage,
                                                    forDuplicateProcessing,
                                                    supportedZones,
                                                    schemaAttributeBuilder.getInstanceProperties(methodName),
                                                    isMergeUpdate,
                                                    effectiveTime,
                                                    methodName);

In both cases the schemaAttributeBuilder contains a newClassification with the appropriate DataType value.

I notice that in the create case the schemaAttributeBuilder is passed down to the generic handler. In the update case schemaAttributeBuilder.getInstanceProperties(methodName) is sent down - that only contains the instance properties but not DataType.

At line 1773 in the update code path , the code creates a new schemaAttributeBuilder -which has lost the embeddedType classification

I am thinking of adding an overloaded version of updateSchemaAttribute method that passes the builder down, then use that. Does this sound reasonable @mandy-chessell ?

@mandy-chessell
Copy link
Contributor

Why create an overloaded method rather than updating the existing method? Which circumstances would you not want the builder?

@davidradl
Copy link
Member Author

@mandy-chessell ok - I will add another parameter to this method.

@mandy-chessell
Copy link
Contributor

My question before was a genuine question since I had not looked at the code. I have now looked at the code and I agree that an overloaded method seems a better idea. There are currently two styles of update method. The method being called only updates the schema attribute entity and not its classification. There is another method (line 1690), used when we know that the type is a primitive - such as a database column - (but not the case in Asset Manager). This passes all of the properties as individual parameters. It has the code to update the classification too. So for Asset Manager we need a third style that takes the schema attribute builder (with the schema type builder embedded) and uses them to do the updates.

@davidradl
Copy link
Member Author

@mandy-chessell I have put in a smaller targeted fix that works that just does applies the classifications after the instance properties are updated. I hope this is ok for now - it solves my issue. I will raise another issue for the bigger change

@planetf1 planetf1 removed the triage New bug/issue which needs checking & assigning label Dec 5, 2022
davidradl added a commit that referenced this issue Dec 13, 2022
#7147 Update schema attribute in asset manager , changed to  ensure that dataType is updated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants