You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fluss.apache.org by ja...@apache.org on 2026/02/12 09:52:12 UTC
(fluss) 07/19: [docs] Fix null value syntax in aggregation merge engine examples (#2645)
This is an automated email from the ASF dual-hosted git repository.
jark pushed a commit to branch release-0.9
in repository https://gitbox.apache.org/repos/asf/fluss.git
commit f404ca361cdde664dad8c24eb7b0f128eeea7058
Author: Yang Wang <oc...@alibaba-inc.com>
AuthorDate: Wed Feb 11 17:39:05 2026 +0800
[docs] Fix null value syntax in aggregation merge engine examples (#2645)
Flink SQL does not support direct null literals in INSERT INTO ... VALUES
statements. Using 'null' directly causes 'Illegal use of NULL' validation
error.
This commit fixes the documentation examples for:
- last_value
- last_value_ignore_nulls
- first_value_ignore_nulls
Changed from:
INSERT INTO t VALUES (1, null, 'value');
To:
INSERT INTO t VALUES (1, CAST(NULL AS STRING), 'value');
The CAST(NULL AS <type>) syntax explicitly specifies the null value's type,
which is required by Flink SQL's type inference.
---
.../docs/table-design/merge-engines/aggregation.md | 24 ++++++++++++++--------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/website/docs/table-design/merge-engines/aggregation.md b/website/docs/table-design/merge-engines/aggregation.md
index 50ded6638..fe3b303b6 100644
--- a/website/docs/table-design/merge-engines/aggregation.md
+++ b/website/docs/table-design/merge-engines/aggregation.md
@@ -464,9 +464,11 @@ CREATE TABLE test_last_value (
INSERT INTO test_last_value VALUES
- (1, 'online', TIMESTAMP '2024-01-01 10:00:00'),
- (1, 'offline', TIMESTAMP '2024-01-01 11:00:00'),
- (1, null, TIMESTAMP '2024-01-01 12:00:00'); -- Null overwrites previous 'offline' value
+ (1, 'online', TIMESTAMP '2024-01-01 10:00:00');
+INSERT INTO test_last_value VALUES
+ (1, 'offline', TIMESTAMP '2024-01-01 11:00:00');
+INSERT INTO test_last_value VALUES
+ (1, CAST(NULL AS STRING), TIMESTAMP '2024-01-01 12:00:00'); -- Null overwrites previous 'offline' value
SELECT * FROM test_last_value WHERE id = 1;
+------------+---------+---------------------+
@@ -536,9 +538,11 @@ CREATE TABLE test_last_value_ignore_nulls (
INSERT INTO test_last_value_ignore_nulls VALUES
- (1, 'user@example.com', '123-456'),
- (1, null, '789-012'), -- Null is ignored, email retains previous value
- (1, 'new@example.com', null);
+ (1, 'user@example.com', '123-456');
+INSERT INTO test_last_value_ignore_nulls VALUES
+ (1, CAST(NULL AS STRING), '789-012'); -- Null is ignored, email retains previous value
+INSERT INTO test_last_value_ignore_nulls VALUES
+ (1, 'new@example.com', CAST(NULL AS STRING));
SELECT * FROM test_last_value_ignore_nulls WHERE id = 1;
+------------+-------------------+---------+
@@ -669,9 +673,11 @@ CREATE TABLE test_first_value_ignore_nulls (
);
INSERT INTO test_first_value_ignore_nulls VALUES
- (1, null, null),
- (1, 'user@example.com', '2024-01-01 10:00:00'),
- (1, 'other@example.com', '2024-01-02 10:00:00'); -- Only the first non-null value is retained
+ (1, CAST(NULL AS STRING), CAST(NULL AS TIMESTAMP(3)));
+INSERT INTO test_first_value_ignore_nulls VALUES
+ (1, 'user@example.com', TIMESTAMP '2024-01-01 10:00:00');
+INSERT INTO test_first_value_ignore_nulls VALUES
+ (1, 'other@example.com', TIMESTAMP '2024-01-02 10:00:00'); -- Only the first non-null value is retained
SELECT * FROM test_first_value_ignore_nulls WHERE id = 1;
+------------+-------------------+---------------------+