Why does FORMAT('v=%.1f', NULL) return v=n in Apache IoTDB table model?
03:17 25 Jun 2026

I'm using Apache IoTDB 2.0.8 in table model to format readings into report strings. A normal numeric value formats correctly with %.1f, but when the same column is NULL, FORMAT('v=%.1f', value) returns v=n instead of v=null or a NULL result.

Table definition and sample rows:

CREATE TABLE replacement_format_null (device_id STRING TAG, value DOUBLE FIELD, label STRING FIELD);
INSERT INTO replacement_format_null(time, device_id, value, label) VALUES (1000, 'D1', 12.345, 'A');
INSERT INTO replacement_format_null(time, device_id, value, label) VALUES (2000, 'D1', null, 'B');

Formatting that surprised me: use %.1f on a NULL numeric value:

SELECT time, value, FORMAT('v=%.1f', value) AS formatted FROM replacement_format_null ORDER BY time;

Query output:

+-----------------------------+------+---------+
| time| value|formatted|
+-----------------------------+------+---------+
|1970-01-01T08:00:01.000+08:00|12.345| v=12.3|
|1970-01-01T08:00:02.000+08:00| null| v=n|
+-----------------------------+------+---------+

Use a string placeholder for the same NULL value:

SELECT time, label, FORMAT('%s:%s', label, value) AS formatted FROM replacement_format_null ORDER BY time;

Output:

+-----------------------------+-----+---------+
| time|label|formatted|
+-----------------------------+-----+---------+
|1970-01-01T08:00:01.000+08:00| A| A:12.345|
|1970-01-01T08:00:02.000+08:00| B| B:null|
+-----------------------------+-----+---------+

Why does FORMAT output the shortened value n when a numeric placeholder receives NULL? Is this a specific NULL conversion in the formatting function, or an edge case of combining %.1f with NULL?

time-series apache-iotdb