Skip to content

Commit

Permalink
Fix for one missing one condition
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-xie committed Feb 9, 2024
1 parent 5483419 commit b80ebf5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions common/pinot/pinotQueryValidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,18 @@ func (qv *VisibilityQueryValidator) processSystemKey(expr sqlparser.Expr) (strin
colNameStr := colName.Name.String()

if comparisonExpr.Operator != sqlparser.EqualStr {
if _, ok := timeSystemKeys[colNameStr]; ok {
sqlVal, ok := comparisonExpr.Right.(*sqlparser.SQLVal)
if !ok {
return "", fmt.Errorf("error: Failed to convert val")
}
trimmed, err := trimTimeFieldValueFromNanoToMilliSeconds(sqlVal)
if err != nil {
return "", err
}
comparisonExpr.Right = trimmed
}

expr.Format(buf)
return buf.String(), nil
}
Expand Down
6 changes: 3 additions & 3 deletions common/pinot/pinotQueryValidator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ func TestValidateQuery(t *testing.T) {
query: "StartTime = 1707319950934000128",
validated: "StartTime = 1707319950934",
},
"Case15-5: unix nano converts to milli seconds for range query": {
query: "StartTime = 1707319950934000128",
validated: "StartTime = 1707319950934",
"Case15-5: unix nano converts to milli seconds for unequal statements query": {
query: "StartTime > 1707319950934000128",
validated: "StartTime > 1707319950934",
},
"Case15-6: open workflows": {
query: "CloseTime = -1",
Expand Down

0 comments on commit b80ebf5

Please sign in to comment.