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

TST: doctest in ibis.bigquery.udf.api is failing for python 3.8 #77

Open
xmnlab opened this issue Feb 21, 2020 · 3 comments
Open

TST: doctest in ibis.bigquery.udf.api is failing for python 3.8 #77

xmnlab opened this issue Feb 21, 2020 · 3 comments

Comments

@xmnlab
Copy link

xmnlab commented Feb 21, 2020

A doctest in ibis.bigquery.udf.api is failing for python 3.8


============================================= FAILURES =============================================
_______________________________ [doctest] ibis.bigquery.udf.api.udf ________________________________
070     `the BigQuery documentation
071     <https://cloud.google.com/bigquery/docs/reference/standard-sql/user-defined-functions#sql-type-encodings-in-javascript>`_.
072 
073     Examples
074     --------
075     >>> from ibis.bigquery import udf
076     >>> import ibis.expr.datatypes as dt
077     >>> @udf(input_type=[dt.double], output_type=dt.double)
UNEXPECTED EXCEPTION: NotImplementedError("'visit_Constant' nodes not yet implemented")
Traceback (most recent call last):

  File "/home/xmn/miniconda3/envs/ibis-py38/lib/python3.8/doctest.py", line 1329, in __run
    exec(compile(example.source, filename, "single",

  File "<doctest ibis.bigquery.udf.api.udf[3]>", line 2, in <module>

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/api.py", line 215, in wrapper
    source = PythonToJavaScriptTranslator(f).compile()

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 133, in compile
    return self.visit(self.ast)

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 146, in visit
    result = method(node)

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 413, in visit_Module
    return '\n\n'.join(map(self.visit, node.body))

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 146, in visit
    result = method(node)

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 211, in visit_FunctionDef
    body = indent(map(self.visit, node.body))

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 49, in indent
    text = '\n'.join(lines)

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 146, in visit
    result = method(node)

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 63, in wrapper
    return f(*args, **kwargs) + ';'

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 232, in visit_Return
    return 'return {}'.format(self.visit(node.value))

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 146, in visit
    result = method(node)

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 273, in visit_BinOp
    self.visit(left), self.visit(op), self.visit(right)

  File "/home/xmn/dev/quansight/ibis-project/ibis/ibis/bigquery/udf/core.py", line 141, in visit
    raise NotImplementedError(

NotImplementedError: 'visit_Constant' nodes not yet implemented
@xmnlab
Copy link
Author

xmnlab commented Feb 21, 2020

https://github.com/ibis-project/ibis/issues/2085 proposes to skip this doctest

@tswast
Copy link
Collaborator

tswast commented Apr 13, 2021

I think this was actually a regression in Ibis 1.4.0, as I get this same NotImplementedError: 'visit_Constant' nodes not yet implemented when I run the code from the ibis bigquery tutorial.

@ibis.bigquery.udf(['double'], 'double')
def example_udf(value):
    return value + 1.0

test_column = ibis.literal(1, type='double')
expression = example_udf(test_column)

print(conn.execute(expression)

@tswast
Copy link
Collaborator

tswast commented Apr 13, 2021

As we are splitting BigQuery to it's own repository (ibis-project/ibis#2665), I'll track the fix for this here: #6

@datapythonista datapythonista transferred this issue from ibis-project/ibis Jun 17, 2021
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

2 participants