You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ja...@apache.org on 2020/12/30 05:46:19 UTC
[flink] branch master updated: [FLINK-20458][docs-zh] Translate
"Getting Started" page of Table SQL
This is an automated email from the ASF dual-hosted git repository.
jark pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push:
new bd403e2 [FLINK-20458][docs-zh] Translate "Getting Started" page of Table SQL
bd403e2 is described below
commit bd403e2cd33490db7aa5dcde72ae53dc46d304a3
Author: yangsanity <47...@qq.com>
AuthorDate: Wed Dec 30 13:45:58 2020 +0800
[FLINK-20458][docs-zh] Translate "Getting Started" page of Table SQL
This closes #14437
---
docs/dev/table/sql/gettingStarted.md | 12 ++---
docs/dev/table/sql/gettingStarted.zh.md | 91 ++++++++++++++++-----------------
2 files changed, 51 insertions(+), 52 deletions(-)
diff --git a/docs/dev/table/sql/gettingStarted.md b/docs/dev/table/sql/gettingStarted.md
index 3d4426f..d96bb7e 100644
--- a/docs/dev/table/sql/gettingStarted.md
+++ b/docs/dev/table/sql/gettingStarted.md
@@ -28,13 +28,13 @@ Flink SQL makes it simple to develop streaming applications using standard SQL.
{:toc}
-### Prerequisetes
+### Prerequisites
You only need to have basic knowledge of SQL to follow along. No other programming experience is assumed.
### Installation
-There are multiple ways to install Flink. For experimentation, the most common option is to download the binaries and run them locally. You can follow the steps in [local installation]({%link try-flink/local_installation.md %}) to set up an environment for the rest of the tutorial.
+There are multiple ways to install Flink. For experimentation, the most common option is to download the binaries and run them locally. You can follow the steps in [local installation]({% link try-flink/local_installation.md %}) to set up an environment for the rest of the tutorial.
Once you're all set, use the following command to start a local cluster from the installation folder:
@@ -54,7 +54,7 @@ To start the SQL client, run the `sql-client` script from the installation folde
{% endhighlight %}
### Hello World
-
+
Once the SQL client, our query editor, is up and running, it's time to start writing queries.
Let's start with printing 'Hello World', using the following simple query:
@@ -88,7 +88,7 @@ Flink data processing pipelines begin with source tables. Source tables produce
Tables can be defined through the SQL client or using environment config file. The SQL client support [SQL DDL commands]({% link dev/table/sql/index.md %}) similar to traditional SQL. Standard SQL DDL is used to [create]({% link dev/table/sql/create.md %}), [alter]({% link dev/table/sql/alter.md %}), [drop]({% link dev/table/sql/drop.md %}) tables.
-Flink has a support for different [connectors]({% link dev/table/connect.md %}) and [formats]({% link dev/table/connectors/formats/index.md %}) that can be used with tables. Following is an example to define a source table backed by a [CSV file]({%link dev/table/connectors/formats/csv.md %}) with `emp_id`, `name`, `dept_id` as columns in a `CREATE` table statement.
+Flink has a support for different [connectors]({% link dev/table/connect.md %}) and [formats]({% link dev/table/connectors/formats/index.md %}) that can be used with tables. Following is an example to define a source table backed by a [CSV file]({% link dev/table/connectors/formats/csv.md %}) with `emp_id`, `name`, `dept_id` as columns in a `CREATE` table statement.
{% highlight sql %}
CREATE TABLE employee_information (
@@ -122,7 +122,7 @@ A [continuous query]({% link dev/table/streaming/dynamic_tables.md %}#continuous
Aggregations on continuous streams need to store aggregated results continuously during the execution of the query. For example, suppose you need to count the number of employees for each department from an incoming data stream. The query needs to maintain the most up to date count for each department to output timely results as new rows are processed.
{% highlight sql %}
- SELECT
+SELECT
dept_id,
COUNT(*) as emp_count
FROM employee_information
@@ -136,7 +136,7 @@ Such queries are considered _stateful_. Flink's advanced fault-tolerance mechani
When running this query, the SQL client provides output in real-time but in a read-only fashion. Storing results - to power a report or dashboard - requires writing out to another table. This can be achieved using an `INSERT INTO` statement. The table referenced in this clause is known as a sink table. An `INSERT INTO` statement will be submitted as a detached query to the Flink cluster.
{% highlight sql %}
- INSERT INTO department_counts
+INSERT INTO department_counts
SELECT
dept_id,
COUNT(*) as emp_count
diff --git a/docs/dev/table/sql/gettingStarted.zh.md b/docs/dev/table/sql/gettingStarted.zh.md
index 153ec0d..5c73f81 100644
--- a/docs/dev/table/sql/gettingStarted.zh.md
+++ b/docs/dev/table/sql/gettingStarted.zh.md
@@ -1,5 +1,5 @@
---
-title: "Getting Started"
+title: "入门"
nav-parent_id: sql
nav-pos: 0
---
@@ -22,54 +22,54 @@ specific language governing permissions and limitations
under the License.
-->
-Flink SQL makes it simple to develop streaming applications using standard SQL. It is easy to learn Flink if you have ever worked with a database or SQL like system by remaining ANSI-SQL 2011 compliant. This tutorial will help you get started quickly with a Flink SQL development environment.
-
+Flink SQL 使得使用标准 SQL 开发流应用程序变的简单。如果你曾经在工作中使用过兼容 ANSI-SQL 2011 的数据库或类似的 SQL 系统,那么就很容易学习 Flink。本教程将帮助你在 Flink SQL 开发环境下快速入门。
+
* This will be replaced by the TOC
{:toc}
-### Prerequisetes
+### 先决条件
-You only need to have basic knowledge of SQL to follow along. No other programming experience is assumed.
+你只需要具备 SQL 的基础知识即可,不需要其他编程经验。
-### Installation
+### 安装
-There are multiple ways to install Flink. For experimentation, the most common option is to download the binaries and run them locally. You can follow the steps in [local installation]({%link try-flink/local_installation.zh.md %}) to set up an environment for the rest of the tutorial.
+安装 Flink 有多种方式。对于实验而言,最常见的选择是下载二进制包并在本地运行。你可以按照[本地模式安装]({% link try-flink/local_installation.zh.md %})中的步骤为本教程的剩余部分设置环境。
-Once you're all set, use the following command to start a local cluster from the installation folder:
+完成所有设置后,在安装文件夹中使用以下命令启动本地集群:
{% highlight bash %}
./bin/start-cluster.sh
{% endhighlight %}
-Once started, the Flink WebUI on [localhost:8081](localhost:8081) is available locally, from which you can monitor the different jobs.
+启动完成后,就可以在本地访问 Flink WebUI [localhost:8081](localhost:8081),通过它,你可以监控不同的作业。
-### SQL Client
+### SQL 客户端
-The [SQL Client]({% link dev/table/sqlClient.zh.md %}) is an interactive client to submit SQL queries to Flink and visualize the results.
-To start the SQL client, run the `sql-client` script from the installation folder.
+[SQL 客户端]({% link dev/table/sqlClient.zh.md %})是一个交互式的客户端,用于向 Flink 提交 SQL 查询并将结果可视化。
+在安装文件夹中运行 `sql-client` 脚本来启动 SQL 客户端。
{% highlight bash %}
./bin/sql-client.sh embedded
{% endhighlight %}
### Hello World
-
-Once the SQL client, our query editor, is up and running, it's time to start writing queries.
-Let's start with printing 'Hello World', using the following simple query:
+
+SQL 客户端(我们的查询编辑器)启动并运行后,就可以开始编写查询了。
+让我们使用以下简单查询打印出 'Hello World':
{% highlight sql %}
SELECT 'Hello World';
{% endhighlight %}
-Running the `HELP` command lists the full set of supported SQL statements. Let's run one such command, `SHOW`, to see a full list of Flink [built-in functions]({% link dev/table/functions/systemFunctions.zh.md %}).
+运行 `HELP` 命令会列出所有支持的 SQL 语句。让我们运行一个 `SHOW` 命令,来查看 Flink [内置函数]({% link dev/table/functions/systemFunctions.zh.md %})的完整列表。
{% highlight sql %}
SHOW FUNCTIONS;
{% endhighlight %}
-These functions provide users with a powerful toolbox of functionality when developing SQL queries.
-For example, `CURRENT_TIMESTAMP` will print the machine's current system time where it is executed.
+这些函数为用户在开发 SQL 查询时提供了一个功能强大的工具箱。
+例如,`CURRENT_TIMESTAMP` 将在执行时打印出机器的当前系统时间。
{% highlight sql %}
SELECT CURRENT_TIMESTAMP;
@@ -79,16 +79,15 @@ SELECT CURRENT_TIMESTAMP;
{% top %}
-## Source Tables
+## Source 表
-As with all SQL engines, Flink queries operate on top of tables.
-It differs from a traditional database because Flink does not manage data at rest locally; instead, its queries operate continuously over external tables.
+与所有 SQL 引擎一样,Flink 查询操作是在表上进行。与传统数据库不同,Flink 不在本地管理静态数据;相反,它的查询在外部表上连续运行。
-Flink data processing pipelines begin with source tables. Source tables produce rows operated over during the query's execution; they are the tables referenced in the `FROM` clause of a query. These could be Kafka topics, databases, filesystems, or any other system that Flink knows how to consume.
+Flink 数据处理流水线开始于 source 表。source 表产生在查询执行期间可以被操作的行;它们是查询时 `FROM` 子句中引用的表。这些表可能是 Kafka 的 topics,数据库,文件系统,或者任何其它 Flink 知道如何消费的系统。
-Tables can be defined through the SQL client or using environment config file. The SQL client support [SQL DDL commands]({% link dev/table/sql/index.zh.md %}) similar to traditional SQL. Standard SQL DDL is used to [create]({% link dev/table/sql/create.zh.md %}), [alter]({% link dev/table/sql/alter.zh.md %}), [drop]({% link dev/table/sql/drop.zh.md %}) tables.
+可以通过 SQL 客户端或使用环境配置文件来定义表。SQL 客户端支持类似于传统 SQL 的 [SQL DDL 命令]({% link dev/table/sql/index.zh.md %})。标准 SQL DDL 用于[创建]({% link dev/table/sql/create.zh.md %}),[修改]({% link dev/table/sql/alter.zh.md %}),[删除]({% link dev/table/sql/drop.zh.md %})表。
-Flink has a support for different [connectors]({% link dev/table/connect.zh.md %}) and [formats]({%link dev/table/connectors/formats/index.zh.md %}) that can be used with tables. Following is an example to define a source table backed by a [CSV file]({%link dev/table/connectors/formats/csv.zh.md %}) with `emp_id`, `name`, `dept_id` as columns in a `CREATE` table statement.
+Flink 支持不同的[连接器]({% link dev/table/connect.zh.md %})和[格式]({% link dev/table/connectors/formats/index.zh.md %})相结合以定义表。下面是一个示例,定义一个以 [CSV 文件]({% link dev/table/connectors/formats/csv.zh.md %})作为存储格式的 source 表,其中 `emp_id`,`name`,`dept_id` 作为 `CREATE` 表语句中的列。
{% highlight sql %}
CREATE TABLE employee_information (
@@ -102,8 +101,8 @@ CREATE TABLE employee_information (
);
{% endhighlight %}
-A continuous query can be defined from this table that reads new rows as they are made available and immediately outputs their results.
-For example, we can filter for just those employees who work in department `1`.
+可以从该表中定义一个连续查询,当新行可用时读取并立即输出它们的结果。
+例如,我们可以过滤出只在部门 `1` 中工作的员工。
{% highlight sql %}
SELECT * from employee_information WHERE DeptId = 1;
@@ -113,55 +112,55 @@ SELECT * from employee_information WHERE DeptId = 1;
{% top %}
-## Continuous Queries
+## 连续查询
-While not designed initially with streaming semantics in mind, SQL is a powerful tool for building continuous data pipelines. Where Flink SQL differs from traditional database queries is that is continuously consuming rows as the arrives and produces updates to its results.
+虽然最初设计时没有考虑流语义,但 SQL 是用于构建连续数据流水线的强大工具。Flink SQL 与传统数据库查询的不同之处在于,Flink SQL 持续消费到达的行并对其结果进行更新。
-A [continuous query]({% link dev/table/streaming/dynamic_tables.zh.md %}#continuous-queries) never terminates and produces a dynamic table as a result. [Dynamic tables]({% link dev/table/streaming/dynamic_tables.zh.md %}#continuous-queries) are the core concept of Flink's Table API and SQL support for streaming data.
+一个[连续查询]({% link dev/table/streaming/dynamic_tables.zh.md %}#continuous-queries)永远不会终止,并会产生一个动态表作为结果。[动态表]({% link dev/table/streaming/dynamic_tables.zh.md %}#continuous-queries)是 Flink 中 Table API 和 SQL 对流数据支持的核心概念。
-Aggregations on continuous streams need to store aggregated results continuously during the execution of the query. For example, suppose you need to count the number of employees for each department from an incoming data stream. The query needs to maintain the most up to date count for each department to output timely results as new rows are processed.
+连续流上的聚合需要在查询执行期间不断地存储聚合的结果。例如,假设你需要从传入的数据流中计算每个部门的员工人数。查询需要维护每个部门最新的计算总数,以便在处理新行时及时输出结果。
{% highlight sql %}
- SELECT
+SELECT
dept_id,
COUNT(*) as emp_count
FROM employee_information
GROUP BY dep_id;
{% endhighlight %}
-Such queries are considered _stateful_. Flink's advanced fault-tolerance mechanism will maintain internal state and consistency, so queries always return the correct result, even in the face of hardware failure.
+这样的查询被认为是 _有状态的_。Flink 的高级容错机制将维持内部状态和一致性,因此即使遇到硬件故障,查询也始终返回正确结果。
-## Sink Tables
+## Sink 表
-When running this query, the SQL client provides output in real-time but in a read-only fashion. Storing results - to power a report or dashboard - requires writing out to another table. This can be achieved using an `INSERT INTO` statement. The table referenced in this clause is known as a sink table. An `INSERT INTO` statement will be submitted as a detached query to the Flink cluster.
+当运行此查询时,SQL 客户端实时但是以只读方式提供输出。存储结果,作为报表或仪表板的数据来源,需要写到另一个表。这可以使用 `INSERT INTO` 语句来实现。本节中引用的表称为 sink 表。`INSERT INTO` 语句将作为一个独立查询被提交到 Flink 集群中。
{% highlight sql %}
- INSERT INTO department_counts
+INSERT INTO department_counts
SELECT
dept_id,
COUNT(*) as emp_count
FROM employee_information;
{% endhighlight %}
-Once submitted, this will run and store the results into the sink table directly, instead of loading the results into the system memory.
+提交后,它将运行并将结果直接存储到 sink 表中,而不是将结果加载到系统内存中。
---------------
{% top %}
-## Looking for Help!
+## 寻求帮助!
-If you get stuck, check out the [community support resources](https://flink.apache.org/community.html).
-In particular, Apache Flink's [user mailing list](https://flink.apache.org/community.html#mailing-lists) consistently ranks as one of the most active of any Apache project and a great way to get help quickly.
+如果你有疑惑,可以查阅[社区支持资源](https://flink.apache.org/zh/community.html)。
+特别是,Apache Flink 的[用户邮件列表](https://flink.apache.org/zh/community.html#mailing-lists)一直被评为是任何 Apache 项目中最活跃的项目之一,也是快速获得帮助的好方法。
-## Resources to Learn more
+## 了解更多资源
-* [SQL]({% link dev/table/sql/index.zh.md %}): Supported operations and syntax for SQL.
-* [SQL Client]({% link dev/table/sqlClient.zh.md %}): Play around with Flink SQL and submit a table program to a cluster without programming knowledge
-* [Concepts & Common API]({% link dev/table/common.zh.md %}): Shared concepts and APIs of the Table API and SQL.
-* [Streaming Concepts]({% link dev/table/streaming/index.zh.md %}): Streaming-specific documentation for the Table API or SQL such as configuration of time attributes and handling of updating results.
-* [Built-in Functions]({% link dev/table/functions/systemFunctions.zh.md %}): Supported functions in Table API and SQL.
-* [Connect to External Systems]({% link dev/table/connect.zh.md %}): Available connectors and formats for reading and writing data to external systems.
+* [SQL]({% link dev/table/sql/index.zh.md %}):SQL 支持的操作和语法。
+* [SQL 客户端]({% link dev/table/sqlClient.zh.md %}):不用编写代码就可以尝试 Flink SQL,可以直接提交 SQL 任务到集群上。
+* [概念与通用 API]({% link dev/table/common.zh.md %}):Table API 和 SQL 公共概念以及 API。
+* [流式概念]({% link dev/table/streaming/index.zh.md %}):Table API 和 SQL 中流式相关的文档,比如配置时间属性和如何处理更新结果。
+* [内置函数]({% link dev/table/functions/systemFunctions.zh.md %}):Table API 和 SQL 中的内置函数。
+* [连接外部系统]({% link dev/table/connect.zh.md %}):读写外部系统的连接器和格式。
---------------