星火SQL查询VS数据框功能 [英] Spark sql queries vs dataframe functions
问题描述
要与星火执行良好的性能。我是想如果这是很好的使用通过SQLContext SQL查询或如果这是更好地做到通过类似df.select数据框功能查询()。
To perform good performance with Spark. I'm a wondering if this is good to use sql queries via SQLContext or if this is better to do queries via DataFrame functions like df.select().
你知道吗? :)
推荐答案
有没有性能上的差异任何责任。这两种方法都使用完全相同的执行引擎和内部数据结构。在一天结束的时候一切都归结到个人preferences。
There is no performance difference whatsoever. Both methods use exactly the same execution engine and internal data structures. At the end of the day all boils down to the personal preferences.
-
可以说
数据帧
查询更容易编程构建,并提供最小的类型安全。
Arguably
DataFrame
queries are much easier to construct programmatically and provide a minimal type safety.
普通SQL查询可以显著更简洁更容易理解。也有便携式并且可以在不与每一个支持的语言的任何修改来使用。随着 HiveContext
这也可以用来揭露一些功能,可以在其他方面无法访问(例如UDF不星火包装)。
Plain SQL queries can be significantly more concise an easier to understand. There are also portable and can be used without any modifications with every supported language. With HiveContext
these can be also used to expose some functionalities which can be inaccessible in other ways (for example UDF without Spark wrappers).
这篇关于星火SQL查询VS数据框功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!