Skip to content

Commit

Permalink
Revert text search columns for pinot visibility store (cadence-workfl…
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-xie authored Jul 9, 2024
1 parent 1e2ef3d commit cb0d3e9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 25 deletions.
20 changes: 7 additions & 13 deletions common/persistence/pinot/pinot_visibility_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ const (
IsDeleted = "IsDeleted" // used for Pinot deletion/rolling upsert only, not visible to user
EventTimeMs = "EventTimeMs" // used for Pinot deletion/rolling upsert only, not visible to user
Memo = "Memo"
WfIDTextSearch = "WorkflowIDTextSearch" // used for text search which can improve the partial match performance on WorkflowID/RunID/WorkflowType text search columns
WfTypeTextSearch = "WorkflowTypeTextSearch" // used for text search which can improve the partial match performance on WorkflowID/RunID/WorkflowType text search columns
RunIDTextSearch = "RunIDTextSearch" // used for text search which can improve the partial match performance on WorkflowID/RunID/WorkflowType text search columns

// used to be micro second
oneMicroSecondInNano = int64(time.Microsecond / time.Nanosecond)
Expand Down Expand Up @@ -618,10 +615,7 @@ func createVisibilityMessage(
m[UpdateTime] = updateTimeUnixMilli
m[ShardID] = shardID
m[IsDeleted] = isDeleted
m[EventTimeMs] = updateTimeUnixMilli // same as update time when record is upserted, could not use updateTime directly since this will be modified by Pinot
m[WfIDTextSearch] = wid // used for text search which can improve the partial match performance
m[RunIDTextSearch] = rid // used for text search which can improve the partial match performance
m[WfTypeTextSearch] = workflowTypeName // used for text search which can improve the partial match performance
m[EventTimeMs] = updateTimeUnixMilli // same as update time when record is upserted, could not use updateTime directly since this will be modified by Pinot

SearchAttributes := make(map[string]interface{})
var err error
Expand Down Expand Up @@ -1093,13 +1087,13 @@ func (v *pinotVisibilityStore) getListAllWorkflowExecutionsQuery(tableName strin

if request.WorkflowSearchValue != "" {
if request.PartialMatch {
query.search.addMatch(WfIDTextSearch, request.WorkflowSearchValue)
query.search.addMatch(WfTypeTextSearch, request.WorkflowSearchValue)
query.search.addMatch(RunIDTextSearch, request.WorkflowSearchValue)
query.search.addMatch(WorkflowID, request.WorkflowSearchValue)
query.search.addMatch(WorkflowType, request.WorkflowSearchValue)
query.search.addMatch(RunID, request.WorkflowSearchValue)
} else {
query.search.addEqual(WfIDTextSearch, request.WorkflowSearchValue)
query.search.addEqual(WfTypeTextSearch, request.WorkflowSearchValue)
query.search.addEqual(RunIDTextSearch, request.WorkflowSearchValue)
query.search.addEqual(WorkflowID, request.WorkflowSearchValue)
query.search.addEqual(WorkflowType, request.WorkflowSearchValue)
query.search.addEqual(RunID, request.WorkflowSearchValue)
}

query.search.lastSearchField()
Expand Down
24 changes: 12 additions & 12 deletions common/persistence/pinot/pinot_visibility_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1779,9 +1779,9 @@ AND StartTime BETWEEN 1547596871371 AND 2547596873371
AND ( CloseStatus = 0
OR CloseStatus = 5
)
AND ( WorkflowIDTextSearch = '123'
OR WorkflowTypeTextSearch = '123'
OR RunIDTextSearch = '123'
AND ( WorkflowID = '123'
OR WorkflowType = '123'
OR RunID = '123'
)
Order BY StartTime DESC
LIMIT 0, 10
Expand Down Expand Up @@ -1811,9 +1811,9 @@ AND IsDeleted = false
AND StartTime BETWEEN 1547596871371 AND 2547596873371
AND ( CloseStatus = 3
)
AND ( WorkflowIDTextSearch = '123'
OR WorkflowTypeTextSearch = '123'
OR RunIDTextSearch = '123'
AND ( WorkflowID = '123'
OR WorkflowType = '123'
OR RunID = '123'
)
Order BY CloseTime ASC
LIMIT 0, 10
Expand All @@ -1840,9 +1840,9 @@ FROM %s
WHERE DomainID = 'bfd5c907-f899-4baf-a7b2-2ab85e623ebd'
AND IsDeleted = false
AND StartTime BETWEEN 1547596871371 AND 2547596873371
AND ( WorkflowIDTextSearch = '123'
OR WorkflowTypeTextSearch = '123'
OR RunIDTextSearch = '123'
AND ( WorkflowID = '123'
OR WorkflowType = '123'
OR RunID = '123'
)
Order BY StartTime DESC
LIMIT 0, 10
Expand All @@ -1867,9 +1867,9 @@ FROM %s
WHERE DomainID = 'bfd5c907-f899-4baf-a7b2-2ab85e623ebd'
AND IsDeleted = false
AND StartTime BETWEEN 1547596871371 AND 2547596873371
AND ( REGEXP_LIKE(WorkflowIDTextSearch, '^.*123.*$')
OR REGEXP_LIKE(WorkflowTypeTextSearch, '^.*123.*$')
OR REGEXP_LIKE(RunIDTextSearch, '^.*123.*$')
AND ( REGEXP_LIKE(WorkflowID, '^.*123.*$')
OR REGEXP_LIKE(WorkflowType, '^.*123.*$')
OR REGEXP_LIKE(RunID, '^.*123.*$')
)
Order BY StartTime DESC
LIMIT 0, 10
Expand Down

0 comments on commit cb0d3e9

Please sign in to comment.