Spark SQL
2016-04-21 20:32
323 查看
Spark SQL 用户自定义函数
用户自定义函数,UDF,可以自己注册自定义函数,并在SQL语句中调用。Spark SQL不仅有自己的UDF接口,也支持已有的Apache Hive UDFSpark SQL UDF
import org.apache.spark.sql.SQLContext import org.apache.spark.{SparkContext, SparkConf} val conf=new SparkConf() val sc=new SparkContext(conf) val sqlCtx=new SQLContext(sc) sqlCtx.udf.register("strLen", (s: String) => s.length()) length=sqlCtx.sql("select strlen('id') from ip ")
How can I register custom UDFs
Spark SQL 性能
conf.set("spark.sql.codegen","true")
相关文章推荐
- MySQL-5.7.11绿色版安装
- oracle中dblink创建
- lampp中修改mysql密码
- PostgreSQL数据库pg_dump命令行不输入密码的方法
- Oracle的存储过程返回结果集
- 数据库笔试题【都是精华】
- MySql 出现ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES).问题解决方案
- 近期SQL优化的一些感悟
- 基于mysql5.6版本的主从库同步
- JDBC连接数据库
- Oracle 官方文档学习之 Cursor(Implicit,Explicit)教程(上)
- 链接/Redis
- Oracle的综合查询练习
- Oracle查询 行列式转换
- Oracle 两个时间相减
- 蜗牛—ORACLE基础之学习(二)
- mysql Tips
- golang gbk转utf8 mssql access
- SQLServer大量数据高效率分页
- 修改 oracle xe 字符集 ZHS16GBK