66import ibis .expr .datatypes as dt
77import ibis .expr .types as ir
88import numpy as np
9+ import packaging
910import pandas as pd
1011import pandas .testing as tm
1112import pytest
1516import ibis_bigquery
1617from ibis_bigquery .client import bigquery_param
1718
18- pytestmark = pytest .mark .bigquery
19+ IBIS_VERSION = packaging .version .Version (ibis .__version__ )
20+ IBIS_1_4_VERSION = packaging .version .Version ("1.4.0" )
1921
2022
2123def test_table (alltypes ):
@@ -236,6 +238,8 @@ def test_subquery_scalar_params(alltypes, project_id):
236238
237239
238240def test_scalar_param_string (alltypes , df ):
241+ if IBIS_VERSION < IBIS_1_4_VERSION :
242+ pytest .skip ("requires ibis 1.4+" )
239243 param = ibis .param ('string' )
240244 expr = alltypes [alltypes .string_col == param ]
241245
@@ -254,6 +258,8 @@ def test_scalar_param_string(alltypes, df):
254258
255259
256260def test_scalar_param_int64 (alltypes , df ):
261+ if IBIS_VERSION < IBIS_1_4_VERSION :
262+ pytest .skip ("requires ibis 1.4+" )
257263 param = ibis .param ('int64' )
258264 expr = alltypes [alltypes .string_col .cast ('int64' ) == param ]
259265
@@ -272,6 +278,8 @@ def test_scalar_param_int64(alltypes, df):
272278
273279
274280def test_scalar_param_double (alltypes , df ):
281+ if IBIS_VERSION < IBIS_1_4_VERSION :
282+ pytest .skip ("requires ibis 1.4+" )
275283 param = ibis .param ('double' )
276284 expr = alltypes [alltypes .string_col .cast ('int64' ).cast ('double' ) == param ]
277285
@@ -290,6 +298,8 @@ def test_scalar_param_double(alltypes, df):
290298
291299
292300def test_scalar_param_boolean (alltypes , df ):
301+ if IBIS_VERSION < IBIS_1_4_VERSION :
302+ pytest .skip ("requires ibis 1.4+" )
293303 param = ibis .param ('boolean' )
294304 expr = alltypes [(alltypes .string_col .cast ('int64' ) == 0 ) == param ]
295305
@@ -316,6 +326,8 @@ def test_scalar_param_boolean(alltypes, df):
316326 ],
317327)
318328def test_scalar_param_timestamp (alltypes , df , timestamp_value ):
329+ if IBIS_VERSION < IBIS_1_4_VERSION :
330+ pytest .skip ("requires ibis 1.4+" )
319331 param = ibis .param ('timestamp' )
320332 expr = alltypes [alltypes .timestamp_col <= param ][['timestamp_col' ]]
321333
@@ -338,6 +350,8 @@ def test_scalar_param_timestamp(alltypes, df, timestamp_value):
338350 ['2009-01-20' , datetime .date (2009 , 1 , 20 ), datetime .datetime (2009 , 1 , 20 )],
339351)
340352def test_scalar_param_date (alltypes , df , date_value ):
353+ if IBIS_VERSION < IBIS_1_4_VERSION :
354+ pytest .skip ("requires ibis 1.4+" )
341355 param = ibis .param ('date' )
342356 expr = alltypes [alltypes .timestamp_col .cast ('date' ) <= param ]
343357
@@ -356,6 +370,8 @@ def test_scalar_param_date(alltypes, df, date_value):
356370
357371
358372def test_scalar_param_array (alltypes , df ):
373+ if IBIS_VERSION < IBIS_1_4_VERSION :
374+ pytest .skip ("requires ibis 1.4+" )
359375 param = ibis .param ('array<double>' )
360376 expr = alltypes .sort_by ('id' ).limit (1 ).double_col .collect () + param
361377 result = expr .execute (params = {param : [1 ]})
@@ -368,6 +384,8 @@ def test_scalar_param_array(alltypes, df):
368384
369385
370386def test_scalar_param_struct (client ):
387+ if IBIS_VERSION < IBIS_1_4_VERSION :
388+ pytest .skip ("requires ibis 1.4+" )
371389 struct_type = dt .Struct .from_tuples ([('x' , dt .int64 ), ('y' , dt .string )])
372390 param = ibis .param (struct_type )
373391 value = collections .OrderedDict ([('x' , 1 ), ('y' , 'foobar' )])
@@ -376,6 +394,8 @@ def test_scalar_param_struct(client):
376394
377395
378396def test_scalar_param_nested (client ):
397+ if IBIS_VERSION < IBIS_1_4_VERSION :
398+ pytest .skip ("requires ibis 1.4+" )
379399 param = ibis .param ('struct<x: array<struct<y: array<double>>>>' )
380400 value = collections .OrderedDict (
381401 [('x' , [collections .OrderedDict ([('y' , [1.0 , 2.0 , 3.0 ])])])]
@@ -467,6 +487,8 @@ def test_parted_column_rename(parted_alltypes):
467487
468488
469489def test_scalar_param_partition_time (parted_alltypes ):
490+ if IBIS_VERSION < IBIS_1_4_VERSION :
491+ pytest .skip ("requires ibis 1.4+" )
470492 assert 'PARTITIONTIME' in parted_alltypes .columns
471493 assert 'PARTITIONTIME' in parted_alltypes .schema ()
472494 param = ibis .param ('timestamp' ).name ('time_param' )
0 commit comments