LadyForest commented on a change in pull request #15230:
URL: https://github.com/apache/flink/pull/15230#discussion_r598239960



##########
File path: docs/content/docs/dev/table/sql/load.md
##########
@@ -0,0 +1,142 @@
+---
+title: "LOAD Statements"
+weight: 12
+type: docs
+aliases:
+  - /dev/table/sql/load.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.
+-->
+
+# LOAD Statements
+
+LOAD statements are used to load a built-in or user-defined module.
+
+## Run a LOAD statement
+
+{{< tabs "load statement" >}}
+{{< tab "Java" >}}
+
+LOAD statements can be executed with the `executeSql()` method of the 
`TableEnvironment`. The `executeSql()` method returns 'OK' for a successful 
LOAD operation; otherwise, it will throw an exception.
+
+The following examples show how to run a LOAD statement in `TableEnvironment`.
+
+{{< /tab >}}
+{{< tab "Scala" >}}
+
+LOAD statements can be executed with the `executeSql()` method of the 
`TableEnvironment`. The `executeSql()` method returns 'OK' for a successful 
LOAD operation; otherwise, it will throw an exception.
+
+The following examples show how to run a LOAD statement in `TableEnvironment`.
+{{< /tab >}}
+{{< tab "Python" >}}
+
+LOAD statements can be executed with the `executeSql()` method of the 
`TableEnvironment`. The `executeSql()` method returns 'OK' for a successful 
LOAD operation; otherwise, it will throw an exception.
+
+The following examples show how to run a LOAD statement in `TableEnvironment`.
+
+{{< /tab >}}
+{{< tab "SQL CLI" >}}
+
+LOAD statements can be executed in [SQL CLI]({{< ref 
"docs/dev/table/sqlClient" >}}).
+
+The following examples show how to run a LOAD statement in SQL CLI.
+
+{{< /tab >}}
+{{< /tabs >}}
+
+{{< tabs "load modules" >}}
+{{< tab "Java" >}}
+```java
+StreamExecutionEnvironment env = 
StreamExecutionEnvironment.getExecutionEnvironment();
+StreamTableEnvironment tEnv = StreamTableEnvironment.create(env);
+
+// load a hive module
+tEnv.executeSql("LOAD MODULE hive WITH ('hive-version' = '3.1.2')");
+tEnv.executeSql("SHOW MODULES").print();
+// +-------------+
+// | module name |
+// +-------------+
+// |        core |
+// |        hive |
+// +-------------+
+
+```
+{{< /tab >}}
+{{< tab "Scala" >}}
+```scala
+val env = StreamExecutionEnvironment.getExecutionEnvironment()
+val tEnv = StreamTableEnvironment.create(env)
+
+// load a hive module
+tEnv.executeSql("LOAD MODULE hive WITH ('hive-version' = '3.1.2')")
+tEnv.executeSql("SHOW MODULES").print()
+// +-------------+
+// | module name |
+// +-------------+
+// |        core |
+// |        hive |
+// +-------------+
+
+```
+{{< /tab >}}
+{{< tab "Python" >}}
+```python
+settings = EnvironmentSettings.new_instance()...
+table_env = StreamTableEnvironment.create(env, settings)
+
+# load a hive module
+table_env.execute_sql("LOAD MODULE hive WITH ('hive-version' = '3.1.2')")
+table_env.execute_sql("SHOW MODULES").print()
+# +-------------+
+# | module name |
+# +-------------+
+# |        core |
+# |        hive |
+# +-------------+
+
+```
+{{< /tab >}}
+{{< tab "SQL CLI" >}}
+```sql
+Flink SQL> LOAD MODULE hive WITH ('hive-version' = '3.1.2');
+[INFO] Load module succeeded!
+
+Flink SQL> SHOW MODULES;
+-- +-------------+
+-- | module name |
+-- +-------------+
+-- |        core |
+-- |        hive |
+-- +-------------+
+
+```
+{{< /tab >}}
+{{< /tabs >}}
+
+{{< top >}}
+
+## LOAD MODULE
+
+The following grammar gives an overview of the available syntax:
+```sql
+LOAD MODULE `module_name` [WITH ('key1' = 'val1', 'key2' = 'val2', ...)]

Review comment:
       > should we explain what's the key1 val1 properties?
   
   Yes, I think we'd better add a description to let users know how to design 
their own module and module factory impl.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to