【问题标题】:declaring output schema when using gapply in Sparkr在 Sparkr 中使用 gapply 时声明输出模式
【发布时间】:2018-01-27 06:41:05
【问题描述】:

我想根据https://spark.apache.org/docs/latest/sparkr.html#gapply使用gapply

问题是我要返回一个包含 2 个数据框的列表。

返回(列表(df1,df2))

在这种情况下如何声明输出模式?

【问题讨论】:

    标签: dataframe schema sparkr gapply


    【解决方案1】:

    您不能使用返回任意列表的函数。 As per gapply documentation(强调我的):

    函数 func 将键 - 分组列和数据框 - 本地 R data.frame 作为参数。 func 的输出是一个本地的R data.frame。

    您可以通过将每个 data.frame 视为与 struct<col1:array<typeofcol1>, col2:array<typeofcol2>, ..., coln:array<typeofcoln>> 等效的类型的单个 Row 来使其工作,但仅只要两个输出 data.frames 具有相同的架构.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-06-10
      • 1970-01-01
      • 2021-09-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-02
      相关资源
      最近更新 更多