Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Run core test suite #99

Open
tswast opened this issue Dec 2, 2021 · 3 comments
Open

Run core test suite #99

tswast opened this issue Dec 2, 2021 · 3 comments

Comments

@tswast
Copy link
Collaborator

tswast commented Dec 2, 2021

See suggestion here: #93

PYTEST_BACKENDS="bigquery" python -m pytest --pyargs ibis.backends.tests --disable-pytest-warnings

Requires other system tests to run first (and save the dataset), since it looks for tables such as functional_alltypes.

@tswast
Copy link
Collaborator Author

tswast commented Dec 2, 2021

Failing tests:

    index : int64
    Unname...4
    date_string_col : string
    string_col : string
    timestamp_col : timestamp
    year : int64
    month : int64
df =       index  Unnamed_0    id  bool_col  tinyint_col  ...  date_string_col  string_col           timestamp_col  year  m...     True            6  ...         01/31/10           6 2010-01-31 05:06:13.650  2010      1

[7300 rows x 15 columns]
result_func = <function <lambda> at 0x7fdac91cf310>, expected_func = <function <lambda> at 0x7fdac91cf3a0>

    @pytest.mark.parametrize(
        ('result_func', 'expected_func'),
        [
            param(
                lambda t: t.string_col.contains('6'),
                lambda t: t.string_col.str.contains('6'),
                id='contains',
            ),
            param(
                lambda t: t.string_col.like('6%'),
                lambda t: t.string_col.str.contains('6.*'),
                id='like',
            ),
            param(
                lambda t: t.string_col.like('6^%'),
                lambda t: t.string_col.str.contains('6%'),
                id='complex_like_escape',
            ),
            param(
                lambda t: t.string_col.like('6^%%'),
                lambda t: t.string_col.str.contains('6%.*'),
                id='complex_like_escape_match',
            ),
            param(
                lambda t: t.string_col.ilike('6%'),
                lambda t: t.string_col.str.contains('6.*'),
                id='ilike',
            ),
            param(
                lambda t: t.string_col.re_search(r'[[:digit:]]+'),
                lambda t: t.string_col.str.contains(r'\d+'),
                id='re_search',
                marks=pytest.mark.xfail_backends(('spark', 'pyspark')),
            ),
            param(
                lambda t: t.string_col.re_extract(r'([[:digit:]]+)', 0),
                lambda t: t.string_col.str.extract(r'(\d+)', expand=False),
                id='re_extract',
                marks=pytest.mark.xfail_backends(('spark', 'pyspark')),
            ),
            param(
                lambda t: t.string_col.re_replace(r'[[:digit:]]+', 'a'),
                lambda t: t.string_col.str.replace(r'\d+', 'a', regex=True),
                id='re_replace',
                marks=pytest.mark.xfail_backends(('spark', 'pyspark')),
            ),
            param(
                lambda t: t.string_col.re_search(r'\\d+'),
                lambda t: t.string_col.str.contains(r'\d+'),
                id='re_search_spark',
                marks=pytest.mark.xpass_backends(
                    ('clickhouse', 'impala', 'spark')
                ),
            ),
            param(
                lambda t: t.string_col.re_extract(r'(\\d+)', 0),
                lambda t: t.string_col.str.extract(r'(\d+)', expand=False),
                id='re_extract_spark',
                marks=pytest.mark.xpass_backends(
                    ('clickhouse', 'impala', 'spark')
                ),
            ),
            param(
                lambda t: t.string_col.re_replace(r'\\d+', 'a'),
                lambda t: t.string_col.str.replace(r'\d+', 'a', regex=True),
                id='re_replace_spark',
                marks=pytest.mark.xpass_backends(
                    ('clickhouse', 'impala', 'spark')
                ),
            ),
            param(
                lambda t: t.string_col.re_search(r'\d+'),
                lambda t: t.string_col.str.contains(r'\d+'),
                id='re_search_spark',
                marks=pytest.mark.xfail_backends(
                    ('clickhouse', 'impala', 'spark')
                ),
            ),
            param(
                lambda t: t.string_col.re_extract(r'(\d+)', 0),
                lambda t: t.string_col.str.extract(r'(\d+)', expand=False),
                id='re_extract_spark',
                marks=pytest.mark.xfail_backends(
                    ('clickhouse', 'impala', 'spark')
                ),
            ),
            param(
                lambda t: t.string_col.re_replace(r'\d+', 'a'),
                lambda t: t.string_col.str.replace(r'\d+', 'a', regex=True),
                id='re_replace_spark',
                marks=pytest.mark.xfail_backends(
                    ('clickhouse', 'impala', 'spark')
                ),
            ),
            param(
                lambda t: t.string_col.repeat(2),
                lambda t: t.string_col * 2,
                id='repeat',
            ),
            param(
                lambda t: t.string_col.translate('0', 'a'),
                lambda t: t.string_col.str.translate(str.maketrans('0', 'a')),
                id='translate',
            ),
            param(
                lambda t: t.string_col.find('a'),
                lambda t: t.string_col.str.find('a'),
                id='find',
            ),
            param(
                lambda t: t.string_col.lpad(10, 'a'),
                lambda t: t.string_col.str.pad(10, fillchar='a', side='left'),
                id='lpad',
            ),
            param(
                lambda t: t.string_col.rpad(10, 'a'),
                lambda t: t.string_col.str.pad(10, fillchar='a', side='right'),
                id='rpad',
            ),
            param(
                lambda t: t.string_col.find_in_set(['1']),
                lambda t: t.string_col.str.find('1'),
                id='find_in_set',
            ),
            param(
                lambda t: t.string_col.find_in_set(['a']),
                lambda t: t.string_col.str.find('a'),
                id='find_in_set_all_missing',
            ),
            param(
                lambda t: t.string_col.lower(),
                lambda t: t.string_col.str.lower(),
                id='lower',
            ),
            param(
                lambda t: t.string_col.upper(),
                lambda t: t.string_col.str.upper(),
                id='upper',
            ),
            param(
                lambda t: t.string_col.reverse(),
                lambda t: t.string_col.str[::-1],
                id='reverse',
            ),
            param(
                lambda t: t.string_col.ascii_str(),
                lambda t: t.string_col.map(ord).astype('int32'),
                id='ascii_str',
                # TODO - dtype - #2553
                marks=pytest.mark.skip_backends(['dask']),
            ),
            param(
                lambda t: t.string_col.length(),
                lambda t: t.string_col.str.len().astype('int32'),
                id='length',
                marks=pytest.mark.xfail_backends(['omniscidb']),  # #2338
            ),
            param(
                lambda t: t.string_col.startswith('foo'),
                lambda t: t.string_col.str.startswith('foo'),
                id='startswith',
            ),
            param(
                lambda t: t.string_col.endswith('foo'),
                lambda t: t.string_col.str.endswith('foo'),
                id='endswith',
            ),
            param(
                lambda t: t.string_col.strip(),
                lambda t: t.string_col.str.strip(),
                id='strip',
            ),
            param(
                lambda t: t.string_col.lstrip(),
                lambda t: t.string_col.str.lstrip(),
                id='lstrip',
            ),
            param(
                lambda t: t.string_col.rstrip(),
                lambda t: t.string_col.str.rstrip(),
                id='rstrip',
            ),
            param(
                lambda t: t.string_col.capitalize(),
                lambda t: t.string_col.str.capitalize(),
                id='capitalize',
            ),
            param(
                lambda t: t.date_string_col.substr(2, 3),
                lambda t: t.date_string_col.str[2:5],
                id='substr',
            ),
            param(
                lambda t: t.date_string_col.left(2),
                lambda t: t.date_string_col.str[:2],
                id='left',
            ),
            param(
                lambda t: t.date_string_col.right(2),
                lambda t: t.date_string_col.str[-2:],
                id='right',
            ),
            param(
                lambda t: t.date_string_col[1:3],
                lambda t: t.date_string_col.str[1:3],
                id='slice',
            ),
            param(
                lambda t: t.date_string_col[t.date_string_col.length() - 1 :],
                lambda t: t.date_string_col.str[-1:],
                id='expr_slice_begin',
                # TODO - substring - #2553
                marks=pytest.mark.xfail_backends(['dask']),
            ),
            param(
                lambda t: t.date_string_col[: t.date_string_col.length()],
                lambda t: t.date_string_col,
                id='expr_slice_end',
                # TODO - substring - #2553
                marks=pytest.mark.xfail_backends(['dask']),
            ),
            param(
                lambda t: t.date_string_col[:],
                lambda t: t.date_string_col,
                id='expr_empty_slice',
                # TODO - substring - #2553
                marks=pytest.mark.xfail_backends(['dask']),
            ),
            param(
                lambda t: t.date_string_col[
                    t.date_string_col.length() - 2 : t.date_string_col.length() - 1
                ],
                lambda t: t.date_string_col.str[-2:-1],
                id='expr_slice_begin_end',
                # TODO - substring - #2553
                marks=pytest.mark.xfail_backends(['dask']),
            ),
            param(
                lambda t: t.date_string_col.split('/'),
                lambda t: t.date_string_col.str.split('/'),
                id='split',
                marks=pytest.mark.xfail_backends(['bigquery']),  # Issue #2372
            ),
            param(
                lambda t: ibis.literal('-').join(['a', t.string_col, 'c']),
                lambda t: 'a-' + t.string_col + '-c',
                id='join',
            ),
        ],
    )
    @pytest.mark.xfail_unsupported
    def test_string(backend, alltypes, df, result_func, expected_func):
        expr = result_func(alltypes)
>       result = expr.execute()

../ibis/ibis/backends/tests/test_string.py:273: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../ibis/ibis/expr/types.py:273: in execute
    return self._find_backend().execute(
ibis_bigquery/__init__.py:268: in execute
    sql = query_ast.compile()
../ibis/ibis/backends/base/sql/compiler/base.py:41: in compile
    compiled_queries = [q.compile() for q in self.queries]
../ibis/ibis/backends/base/sql/compiler/base.py:41: in <listcomp>
    compiled_queries = [q.compile() for q in self.queries]
../ibis/ibis/backends/base/sql/compiler/query_builder.py:289: in compile
    select_frag = self.format_select_set()
../ibis/ibis/backends/base/sql/compiler/query_builder.py:344: in format_select_set
    expr_str = self._translate(expr, named=True)
../ibis/ibis/backends/base/sql/compiler/query_builder.py:237: in _translate
    return translator.get_result()
../ibis/ibis/backends/base/sql/compiler/translator.py:222: in get_result
    translated = self.translate(self.expr)
../ibis/ibis/backends/base/sql/compiler/translator.py:277: in translate
    return formatter(self, expr)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

translator = <ibis_bigquery.compiler.BigQueryExprTranslator object at 0x7fdab88ed970>
expr = ref_0
BigQueryTable[table]
  name: swast-scratch.ibis_gbq_testing.functional_alltypes
  schema:
    index : int64
    ...ing_col = Column[string*] 'date_string_col' from table
            ref_0
      right:
        Literal[int8]
          0

    def _string_substring(translator, expr):
        op = expr.op()
        arg, start, length = op.args
>       if length.op().value < 0:
E       AttributeError: 'Subtract' object has no attribute 'value'

ibis_bigquery/compiler.py:202: AttributeError
____________________________________________ test_string[bigquery-expr_slice_begin_end] ____________________________________________

backend = <ibis_bigquery.tests.conftest.TestConf object at 0x7fdad8429c70>
alltypes = BigQueryTable[table]
  name: swast-scratch.ibis_gbq_testing.functional_alltypes
  schema:
    index : int64
    Unname...4
    date_string_col : string
    string_col : string
    timestamp_col : timestamp
    year : int64
    month : int64
df =       index  Unnamed_0    id  bool_col  tinyint_col  ...  date_string_col  string_col           timestamp_col  year  m...     True            6  ...         01/31/10           6 2010-01-31 05:06:13.650  2010      1

[7300 rows x 15 columns]
result_func = <function <lambda> at 0x7fdac91cf430>, expected_func = <function <lambda> at 0x7fdac91cf4c0>

    @pytest.mark.parametrize(
        ('result_func', 'expected_func'),
        [
            param(
                lambda t: t.string_col.contains('6'),
                lambda t: t.string_col.str.contains('6'),
                id='contains',
            ),
            param(
                lambda t: t.string_col.like('6%'),
                lambda t: t.string_col.str.contains('6.*'),
                id='like',
            ),
            param(
                lambda t: t.string_col.like('6^%'),
                lambda t: t.string_col.str.contains('6%'),
                id='complex_like_escape',
            ),
            param(
                lambda t: t.string_col.like('6^%%'),
                lambda t: t.string_col.str.contains('6%.*'),
                id='complex_like_escape_match',
            ),
            param(
                lambda t: t.string_col.ilike('6%'),
                lambda t: t.string_col.str.contains('6.*'),
                id='ilike',
            ),
            param(
                lambda t: t.string_col.re_search(r'[[:digit:]]+'),
                lambda t: t.string_col.str.contains(r'\d+'),
                id='re_search',
                marks=pytest.mark.xfail_backends(('spark', 'pyspark')),
            ),
            param(
                lambda t: t.string_col.re_extract(r'([[:digit:]]+)', 0),
                lambda t: t.string_col.str.extract(r'(\d+)', expand=False),
                id='re_extract',
                marks=pytest.mark.xfail_backends(('spark', 'pyspark')),
            ),
            param(
                lambda t: t.string_col.re_replace(r'[[:digit:]]+', 'a'),
                lambda t: t.string_col.str.replace(r'\d+', 'a', regex=True),
                id='re_replace',
                marks=pytest.mark.xfail_backends(('spark', 'pyspark')),
            ),
            param(
                lambda t: t.string_col.re_search(r'\\d+'),
                lambda t: t.string_col.str.contains(r'\d+'),
                id='re_search_spark',
                marks=pytest.mark.xpass_backends(
                    ('clickhouse', 'impala', 'spark')
                ),
            ),
            param(
                lambda t: t.string_col.re_extract(r'(\\d+)', 0),
                lambda t: t.string_col.str.extract(r'(\d+)', expand=False),
                id='re_extract_spark',
                marks=pytest.mark.xpass_backends(
                    ('clickhouse', 'impala', 'spark')
                ),
            ),
            param(
                lambda t: t.string_col.re_replace(r'\\d+', 'a'),
                lambda t: t.string_col.str.replace(r'\d+', 'a', regex=True),
                id='re_replace_spark',
                marks=pytest.mark.xpass_backends(
                    ('clickhouse', 'impala', 'spark')
                ),
            ),
            param(
                lambda t: t.string_col.re_search(r'\d+'),
                lambda t: t.string_col.str.contains(r'\d+'),
                id='re_search_spark',
                marks=pytest.mark.xfail_backends(
                    ('clickhouse', 'impala', 'spark')
                ),
            ),
            param(
                lambda t: t.string_col.re_extract(r'(\d+)', 0),
                lambda t: t.string_col.str.extract(r'(\d+)', expand=False),
                id='re_extract_spark',
                marks=pytest.mark.xfail_backends(
                    ('clickhouse', 'impala', 'spark')
                ),
            ),
            param(
                lambda t: t.string_col.re_replace(r'\d+', 'a'),
                lambda t: t.string_col.str.replace(r'\d+', 'a', regex=True),
                id='re_replace_spark',
                marks=pytest.mark.xfail_backends(
                    ('clickhouse', 'impala', 'spark')
                ),
            ),
            param(
                lambda t: t.string_col.repeat(2),
                lambda t: t.string_col * 2,
                id='repeat',
            ),
            param(
                lambda t: t.string_col.translate('0', 'a'),
                lambda t: t.string_col.str.translate(str.maketrans('0', 'a')),
                id='translate',
            ),
            param(
                lambda t: t.string_col.find('a'),
                lambda t: t.string_col.str.find('a'),
                id='find',
            ),
            param(
                lambda t: t.string_col.lpad(10, 'a'),
                lambda t: t.string_col.str.pad(10, fillchar='a', side='left'),
                id='lpad',
            ),
            param(
                lambda t: t.string_col.rpad(10, 'a'),
                lambda t: t.string_col.str.pad(10, fillchar='a', side='right'),
                id='rpad',
            ),
            param(
                lambda t: t.string_col.find_in_set(['1']),
                lambda t: t.string_col.str.find('1'),
                id='find_in_set',
            ),
            param(
                lambda t: t.string_col.find_in_set(['a']),
                lambda t: t.string_col.str.find('a'),
                id='find_in_set_all_missing',
            ),
            param(
                lambda t: t.string_col.lower(),
                lambda t: t.string_col.str.lower(),
                id='lower',
            ),
            param(
                lambda t: t.string_col.upper(),
                lambda t: t.string_col.str.upper(),
                id='upper',
            ),
            param(
                lambda t: t.string_col.reverse(),
                lambda t: t.string_col.str[::-1],
                id='reverse',
            ),
            param(
                lambda t: t.string_col.ascii_str(),
                lambda t: t.string_col.map(ord).astype('int32'),
                id='ascii_str',
                # TODO - dtype - #2553
                marks=pytest.mark.skip_backends(['dask']),
            ),
            param(
                lambda t: t.string_col.length(),
                lambda t: t.string_col.str.len().astype('int32'),
                id='length',
                marks=pytest.mark.xfail_backends(['omniscidb']),  # #2338
            ),
            param(
                lambda t: t.string_col.startswith('foo'),
                lambda t: t.string_col.str.startswith('foo'),
                id='startswith',
            ),
            param(
                lambda t: t.string_col.endswith('foo'),
                lambda t: t.string_col.str.endswith('foo'),
                id='endswith',
            ),
            param(
                lambda t: t.string_col.strip(),
                lambda t: t.string_col.str.strip(),
                id='strip',
            ),
            param(
                lambda t: t.string_col.lstrip(),
                lambda t: t.string_col.str.lstrip(),
                id='lstrip',
            ),
            param(
                lambda t: t.string_col.rstrip(),
                lambda t: t.string_col.str.rstrip(),
                id='rstrip',
            ),
            param(
                lambda t: t.string_col.capitalize(),
                lambda t: t.string_col.str.capitalize(),
                id='capitalize',
            ),
            param(
                lambda t: t.date_string_col.substr(2, 3),
                lambda t: t.date_string_col.str[2:5],
                id='substr',
            ),
            param(
                lambda t: t.date_string_col.left(2),
                lambda t: t.date_string_col.str[:2],
                id='left',
            ),
            param(
                lambda t: t.date_string_col.right(2),
                lambda t: t.date_string_col.str[-2:],
                id='right',
            ),
            param(
                lambda t: t.date_string_col[1:3],
                lambda t: t.date_string_col.str[1:3],
                id='slice',
            ),
            param(
                lambda t: t.date_string_col[t.date_string_col.length() - 1 :],
                lambda t: t.date_string_col.str[-1:],
                id='expr_slice_begin',
                # TODO - substring - #2553
                marks=pytest.mark.xfail_backends(['dask']),
            ),
            param(
                lambda t: t.date_string_col[: t.date_string_col.length()],
                lambda t: t.date_string_col,
                id='expr_slice_end',
                # TODO - substring - #2553
                marks=pytest.mark.xfail_backends(['dask']),
            ),
            param(
                lambda t: t.date_string_col[:],
                lambda t: t.date_string_col,
                id='expr_empty_slice',
                # TODO - substring - #2553
                marks=pytest.mark.xfail_backends(['dask']),
            ),
            param(
                lambda t: t.date_string_col[
                    t.date_string_col.length() - 2 : t.date_string_col.length() - 1
                ],
                lambda t: t.date_string_col.str[-2:-1],
                id='expr_slice_begin_end',
                # TODO - substring - #2553
                marks=pytest.mark.xfail_backends(['dask']),
            ),
            param(
                lambda t: t.date_string_col.split('/'),
                lambda t: t.date_string_col.str.split('/'),
                id='split',
                marks=pytest.mark.xfail_backends(['bigquery']),  # Issue #2372
            ),
            param(
                lambda t: ibis.literal('-').join(['a', t.string_col, 'c']),
                lambda t: 'a-' + t.string_col + '-c',
                id='join',
            ),
        ],
    )
    @pytest.mark.xfail_unsupported
    def test_string(backend, alltypes, df, result_func, expected_func):
        expr = result_func(alltypes)
>       result = expr.execute()

../ibis/ibis/backends/tests/test_string.py:273: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../ibis/ibis/expr/types.py:273: in execute
    return self._find_backend().execute(
ibis_bigquery/__init__.py:268: in execute
    sql = query_ast.compile()
../ibis/ibis/backends/base/sql/compiler/base.py:41: in compile
    compiled_queries = [q.compile() for q in self.queries]
../ibis/ibis/backends/base/sql/compiler/base.py:41: in <listcomp>
    compiled_queries = [q.compile() for q in self.queries]
../ibis/ibis/backends/base/sql/compiler/query_builder.py:289: in compile
    select_frag = self.format_select_set()
../ibis/ibis/backends/base/sql/compiler/query_builder.py:344: in format_select_set
    expr_str = self._translate(expr, named=True)
../ibis/ibis/backends/base/sql/compiler/query_builder.py:237: in _translate
    return translator.get_result()
../ibis/ibis/backends/base/sql/compiler/translator.py:222: in get_result
    translated = self.translate(self.expr)
../ibis/ibis/backends/base/sql/compiler/translator.py:277: in translate
    return formatter(self, expr)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

translator = <ibis_bigquery.compiler.BigQueryExprTranslator object at 0x7fdac94a88b0>
expr = ref_0
BigQueryTable[table]
  name: swast-scratch.ibis_gbq_testing.functional_alltypes
  schema:
    index : int64
    ...[string*] 'date_string_col' from table
                ref_0
          right:
            Literal[int8]
              2

    def _string_substring(translator, expr):
        op = expr.op()
        arg, start, length = op.args
>       if length.op().value < 0:
E       AttributeError: 'Subtract' object has no attribute 'value'

ibis_bigquery/compiler.py:202: AttributeError
__________________________________________ test_timestamp_extract[bigquery-week_of_year] ___________________________________________

backend = <ibis_bigquery.tests.conftest.TestConf object at 0x7fdad8429c70>
alltypes = BigQueryTable[table]
  name: swast-scratch.ibis_gbq_testing.functional_alltypes
  schema:
    index : int64
    Unname...4
    date_string_col : string
    string_col : string
    timestamp_col : timestamp
    year : int64
    month : int64
df =       index  Unnamed_0    id  bool_col  tinyint_col  ...  date_string_col  string_col           timestamp_col  year  m...     True            6  ...         01/31/10           6 2010-01-31 05:06:13.650  2010      1

[7300 rows x 15 columns]
attr = 'week_of_year'

    @pytest.mark.parametrize(
        'attr',
        [
            'year',
            'month',
            'day',
            'day_of_year',
            'quarter',
            'epoch_seconds',
            'week_of_year',
            'hour',
            'minute',
            'second',
            'millisecond',
        ],
    )
    @pytest.mark.xfail_unsupported
    def test_timestamp_extract(backend, alltypes, df, attr):
        if attr == 'millisecond':
            if backend.name() == 'sqlite':
                pytest.xfail(reason=('Issue #2156'))
            if backend.name() == 'spark':
                pytest.xfail(reason='Issue #2159')
            expected = (df.timestamp_col.dt.microsecond // 1000).astype('int32')
        elif attr == 'epoch_seconds':
            expected = df.timestamp_col.astype('int64') // int(1e9)
        elif attr == 'week_of_year':
            expected = df.timestamp_col.dt.isocalendar().week.astype('int32')
        else:
            expected = getattr(df.timestamp_col.dt, attr.replace('_', '')).astype(
                'int32'
            )
    
        expr = getattr(alltypes.timestamp_col, attr)()
>       result = expr.execute()

../ibis/ibis/backends/tests/test_temporal.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../ibis/ibis/expr/types.py:273: in execute
    return self._find_backend().execute(
ibis_bigquery/__init__.py:270: in execute
    cursor = self.raw_sql(sql, params=params, **kwargs)
ibis_bigquery/__init__.py:227: in raw_sql
    return self._execute(query, results=results, query_parameters=query_parameters)
ibis_bigquery/__init__.py:220: in _execute
    query.result()  # blocks until finished
/usr/local/Caskroom/miniconda/base/envs/ibis-bigquery-dev/lib/python3.8/site-packages/google/cloud/bigquery/job/query.py:1266: in result
    super(QueryJob, self).result(retry=retry, timeout=timeout)
/usr/local/Caskroom/miniconda/base/envs/ibis-bigquery-dev/lib/python3.8/site-packages/google/cloud/bigquery/job/base.py:679: in result
    return super(_AsyncJob, self).result(timeout=timeout, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <google.cloud.bigquery.job.query.QueryJob object at 0x7fdad8462b20>, timeout = None
retry = <google.api_core.retry.Retry object at 0x7fdac8b51eb0>

    def result(self, timeout=None, retry=DEFAULT_RETRY):
        """Get the result of the operation, blocking if necessary.
    
        Args:
            timeout (int):
                How long (in seconds) to wait for the operation to complete.
                If None, wait indefinitely.
    
        Returns:
            google.protobuf.Message: The Operation's result.
    
        Raises:
            google.api_core.GoogleAPICallError: If the operation errors or if
                the timeout is reached before the operation completes.
        """
        kwargs = {} if retry is DEFAULT_RETRY else {"retry": retry}
        self._blocking_poll(timeout=timeout, **kwargs)
    
        if self._exception is not None:
            # pylint: disable=raising-bad-type
            # Pylint doesn't recognize that this is valid in this case.
>           raise self._exception
E           google.api_core.exceptions.BadRequest: 400 Function not found: weekofyear at [1:8]
E           
E           (job ID: 28d4b903-4cb4-48ce-bfdb-3a4a152f8630)
E           
E                          -----Query Job SQL Follows-----                
E           
E               |    .    |    .    |    .    |    .    |    .    |
E              1:SELECT weekofyear(`timestamp_col`) AS `tmp`
E              2:FROM `swast-scratch.ibis_gbq_testing.functional_alltypes`
E              3:LIMIT 10000
E               |    .    |    .    |    .    |    .    |    .    |

/usr/local/Caskroom/miniconda/base/envs/ibis-bigquery-dev/lib/python3.8/site-packages/google/api_core/future/polling.py:134: BadRequest
_____________________________________ test_ungrouped_unbounded_window[bigquery-orderered-mean] _____________________________________

backend = <ibis_bigquery.tests.conftest.TestConf object at 0x7fdad8429c70>
alltypes = BigQueryTable[table]
  name: swast-scratch.ibis_gbq_testing.functional_alltypes
  schema:
    index : int64
    Unname...4
    date_string_col : string
    string_col : string
    timestamp_col : timestamp
    year : int64
    month : int64
df =       index  Unnamed_0    id  bool_col  tinyint_col  ...  date_string_col  string_col           timestamp_col  year  m...    False            9  ...         12/31/10           9 2010-12-31 05:09:13.860  2010     12

[7300 rows x 15 columns]
con = <ibis_bigquery.Backend object at 0x7fdad8429e50>, result_fn = <function <lambda> at 0x7fdad834e430>
expected_fn = <function <lambda> at 0x7fdad834e4c0>, ordered = True

    @pytest.mark.parametrize(
        ('result_fn', 'expected_fn'),
        [
            # Reduction ops
            param(
                lambda t, win: t.double_col.mean().over(win),
                lambda df: pd.Series([df.double_col.mean()] * len(df.double_col)),
                id='mean',
            ),
            param(
                lambda t, win: mean_udf(t.double_col).over(win),
                lambda df: pd.Series([df.double_col.mean()] * len(df.double_col)),
                id='mean_udf',
                marks=pytest.mark.udf,
            ),
            # Analytic ops
            param(
                lambda t, win: t.float_col.lag().over(win),
                lambda df: df.float_col.shift(1),
                id='lag',
            ),
            param(
                lambda t, win: t.float_col.lead().over(win),
                lambda df: df.float_col.shift(-1),
                id='lead',
            ),
            param(
                lambda t, win: calc_zscore(t.double_col).over(win),
                lambda df: df.double_col.transform(calc_zscore.func),
                id='zscore_udf',
                marks=pytest.mark.udf,
            ),
        ],
    )
    @pytest.mark.parametrize(
        ('ordered'),
        [
            param(
                # Temporarily disabled on Spark and Imapala because their behavior
                # is currently inconsistent with the other backends (see #2378).
                True,
                id='orderered',
                marks=pytest.mark.skip_backends(['spark', 'impala']),
            ),
            param(
                # Disabled on MySQL and PySpark because they require a defined
                # ordering for analytic ops like lag and lead.
                # Disabled on Spark because its behavior is inconsistent with other
                # backends (see #2381).
                False,
                id='unordered',
                marks=pytest.mark.skip_backends(['mysql', 'pyspark', 'spark']),
            ),
        ],
    )
    # Some backends do not support non-grouped window specs
    @pytest.mark.xfail_backends(['omniscidb'])
    @pytest.mark.xfail_unsupported
    def test_ungrouped_unbounded_window(
        backend, alltypes, df, con, result_fn, expected_fn, ordered
    ):
        if not backend.supports_window_operations:
            pytest.skip(f'Backend {backend} does not support window operations')
    
        # Define a window that is
        # 1) Ungrouped
        # 2) Ordered if `ordered` is True
        # 3) Unbounded
        order_by = [alltypes.id] if ordered else None
        window = ibis.window(order_by=order_by)
        expr = alltypes.mutate(
            val=result_fn(
                alltypes,
                win=window,
            )
        )
        result = expr.execute()
        result = result.set_index('id').sort_index()
    
        # Apply `expected_fn` onto a DataFrame that is
        # 1) Ungrouped
        # 2) Ordered if `ordered` is True
        df = df.sort_values('id') if ordered else df
        expected = df.assign(val=expected_fn(df))
        expected = expected.set_index('id').sort_index()
    
        left, right = result.val, expected.val
    
>       backend.assert_series_equal(left, right)

../ibis/ibis/backends/tests/test_window.py:490: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../ibis/ibis/backends/tests/base.py:48: in assert_series_equal
    return super().assert_series_equal(left, right, *args, **kwargs)
../ibis/ibis/backends/tests/base.py:95: in assert_series_equal
    tm.assert_series_equal(left, right, *args, **kwargs)
pandas/_libs/testing.pyx:46: in pandas._libs.testing.assert_almost_equal
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   AssertionError: Series are different
E   
E   Series values are different (90.0 %)
E   [index]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...]
E   [left]:  [0.0, 5.05, 10.1, 15.15, 20.2, 25.25, 30.3, 35.35, 36.792857142857144, 37.03333333333333, 37.292307692307695, 37.875, 38.71666666666667, 39.21176470588235, 40.4, 40.4, 40.4, 40.78846153846154, 40.83913043478261, 40.96111111111111, 41.31818181818182, 41.522222222222226, 41.77727272727273, 41.84285714285714, 41.88529411764706, 42.083333333333336, 42.236363636363635, 42.56428571428572, 42.58378378378379, 42.644444444444446, 42.695454545454545, 42.81521739130435, 42.925, 42.98372093023256, 43.05789473684211, 43.154545454545456, 43.193617021276594, 43.205555555555556, 43.285714285714285, 43.285714285714285, 43.32368421052632, 43.449056603773585, 43.50769230769231, 43.52619047619048, 43.55625, 43.589473684210525, 43.61363636363637, 43.766666666666666, 43.766666666666666, 43.766666666666666, 43.81216216216216, 43.85526315789474, 43.86716417910448, 43.88275862068966, 43.896153846153844, 43.964705882352945, 43.983870967741936, 43.9972602739726, 44.00714285714286, 44.0406976744186, 44.05689655172414, 44.07272727272727, 44.12105263157895, 44.14677419354839, 44.16063829787234, 44.172289156626505, 44.1875, 44.23103448275862, 44.24761904761905, 44.26176470588236, 44.284615384615385, 44.284615384615385, 44.306603773584904, 44.30967741935484, 44.327777777777776, 44.34146341463415, 44.35217391304348, 44.35670103092784, 44.386842105263156, 44.4051724137931, 44.41410256410256, 44.42038834951456, 44.44, 44.458878504672896, 44.46463414634147, 44.472580645161294, 44.48809523809524, 44.511504424778764, 44.51481481481481, 44.522448979591836, 44.53181818181818, 44.54358974358974, 44.5455223880597, 44.55882352941177, 44.55882352941177, 44.571739130434786, 44.57931034482759, 44.58780487804878, 44.608333333333334, 44.61496062992126, ...]
E   [right]: [45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, 45.45, ...]

pandas/_libs/testing.pyx:161: AssertionError
_____________________________________ test_ungrouped_unbounded_window[bigquery-unordered-lag] ______________________________________

backend = <ibis_bigquery.tests.conftest.TestConf object at 0x7fdad8429c70>
alltypes = BigQueryTable[table]
  name: swast-scratch.ibis_gbq_testing.functional_alltypes
  schema:
    index : int64
    Unname...4
    date_string_col : string
    string_col : string
    timestamp_col : timestamp
    year : int64
    month : int64
df =       index  Unnamed_0    id  bool_col  tinyint_col  ...  date_string_col  string_col           timestamp_col  year  m...     True            6  ...         01/31/10           6 2010-01-31 05:06:13.650  2010      1

[7300 rows x 15 columns]
con = <ibis_bigquery.Backend object at 0x7fdad8429e50>, result_fn = <function <lambda> at 0x7fdad834e670>
expected_fn = <function <lambda> at 0x7fdad834e700>, ordered = False

    @pytest.mark.parametrize(
        ('result_fn', 'expected_fn'),
        [
            # Reduction ops
            param(
                lambda t, win: t.double_col.mean().over(win),
                lambda df: pd.Series([df.double_col.mean()] * len(df.double_col)),
                id='mean',
            ),
            param(
                lambda t, win: mean_udf(t.double_col).over(win),
                lambda df: pd.Series([df.double_col.mean()] * len(df.double_col)),
                id='mean_udf',
                marks=pytest.mark.udf,
            ),
            # Analytic ops
            param(
                lambda t, win: t.float_col.lag().over(win),
                lambda df: df.float_col.shift(1),
                id='lag',
            ),
            param(
                lambda t, win: t.float_col.lead().over(win),
                lambda df: df.float_col.shift(-1),
                id='lead',
            ),
            param(
                lambda t, win: calc_zscore(t.double_col).over(win),
                lambda df: df.double_col.transform(calc_zscore.func),
                id='zscore_udf',
                marks=pytest.mark.udf,
            ),
        ],
    )
    @pytest.mark.parametrize(
        ('ordered'),
        [
            param(
                # Temporarily disabled on Spark and Imapala because their behavior
                # is currently inconsistent with the other backends (see #2378).
                True,
                id='orderered',
                marks=pytest.mark.skip_backends(['spark', 'impala']),
            ),
            param(
                # Disabled on MySQL and PySpark because they require a defined
                # ordering for analytic ops like lag and lead.
                # Disabled on Spark because its behavior is inconsistent with other
                # backends (see #2381).
                False,
                id='unordered',
                marks=pytest.mark.skip_backends(['mysql', 'pyspark', 'spark']),
            ),
        ],
    )
    # Some backends do not support non-grouped window specs
    @pytest.mark.xfail_backends(['omniscidb'])
    @pytest.mark.xfail_unsupported
    def test_ungrouped_unbounded_window(
        backend, alltypes, df, con, result_fn, expected_fn, ordered
    ):
        if not backend.supports_window_operations:
            pytest.skip(f'Backend {backend} does not support window operations')
    
        # Define a window that is
        # 1) Ungrouped
        # 2) Ordered if `ordered` is True
        # 3) Unbounded
        order_by = [alltypes.id] if ordered else None
        window = ibis.window(order_by=order_by)
        expr = alltypes.mutate(
            val=result_fn(
                alltypes,
                win=window,
            )
        )
        result = expr.execute()
        result = result.set_index('id').sort_index()
    
        # Apply `expected_fn` onto a DataFrame that is
        # 1) Ungrouped
        # 2) Ordered if `ordered` is True
        df = df.sort_values('id') if ordered else df
        expected = df.assign(val=expected_fn(df))
        expected = expected.set_index('id').sort_index()
    
        left, right = result.val, expected.val
    
>       backend.assert_series_equal(left, right)

../ibis/ibis/backends/tests/test_window.py:490: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../ibis/ibis/backends/tests/base.py:48: in assert_series_equal
    return super().assert_series_equal(left, right, *args, **kwargs)
../ibis/ibis/backends/tests/base.py:95: in assert_series_equal
    tm.assert_series_equal(left, right, *args, **kwargs)
pandas/_libs/testing.pyx:46: in pandas._libs.testing.assert_almost_equal
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   AssertionError: Series are different
E   
E   Series values are different (0.0411 %)
E   [index]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...]
E   [left]:  [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...]
E   [right]: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...]

pandas/_libs/testing.pyx:161: AssertionError
===================================================== short test summary info ======================================================
FAILED test_api.py::test_database_consistency[bigquery] - AssertionError: assert False
FAILED test_generic.py::test_select_filter_mutate[bigquery] - AssertionError: DataFrame.iloc[:, 8] (column name="float_col") are ...
FAILED test_numeric.py::test_binary_arithmetic_operations[bigquery-floordiv] - AssertionError: More than one xfail_unsupported ma...
FAILED test_string.py::test_string[bigquery-expr_slice_begin] - AttributeError: 'Subtract' object has no attribute 'value'
FAILED test_string.py::test_string[bigquery-expr_slice_end] - AttributeError: 'Subtract' object has no attribute 'value'
FAILED test_string.py::test_string[bigquery-expr_empty_slice] - AttributeError: 'Subtract' object has no attribute 'value'
FAILED test_string.py::test_string[bigquery-expr_slice_begin_end] - AttributeError: 'Subtract' object has no attribute 'value'
FAILED test_temporal.py::test_timestamp_extract[bigquery-week_of_year] - google.api_core.exceptions.BadRequest: 400 Function not ...
FAILED test_window.py::test_ungrouped_unbounded_window[bigquery-orderered-mean] - AssertionError: Series are different
FAILED test_window.py::test_ungrouped_unbounded_window[bigquery-unordered-lag] - AssertionError: Series are different
ERROR test_join.py::test_join_project_left_table[bigquery-inner] - google.api_core.exceptions.NotFound: 404 GET https://bigquery....
ERROR test_join.py::test_join_project_left_table[bigquery-left] - google.api_core.exceptions.NotFound: 404 GET https://bigquery.g...
ERROR test_join.py::test_join_project_left_table[bigquery-right] - google.api_core.exceptions.NotFound: 404 GET https://bigquery....
ERROR test_join.py::test_join_project_left_table[bigquery-outer] - google.api_core.exceptions.NotFound: 404 GET https://bigquery....
ERROR test_join.py::test_join_project_left_table[bigquery-semi] - google.api_core.exceptions.NotFound: 404 GET https://bigquery.g...
ERROR test_join.py::test_join_project_left_table[bigquery-anti] - google.api_core.exceptions.NotFound: 404 GET https://bigquery.g...
============= 10 failed, 289 passed, 220 skipped, 57 xfailed, 1 xpassed, 266 warnings, 6 errors in 2956.35s (0:49:16) ==============

@tswast
Copy link
Collaborator Author

tswast commented Dec 2, 2021

(ibis-bigquery-dev) ➜  ibis-bigquery git:(compat_ibis2) PYTEST_BACKENDS="bigquery" python -m pytest --pyargs ibis.backends.tests.test_api::'test_database_consistency[bigquery]' --disable-pytest-warnings
================================================================== test session starts ===================================================================
platform darwin -- Python 3.8.10, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /Users/swast/src/github.com/ibis-project/ibis-bigquery
plugins: cov-2.12.1, mock-3.6.1
collected 1 item                                                                                                                                         

. F                                                                                                                                                [100%]

======================================================================== FAILURES ========================================================================
__________________________________________________________ test_database_consistency[bigquery] ___________________________________________________________

con = <ibis_bigquery.Backend object at 0x7f7fa199aaf0>

    @pytest.mark.xfail_backends(['hdf5'])
    @pytest.mark.xfail_unsupported
    def test_database_consistency(con):
        # every backend has a different set of databases, not testing the
        # exact names for now
        databases = con.list_databases()
        assert isinstance(databases, list)
        assert len(databases) >= 1
        assert all(isinstance(database, str) for database in databases)
    
        current_database = con.current_database
>       assert isinstance(current_database, str)
E       AssertionError: assert False
E        +  where False = isinstance(BigQueryDatabase('ibis_gbq_testing'), str)

../ibis/ibis/backends/tests/test_api.py:39: AssertionError
================================================================ short test summary info =================================================================
FAILED ::test_database_consistency[bigquery] - AssertionError: assert False
============================================================= 1 failed, 6 warnings in 2.95s ==============================================================

I think this is a problem with the test. I suspect it should be is_instance(current_database, con.database_class).

@tswast
Copy link
Collaborator Author

tswast commented Dec 2, 2021

(ibis-bigquery-dev) ➜  ibis-bigquery git:(compat_ibis2) PYTEST_BACKENDS="bigquery" python -m pytest --pyargs ibis.backends.tests.test_generic::test_select_filter_mutate --disable-pytest-warnings
================================================================== test session starts ===================================================================
platform darwin -- Python 3.8.10, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /Users/swast/src/github.com/ibis-project/ibis-bigquery
plugins: cov-2.12.1, mock-3.6.1
collected 1 item                                                                                                                                         

. F                                                                                                                                                [100%]

======================================================================== FAILURES ========================================================================
__________________________________________________________ test_select_filter_mutate[bigquery] ___________________________________________________________

backend = <ibis_bigquery.tests.conftest.TestConf object at 0x7fa7a0add6d0>
alltypes = BigQueryTable[table]
  name: swast-scratch.ibis_gbq_testing.functional_alltypes
  schema:
    index : int64
    Unname...4
    date_string_col : string
    string_col : string
    timestamp_col : timestamp
    year : int64
    month : int64
df =       index  Unnamed_0    id  bool_col  tinyint_col  smallint_col  ...  double_col  date_string_col  string_col       ...          6  ...        60.6         01/31/10           6 2010-01-31 05:06:13.650  2010     1

[7300 rows x 15 columns]

    @pytest.mark.xfail_unsupported
    @pytest.mark.skip_backends(['postgres'])
    def test_select_filter_mutate(backend, alltypes, df):
        """Test that select, filter and mutate are executed in right order.
    
        Before Pr 2635, try_fusion in analysis.py would fuse these operations
        together in a way that the order of the operations were wrong. (mutate
        was executed before filter).
        """
        t = alltypes
    
        # Prepare the float_col so that filter must execute
        # before the cast to get the correct result.
        t = t.mutate(
            float_col=ibis.case()
            .when(t['bool_col'], t['float_col'])
            .else_(np.nan)
            .end()
        )
    
        # Actual test
        t = t[t.columns]
        t = t[~t['float_col'].isnan()]
        t = t.mutate(float_col=t['float_col'].cast('int32'))
        result = t.execute()
    
        expected = df.copy()
        expected.loc[~df['bool_col'], 'float_col'] = None
        expected = expected[~expected['float_col'].isna()]
        expected = expected.assign(float_col=expected['float_col'].astype('int32'))
    
>       backend.assert_frame_equal(result, expected)

../ibis/ibis/backends/tests/test_generic.py:258: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../ibis/ibis/backends/tests/base.py:57: in assert_frame_equal
    return super().assert_frame_equal(left, right, *args, **kwargs)
../ibis/ibis/backends/tests/base.py:103: in assert_frame_equal
    tm.assert_frame_equal(left, right, *args, **kwargs)
pandas/_libs/testing.pyx:46: in pandas._libs.testing.assert_almost_equal
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   AssertionError: DataFrame.iloc[:, 8] (column name="float_col") are different
E   
E   DataFrame.iloc[:, 8] (column name="float_col") values are different (40.0 %)
E   [index]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...]
E   [left]:  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...]
E   [right]: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...]

pandas/_libs/testing.pyx:161: AssertionError
================================================================ short test summary info =================================================================
FAILED ::test_select_filter_mutate[bigquery] - AssertionError: DataFrame.iloc[:, 8] (column name="float_col") are different
============================================================ 1 failed, 20 warnings in 11.34s =============================================================

I'm not sure what is going on in this one, but it seems like a somewhat recent fix so I don't think it should block release of 2.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant