This is an automated email from the ASF dual-hosted git repository.
yunhong pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fluss.git
The following commit(s) were added to refs/heads/main by this push:
new 1e8cd6047 [docs] Fix null value syntax in aggregation merge engine
examples (#2645)
1e8cd6047 is described below
commit 1e8cd60472c066b4e9b8b36333f345baf8641130
Author: Yang Wang <[email protected]>
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, '[email protected]', '123-456'),
- (1, null, '789-012'), -- Null is ignored, email retains previous value
- (1, '[email protected]', null);
+ (1, '[email protected]', '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, '[email protected]', 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, '[email protected]', '2024-01-01 10:00:00'),
- (1, '[email protected]', '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, '[email protected]', TIMESTAMP '2024-01-01 10:00:00');
+INSERT INTO test_first_value_ignore_nulls VALUES
+ (1, '[email protected]', 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;
+------------+-------------------+---------------------+