Skip to content

Commit 7084e98

Browse files
committed
Rename current Visibility query converter with 'legacy' suffix
1 parent 48c5eb7 commit 7084e98

23 files changed

+122
-120
lines changed

common/persistence/sql/factory.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ func NewRefCountedDBConn(
171171
}
172172
}
173173

174-
// Get returns a mysql db connection and increments a reference count
175-
// this method will create a new connection, if an existing connection
174+
// Get returns a db connection and increments a reference count.
175+
// This method will create a new connection, if an existing connection
176176
// does not exist
177177
func (c *DbConn) Get() (sqlplugin.DB, error) {
178178
c.Lock()

common/persistence/visibility/store/elasticsearch/converter.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ var allowedComparisonOperators = map[string]struct{}{
1919
sqlparser.NotStartsWithStr: {},
2020
}
2121

22-
func NewQueryConverter(
22+
func NewQueryConverterLegacy(
2323
fnInterceptor query.FieldNameInterceptor,
2424
fvInterceptor query.FieldValuesInterceptor,
2525
saNameType searchattribute.NameTypeMap,
26-
) *query.Converter {
26+
) *query.ConverterLegacy {
2727
if fnInterceptor == nil {
2828
fnInterceptor = &query.NopFieldNameInterceptor{}
2929
}
@@ -44,5 +44,5 @@ func NewQueryConverter(
4444
whereConverter.And = query.NewAndConverter(whereConverter)
4545
whereConverter.Or = query.NewOrConverter(whereConverter)
4646

47-
return query.NewConverter(fnInterceptor, whereConverter)
47+
return query.NewConverterLegacy(fnInterceptor, whereConverter)
4848
}

common/persistence/visibility/store/elasticsearch/converter_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ var testNameTypeMap = searchattribute.NewNameTypeMapStub(
126126
)
127127

128128
func TestSupportedSelectWhere(t *testing.T) {
129-
c := NewQueryConverter(nil, nil, testNameTypeMap)
129+
c := NewQueryConverterLegacy(nil, nil, testNameTypeMap)
130130

131131
for sql, expectedJson := range supportedWhereCases {
132132
queryParams, err := c.ConvertWhereOrderBy(sql)
@@ -140,7 +140,7 @@ func TestSupportedSelectWhere(t *testing.T) {
140140
}
141141

142142
func TestEmptySelectWhere(t *testing.T) {
143-
c := NewQueryConverter(nil, nil, testNameTypeMap)
143+
c := NewQueryConverterLegacy(nil, nil, testNameTypeMap)
144144

145145
queryParams, err := c.ConvertWhereOrderBy("")
146146
assert.NoError(t, err)
@@ -157,7 +157,7 @@ func TestEmptySelectWhere(t *testing.T) {
157157
}
158158

159159
func TestSupportedSelectWhereOrder(t *testing.T) {
160-
c := NewQueryConverter(nil, nil, testNameTypeMap)
160+
c := NewQueryConverterLegacy(nil, nil, testNameTypeMap)
161161

162162
for sql, expectedJson := range supportedWhereOrderCases {
163163
queryParams, err := c.ConvertWhereOrderBy(sql)
@@ -178,7 +178,7 @@ func TestSupportedSelectWhereOrder(t *testing.T) {
178178
}
179179

180180
func TestSupportedSelectWhereGroupBy(t *testing.T) {
181-
c := NewQueryConverter(nil, nil, testNameTypeMap)
181+
c := NewQueryConverterLegacy(nil, nil, testNameTypeMap)
182182

183183
for sql, expectedJson := range supportedWhereGroupByCases {
184184
queryParams, err := c.ConvertWhereOrderBy(sql)
@@ -196,7 +196,7 @@ func TestSupportedSelectWhereGroupBy(t *testing.T) {
196196
}
197197

198198
func TestErrors(t *testing.T) {
199-
c := NewQueryConverter(nil, nil, testNameTypeMap)
199+
c := NewQueryConverterLegacy(nil, nil, testNameTypeMap)
200200
for sql, expectedErrMessage := range errorCases {
201201
_, err := c.ConvertSql(sql)
202202
assert.Contains(t, err.Error(), expectedErrMessage, sql)

common/persistence/visibility/store/elasticsearch/visibility_store.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ func (s *VisibilityStore) CountWorkflowExecutions(
363363
ctx context.Context,
364364
request *manager.CountWorkflowExecutionsRequest,
365365
) (*manager.CountWorkflowExecutionsResponse, error) {
366-
queryParams, err := s.convertQuery(request.Namespace, request.NamespaceID, request.Query)
366+
queryParams, err := s.convertQueryLegacy(request.Namespace, request.NamespaceID, request.Query)
367367
if err != nil {
368368
return nil, err
369369
}
@@ -383,7 +383,7 @@ func (s *VisibilityStore) CountWorkflowExecutions(
383383

384384
func (s *VisibilityStore) countGroupByWorkflowExecutions(
385385
ctx context.Context,
386-
queryParams *query.QueryParams,
386+
queryParams *query.QueryParamsLegacy,
387387
) (*manager.CountWorkflowExecutionsResponse, error) {
388388
groupByFields := queryParams.GroupBy
389389

@@ -461,7 +461,7 @@ func (s *VisibilityStore) BuildSearchParametersV2(
461461
request *manager.ListWorkflowExecutionsRequestV2,
462462
getFieldSorter func([]elastic.Sorter) ([]elastic.Sorter, error),
463463
) (*client.SearchParameters, error) {
464-
queryParams, err := s.convertQuery(
464+
queryParams, err := s.convertQueryLegacy(
465465
request.Namespace,
466466
request.NamespaceID,
467467
request.Query,
@@ -562,17 +562,17 @@ func (s *VisibilityStore) processPageToken(
562562
return nil
563563
}
564564

565-
func (s *VisibilityStore) convertQuery(
565+
func (s *VisibilityStore) convertQueryLegacy(
566566
namespace namespace.Name,
567567
namespaceID namespace.ID,
568568
requestQueryStr string,
569-
) (*query.QueryParams, error) {
569+
) (*query.QueryParamsLegacy, error) {
570570
saTypeMap, err := s.searchAttributesProvider.GetSearchAttributes(s.index, false)
571571
if err != nil {
572572
return nil, serviceerror.NewUnavailablef("unable to read search attribute types: %v", err)
573573
}
574574
nameInterceptor := NewNameInterceptor(namespace, saTypeMap, s.searchAttributesMapperProvider)
575-
queryConverter := NewQueryConverter(
575+
queryConverter := NewQueryConverterLegacy(
576576
nameInterceptor,
577577
NewValuesInterceptor(namespace, saTypeMap),
578578
saTypeMap,

0 commit comments

Comments
 (0)