You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Brian Hulette (Jira)" <ji...@apache.org> on 2021/09/14 19:20:00 UTC

[jira] [Commented] (BEAM-12698) Some binary operations on DeferredSeries don't work

    [ https://issues.apache.org/jira/browse/BEAM-12698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17415115#comment-17415115 ] 

Brian Hulette commented on BEAM-12698:
--------------------------------------

Hi [~zywind], {{with_output_types}} is intended to just annotate the output type of a transform, it doesn't modify the elements in anyway. In your case {{beam.Map(json.loads)}} produces a python dictionary, so it's not correct to annotate it with the output type {{CustomNamedTupleType}}. Instead you'll want to add another transform after the {{beam.Map(json.loads)}} like {{beam.Map(convert_dictionary_to_custom_type).with_output_types(CustomNamedTupleType)}}. Hope that helps!

I'm going to go ahead and close this, but if you have more questions about the above feel free to keep commenting here. (Alternatively we keep an eye on the user@beam.apache.org mailing list and other [support channels|https://beam.apache.org/community/contact-us/]

> Some binary operations on DeferredSeries don't work
> ---------------------------------------------------
>
>                 Key: BEAM-12698
>                 URL: https://issues.apache.org/jira/browse/BEAM-12698
>             Project: Beam
>          Issue Type: Bug
>          Components: dsl-dataframe
>    Affects Versions: 2.31.0
>            Reporter: Yunfeng Zhang
>            Priority: P2
>
> I get an error when trying to multiply two columns of a deferred dataframe:
> ib.collect(df.A.mul(df.B))
> {color:#FF0000}TypeError: can't multiply sequence by non-int of type 'str' [while running '[35]: ComputedExpression[mul_Series_140480471782160]/[ComputedExpression[mul_Series_140480471782160]]:140480472023312/FlatMap(evaluate)/FlatMap(evaluate)']{color}
>  
> Similarly, adding a scalar also doesn't work:
> ib.collect(df.A.add(1))
> {color:#FF0000}TypeError: can only concatenate str (not "int") to str [while running '[39]: ComputedExpression[add_Series_140480422551952]/[ComputedExpression[get_column_Series_140480422552144], ComputedExpression[add_Series_140480422551952]]:140480472568336/FlatMap(evaluate)/FlatMap(evaluate)']{color}
> {color:#172b4d}But adding two columns work.{color}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)