Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit baa8be3

Browse files
author
trzysiek
committed
Merge branch 'main' into datetime
2 parents 88a9941 + e75fda2 commit baa8be3

File tree

8 files changed

+232
-48
lines changed

8 files changed

+232
-48
lines changed

ci/it/go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ require (
6060
go.opentelemetry.io/otel v1.24.0 // indirect
6161
go.opentelemetry.io/otel/metric v1.24.0 // indirect
6262
go.opentelemetry.io/otel/trace v1.24.0 // indirect
63-
golang.org/x/crypto v0.31.0 // indirect
64-
golang.org/x/net v0.33.0 // indirect
65-
golang.org/x/sys v0.28.0 // indirect
63+
golang.org/x/crypto v0.35.0 // indirect
64+
golang.org/x/net v0.36.0 // indirect
65+
golang.org/x/sys v0.30.0 // indirect
6666
google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect
6767
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
6868
gopkg.in/yaml.v3 v3.0.1 // indirect

ci/it/go.sum

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,17 +165,17 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
165165
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
166166
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
167167
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
168-
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
169-
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
168+
golang.org/x/crypto v0.35.0 h1:b15kiHdrGCHrP6LvwaQ3c03kgNhhiMgvlhxHQhmg2Xs=
169+
golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ=
170170
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
171171
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
172172
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
173173
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
174174
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
175175
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
176176
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
177-
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
178-
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
177+
golang.org/x/net v0.36.0 h1:vWF2fRbw4qslQsQzgFqZff+BItCvGFQqKzKIzx1rmoA=
178+
golang.org/x/net v0.36.0/go.mod h1:bFmbeoIPfrw4sMHNhb4J9f6+tPziuGjq7Jk/38fxi1I=
179179
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
180180
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
181181
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -193,17 +193,17 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc
193193
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
194194
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
195195
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
196-
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
197-
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
196+
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
197+
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
198198
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
199-
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
200-
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
199+
golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
200+
golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
201201
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
202202
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
203203
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
204204
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
205-
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
206-
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
205+
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
206+
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
207207
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44=
208208
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
209209
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

platform/clickhouse/schema.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ const (
2121
DeprecatedAttributesValueColumn = "attributes_string_value"
2222
DeprecatedAttributesValueType = "attributes_string_type"
2323

24-
attributesColumnType = "Map(String, String)" // ClickHouse type of AttributesValuesColumn, AttributesMetadataColumn
24+
// ClickHouse type of AttributesValuesColumn, AttributesMetadataColumn
25+
// Important: If we ever introduce attributes with values of no-String type,
26+
// consider updating SchemaCheckPass.applyMatchOperator as well.
27+
attributesColumnType = "Map(String, String)"
2528
AttributesValuesColumn = "attributes_values"
2629
AttributesMetadataColumn = "attributes_metadata"
2730

@@ -438,3 +441,7 @@ func NewDefaultBoolAttribute() Attribute {
438441
func (dt DateTimeType) String() string {
439442
return []string{"DateTime64", "DateTime", "Invalid"}[dt]
440443
}
444+
445+
func IsColumnAttributes(colName string) bool {
446+
return colName == AttributesValuesColumn || colName == AttributesMetadataColumn
447+
}

platform/clickhouse/table_discovery.go

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -631,40 +631,58 @@ func (td *tableDiscovery) enrichTableWithMapFields(inputTable map[string]map[str
631631
for table, columns := range inputTable {
632632
for colName, columnMeta := range columns {
633633
if strings.HasPrefix(columnMeta.colType, "Map(String") {
634-
// Query ClickHouse for map keys in the given column
635-
rows, err := td.dbConnPool.Query(context.Background(), fmt.Sprintf("SELECT arrayJoin(mapKeys(%s)) FROM %s", colName, table))
636-
if err != nil {
637-
fmt.Println("Error querying map keys:", err)
638-
continue
639-
}
640-
634+
logger.Debug().Msgf("Discovered map column: %s.%s", table, colName)
641635
// Ensure the table exists in outputTable
642636
if _, ok := outputTable[table]; !ok {
643637
outputTable[table] = make(map[string]columnMetadata)
644638
}
639+
if _, ok := outputTable[table][colName]; !ok {
640+
// Update origin for incoming map column
641+
columnMeta.origin = schema.FieldSourceIngest
642+
outputTable[table][colName] = columnMeta
643+
logger.Debug().Msgf("Added column: %s.%s", table, colName)
644+
}
645645

646-
// Process returned keys and add them as virtual columns
646+
// Query ClickHouse for map keys in the given column
647+
rows, err := td.dbConnPool.Query(context.Background(), fmt.Sprintf("SELECT DISTINCT arrayJoin(mapKeys(%s)) FROM %s", colName, table))
648+
if err != nil {
649+
logger.Error().Msgf("Error querying map keys for table, column: %s, %s, %v", table, colName, err)
650+
continue
651+
}
652+
foundKeys := false
647653
for rows.Next() {
654+
foundKeys = true
648655
var key string
649656
if err := rows.Scan(&key); err != nil {
650-
fmt.Println("Error scanning key:", err)
657+
logger.Error().Msgf("Error scanning key for table, column: %s, %s, %v", table, colName, err)
651658
continue
652659
}
653-
// Update origin for incoming map column
654-
columnMeta.origin = schema.FieldSourceIngest
655-
outputTable[table][colName] = columnMeta
656660
// Add virtual column for each key in the map
657661
// with origin set to mapping
658-
virtualColName := colName + "." + key
659-
valueType, err := extractMapValueType(columnMeta.colType)
660-
if err == nil {
661-
outputTable[table][virtualColName] = columnMetadata{
662+
mapKeyCol := colName + "." + key
663+
var valueType string
664+
valueType, err = extractMapValueType(columnMeta.colType)
665+
if err != nil {
666+
logger.Error().Msgf("Error extracting value type for table, column: %s, %s, %v", table, colName, err)
667+
continue
668+
} else {
669+
outputTable[table][mapKeyCol] = columnMetadata{
662670
colType: valueType,
663671
origin: schema.FieldSourceMapping,
664672
}
673+
logger.Debug().Msgf("Added map key column: %s.%s", table, mapKeyCol)
665674
}
666675
}
667-
rows.Close() // Close after processing
676+
if !foundKeys {
677+
logger.Debug().Msgf("No map keys found for table, column: %s, %s", table, colName)
678+
}
679+
if err := rows.Err(); err != nil {
680+
logger.Error().Msgf("Error iterating map keys for %s.%s: %v", table, colName, err)
681+
}
682+
err = rows.Close() // Close after processing
683+
if err != nil {
684+
logger.Error().Msgf("Error closing rows for table, column: %s, %s, %v", table, colName, err)
685+
}
668686
} else {
669687
// Copy other columns as-is
670688
if _, ok := outputTable[table]; !ok {

platform/config/index_config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ func (c IndexConfiguration) String(indexName string) string {
7575
if c.UseCommonTable {
7676
builder.WriteString(", useSingleTable: true")
7777
}
78+
builder.WriteString(fmt.Sprintf(", enableFieldMapSyntax: %v", c.EnableFieldMapSyntax))
7879

7980
return builder.String()
8081
}

platform/frontend_connectors/schema_transformer.go

Lines changed: 53 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,28 +1307,67 @@ func (s *SchemaCheckPass) applyMatchOperator(ctx context.Context, indexSchema sc
13071307

13081308
visitor := model.NewBaseVisitor()
13091309

1310-
var err error
1311-
13121310
visitor.OverrideVisitInfix = func(b *model.BaseExprVisitor, e model.InfixExpr) interface{} {
1313-
lhs, ok := e.Left.(model.ColumnRef)
1314-
rhs, ok2 := e.Right.(model.LiteralExpr)
1311+
var (
1312+
lhs = e.Left
1313+
rhs, okRight = e.Right.(model.LiteralExpr)
1314+
col, okLeft = e.Left.(model.ColumnRef)
1315+
lhsIsArrayAccess bool
1316+
)
1317+
1318+
if !okLeft {
1319+
if arrayAccess, ok := lhs.(model.ArrayAccess); ok {
1320+
lhsIsArrayAccess = true
1321+
okLeft = true
1322+
col = arrayAccess.ColumnRef
1323+
}
1324+
}
1325+
1326+
if okLeft && okRight && e.Op == model.MatchOperator {
1327+
if _, ok := rhs.Value.(string); !ok {
1328+
// only strings can be ILIKEd, everything else is a simple =
1329+
return model.NewInfixExpr(lhs, "=", rhs.Clone())
1330+
}
13151331

1316-
if ok && ok2 && e.Op == model.MatchOperator {
1317-
field, found := indexSchema.ResolveFieldByInternalName(lhs.ColumnName)
1332+
var colIsAttributes bool
1333+
field, found := indexSchema.ResolveFieldByInternalName(col.ColumnName)
13181334
if !found {
1319-
logger.Error().Msgf("Field %s not found in schema for table %s, should never happen here", lhs.ColumnName, query.TableName)
1335+
// indexSchema won't find attributes columns, that's why this check
1336+
if clickhouse.IsColumnAttributes(col.ColumnName) {
1337+
colIsAttributes = true
1338+
} else {
1339+
logger.Error().Msgf("Field %s not found in schema for table %s, should never happen here", col.ColumnName, query.TableName)
1340+
}
13201341
}
13211342

1322-
rhsValue := rhs.Value.(string)
1343+
rhsValue := rhs.Value.(string) // checked above
13231344
rhsValue = strings.TrimPrefix(rhsValue, "'")
13241345
rhsValue = strings.TrimSuffix(rhsValue, "'")
13251346

1326-
switch field.Type.String() {
1327-
case schema.QuesmaTypeInteger.Name, schema.QuesmaTypeLong.Name, schema.QuesmaTypeUnsignedLong.Name, schema.QuesmaTypeFloat.Name, schema.QuesmaTypeBoolean.Name:
1347+
ilike := func() model.Expr {
1348+
return model.NewInfixExpr(lhs, "ILIKE", model.NewLiteralWithEscapeType(rhsValue, rhs.EscapeType))
1349+
}
1350+
equal := func() model.Expr {
13281351
rhsValue = strings.Trim(rhsValue, "%")
13291352
return model.NewInfixExpr(lhs, "=", model.NewLiteral(rhsValue))
1353+
}
1354+
1355+
// handling case when e.Left is an array access
1356+
if lhsIsArrayAccess {
1357+
if colIsAttributes || field.IsMapWithStringValues() { // attributes always have string values, so ilike
1358+
return ilike()
1359+
} else {
1360+
return equal()
1361+
}
1362+
}
1363+
1364+
// handling case when e.Left is a simple column ref
1365+
// TODO: improve? we seem to be `ilike'ing` too much
1366+
switch field.Type.String() {
1367+
case schema.QuesmaTypeInteger.Name, schema.QuesmaTypeLong.Name, schema.QuesmaTypeUnsignedLong.Name, schema.QuesmaTypeFloat.Name, schema.QuesmaTypeBoolean.Name:
1368+
return equal()
13301369
default:
1331-
return model.NewInfixExpr(lhs, "ILIKE", model.NewLiteralWithEscapeType(rhsValue, rhs.EscapeType))
1370+
return ilike()
13321371
}
13331372
}
13341373

@@ -1372,15 +1411,14 @@ func (s *SchemaCheckPass) applyMatchOperator(ctx context.Context, indexSchema sc
13721411
}
13731412
}
13741413

1414+
if e.Op == model.MatchOperator {
1415+
logger.Error().Msgf("Match operator is not supported for column %v", col)
1416+
}
13751417
return model.NewInfixExpr(e.Left.Accept(b).(model.Expr), e.Op, e.Right.Accept(b).(model.Expr))
13761418
}
13771419

13781420
expr := query.SelectCommand.Accept(visitor)
13791421

1380-
if err != nil {
1381-
return nil, err
1382-
}
1383-
13841422
if _, ok := expr.(*model.SelectCommand); ok {
13851423
query.SelectCommand = *expr.(*model.SelectCommand)
13861424
}

platform/frontend_connectors/schema_transformer_test.go

Lines changed: 112 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,8 +1142,10 @@ func TestFullTextFields(t *testing.T) {
11421142
func Test_applyMatchOperator(t *testing.T) {
11431143
schemaTable := schema.Table{
11441144
Columns: map[string]schema.Column{
1145-
"message": {Name: "message", Type: "String"},
1146-
"count": {Name: "count", Type: "Int64"},
1145+
"message": {Name: "message", Type: "String"},
1146+
"map_str_str": {Name: "map_str_str", Type: "Map(String, String)"},
1147+
"map_str_int": {Name: "map_str_int", Type: "Map(String, Int)"},
1148+
"count": {Name: "count", Type: "Int64"},
11471149
},
11481150
}
11491151

@@ -1206,6 +1208,114 @@ func Test_applyMatchOperator(t *testing.T) {
12061208
},
12071209
},
12081210
},
1211+
{
1212+
name: "match operator transformation for map(string, string) (ILIKE)",
1213+
query: &model.Query{
1214+
TableName: "test",
1215+
SelectCommand: model.SelectCommand{
1216+
FromClause: model.NewTableRef("test"),
1217+
Columns: []model.Expr{model.NewColumnRef("message")},
1218+
WhereClause: model.NewInfixExpr(
1219+
model.NewArrayAccess(model.NewColumnRef("map_str_str"), model.NewLiteral("'warsaw'")),
1220+
model.MatchOperator,
1221+
model.NewLiteralWithEscapeType("'needle'", model.NotEscapedLikeFull),
1222+
),
1223+
},
1224+
},
1225+
expected: &model.Query{
1226+
TableName: "test",
1227+
SelectCommand: model.SelectCommand{
1228+
FromClause: model.NewTableRef("test"),
1229+
Columns: []model.Expr{model.NewColumnRef("message")},
1230+
WhereClause: model.NewInfixExpr(
1231+
model.NewArrayAccess(model.NewColumnRef("map_str_str"), model.NewLiteral("'warsaw'")),
1232+
"ILIKE",
1233+
model.NewLiteralWithEscapeType("needle", model.NotEscapedLikeFull),
1234+
),
1235+
},
1236+
},
1237+
},
1238+
{
1239+
name: "match operator transformation for map(string, int) (=)",
1240+
query: &model.Query{
1241+
TableName: "test",
1242+
SelectCommand: model.SelectCommand{
1243+
FromClause: model.NewTableRef("test"),
1244+
Columns: []model.Expr{model.NewColumnRef("message")},
1245+
WhereClause: model.NewInfixExpr(
1246+
model.NewArrayAccess(model.NewColumnRef("map_str_int"), model.NewLiteral("'warsaw'")),
1247+
model.MatchOperator,
1248+
model.NewLiteral(50),
1249+
),
1250+
},
1251+
},
1252+
expected: &model.Query{
1253+
TableName: "test",
1254+
SelectCommand: model.SelectCommand{
1255+
FromClause: model.NewTableRef("test"),
1256+
Columns: []model.Expr{model.NewColumnRef("message")},
1257+
WhereClause: model.NewInfixExpr(
1258+
model.NewArrayAccess(model.NewColumnRef("map_str_int"), model.NewLiteral("'warsaw'")),
1259+
"=",
1260+
model.NewLiteral(50),
1261+
),
1262+
},
1263+
},
1264+
},
1265+
{
1266+
name: "match operator transformation for Attributes map (1/2)",
1267+
query: &model.Query{
1268+
TableName: "test",
1269+
SelectCommand: model.SelectCommand{
1270+
FromClause: model.NewTableRef("test"),
1271+
Columns: []model.Expr{model.NewColumnRef("message")},
1272+
WhereClause: model.NewInfixExpr(
1273+
model.NewArrayAccess(model.NewColumnRef(clickhouse.AttributesValuesColumn), model.NewLiteral("'warsaw'")),
1274+
model.MatchOperator,
1275+
model.NewLiteralWithEscapeType("needle", model.NotEscapedLikeFull),
1276+
),
1277+
},
1278+
},
1279+
expected: &model.Query{
1280+
TableName: "test",
1281+
SelectCommand: model.SelectCommand{
1282+
FromClause: model.NewTableRef("test"),
1283+
Columns: []model.Expr{model.NewColumnRef("message")},
1284+
WhereClause: model.NewInfixExpr(
1285+
model.NewArrayAccess(model.NewColumnRef(clickhouse.AttributesValuesColumn), model.NewLiteral("'warsaw'")),
1286+
"ILIKE",
1287+
model.NewLiteralWithEscapeType("needle", model.NotEscapedLikeFull),
1288+
),
1289+
},
1290+
},
1291+
},
1292+
{
1293+
name: "match operator transformation for Attributes map (2/2)",
1294+
query: &model.Query{
1295+
TableName: "test",
1296+
SelectCommand: model.SelectCommand{
1297+
FromClause: model.NewTableRef("test"),
1298+
Columns: []model.Expr{model.NewColumnRef("message")},
1299+
WhereClause: model.NewInfixExpr(
1300+
model.NewArrayAccess(model.NewColumnRef(clickhouse.AttributesMetadataColumn), model.NewLiteral("'warsaw'")),
1301+
model.MatchOperator,
1302+
model.NewLiteralWithEscapeType("needle", model.NotEscapedLikeFull),
1303+
),
1304+
},
1305+
},
1306+
expected: &model.Query{
1307+
TableName: "test",
1308+
SelectCommand: model.SelectCommand{
1309+
FromClause: model.NewTableRef("test"),
1310+
Columns: []model.Expr{model.NewColumnRef("message")},
1311+
WhereClause: model.NewInfixExpr(
1312+
model.NewArrayAccess(model.NewColumnRef(clickhouse.AttributesMetadataColumn), model.NewLiteral("'warsaw'")),
1313+
"ILIKE",
1314+
model.NewLiteralWithEscapeType("needle", model.NotEscapedLikeFull),
1315+
),
1316+
},
1317+
},
1318+
},
12091319
}
12101320

12111321
for _, tt := range tests {

0 commit comments

Comments
 (0)