-
Notifications
You must be signed in to change notification settings - Fork 805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update ListAllWorkflowExecutions pinot endpoint #6160
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -720,20 +720,19 @@ | |
|
||
func (s *PinotQuerySearchField) addEqual(obj string, val interface{}) { | ||
s.checkFirstSearchField() | ||
if _, ok := val.(string); ok { | ||
val = fmt.Sprintf("'%s'", val) | ||
} else { | ||
val = fmt.Sprintf("%v", val) | ||
switch val.(type) { | ||
case string: | ||
s.string += fmt.Sprintf("%s = '%s'\n", obj, val) | ||
case int32: | ||
s.string += fmt.Sprintf("%s = %d\n", obj, val) | ||
default: | ||
s.string += fmt.Sprintf("%s = %v\n", obj, val) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A test for this case is missing (according to codecov). |
||
} | ||
|
||
quotedVal := fmt.Sprintf("%s", val) | ||
s.string += fmt.Sprintf("%s = %s\n", obj, quotedVal) | ||
} | ||
|
||
func (s *PinotQuerySearchField) addMatch(obj string, val interface{}) { | ||
s.checkFirstSearchField() | ||
|
||
s.string += fmt.Sprintf("text_match(%s, '\"%s\"')\n", obj, val) | ||
s.string += fmt.Sprintf("REGEXP_LIKE(%s, '^.*%s.*$')\n", obj, val) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Once we add the text index, we should use Text_Match for partial match. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can update and test after Pinot team enable text index for us. |
||
} | ||
|
||
func NewPinotQuery(tableName string) PinotQuery { | ||
|
@@ -778,7 +777,7 @@ | |
|
||
func (q *PinotQuery) addStatusFilters(status []types.WorkflowExecutionCloseStatus) { | ||
for _, s := range status { | ||
q.search.addEqual(CloseStatus, s.String()) | ||
q.search.addEqual(CloseStatus, int32(s)) | ||
} | ||
|
||
q.search.lastSearchField() | ||
|
@@ -1094,13 +1093,13 @@ | |
|
||
if request.WorkflowSearchValue != "" { | ||
if request.PartialMatch { | ||
query.search.addMatch(WorkflowID, request.WorkflowSearchValue) | ||
query.search.addMatch(WorkflowType, request.WorkflowSearchValue) | ||
query.search.addMatch(RunID, request.WorkflowSearchValue) | ||
query.search.addMatch(WfIDTextSearch, request.WorkflowSearchValue) | ||
query.search.addMatch(WfTypeTextSearch, request.WorkflowSearchValue) | ||
query.search.addMatch(RunIDTextSearch, request.WorkflowSearchValue) | ||
} else { | ||
query.search.addEqual(WorkflowID, request.WorkflowSearchValue) | ||
query.search.addEqual(WorkflowType, request.WorkflowSearchValue) | ||
query.search.addEqual(RunID, request.WorkflowSearchValue) | ||
query.search.addEqual(WfIDTextSearch, request.WorkflowSearchValue) | ||
query.search.addEqual(WfTypeTextSearch, request.WorkflowSearchValue) | ||
query.search.addEqual(RunIDTextSearch, request.WorkflowSearchValue) | ||
} | ||
|
||
query.search.lastSearchField() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole thing with += of strings is extremely error-prone and inefficient.
I suggest revisiting this and building a set of filters to groups with "()" around them and then joining them together in one go.
But that would be a separate problem/PR.
cc @neil-xie