(typ, val, c)
return NativeValue(string_array._getvalue(), is_error=is_error)
Unbox a Pandas String Series. We just redirect to StringArray implementation.
Unbox a Pandas String Series. We just redirect to StringArray implementation.
Unbox a Pandas String Series . We just redirect to StringArray implementation .
def unbox_str_series(typ, val, c):
    """
    Unbox a Pandas String Series. We just redirect to StringArray implementation.
    """
    dtype = StringArrayPayloadType()
    payload = cgutils.create_struct_proxy(dtype)(c.context, c.builder)
    string_array = c.context.make_helper(c.builder, typ)

    # function signature of string_array_from_sequence
    # we use void* instead of PyObject*
    fnty = lir.FunctionType(lir.VoidType(),
                            [lir.IntType(8).as_pointer(),
                             lir.IntType(64).as_pointer(),
                             lir.IntType(32).as_pointer().as_pointer(),
                             lir.IntType(8).as_pointer().as_pointer(),
                             lir.IntType(8).as_pointer().as_pointer(),
                             ])
    fn = cgutils.get_or_insert_function(c.builder.module, fnty, name="string_array_from_sequence")
    c.builder.call(fn, [val,
                        string_array._get_ptr_by_name('num_items'),
                        payload._get_ptr_by_name('offsets'),
                        payload._get_ptr_by_name('data'),
                        payload._get_ptr_by_name('null_bitmap'),
                        ])

    # the raw data is now copied to payload
    # The native representation is a proxy to the payload, we need to
    # get a proxy and attach the payload and meminfo
    meminfo, meminfo_data_ptr = construct_string_array(c.context, c.builder)
    c.builder.store(payload._getvalue(), meminfo_data_ptr)

    string_array.meminfo = meminfo
    string_array.offsets = payload.offsets
    string_array.data = payload.data
    string_array.null_bitmap = payload.null_bitmap
    string_array.num_total_chars = c.builder.zext(c.builder.load(
        c.builder.gep(string_array.offsets, [string_array.num_items])), lir.IntType(64))

    # FIXME how to check that the returned size is > 0?
    is_error = cgutils.is_not_null(c.builder, c.pyapi.err_occurred())
    return NativeValue(string_array._getvalue(), is_error=is_error)
def unbox_str_series ( typ , val , c ) : dtype = StringArrayPayloadType ( ) payload = cgutils . create_struct_proxy ( dtype ) ( c . context , c . builder ) string_array = c . context . make_helper ( c . builder , typ ) # function signature of string_array_from_sequence # we use void* instead of PyObject* fnty = lir . FunctionType ( lir . VoidType ( ) , [ lir . IntType ( 8 ) . as_pointer ( ) , lir . IntType ( 64 ) . as_pointer ( ) , lir . IntType ( 32 ) . as_pointer ( ) . as_pointer ( ) , lir . IntType ( 8 ) . as_pointer ( ) . as_pointer ( ) , lir . IntType ( 8 ) . as_pointer ( ) . as_pointer ( ) , ] ) fn = cgutils . get_or_insert_function ( c . builder . module , fnty , name = "string_array_from_sequence" ) c . builder . call ( fn , [ val , string_array . _get_ptr_by_name ( 'num_items' ) , payload . _get_ptr_by_name ( 'offsets' ) , payload . _get_ptr_by_name ( 'data' ) , payload . _get_ptr_by_name ( 'null_bitmap' ) , ] ) # the raw data is now copied to payload # The native representation is a proxy to the payload, we need to # get a proxy and attach the payload and meminfo meminfo , meminfo_data_ptr = construct_string_array ( c . context , c . builder ) c . builder . store ( payload . _getvalue ( ) , meminfo_data_ptr ) string_array . meminfo = meminfo string_array . offsets = payload . offsets string_array . data = payload . data string_array . null_bitmap = payload . null_bitmap string_array . num_total_chars = c . builder . zext ( c . builder . load ( c . builder . gep ( string_array . offsets , [ string_array . num_items ] ) ) , lir . IntType ( 64 ) ) # FIXME how to check that the returned size is > 0? is_error = cgutils . is_not_null ( c . builder , c . pyapi . err_occurred ( ) ) return NativeValue ( string_array . _getvalue ( ) , is_error = is_error )