From cb0d3e9acc0fc0538f911906f3a6a511671d1e75 Mon Sep 17 00:00:00 2001 From: neil-xie <104041627+neil-xie@users.noreply.github.com> Date: Mon, 8 Jul 2024 17:17:43 -0700 Subject: [PATCH] Revert text search columns for pinot visibility store (#6162) --- .../pinot/pinot_visibility_store.go | 20 ++++++---------- .../pinot/pinot_visibility_store_test.go | 24 +++++++++---------- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/common/persistence/pinot/pinot_visibility_store.go b/common/persistence/pinot/pinot_visibility_store.go index cdfe894f044..28db7707d38 100644 --- a/common/persistence/pinot/pinot_visibility_store.go +++ b/common/persistence/pinot/pinot_visibility_store.go @@ -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) @@ -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 @@ -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() diff --git a/common/persistence/pinot/pinot_visibility_store_test.go b/common/persistence/pinot/pinot_visibility_store_test.go index 4a74afe09b0..7a084a6127b 100644 --- a/common/persistence/pinot/pinot_visibility_store_test.go +++ b/common/persistence/pinot/pinot_visibility_store_test.go @@ -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 @@ -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 @@ -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 @@ -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