-
Notifications
You must be signed in to change notification settings - Fork 51
fix(QTDI-2420): Change discover schema action order for input in TaCoKitGuessSchema #1164
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
base: master
Are you sure you want to change the base?
Changes from all commits
02fc4b2
977a048
b1eca2e
be418b9
6745ba8
7f1d806
aec9658
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -421,22 +421,23 @@ public boolean guessSchemaThroughAction(final Schema schema) { | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ServiceMeta.ActionMeta actionRef; | ||||||||||||||||||||||||
| if (action == null || action.isEmpty()) { | ||||||||||||||||||||||||
| // dataset name should be the same as DiscoverSchema action name so let's try to guess from the component | ||||||||||||||||||||||||
| // Dataset name should match the DiscoverSchema or DiscoverSchemaExtended action name, so try to | ||||||||||||||||||||||||
| // guess it from the component (preferring DiscoverSchemaExtended over DiscoverSchema). | ||||||||||||||||||||||||
| actionRef = findFirstComponentDataSetName() | ||||||||||||||||||||||||
| .flatMap(datasetName -> services | ||||||||||||||||||||||||
| .stream() | ||||||||||||||||||||||||
| .flatMap(s -> s.getActions().stream()) | ||||||||||||||||||||||||
| .filter(a -> a.getFamily().equals(family) && a.getType().equals(SCHEMA_TYPE)) | ||||||||||||||||||||||||
| .filter(a -> a.getFamily().equals(family) && a.getType().equals(SCHEMA_EXTENDED_TYPE)) | ||||||||||||||||||||||||
| .filter(a -> a.getAction().equals(datasetName)) | ||||||||||||||||||||||||
| .findFirst()) | ||||||||||||||||||||||||
| .orElse(null); | ||||||||||||||||||||||||
| if (actionRef == null) { | ||||||||||||||||||||||||
| // let's try DiscoverSchemaExtended action name | ||||||||||||||||||||||||
| // second find DiscoverSchema action name | ||||||||||||||||||||||||
| actionRef = findFirstComponentDataSetName() | ||||||||||||||||||||||||
| .flatMap(datasetName -> services | ||||||||||||||||||||||||
| .stream() | ||||||||||||||||||||||||
| .flatMap(s -> s.getActions().stream()) | ||||||||||||||||||||||||
| .filter(a -> a.getFamily().equals(family) && a.getType().equals(SCHEMA_EXTENDED_TYPE)) | ||||||||||||||||||||||||
| .filter(a -> a.getFamily().equals(family) && a.getType().equals(SCHEMA_TYPE)) | ||||||||||||||||||||||||
| .filter(a -> a.getAction().equals(datasetName)) | ||||||||||||||||||||||||
| .findFirst()) | ||||||||||||||||||||||||
| .orElse(null); | ||||||||||||||||||||||||
|
|
@@ -446,10 +447,18 @@ public boolean guessSchemaThroughAction(final Schema schema) { | |||||||||||||||||||||||
| .stream() | ||||||||||||||||||||||||
| .flatMap(s -> s.getActions().stream()) | ||||||||||||||||||||||||
| .filter(a -> a.getFamily().equals(family) && a.getAction().equals(action) | ||||||||||||||||||||||||
| && a.getType().equals(SCHEMA_TYPE)) | ||||||||||||||||||||||||
| && (a.getType().equals(SCHEMA_EXTENDED_TYPE) || a.getType().equals(SCHEMA_TYPE))) | ||||||||||||||||||||||||
| // When both DiscoverSchemaExtended and DiscoverSchema exist for the same action name, | ||||||||||||||||||||||||
| // prefer the extended schema action by ordering it first. | ||||||||||||||||||||||||
| .sorted((action1, action2) -> { | ||||||||||||||||||||||||
| boolean action1IsExtended = action1.getType().equals(SCHEMA_EXTENDED_TYPE); | ||||||||||||||||||||||||
| boolean action2IsExtended = action2.getType().equals(SCHEMA_EXTENDED_TYPE); | ||||||||||||||||||||||||
| return Boolean.compare(!action1IsExtended, !action2IsExtended); | ||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||
undx marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||
| .findFirst() | ||||||||||||||||||||||||
|
Comment on lines
+453
to
458
|
||||||||||||||||||||||||
| .sorted((action1, action2) -> { | |
| boolean action1IsExtended = action1.getType().equals(SCHEMA_EXTENDED_TYPE); | |
| boolean action2IsExtended = action2.getType().equals(SCHEMA_EXTENDED_TYPE); | |
| return Boolean.compare(!action1IsExtended, !action2IsExtended); | |
| }) | |
| .findFirst() | |
| .min((action1, action2) -> { | |
| boolean action1IsExtended = action1.getType().equals(SCHEMA_EXTENDED_TYPE); | |
| boolean action2IsExtended = action2.getType().equals(SCHEMA_EXTENDED_TYPE); | |
| return Boolean.compare(!action1IsExtended, !action2IsExtended); | |
| }) |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -240,8 +240,8 @@ Example: | |||||||
| ==== For inputs | ||||||||
|
|
||||||||
| . Try to find an action in declared Service class | ||||||||
| .. search an action of type `@DiscoverSchema` named like the input dataset. | ||||||||
| .. search an action of type `@DiscoverSchemaExtended` named like the input dataset. | ||||||||
| .. search an action of type `@DiscoverSchema` named like the input dataset. | ||||||||
| .. search an action of type `@DiscoverSchema`. | ||||||||
| . Execute a fake job with component to retrieve output schema. | ||||||||
undx marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
245
to
246
|
||||||||
| .. search an action of type `@DiscoverSchema`. | |
| . Execute a fake job with component to retrieve output schema. | |
| . If no matching action is found, execute a fake job with the component to retrieve the output schema. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is grammatically unclear: “second find DiscoverSchema action name”. Consider rephrasing (e.g., “Then try the DiscoverSchema action name”) so it’s easier to follow when debugging action selection.