-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AggregationStore: Templated filter column arguments (#2297)
* Added filter template support for columns * Build passes * Added more tests * Added column argument validator unit tests * Build passed Co-authored-by: Aaron Klish <[email protected]>
- Loading branch information
Showing
21 changed files
with
399 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
.../src/main/java/com/yahoo/elide/datastores/aggregation/metadata/models/RequiresFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2021, Yahoo Inc. | ||
* Licensed under the Apache License, Version 2.0 | ||
* See LICENSE file in project root for terms. | ||
*/ | ||
package com.yahoo.elide.datastores.aggregation.metadata.models; | ||
|
||
import com.yahoo.elide.core.dictionary.EntityDictionary; | ||
import com.yahoo.elide.core.filter.dialect.ParseException; | ||
import com.yahoo.elide.core.filter.dialect.RSQLFilterDialect; | ||
import com.yahoo.elide.core.filter.expression.FilterExpression; | ||
import com.yahoo.elide.core.type.Type; | ||
import com.yahoo.elide.modelconfig.model.Named; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
/** | ||
* Metadata models that require a client filter. | ||
*/ | ||
public interface RequiresFilter extends Named { | ||
Table getTable(); | ||
|
||
String getRequiredFilter(); | ||
|
||
default FilterExpression getRequiredFilter(EntityDictionary dictionary) { | ||
Type<?> cls = dictionary.getEntityClass(getTable().getName(), getTable().getVersion()); | ||
RSQLFilterDialect filterDialect = new RSQLFilterDialect(dictionary); | ||
|
||
if (StringUtils.isNotEmpty(getRequiredFilter())) { | ||
try { | ||
return filterDialect.parseFilterExpression(getRequiredFilter(), cls, false, true); | ||
} catch (ParseException e) { | ||
throw new IllegalStateException(e); | ||
} | ||
} | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.