如何使用scala将过滤器从apache.spark.sql应用于RelationalGroupedDataSet类?
我试图找到一个过滤器函数(获取列表类型对象,并且功能st函数应为输入列表元素的类型,并应返回一个bool值,并且这两个函数的过滤器的输出包含原始列表该函数在元素上返回true的元素)。
当我尝试应用过滤器时,我会出现错误。是否有任何方法可以将过滤器应用于RelationalGroupedDataSet? (我在附带的文档中找不到任何内容: https://spark.apache.org/docs/2.4.4/api/java/java/org/org/apache/spark/sql/sql/relationalgroupeddataset.html
)对于我应该如何访问关系群的特定列值?
谢谢!
I was trying to find a filter function (takes a List type object and a function s.t. the function should be of type of the input list elements and should return a bool value, and the output of the filter of these two functions contains the original list element in which the function returns true on the element).
When I try to apply filter, I get an error. Are there any ways to apply filter to a RelationalGroupedDataset? (I wasn't able to find any in the attached docs: https://spark.apache.org/docs/2.4.4/api/java/org/apache/spark/sql/RelationalGroupedDataset.html)
Also, is there proper notation for how I should be accessing a specific column value for a RelationalGroupedDataset?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个例子:
它应该为您提供指导。
Here is is an example:
It should give you guidance.
尝试将
:_*
添加到Groupby中:这是一种特殊的语法,用于将参数传递给Scala中的Varargs函数。
没有
:_*
编译器正在寻找接受seq [列]
的函数,并且找不到它。您可以在此处使用varargs阅读更多有关varargs的信息。
Try to add
:_*
to passed cols into groupBy:it's a special syntax for passing arguments to varargs functions in scala.
Without
:_*
compiler is looking for function which acceptsSeq[Column]
and will not found it.You can read more about functions with varargs here for example.