Skip to content

Type Conversion for UDF - segfault #17523

@saptarshiguha

Description

@saptarshiguha

What happens?

Hello,

retype_scalar = {
    'mode': str,
    'numeric': float,
    'xtraJSON':str
}

retype_taxonomy= {
    'categories': list[str],
    'is_harmful': int
}

retypemetrics = {
    'eaq3':  retype_scalar,
    #'eaq3a': retype_taxonomy,
    #'eaq1': retype_scalar,
    #'eaq2': retype_scalar,
    'eaq5': retype_scalar
}
d.typing.DuckDBPyType(retypemetrics)

When I try running d.typing.DuckDBPyType(retypemetrics) , the first time I get

 STRUCT(eaq3 STRUCT("mode" VARCHAR, "numeric" DOUBLE, xtraJSON VARCHAR), eaq5 STRUCT("mode" VARCHAR, "numeric" DOUBLE, xtraJSON VARCHAR))

And then I run the last command again

In [3]:  d.typing.DuckDBPyType(retypemetrics)
   ...: 
---------------------------------------------------------------------------
NotImplementedException                   Traceback (most recent call last)
Cell In[3], line 1
----> 1 d.typing.DuckDBPyType(retypemetrics)

NotImplementedException: Not implemented Error: Could not convert from object of type '<class 'int'>' to DuckDBPyType

In [4]: 

and then if I run this again

: Not implemented Error: Could not convert from object of type '<class 'weakref.ReferenceType'>' to DuckDBPyType

and if I run the again I get Not implemented Error: Could not convert from object of type '<class 'bool'>' to DuckDBPyType

and finally end with a segfault.

To Reproduce

See above

OS:

macOS

DuckDB Version:

v1.2.2 7c03946

DuckDB Client:

Python 3.11.6

Hardware:

No response

Full Name:

Saptarshi Guha

Affiliation:

None

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have not tested with any build

Did you include all relevant data sets for reproducing the issue?

No - Other reason (please specify in the issue body)

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions