-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ac51bd
commit 0021c9a
Showing
10 changed files
with
206 additions
and
93 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
25 changes: 25 additions & 0 deletions
25
...ypertrace/core/documentstore/mongo/query/parser/MongoDollarPrefixingIdempotentParser.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,25 @@ | ||
package org.hypertrace.core.documentstore.mongo.query.parser; | ||
|
||
import static org.hypertrace.core.documentstore.mongo.MongoUtils.PREFIX; | ||
|
||
import java.util.Optional; | ||
import org.hypertrace.core.documentstore.expression.impl.IdentifierExpression; | ||
|
||
final class MongoDollarPrefixingIdempotentParser extends MongoSelectTypeExpressionParser { | ||
MongoDollarPrefixingIdempotentParser(final MongoSelectTypeExpressionParser baseParser) { | ||
super(baseParser); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public String visit(final IdentifierExpression expression) { | ||
return Optional.ofNullable(baseParser.visit(expression)) | ||
.map(Object::toString) | ||
.map(this::idempotentPrefix) | ||
.orElse(null); | ||
} | ||
|
||
private String idempotentPrefix(final String identifier) { | ||
return identifier.startsWith(PREFIX) ? identifier : PREFIX + identifier; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
.../hypertrace/core/documentstore/mongo/query/parser/MongoExprRelationalFilterOperation.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,21 @@ | ||
package org.hypertrace.core.documentstore.mongo.query.parser; | ||
|
||
import java.util.Map; | ||
import lombok.AllArgsConstructor; | ||
import org.hypertrace.core.documentstore.expression.type.SelectTypeExpression; | ||
|
||
@AllArgsConstructor | ||
class MongoExprRelationalFilterOperation implements RelationalFilterOperation { | ||
public static final String EXPR = "$expr"; | ||
|
||
private final MongoSelectTypeExpressionParser lhsParser; | ||
private final MongoSelectTypeExpressionParser rhsParser; | ||
private final String operator; | ||
|
||
@Override | ||
public Map<String, Object> apply(final SelectTypeExpression lhs, final SelectTypeExpression rhs) { | ||
final Object parsedLhs = lhs.accept(lhsParser); | ||
final Object parsedRhs = rhs.accept(rhsParser); | ||
return Map.of(operator, new Object[] {parsedLhs, parsedRhs}); | ||
} | ||
} |
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
4 changes: 2 additions & 2 deletions
4
...ertrace/core/documentstore/mongo/query/parser/MongoFunctionRelationalFilterOperation.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
Oops, something went wrong.