Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
eb76414c
Unverified
Commit
eb76414c
authored
Jan 05, 2024
by
Zzm0809
Committed by
GitHub
Jan 05, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete error docs (#2920)
parent
77384b2b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
4 additions
and
272 deletions
+4
-272
job_config_submit.md
docs/docs/user_guide/studio/job_config_submit.md
+0
-0
studio_overview.md
docs/docs/user_guide/studio/studio_overview.md
+4
-2
_category_.json
docs/docs/user_guide/studio/udf_develop/_category_.json
+0
-4
intro.md
docs/docs/user_guide/studio/udf_develop/intro.md
+0
-35
Java&Scala.md
...ocs/user_guide/studio/udf_develop/quick_use/Java&Scala.md
+0
-110
Python.md
docs/docs/user_guide/studio/udf_develop/quick_use/Python.md
+0
-80
_category_.json
...s/user_guide/studio/udf_develop/quick_use/_category_.json
+0
-4
template_intro.md
docs/docs/user_guide/studio/udf_develop/template_intro.md
+0
-37
No files found.
docs/docs/user_guide/studio/job_config_submit.md
deleted
100644 → 0
View file @
77384b2b
This diff is collapsed.
Click to expand it.
docs/docs/user_guide/studio/studio_overview.md
View file @
eb76414c
...
@@ -18,4 +18,6 @@ Dinky 数据开发功能主要包括:
...
@@ -18,4 +18,6 @@ Dinky 数据开发功能主要包括:
-
基于 Flink SQL/Flink Jar 任务的开发与调试和运行
-
基于 Flink SQL/Flink Jar 任务的开发与调试和运行
-
基于 Python/Java/Scala 的 UDF 开发与调试和运行
-
基于 Python/Java/Scala 的 UDF 开发与调试和运行
-
根据作业类型自动渲染数据开发界面,使得页面交互更加友好,开发更加高效
-
根据作业类型自动渲染数据开发界面,使得页面交互更加友好,开发更加高效
-
\ No newline at end of file
快马加鞭赶来中, 如您想要贡献此部分文档, 请参考
[
贡献指南
](
../../developer_guide/contribution/how_contribute
)
。
\ No newline at end of file
docs/docs/user_guide/studio/udf_develop/_category_.json
deleted
100644 → 0
View file @
77384b2b
{
"label"
:
"udf_develop"
,
"position"
:
10
}
docs/docs/user_guide/studio/udf_develop/intro.md
deleted
100644 → 0
View file @
77384b2b
---
sidebar_position
:
1
id
:
udf_intro
title
:
UDF 功能简介
---
## 开发目的
在使用 flink 中,难免碰到 UDF 的场景。开发、编译、打包,注册函数、测试等一系列流水线操作,这些
都由 Dinky 接管后,只需要开发、测试即可。
目前 Dinky 在对此模块进行优化调整,并有了一个雏形,现阶段支持单类开发;
Dinky 将持续打造 UDF 开发,将来规划与 git接轨,实现在线开发。
> 1. UDF 目前还在孵化阶段,请谨慎使用;
>
> 2. 支持 `Python` 、`Java` 、 `Scala` 三种代码语言
>
> 3. Flink 模式现除了 `k8s application`不支持外,其余模式均可正常使用
---
## 使用方式
1.
在
`数据开发`
里面创建作业 , 然后选择
`Python`
、
`Java`
、
`Scala`
等即可
!
[
create_udf_work.png
](
http://pic.dinky.org.cn/dinky/docs/zh-CN/udf_develop/create_udf_work.png
)
2.
udf 这边提供模板,方便快速创建,模板具体使用请看
[
udf 模板介绍
](
./udf_template_intro
)
!
[
create_udf_work2.png
](
http://pic.dinky.org.cn/dinky/docs/zh-CN/udf_develop/create_udf_work2.png
)
---
## 操作演示

docs/docs/user_guide/studio/udf_develop/quick_use/Java&Scala.md
deleted
100644 → 0
View file @
77384b2b
---
sidebar_position
:
1
id
:
java&scala_udf
title
:
Java&Scala UDF
---
### 初始环境准备
1.
创建对应的表。
```
sql
CREATE
TABLE
`Order`
(
id
INT
,
product_id
INT
,
quantity
INT
,
order_time
TIMESTAMP
,
PRIMARY
KEY
(
id
)
NOT
ENFORCED
)
WITH
(
'connector'
=
'datagen'
,
'fields.id.kind'
=
'sequence'
,
'fields.id.start'
=
'1'
,
'fields.id.end'
=
'100000'
,
'fields.product_id.min'
=
'1'
,
'fields.product_id.max'
=
'100'
,
'rows-per-second'
=
'1'
);
CREATE
TABLE
`Product`
(
id
INT
,
name
VARCHAR
,
price
DOUBLE
,
PRIMARY
KEY
(
id
)
NOT
ENFORCED
)
WITH
(
'connector'
=
'datagen'
,
'fields.id.min'
=
'1'
,
'fields.id.max'
=
'100'
,
'rows-per-second'
=
'1'
);
`
``
在数据开发界面点击保存,并且检查成功没有问题一会,运行就会在 **Catalog** 界面看到创建的
``
`
Order
`
``
和
``
`
Product
`
``
表。

2. 执行查询任务。
``
`
sql
SELECT
o
.
id
,
p
.
name
,
o
.
order_time
FROM
`Order`
o
INNER
JOIN
`Product`
p
ON
o
.
product_id
=
p
.
id
;
`
``
点击调试以后得到下面的效果图。

### 定义UDF函数
创建一个UDF函数
对应函数的类名。
```
java
com.test.SubFunction
```

下面是udf函数的代码。
```
java
package com.test;
import org.apache.flink.table.functions.ScalarFunction;
public class SubFunction extends ScalarFunction {
public String eval(String s) {
if(null==s){
return s;
}
return s.substring(0,3);
}
}
```
如下图所示。

### 函数的使用
定义一个flinksql任务,执行下面代码。
```
sql
create temporary function sb_j as 'com.test.SubFunction';
SELECT o.id, sb_j(p.name), o.order_time
FROM
`Order`
o
INNER JOIN
`Product`
p
ON o.product_id = p.id;
```
看到如下那么表示执行成功了。

\ No newline at end of file
docs/docs/user_guide/studio/udf_develop/quick_use/Python.md
deleted
100644 → 0
View file @
77384b2b
---
sidebar_position
:
2
id
:
python_udf
title
:
Python UDF
---
## 环境准备
1.
需要把
`${FLINK_HOME}/opt/flink-python_${scala-version}-${flink-version}.jar`
放入到
`${FLINK_HOME}/lib/`
和
`${DINKY_HOME}/plugins/`
下面。如下:

2.
在 Dinky 安装目录
`conf/application.yml`
下,配置 python 执行环境。例如 :/usr/bin/python3.6

----
## 作业创建
1.
选择 Python 作业,并输入对应参数
```
text
python_udf_test
python截取函数
SubFunction.f
```

> 注意名称,底层实现逻辑即通过名称创建 py 文件,如: python_udf_test.py

> 观察最右侧的类型,前缀就是 刚刚填的`名称`
2.
接下来创建一个
`FlinkSql`
作业
创建函数与Java不太一样, 最后得指定语言
language PYTHON
```
sql
create
temporary
function
sb_p
as
'python_udf_test.SubFunction'
language
PYTHON
;
CREATE
TABLE
sourceTable
(
id
int
,
python_c
string
)
WITH
(
'connector'
=
'datagen'
);
CREATE
TABLE
sinkTable
WITH
(
'connector'
=
'print'
)
LIKE
sourceTable
(
EXCLUDING
ALL
);
insert
into
sinkTable
select
id
,
sb_p
(
python_c
)
from
sourceTable
;
```

flink-conf.yml
```
yaml
python.client.executable
:
/root/miniconda3/bin/python3.8
python.executable
:
/root/miniconda3/bin/python3.8
```
或在sql中配置
```
sql
set
'python.client.executable'
=
'/root/miniconda3/bin/python3.8'
;
set
'python.executable'
=
'/root/miniconda3/bin/python3.8'
;
```
> 这里需要注意的是,`flink-conf.yml` 得配置 `python` 的执行路径,`python` 环境必须包含 `apache-flink`和`pyflink`, 注意根据flink版本安装相应版本的包
>
> `python.executable` 是 NodeManager 环境的 python 执行路径
>
> `python.client.executable` 是 Dinky 当前机器所在的python环境
>
> 特别注意,`yarn-application` 环境,2个参数均是hadoop集群 python3 的执行路径
3.
执行,结果查看

## 动图演示

docs/docs/user_guide/studio/udf_develop/quick_use/_category_.json
deleted
100644 → 0
View file @
77384b2b
{
"label"
:
"快速使用"
,
"position"
:
1
}
docs/docs/user_guide/studio/udf_develop/template_intro.md
deleted
100644 → 0
View file @
77384b2b
---
sidebar_position
:
2
id
:
udf_template_intro
title
:
UDF Template 介绍
---
## 开发目的
1.
为了减少代码复制,实现快速开发
## 使用方式
模板引擎框架采用
[
`Freemarker`
](
https://freemarker.apache.org/
)
1.
在
`配置中心 -> udf模板设置`
可调节对应模板。Dinky官方目前提供这几个模板,后续会不断迭代以及追加
!
[
template_intro.png
](
http://pic.dinky.org.cn/dinky/docs/zh-CN/udf_develop/template_intro.png
)
2.
在编辑模板中,java、scala 提供 package、className参数,由类名解析而来;如:
`com.dinky.SubStringFunction`
,
对应解析成
```
${package}=com.dinky
${className}=SubStringFunction
```


3.
python 这边较为特殊,目前只有2个参数,如:
`SubStringFunction.f`
,对应为
```
${className}=SubStringFunction,
${attr}=f
```


\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment