Skip to content

Commit

Permalink
Fixed integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GrigoriyPA committed Nov 8, 2024
1 parent d2e8417 commit 3839b29
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions ydb/tests/fq/yds/test_row_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ def test_filters_non_optional_field(self, kikimr, client):
self.run_and_check(kikimr, client, sql + filter, data, expected, 'predicate: WHERE `event` IN (\\"1\\"')
filter = ' event IS DISTINCT FROM data AND event IN ("1", "2", "3", "4", "5", "6", "7", "event2")'
self.run_and_check(kikimr, client, sql + filter, data, expected, 'predicate: WHERE (`event` IS DISTINCT FROM `data` AND `event` IN (\\"1\\"')
filter = ' IF(event == "event2", event IS DISTINCT FROM data, FALSE)'
self.run_and_check(kikimr, client, sql + filter, data, expected, 'predicate: WHERE IF(`event` == "event2", `event` IS DISTINCT FROM `data`, FALSE)')
filter = ' IF(event = "event2", event IS DISTINCT FROM data, FALSE)'
self.run_and_check(kikimr, client, sql + filter, data, expected, 'predicate: WHERE IF(`event` = \\"event2\\", `event` IS DISTINCT FROM `data`, FALSE)')

@yq_v1
def test_filters_optional_field(self, kikimr, client):
Expand All @@ -340,10 +340,10 @@ def test_filters_optional_field(self, kikimr, client):
sql = Rf'''
INSERT INTO {YDS_CONNECTION}.`{self.output_topic}`
SELECT Cast(time as String) FROM {YDS_CONNECTION}.`{self.input_topic}`
WITH (format=json_each_row, SCHEMA (time UInt64 NOT NULL, data String, event String, flag Bool)) WHERE '''
WITH (format=json_each_row, SCHEMA (time UInt64 NOT NULL, data String, event String, flag Bool, field1 UInt8, field2 Int64)) WHERE '''
data = [
'{"time": 101, "data": "hello1", "event": "event1", "flag": false}',
'{"time": 102, "data": "hello2", "event": "event2", "flag": true}']
'{"time": 101, "data": "hello1", "event": "event1", "flag": false, "field1": 5, "field2": 5}',
'{"time": 102, "data": "hello2", "event": "event2", "flag": true, "field1": 5, "field2": 1005}']
expected = ['102']
filter = 'data = "hello2"'
self.run_and_check(kikimr, client, sql + filter, data, expected, 'predicate: WHERE `data` = \\"hello2\\"')
Expand All @@ -353,6 +353,8 @@ def test_filters_optional_field(self, kikimr, client):
# self.run_and_check(kikimr, client, sql + filter, data, expected, 'predicate: WHERE `event` IS NOT DISTINCT FROM \\"event2\\"')
# filter = ' event IS DISTINCT FROM "event1"'
# self.run_and_check(kikimr, client, sql + filter, data, expected, 'predicate: WHERE `event` IS DISTINCT FROM \\"event1\\"')
# filter = ' field1 IS DISTINCT FROM field2'
# self.run_and_check(kikimr, client, sql + filter, data, expected, 'predicate: WHERE `field1` IS DISTINCT FROM `field2`')
filter = 'event IN ("event2")'
self.run_and_check(kikimr, client, sql + filter, data, expected, 'predicate: WHERE `event` IN (\\"event2\\")')
filter = 'event IN ("1", "2", "3", "4", "5", "6", "7", "event2")'
Expand All @@ -361,10 +363,10 @@ def test_filters_optional_field(self, kikimr, client):
# self.run_and_check(kikimr, client, sql + filter, data, expected, 'predicate: WHERE (`event` IS DISTINCT FROM `data` AND `event` IN (\\"1\\"')
# filter = ' IF(event == "event2", event IS DISTINCT FROM data, FALSE)'
# self.run_and_check(kikimr, client, sql + filter, data, expected, 'predicate: WHERE IF(`event` == "event2", `event` IS DISTINCT FROM `data`, FALSE)')
filter = ' COALESCE(event == "event2", TRUE)'
self.run_and_check(kikimr, client, sql + filter, data, expected, 'predicate: WHERE COALESCE(`event` == "event2", TRUE)')
filter = ' COALESCE(event == "event2", data == "hello2", TRUE)'
self.run_and_check(kikimr, client, sql + filter, data, expected, 'predicate: WHERE COALESCE(`event` == "event2", `data` == "hello2", TRUE)')
filter = ' COALESCE(event = "event2", TRUE)'
self.run_and_check(kikimr, client, sql + filter, data, expected, 'predicate: WHERE COALESCE(`event` = \\"event2\\", TRUE)')
filter = ' COALESCE(event = "event2", data = "hello2", TRUE)'
self.run_and_check(kikimr, client, sql + filter, data, expected, 'predicate: WHERE COALESCE(`event` = \\"event2\\", `data` = \\"hello2\\", TRUE)')

@yq_v1
def test_filter_missing_fields(self, kikimr, client):
Expand Down

0 comments on commit 3839b29

Please sign in to comment.