yiguolei commented on code in PR #4380:
URL: https://github.com/apache/doris-website/pull/4380#discussion_r4323748405
##########
i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/basic-element/sql-data-types/conversion/file-conversion.md:
##########
@@ -0,0 +1,180 @@
+---
+{
+ "title": "转换为/从 FILE",
+ "language": "zh-CN",
+ "description": "FILE 与 STRUCT、JSON、VARIANT 的显式双向转换及 NULL 处理规则。"
+}
+---
+
+# 转换为/从 FILE
+
+FILE 支持与 STRUCT、JSON、VARIANT 显式双向转换。**FILE 与这些类型之间不支持隐式转换,须使用 CAST。**
转换本身不访问远端存储,字段定义及取值约束见 [FILE](../semi-structured/FILE.md)。
+
+## 转换为 FILE
+
+### FROM STRUCT
+
+源 STRUCT 须包含完整六字段,按名称匹配,不区分大小写,字段顺序可不同。offset 和 size 须为 BIGINT 或 NULL,inline
须为 VARBINARY 或 NULL,文本字段须为 CHAR/VARCHAR/STRING 或 NULL。未知、缺失、重复或类型不兼容的字段会被拒绝。
+
+```sql
+SELECT CAST(NAMED_STRUCT(
+ 'uri', 's3://linrrzqqq/doris-file-type-test/my-github-avatar.jpg',
'offset', NULL, 'size', CAST(3 AS BIGINT),
+ 'content_type', NULL, 'checksum', NULL, 'inline', X'616263'
+) AS FILE) AS f;
+```
+```text
++-----------------------------------------------------------------------------------------------------------+
+| f
|
++-----------------------------------------------------------------------------------------------------------+
+|
{"uri":"s3://linrrzqqq/doris-file-type-test/my-github-avatar.jpg","offset":null,"size":3,"content_type":null,"checksum":null,"inline":"YWJj"}
|
++-----------------------------------------------------------------------------------------------------------+
+```
+
+### FROM JSON
+
+JSON 对象须恰好包含 uri、offset、size、content_type、checksum、inline 六个小写 key。offset 和
size 接受 BIGINT 范围的 JSON 整数或 null;inline 接受标准、带 padding 的 Base64 字符串或
null,空字符串表示空字节序列。
+
+```sql
+SELECT CAST(JSON_PARSE(
Review Comment:
这里的cast 容易翻车,比如这个json 假如不符合要求,我们是报错,还是返回null,就会有那种严格模式的引入。
struct 是确定的。所以我建议不要写这个cast from json or variant了
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]