diff --git a/common/pinot/pinotQueryValidator.go b/common/pinot/pinotQueryValidator.go index ec6024126f3..aa776ecd624 100644 --- a/common/pinot/pinotQueryValidator.go +++ b/common/pinot/pinotQueryValidator.go @@ -271,7 +271,7 @@ func (qv *VisibilityQueryValidator) processSystemKey(expr sqlparser.Expr) (strin return "", fmt.Errorf("right comparison is invalid: %v", comparisonExpr.Right) } colValStr := string(colVal.Val) - return fmt.Sprintf("TEXT_MATCH(%s, '%s')", colNameStr, colValStr), nil + return fmt.Sprintf("TEXT_MATCH(%s, '/.*%s.*/')", colNameStr, colValStr), nil } if comparisonExpr.Operator != sqlparser.EqualStr && comparisonExpr.Operator != sqlparser.NotEqualStr { diff --git a/common/pinot/pinotQueryValidator_test.go b/common/pinot/pinotQueryValidator_test.go index 14608812176..a77f0782180 100644 --- a/common/pinot/pinotQueryValidator_test.go +++ b/common/pinot/pinotQueryValidator_test.go @@ -48,7 +48,7 @@ func TestValidateQuery(t *testing.T) { }, "Case2-2: simple query with partial match": { query: "WorkflowID like 'wid'", - validated: "TEXT_MATCH(WorkflowID, 'wid')", + validated: "TEXT_MATCH(WorkflowID, '/.*wid.*/')", }, "Case2-3: invalid simple query with partial match": { query: "WorkflowID like wid", @@ -95,7 +95,7 @@ func TestValidateQuery(t *testing.T) { }, "Case6-5: complex query with partial match": { query: "RunID like '123' or WorkflowID like '123'", - validated: "(TEXT_MATCH(RunID, '123') or TEXT_MATCH(WorkflowID, '123'))", + validated: "(TEXT_MATCH(RunID, '/.*123.*/') or TEXT_MATCH(WorkflowID, '/.*123.*/'))", }, "Case7: invalid sql query": { query: "Invalid SQL",