1010import opteryx
1111from opteryx .connectors import DiskConnector
1212from opteryx .connectors import IcebergConnector
13+ from opteryx .compiled .structures .relation_statistics import to_int
1314
1415
1516# this is how we get the raw list of files for the scan
@@ -73,16 +74,16 @@ def test_iceberg_get_statistics_manual():
7374 stats .update_upper (column_names [k ], IcebergConnector .decode_iceberg_value (v , column_types [k ]))
7475
7576 assert stats .record_count == 100000
76- assert stats .lower_bounds ["followers" ] == 0
77- assert stats .upper_bounds ["followers" ] == 8266250
78- assert stats .lower_bounds ["user_name" ] == ""
79- assert stats .upper_bounds ["user_name" ] == "🫖🔫"
80- assert stats .lower_bounds ["tweet_id" ] == 1346604539013705728
81- assert stats .upper_bounds ["tweet_id" ] == 1346615999009755142
82- assert stats .lower_bounds ["text" ] == "!! PLEASE STOP A"
83- assert stats .upper_bounds ["text" ] == "🪶Cultural approq"
84- assert stats .lower_bounds ["timestamp" ] == "2021-01-05T23:48"
85- assert stats .upper_bounds ["timestamp" ] == "2021-01-06T00:35"
77+ assert stats .lower_bounds [b "followers" ] == 0
78+ assert stats .upper_bounds [b "followers" ] == 8266250
79+ assert stats .lower_bounds [b "user_name" ] == to_int ( "" )
80+ assert stats .upper_bounds [b "user_name" ] == to_int ( "🫖🔫" )
81+ assert stats .lower_bounds [b "tweet_id" ] == to_int ( 1346604539013705728 )
82+ assert stats .upper_bounds [b "tweet_id" ] == to_int ( 1346615999009755142 )
83+ assert stats .lower_bounds [b "text" ] == to_int ( "!! PLEASE STOP A" )
84+ assert stats .upper_bounds [b "text" ] == to_int ( "🪶Cultural approq" )
85+ assert stats .lower_bounds [b "timestamp" ] == to_int ( "2021-01-05T23:48" )
86+ assert stats .upper_bounds [b "timestamp" ] == to_int ( "2021-01-06T00:35" )
8687
8788@skip_if (is_arm () or is_windows () or is_mac ())
8889def test_iceberg_connector ():
@@ -106,16 +107,16 @@ def test_iceberg_get_stats_tweets():
106107 stats = connector .relation_statistics
107108
108109 assert stats .record_count == 100000
109- assert stats .lower_bounds ["followers" ] == 0
110- assert stats .upper_bounds ["followers" ] == 8266250
111- assert stats .lower_bounds ["user_name" ] == ""
112- assert stats .upper_bounds ["user_name" ] == "🫖🔫"
113- assert stats .lower_bounds ["tweet_id" ] == 1346604539013705728
114- assert stats .upper_bounds ["tweet_id" ] == 1346615999009755142
115- assert stats .lower_bounds ["text" ] == "!! PLEASE STOP A"
116- assert stats .upper_bounds ["text" ] == "🪶Cultural approq"
117- assert stats .lower_bounds ["timestamp" ] == "2021-01-05T23:48"
118- assert stats .upper_bounds ["timestamp" ] == "2021-01-06T00:35"
110+ assert stats .lower_bounds [b "followers" ] == 0
111+ assert stats .upper_bounds [b "followers" ] == 8266250
112+ assert stats .lower_bounds [b "user_name" ] == to_int ( "" )
113+ assert stats .upper_bounds [b "user_name" ] == to_int ( "🫖🔫" )
114+ assert stats .lower_bounds [b "tweet_id" ] == to_int ( 1346604539013705728 )
115+ assert stats .upper_bounds [b "tweet_id" ] == to_int ( 1346615999009755142 )
116+ assert stats .lower_bounds [b "text" ] == to_int ( "!! PLEASE STOP A" )
117+ assert stats .upper_bounds [b "text" ] == to_int ( "🪶Cultural approq" )
118+ assert stats .lower_bounds [b "timestamp" ] == to_int ( "2021-01-05T23:48" )
119+ assert stats .upper_bounds [b "timestamp" ] == to_int ( "2021-01-06T00:35" )
119120
120121@skip_if (is_arm () or is_windows () or is_mac ())
121122def test_iceberg_get_stats_missions ():
@@ -130,16 +131,16 @@ def test_iceberg_get_stats_missions():
130131 stats = connector .relation_statistics
131132
132133 assert stats .record_count == 100000
133- assert stats .lower_bounds ["followers" ] == 0
134- assert stats .upper_bounds ["followers" ] == 8266250
135- assert stats .lower_bounds ["user_name" ] == ""
136- assert stats .upper_bounds ["user_name" ] == "🫖🔫"
137- assert stats .lower_bounds ["tweet_id" ] == 1346604539013705728
138- assert stats .upper_bounds ["tweet_id" ] == 1346615999009755142
139- assert stats .lower_bounds ["text" ] == "!! PLEASE STOP A"
140- assert stats .upper_bounds ["text" ] == "🪶Cultural approq"
141- assert stats .lower_bounds ["timestamp" ] == "2021-01-05T23:48"
142- assert stats .upper_bounds ["timestamp" ] == "2021-01-06T00:35"
134+ assert stats .lower_bounds [b "followers" ] == 0
135+ assert stats .upper_bounds [b "followers" ] == 8266250
136+ assert stats .lower_bounds [b "user_name" ] == to_int ( "" )
137+ assert stats .upper_bounds [b "user_name" ] == to_int ( "🫖🔫" )
138+ assert stats .lower_bounds [b "tweet_id" ] == to_int ( 1346604539013705728 )
139+ assert stats .upper_bounds [b "tweet_id" ] == to_int ( 1346615999009755142 )
140+ assert stats .lower_bounds [b "text" ] == to_int ( "!! PLEASE STOP A" )
141+ assert stats .upper_bounds [b "text" ] == to_int ( "🪶Cultural approq" )
142+ assert stats .lower_bounds [b "timestamp" ] == to_int ( "2021-01-05T23:48" )
143+ assert stats .upper_bounds [b "timestamp" ] == to_int ( "2021-01-06T00:35" )
143144
144145@skip_if (is_arm () or is_windows () or is_mac ())
145146def test_iceberg_get_stats_remote ():
@@ -165,18 +166,18 @@ def test_iceberg_get_stats_remote():
165166 stats = connector .relation_statistics
166167
167168 assert stats .record_count == 9
168- assert stats .lower_bounds ["id" ] == 1 , stats .lower_bounds ["id" ]
169- assert stats .upper_bounds ["id" ] == 9 , stats .upper_bounds ["id" ]
170- assert stats .lower_bounds ["name" ] == "Earth" , stats .lower_bounds ["name" ]
171- assert stats .upper_bounds ["name" ] == "Venus" , stats .upper_bounds ["name" ]
172- assert stats .lower_bounds ["mass" ] == 0.0146 , stats .lower_bounds ["mass" ]
173- assert stats .upper_bounds ["mass" ] == 1898.0 , stats .upper_bounds ["mass" ]
174- assert stats .lower_bounds ["diameter" ] == 2370 , stats .lower_bounds ["diameter" ]
175- assert stats .upper_bounds ["diameter" ] == 142984 , stats .upper_bounds ["diameter" ]
176- assert stats .lower_bounds ["gravity" ] == Decimal ("0.7" ), stats .lower_bounds ["gravity" ]
177- assert stats .upper_bounds ["gravity" ] == Decimal ("23.1" ), stats .upper_bounds ["gravity" ]
178- assert stats .lower_bounds ["surfacePressure" ] == 0.0 , stats .lower_bounds ["surfacePressure" ]
179- assert stats .upper_bounds ["surfacePressure" ] == 92.0 , stats .upper_bounds ["surfacePressure" ]
169+ assert stats .lower_bounds [b "id" ] == 1 , stats .lower_bounds [b "id" ]
170+ assert stats .upper_bounds [b "id" ] == 9 , stats .upper_bounds [b "id" ]
171+ assert stats .lower_bounds [b "name" ] == to_int ( "Earth" ) , stats .lower_bounds [b "name" ]
172+ assert stats .upper_bounds [b "name" ] == to_int ( "Venus" ) , stats .upper_bounds [b "name" ]
173+ assert stats .lower_bounds [b "mass" ] == to_int ( 0.0146 ) , stats .lower_bounds [b "mass" ]
174+ assert stats .upper_bounds [b "mass" ] == to_int ( 1898.0 ) , stats .upper_bounds [b "mass" ]
175+ assert stats .lower_bounds [b "diameter" ] == 2370 , stats .lower_bounds [b "diameter" ]
176+ assert stats .upper_bounds [b "diameter" ] == 142984 , stats .upper_bounds [b "diameter" ]
177+ assert stats .lower_bounds [b "gravity" ] == to_int ( Decimal ("0.7" )) , stats .lower_bounds [b "gravity" ]
178+ assert stats .upper_bounds [b "gravity" ] == to_int ( Decimal ("23.1" )) , stats .upper_bounds [b "gravity" ]
179+ assert stats .lower_bounds [b "surfacePressure" ] == to_int ( 0.0 ) , stats .lower_bounds [b "surfacePressure" ]
180+ assert stats .upper_bounds [b "surfacePressure" ] == to_int ( 92.0 ) , stats .upper_bounds [b "surfacePressure" ]
180181
181182
182183@skip_if (is_arm () or is_windows () or is_mac ())
0 commit comments