=== $ spark sql 的特别的方法
/**
* Equality test.
* {{{
* // Scala:
* df.filter( df("colA") === df("colB") )
*
* // Java
* import static org.apache.spark.sql.functions.*;
* df.filter( col("colA").equalTo(col("colB")) );
* }}}
*
* @group expr_ops
* @since 1.3.0
*/
def === (other: Any): Column = withExpr {
val right = lit(other).expr
if (this.expr == right) {
logWarning(
s"Constructing trivially true equals predicate, '${this.expr} = $right'. " +
"Perhaps you need to use aliases.")
}
EqualTo(expr, right)
}
使用场景,join时判断等值时scala中使用===判断
/**
* Converts $"col name" into a [[Column]].
*
* @since 2.0.0
*/
implicit class StringToColumn(val sc: StringContext) {
def $(args: Any*): ColumnName = {
new ColumnName(sc.s(args: _*))
}
}
使用场景,根据聚合之后的别名排序
.agg(count(userActionLog("logId")).alias("actionCount"))
// 第五步:进行排序
.sort($"actionCount".desc)
随机推荐
- php mysql procedure获取多个结果集
protected function getRs($id) { $db = new mysqli(C("DB_HOST"), C("DB_USER"), C(& ...
- gcc cc1: all warnings being treated as errors
cc1: all warnings being treated as errors 在Makefile中找到 -Werror项,删除即可.删除后重新编译. 或设置环境变量 c工程设置 export C ...
- python3 bytes 和 string转换
转自:http://www.jb51.net/article/105064.htm 前言 Python 3 最重要的新特性大概要算是对文本和二进制数据作了更为清晰的区分. 文本总是 Unicode,由 ...
- js json转url参数
var json = { sh: '上海' } var params = Object.keys(json).map(function (key) { // body... return encode ...
- 开发前奏曲之添加Android SDK平台工具
原文:http://android.eoe.cn/topic/android_sdk Android SDK分离不同部位的SDK成单独的下载包.您已经安装只包含SDK工具的SDK入门包.要开发一个An ...
- Python 构建方便的函数调用
CODE: #!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on 2014-7-14 @author: guaguastd @name: c ...
- Vuex 入门指南
1.Vuex是什么? 我们还是像以往一样先看一看官方文档对此的解读(Vuex 是什么? · GitBook) Vuex 是一个专为 Vue.js 应用程序开发的状态管理模式.它采用集中式存储管理应用的 ...
- Project Euler:Problem 32 Pandigital products
We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly o ...
- Stochastic Gradient Descent收敛判断及收敛速度的控制
要判断Stochastic Gradient Descent是否收敛,可以像Batch Gradient Descent一样打印出iteration的次数和Cost的函数关系图,然后判断曲线是否呈现下 ...
- Flink papers
Around 2009 the Stratosphere research project started at the TU Berlin which a few years later was s ...