yiguolei commented on code in PR #4380:
URL: https://github.com/apache/doris-website/pull/4380#discussion_r4323508069
##########
docs/sql-manual/basic-element/sql-data-types/semi-structured/FILE.md:
##########
@@ -0,0 +1,136 @@
+---
+{
+ "title": "FILE | Semi Structured",
+ "language": "en",
+ "description": "FILE fields, constraints, construction, and field access.",
+ "sidebar_label": "FILE"
+}
+---
+
+# FILE
+
+## Type Description
+
+- `FILE` represents a file in a query: it can store the file location or hold
its binary contents directly.
+- A FILE value can also carry information such as size and content type. Its
six fields have fixed names and types, and all allow NULL.
+- It can be nested in ARRAY, STRUCT, and MAP values.
+
+```sql
+FILE
+```
+
+| Field | Type | Description |
+| --- | --- | --- |
+| uri | VARCHAR(65533) | File location, preserved as supplied. |
+| offset | BIGINT | Starting byte offset; NULL or a nonnegative value. A
non-NULL offset requires size. |
+| size | BIGINT | Declared content length in bytes; NULL or a nonnegative
value, including 0. |
+| content_type | VARCHAR(1024) | NULL or a valid, nonempty MIME media type,
such as `image/png`. |
+| checksum | VARCHAR(1024) | NULL or a nonempty `algorithm:digest`
declaration. |
+| inline | VARBINARY | NULL or binary content, including empty bytes, subject
to the VARBINARY value length limit. |
+
+- For a non-NULL FILE, uri or inline must be non-NULL. When inline is present,
the other five fields may all be NULL. Inline can also coexist with metadata;
any supplied fields must satisfy their own constraints.
+- URI strings are stored without syntax validation, encoding, or decoding.
Constructing FILE with CAST does not access the referenced object. Doris does
not check whether inline matches the URI, size, or checksum.
+- When offset is NULL, a supplied size describes the range starting at 0. When
both are present, the range is `[offset, offset + size)`; their sum must not
exceed the BIGINT maximum, `9223372036854775807`.
+- Checksum declarations use `ETAG`, `MD5`, `CRC32`, `CRC32C`, or `SHA-256` for
known algorithms. ETAG is an opaque nonempty value; MD5, CRC32/CRC32C, and
SHA-256 require 32, 8, and 64 lowercase hexadecimal digits respectively. Other
algorithm names and digests must both be nonempty. Doris validates the
declaration without calculating or verifying the content digest.
+- MySQL query results display FILE as a six-field JSON object, with inline
encoded as Base64.
+
+## Type Constraints
+
+- FILE is available in query expressions. FILE columns cannot be declared in
internal tables or external catalogs, including FILE nested in containers.
+- Whole FILE values and containers containing FILE cannot be used for
comparison, sorting, hashing, grouping, DISTINCT, or MAP keys. Extract an
ordinary scalar field for these operations.
+- FILE supports explicit conversion to and from STRUCT, JSON, and VARIANT.
There is no implicit conversion between FILE and these types; use CAST. See
[FILE Type Conversion](../conversion/file-conversion.md).
+- FILE arguments, return values, and aggregate intermediate types are
unsupported in UDFs, including nested FILE.
+
+## Obtaining FILE Values
+
+### Construct from metadata
+
+Use an explicit CAST to construct FILE from a six-field STRUCT, JSON, or
VARIANT value. Fields whose values are NULL must still be included. This
conversion does not access remote storage.
+
+```sql
+SELECT CAST(NAMED_STRUCT(
Review Comment:
我们还需要提供一个函数,通过一个json 转FILE
--
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]