Myasuka commented on code in PR #721: URL: https://github.com/apache/flink-web/pull/721#discussion_r1522360842
########## docs/content/posts/2024-03-xx-release-1.19.0.md: ########## @@ -0,0 +1,501 @@ +--- +authors: +- LincolnLee: + name: "Lincoln Lee" + twitter: lincoln_86xy + +date: "2024-03-xxT22:00:00Z" +subtitle: "" +title: Announcing the Release of Apache Flink 1.19 +aliases: +- /news/2024/03/xx/release-1.19.0.html +--- + +The Apache Flink PMC is pleased to announce the release of Apache Flink 1.19.0. As usual, we are +looking at a packed release with a wide variety of improvements and new features. Overall, 162 +people contributed to this release completing 33 FLIPs and 600+ issues. Thank you! + +Let's dive into the highlights. + +# Flink SQL Improvements + +## Custom Parallelism for Table/SQL Sources + +Now in Flink 1.19, you can set a custom parallelism for performance tuning via the `scan.parallelism` +option. The first available connector is DataGen (Kafka connector is on the way). Here is an example +using SQL Client: + +```sql +-- set parallelism within the ddl +CREATE TABLE Orders ( + order_number BIGINT, + price DECIMAL(32,2), + buyer ROW<first_name STRING, last_name STRING>, + order_time TIMESTAMP(3) +) WITH ( + 'connector' = 'datagen', + 'scan.parallelism' = '4' +); + +-- or set parallelism via dynamic table option +SELECT * FROM Orders /*+ OPTIONS('scan.parallelism'='4') */; +``` + +**More Information** +* [Documentation](https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/sourcessinks/#scan-table-source) +* [FLIP-367: Support Setting Parallelism for Table/SQL Sources](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=263429150) + + +## Configurable SQL Gateway Java Options + +A new option `env.java.opts.sql-gateway` for specifying the Java options is introduced in Flink 1.19, +so you can fine-tune the memory settings, garbage collection behavior, and other relevant Java +parameters for SQL Gateway. + +**More Information** +* [FLINK-33203](https://issues.apache.org/jira/browse/FLINK-33203) + + +## Configure Different State TTLs Using SQL Hint + +Starting from Flink 1.18, Table API and SQL users can set state time-to-live (TTL) individually for +stateful operators via the SQL compiled plan. In Flink 1.19, users have a more flexible way to +specify custom TTL values for regular joins and group aggregations directly within their queries by [utilizing the STATE_TTL hint](https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/sql/queries/hints/#state-ttl-hints). +This improvement means that you no longer need to alter your compiled plan to set specific TTLs for +these frequently used operators. With the introduction of `STATE_TTL` hints, you can streamline your workflow and +dynamically adjust the TTL based on your operational requirements. + +Here is an example: +```sql +-- set state ttl for join +SELECT /*+ STATE_TTL('Orders'= '1d', 'Customers' = '20d') */ * +FROM Orders LEFT OUTER JOIN Customers + ON Orders.o_custkey = Customers.c_custkey; + +-- set state ttl for aggregation +SELECT /*+ STATE_TTL('o' = '1d') */ o_orderkey, SUM(o_totalprice) AS revenue +FROM Orders AS o +GROUP BY o_orderkey; +``` + +**More Information** +* [Documentation](https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/sql/queries/hints/#state-ttl-hints) +* [FLIP-373: Support Configuring Different State TTLs using SQL Hint](https://cwiki.apache.org/confluence/display/FLINK/FLIP-373%3A+Support+Configuring+Different+State+TTLs+using+SQL+Hint) + + +## Named Parameters for Functions and Procedures + +Named parameters now can be used when calling a function or stored procedure. With named parameters, +users do not need to strictly specify the parameter position, just specify the parameter name and its +corresponding value. At the same time, if non-essential parameters are not specified, they will default to being filled with null. + +Here's an example of defining a function with one mandatory parameter and two optional parameters using named parameters: +```java +public static class NamedArgumentsTableFunction extends TableFunction<Object> { + + @FunctionHint( + output = @DataTypeHint("STRING"), + arguments = { + @ArgumentHint(name = "in1", isOptional = false, type = @DataTypeHint("STRING")), + @ArgumentHint(name = "in2", isOptional = true, type = @DataTypeHint("STRING")), + @ArgumentHint(name = "in3", isOptional = true, type = @DataTypeHint("STRING"))}) + public void eval(String arg1, String arg2, String arg3) { + collect(arg1 + ", " + arg2 + "," + arg3); + } + +} +``` +When calling the function in SQL, parameters can be specified by name, for example: +```sql +SELECT * FROM TABLE(myFunction(in1 => 'v1', in3 => 'v3', in2 => 'v2')) Review Comment: Another small suggestion, we'd better add a semicolon in the end of SQL statement. `SELECT * FROM TABLE(myFunction(in1 => 'v1', in3 => 'v3', in2 => 'v2'));` ########## docs/content/posts/2024-03-xx-release-1.19.0.md: ########## @@ -0,0 +1,501 @@ +--- +authors: +- LincolnLee: + name: "Lincoln Lee" + twitter: lincoln_86xy + +date: "2024-03-xxT22:00:00Z" +subtitle: "" +title: Announcing the Release of Apache Flink 1.19 +aliases: +- /news/2024/03/xx/release-1.19.0.html +--- + +The Apache Flink PMC is pleased to announce the release of Apache Flink 1.19.0. As usual, we are +looking at a packed release with a wide variety of improvements and new features. Overall, 162 +people contributed to this release completing 33 FLIPs and 600+ issues. Thank you! + +Let's dive into the highlights. + +# Flink SQL Improvements + +## Custom Parallelism for Table/SQL Sources + +Now in Flink 1.19, you can set a custom parallelism for performance tuning via the `scan.parallelism` +option. The first available connector is DataGen (Kafka connector is on the way). Here is an example +using SQL Client: + +```sql +-- set parallelism within the ddl +CREATE TABLE Orders ( + order_number BIGINT, + price DECIMAL(32,2), + buyer ROW<first_name STRING, last_name STRING>, + order_time TIMESTAMP(3) +) WITH ( + 'connector' = 'datagen', + 'scan.parallelism' = '4' +); + +-- or set parallelism via dynamic table option +SELECT * FROM Orders /*+ OPTIONS('scan.parallelism'='4') */; +``` + +**More Information** +* [Documentation](https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/sourcessinks/#scan-table-source) +* [FLIP-367: Support Setting Parallelism for Table/SQL Sources](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=263429150) + + +## Configurable SQL Gateway Java Options + +A new option `env.java.opts.sql-gateway` for specifying the Java options is introduced in Flink 1.19, +so you can fine-tune the memory settings, garbage collection behavior, and other relevant Java +parameters for SQL Gateway. + +**More Information** +* [FLINK-33203](https://issues.apache.org/jira/browse/FLINK-33203) + + +## Configure Different State TTLs Using SQL Hint + +Starting from Flink 1.18, Table API and SQL users can set state time-to-live (TTL) individually for +stateful operators via the SQL compiled plan. In Flink 1.19, users have a more flexible way to +specify custom TTL values for regular joins and group aggregations directly within their queries by [utilizing the STATE_TTL hint](https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/sql/queries/hints/#state-ttl-hints). +This improvement means that you no longer need to alter your compiled plan to set specific TTLs for +these frequently used operators. With the introduction of `STATE_TTL` hints, you can streamline your workflow and +dynamically adjust the TTL based on your operational requirements. + +Here is an example: +```sql +-- set state ttl for join +SELECT /*+ STATE_TTL('Orders'= '1d', 'Customers' = '20d') */ * +FROM Orders LEFT OUTER JOIN Customers + ON Orders.o_custkey = Customers.c_custkey; + +-- set state ttl for aggregation +SELECT /*+ STATE_TTL('o' = '1d') */ o_orderkey, SUM(o_totalprice) AS revenue +FROM Orders AS o +GROUP BY o_orderkey; +``` + +**More Information** +* [Documentation](https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/sql/queries/hints/#state-ttl-hints) +* [FLIP-373: Support Configuring Different State TTLs using SQL Hint](https://cwiki.apache.org/confluence/display/FLINK/FLIP-373%3A+Support+Configuring+Different+State+TTLs+using+SQL+Hint) + + +## Named Parameters for Functions and Procedures + +Named parameters now can be used when calling a function or stored procedure. With named parameters, +users do not need to strictly specify the parameter position, just specify the parameter name and its +corresponding value. At the same time, if non-essential parameters are not specified, they will default to being filled with null. + +Here's an example of defining a function with one mandatory parameter and two optional parameters using named parameters: +```java +public static class NamedArgumentsTableFunction extends TableFunction<Object> { + + @FunctionHint( + output = @DataTypeHint("STRING"), + arguments = { + @ArgumentHint(name = "in1", isOptional = false, type = @DataTypeHint("STRING")), + @ArgumentHint(name = "in2", isOptional = true, type = @DataTypeHint("STRING")), + @ArgumentHint(name = "in3", isOptional = true, type = @DataTypeHint("STRING"))}) + public void eval(String arg1, String arg2, String arg3) { + collect(arg1 + ", " + arg2 + "," + arg3); + } + +} +``` +When calling the function in SQL, parameters can be specified by name, for example: +```sql +SELECT * FROM TABLE(myFunction(in1 => 'v1', in3 => 'v3', in2 => 'v2')) +``` +Also the optional parameters can be omitted: +```sql +SELECT * FROM TABLE(myFunction(in1 => 'v1')) Review Comment: Same here: `SELECT * FROM TABLE(myFunction(in1 => 'v1'));` -- 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. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org