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

Inject customizable extraction functions to RegisteredLookupDimension #724

Merged
merged 3 commits into from
Jun 27, 2018

Conversation

QubitPi
Copy link
Contributor

@QubitPi QubitPi commented Jun 21, 2018

Addresses issue #723

Problem

We have a business requirement to return different default value for different registered lookup. To be more specific, here is an example of serialized registered lookup extraction function

{
    "type" : "registeredLookup",
    "lookup" : "<lookup name>",
    "retainMissingValue" : false,
    "replaceMissingValueWith" : "<default lookup value>",
    "injective" : false,
    "optimize" : true
}

API supports lookups with user-defined lookup name as in "lookup" : "<lookup name>". It is, however, not possible for downstream projects to specify the rest of attributes. We need a different default lookup value as in "replaceMissingValueWith" : "<default lookup value>" for each lookup extraction function.

Solution

The cause of this issue is in DefaultRegisteredLookupDimensionConfig, we only pass in a list of lookup names. If, instead, we pass in a list of RegisteredLookupExtractionFunction, the downstream projects could freely define all of the attributes for a registered lookup extraction function and then configure them in.

This PR essentially changes List<String> lookups to List<ExtractionFunction> registeredLookupExtractionFns in DefaultRegisteredLookupDimensionConfig.

@michael-mclawhorn This might have impact on #719

@QubitPi QubitPi force-pushed the issue-723-customizable-extractFns branch from d0f86ef to 6bfdece Compare June 21, 2018 07:27
@yahoo yahoo deleted a comment Jun 21, 2018
@QubitPi QubitPi force-pushed the issue-723-customizable-extractFns branch 2 times, most recently from 30e2281 to 3649ac1 Compare June 21, 2018 07:43
keyValueStore,
searchProvider
);
this.registeredLookupExtractionFns = Collections.unmodifiableList(registeredLookupExtractionFns);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only this line is effectively changed for this constructor, the rest is Javadoc updates

@NotNull LinkedHashSet<DimensionField> fields,
@NotNull KeyValueStore keyValueStore,
@NotNull SearchProvider searchProvider,
@NotNull List<ExtractionFunction> registeredLookupExtractionFns
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only this line is effectively changed for this constructor, the rest is Javadoc updates

@@ -17,9 +18,9 @@ default Class getType() {
}

/**
* Returns a list of lookups used to configure the Lookup dimension.
* Returns a list of extraction function for the lookup dimension values.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(sp) extraction functions

Copy link
Contributor

@michael-mclawhorn michael-mclawhorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just fix the spelling issue and merge.

@QubitPi QubitPi force-pushed the issue-723-customizable-extractFns branch from 3d8f29f to c194850 Compare June 27, 2018 20:49
@yahoo yahoo deleted a comment Jun 27, 2018
@QubitPi
Copy link
Contributor Author

QubitPi commented Jun 27, 2018

Thank you for the review and approvals, @michael-mclawhorn @efronbs !

@QubitPi QubitPi merged commit 41543bb into master Jun 27, 2018
@QubitPi QubitPi deleted the issue-723-customizable-extractFns branch June 27, 2018 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants