Skip to content

Commit c9a4dcb

Browse files
committed
Clarify custom predicate examples
1 parent c2facf8 commit c9a4dcb

3 files changed

Lines changed: 12 additions & 14 deletions

File tree

pinot-common/src/main/java/org/apache/pinot/common/filter/FilterPredicatePlugin.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
/**
2727
* SPI interface for registering custom filter predicates into Pinot.
2828
*
29-
* <p>A plugin implementing this interface can introduce a new filter predicate (e.g., SEMANTIC_MATCH)
29+
* <p>A plugin implementing this interface can introduce a new filter predicate (for example, anyLike)
3030
* without modifying Pinot core code. The plugin handles three layers:
3131
* <ol>
3232
* <li><b>SQL Parsing</b> — validation and rewriting of the Thrift expression tree</li>
@@ -42,7 +42,7 @@
4242
public interface FilterPredicatePlugin {
4343

4444
/**
45-
* Returns the canonical name of this filter predicate (e.g., "SEMANTIC_MATCH").
45+
* Returns the canonical name of this filter predicate (for example, "LIKE_ANY").
4646
* Must be unique across all registered plugins and built-in filter kinds.
4747
* The name is case-insensitive and will be canonicalized for matching.
4848
*/
@@ -79,8 +79,8 @@ default void rewriteExpression(List<org.apache.pinot.common.request.Expression>
7979
* Returns the operand type families for Calcite SQL operator registration.
8080
* Each element corresponds to one operand and specifies its expected SQL type family.
8181
*
82-
* <p>Example for SEMANTIC_MATCH(column, 'query', topK):
83-
* {@code List.of(OperandType.STRING, OperandType.STRING, OperandType.INTEGER)}
82+
* <p>Example for anyLike(column, 'foo%', '%bar'):
83+
* {@code List.of(OperandType.STRING, OperandType.STRING, OperandType.STRING)}
8484
*/
8585
List<OperandType> getOperandTypes();
8686

pinot-common/src/main/java/org/apache/pinot/common/request/context/predicate/CustomPredicate.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,18 @@
2525
* Base class for custom filter predicates registered via the plugin system.
2626
*
2727
* <p>Plugin authors should extend this class to define their own predicate types
28-
* (e.g., SemanticMatchPredicate). The {@link #getCustomTypeName()} method returns
28+
* (for example, AnyLikePredicate). The {@link #getCustomTypeName()} method returns
2929
* the unique predicate name used to look up the corresponding filter operator factory
3030
* at query execution time.
3131
*
3232
* <p>Example:
3333
* <pre>
34-
* public class SemanticMatchPredicate extends CustomPredicate {
35-
* private final String _queryText;
36-
* private final int _topK;
34+
* public class AnyLikePredicate extends CustomPredicate {
35+
* private final List<String> _patterns;
3736
*
38-
* public SemanticMatchPredicate(ExpressionContext lhs, String queryText, int topK) {
39-
* super(lhs, "SEMANTIC_MATCH");
40-
* _queryText = queryText;
41-
* _topK = topK;
37+
* public AnyLikePredicate(ExpressionContext lhs, List<String> patterns) {
38+
* super(lhs, "LIKE_ANY");
39+
* _patterns = patterns;
4240
* }
4341
* // ... getters, equals, hashCode, toString
4442
* }
@@ -59,7 +57,7 @@ public final Type getType() {
5957
}
6058

6159
/**
62-
* Returns the unique name of this custom predicate type (e.g., "SEMANTIC_MATCH").
60+
* Returns the unique name of this custom predicate type (for example, "LIKE_ANY").
6361
* Used to look up the corresponding filter operator factory at execution time.
6462
*/
6563
public String getCustomTypeName() {

pinot-core/src/main/java/org/apache/pinot/core/operator/filter/custom/CustomFilterOperatorFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
public interface CustomFilterOperatorFactory {
4242

4343
/**
44-
* Returns the predicate name this factory handles (e.g., "SEMANTIC_MATCH").
44+
* Returns the predicate name this factory handles (for example, "LIKE_ANY").
4545
* Must match the name returned by the corresponding
4646
* {@link org.apache.pinot.common.request.context.predicate.CustomPredicate#getCustomTypeName()}.
4747
*/

0 commit comments

Comments
 (0)