Skip to content

Commit

Permalink
[FLINK-22673][docs] Add docs for JAR related commands and remove the …
Browse files Browse the repository at this point in the history
…usage of the YAML file

This closes apache#16779
  • Loading branch information
fsk119 committed Aug 13, 2021
1 parent adcaaff commit 5c951da
Show file tree
Hide file tree
Showing 6 changed files with 215 additions and 89 deletions.
89 changes: 89 additions & 0 deletions docs/content.zh/docs/dev/table/sql/jar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
title: "JAR Statements"
weight: 16
type: docs
aliases:
- /dev/table/sql/jar.html
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

# JAR Statements

JAR statements are used to add user jars into the classpath or remove user jars from the classpath
or show added jars in the classpath in the runtime.

Flink SQL supports the following JAR statements for now:
- ADD JAR
- REMOVE JAR
- SHOW JARS

<span class="label label-danger">Attention</span> JAR statements only work in the [SQL CLI]({{< ref "docs/dev/table/sqlClient" >}}).


## Run a JAR statement

{{< tabs "add jar statement" >}}
{{< tab "SQL CLI" >}}

The following examples show how to run `JAR` statements in [SQL CLI]({{< ref "docs/dev/table/sqlClient" >}}).

{{< /tab >}}
{{< /tabs >}}

{{< tabs "add jar" >}}
{{< tab "SQL CLI" >}}
```sql
Flink SQL> ADD JAR '/path/hello.jar';
[INFO] The specified jar is added into session classloader.

Flink SQL> SHOW JARS;
/path/hello.jar

Flink SQL> REMOVE JAR '/path/hello.jar';
[INFO] The specified jar is removed from session classloader.
```
{{< /tab >}}
{{< /tabs >}}

## ADD JAR

```sql
ADD JAR '<path_to_filename>.jar'
```

Currently it only supports to add the local jar into the session classloader.

## REMOVE JAR

```sql
REMOVE JAR '<path_to_filename>.jar'
```

Currently it only supports to remove the jar that is added by the [`ADD JAR`](#add-jar) statements.

## SHOW JARS

```sql
SHOW JARS
```

Show all added jars in the session classloader which are added by [`ADD JAR`](#add-jar) statements.

{{< top >}}
15 changes: 14 additions & 1 deletion docs/content.zh/docs/dev/table/sql/show.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ SHOW 语句用于列出所有的 catalog,或者列出当前 catalog 中所有
- SHOW DATABASES
- SHOW CURRENT DATABASE
- SHOW TABLES
- SHOW CREATE TABLE
- SHOW CREATE TABLE
- SHOW VIEWS
- SHOW FUNCTIONS
- SHOW MODULES
- SHOW FULL MODULES
- SHOW JARS


## 执行 SHOW 语句
Expand Down Expand Up @@ -411,6 +412,8 @@ Flink SQL> SHOW FULL MODULES;
+-------------+------+
1 row in set

Flink SQL> SHOW JARS;
/path/to/addedJar.jar

```
{{< /tab >}}
Expand Down Expand Up @@ -498,4 +501,14 @@ SHOW [FULL] MODULES
**FULL**
展示当前环境加载的所有 module 及激活状态。

## SHOW JARS

```sql
SHOW JARS
```

展示所有通过 [`ADD JAR`]({{< ref "docs/dev/table/sql/jar" >}}#add-jar) 语句加入到 session classloader 中的 jar。

<span class="label label-danger">Attention</span> 当前 SHOW JARS 命令只能在 [SQL CLI]({{< ref "docs/dev/table/sqlClient" >}}) 中使用。

{{< top >}}
39 changes: 0 additions & 39 deletions docs/content.zh/docs/dev/table/sqlClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,6 @@ Mode "embedded" (default) submits Flink jobs from the local machine.
Syntax: [embedded] [OPTIONS]
"embedded" mode options:
-d,--defaults <environment file> Deprecated feature: the environment
properties with which every new
session is initialized. Properties
might be overwritten by session
properties.
-e,--environment <environment file> Deprecated feature: the environment
properties to be imported into the
session. It might overwrite default
environment properties.
-f,--file <script file> Script file that should be executed.
In this mode, the client will not
open an interactive terminal.
Expand Down Expand Up @@ -665,36 +656,6 @@ If the option `pipeline.name` is not specified, SQL Client will generate a defau

{{< top >}}

Compatibility
-------------

To be compatible with before, SQL Client still supports to initialize with environment YAML file and allows to `SET` the key in YAML file.
When set the key defined in YAML file, the SQL Client will print the warning messages to inform.

```sql
Flink SQL> SET 'execution.type' = 'batch';
[WARNING] The specified key 'execution.type' is deprecated. Please use 'execution.runtime-mode' instead.
[INFO] Session property has been set.

-- all the following DML statements will be restored from the specified savepoint path
Flink SQL> INSERT INTO ...
```

When using `SET` command to print the properties, the SQL Client will also print all the properties.
To distinguish the deprecated key, the sql client use the '[DEPRECATED]' as the identifier.

```sql
Flink SQL>SET;
execution.runtime-mode=batch
sql-client.execution.result-mode=table
[DEPRECATED] execution.result-mode=table
[DEPRECATED] execution.type=batch
```

If you want to see more information about environment files, please refer to [previous docs version](https://ci.apache.org/projects/flink/flink-docs-release-1.12/dev/table/sqlClient.html#environment-files)

{{< top >}}

<a name="limitations--future"></a>

局限与未来
Expand Down
89 changes: 89 additions & 0 deletions docs/content/docs/dev/table/sql/jar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
title: "JAR Statements"
weight: 16
type: docs
aliases:
- /dev/table/sql/jar.html
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

# JAR Statements

JAR statements are used to add user jars into the classpath or remove user jars from the classpath
or show added jars in the classpath in the runtime.

Flink SQL supports the following JAR statements for now:
- ADD JAR
- REMOVE JAR
- SHOW JARS

<span class="label label-danger">Attention</span> JAR statements only work in the [SQL CLI]({{< ref "docs/dev/table/sqlClient" >}}).


## Run a JAR statement

{{< tabs "add jar statement" >}}
{{< tab "SQL CLI" >}}

The following examples show how to run `JAR` statements in [SQL CLI]({{< ref "docs/dev/table/sqlClient" >}}).

{{< /tab >}}
{{< /tabs >}}

{{< tabs "add jar" >}}
{{< tab "SQL CLI" >}}
```sql
Flink SQL> ADD JAR '/path/hello.jar';
[INFO] The specified jar is added into session classloader.

Flink SQL> SHOW JARS;
/path/hello.jar

Flink SQL> REMOVE JAR '/path/hello.jar';
[INFO] The specified jar is removed from session classloader.
```
{{< /tab >}}
{{< /tabs >}}

## ADD JAR

```sql
ADD JAR '<path_to_filename>.jar'
```

Currently it only supports to add the local jar into the session classloader.

## REMOVE JAR

```sql
REMOVE JAR '<path_to_filename>.jar'
```

Currently it only supports to remove the jar that is added by the [`ADD JAR`](#add-jar) statements.

## SHOW JARS

```sql
SHOW JARS
```

Show all added jars in the session classloader which are added by [`ADD JAR`](#add-jar) statements.

{{< top >}}
17 changes: 15 additions & 2 deletions docs/content/docs/dev/table/sql/show.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ Flink SQL supports the following SHOW statements for now:
- SHOW DATABASES
- SHOW CURRENT DATABASE
- SHOW TABLES
- SHOW CREATE TABLE
- SHOW CREATE TABLE
- SHOW VIEWS
- SHOW FUNCTIONS
- SHOW MODULES
- SHOW JARS

## Run a SHOW statement

Expand Down Expand Up @@ -410,6 +411,8 @@ Flink SQL> SHOW FULL MODULES;
+-------------+------+
1 row in set

Flink SQL> SHOW JARS;
/path/to/addedJar.jar

```
{{< /tab >}}
Expand Down Expand Up @@ -466,7 +469,7 @@ SHOW CREATE TABLE

Show create table statement for specified table.

<span class="label label-danger">Attention</span> Currently `SHOW CREATE TABLE` only supports table that is created by Flink SQL DDL.
<span class="label label-danger">Attention</span> Currently `SHOW CREATE TABLE` only supports table that is created by Flink SQL DDL.

## SHOW VIEWS

Expand Down Expand Up @@ -498,4 +501,14 @@ Show all enabled module names with resolution order.
**FULL**
Show all loaded modules and enabled status with resolution order.

## SHOW JARS

```sql
SHOW JARS
```

Show all added jars in the session classloader which are added by [`ADD JAR`]({{< ref "docs/dev/table/sql/jar" >}}#add-jar) statements.

<span class="label label-danger">Attention</span> Currently `SHOW JARS` only works in the [SQL CLI]({{< ref "docs/dev/table/sqlClient" >}}).

{{< top >}}
Loading

0 comments on commit 5c951da

Please sign in to comment.