在上篇文章我,我们介绍了 Codegen 实现的自定义函数,当时为了简化叙述,假设所有输入数据均为非空值。在本篇文章中,我们将介绍如何在 Codegen 中处理空值的问题。 Codegen 的自定义函数 自定义函数的需求与前文一样: 需要一个名字为 my_foo 的函数 该函数接受两个 double 类型的参数作为输入 参数名记为 x,y 函数输出 x*y+3 与...
5-Codegen 示例
在之前的文章中,我们介绍了 Spark 中两种自定义函数的实现,本篇文章中我们将正式介绍用 Codegen 方式实现的自定义函数。为了简化叙述,本篇文章并不介绍如何在 Codegen 中处理 Null 值,假设用户的所有输入数据均为非空。 Codegen 的自定义函数 自定义函数的需求与前文一样: 需要一个名字为 my_foo 的函数 该函数接受两个 double 类型的参数...
4-自定义函数示例2
在上一篇文章中,我们介绍了使用 Spark 原生的 UDF 实现的自定义函数,在这里我们介绍一种非 UDF 实现的自定义函数,为后面介绍的 Codegen 实现自定义函数打基础。 非 UDF 的自定义函数 自定义函数的需求与前文一样: 需要一个名字为 my_foo 的函数 该函数接受两个 double 类型的参数作为输入 参数名记为 x,y 函数输出 x*y+3 非...
3-自定义函数示例1
Spark 原生提供UDF用于实现自定义函数 UDF 示例 假设我们的需求是这样的: 需要一个名字为 my_foo 的函数 该函数接受两个 double 类型的参数作为输入 参数名记为 x,y 函数输出 x*y+3 为了实现上述功能,我们在程序中定义了 my_foo 匿名函数,并向 spark 注册 udf,完整代码位于 https://github.com/adr...
2-显示 Codegen 代码
在上一篇文章中,我们演示了如何新建一个 Spark SQL 的工程,并展示了一个简单的 SQL 查询 select x, y, power(x,y) from data_test 文章 Deep Dive into Spark SQL’s Catalyst Optimizer 详细介绍了 Spark SQL 的优化机制。为了提高查询速度,Spark 会将查询的 SQL 语句动态生成一份对...
1-新建一个 Spark SQL 的工程
本文介绍如何新建一个 Spark SQL 的例子,Spark 采用 standalone 的 local 模式, 需要安装 scala 本文所演示的例子位于 https://github.com/adream307/SparkSQLWithCodegen/tree/master/code/new_spark_sql_project 目录内 新建目录结构 Spark SQL 工程的目录结构...
Enable Google Page Views
This post is to enable Page Views on the Chirpy theme based blog that you just built. This requires technical knowledge and it’s recommended to keep the google_analytics.pv disabled unless you have...
Customize the Favicon
In Chirpy, the image files of Favicons are placed in assets/img/favicons/. You may need to replace them with your own. So let’s see how to customize these Favicons. With a square image (PNG, JPG o...
Getting Started
Installation Fork Chirpy on GitHub, rename the repository to USERNAME.github.io (where USERNAME is your GitHub username), and then open terminal and clone the fork to local by: $ git clone https:...
Writing a New Post
Naming and Path Create a new file named YYYY-MM-DD-TITLE.EXTENSION and put it in the _posts/ of the root directory. Please note that the EXTENSION must be one of md and markdown. Front Matter Ba...