Skip to content

[docs](variant) document VARIANT behavior in Doris 4.2+#4001

Draft
eldenmoon wants to merge 10 commits into
apache:masterfrom
eldenmoon:agent/variant-v2-compute-behavior
Draft

[docs](variant) document VARIANT behavior in Doris 4.2+#4001
eldenmoon wants to merge 10 commits into
apache:masterfrom
eldenmoon:agent/variant-v2-compute-behavior

Conversation

@eldenmoon

@eldenmoon eldenmoon commented Jul 19, 2026

Copy link
Copy Markdown
Member

What changed

  • Merge the Doris 4.2+ compute behavior into the main English and Chinese VARIANT reference instead of exposing a separate V2 document or V2 session switch.
  • Document JSON/JSONB input for PARSE_TO_VARIANT and PARSE_TO_VARIANT_ERROR_TO_NULL, and explain that ERROR_TO_NULL converts parsing and validation failures to SQL NULL.
  • Add complete CAST guidance in both directions: supported SQL types to VARIANT, VARIANT to supported SQL types, JSON/JSONB conversion, array conversion, and the enable_variant_string_cast_parse behavior.
  • Document logical equality and canonical hash semantics, including GROUP BY, DISTINCT, set operations, JOIN restrictions, ORDER BY restrictions, window keys, COUNT, MIN/MAX, nested expressions, and explode behavior.
  • Align ELEMENT_AT documentation with Doris 4.2+ VARIANT array indexing and update the Variant Functions sidebar.

Why

The documentation should describe user-visible VARIANT capabilities by Doris version, not expose the internal ColumnVariantV2 implementation. The refactor also consolidates one data type into one reference page and fills the missing CAST, JSONB, hash, grouping, join, and ordering details requested in review.

Validation

  • git diff --check: passed.
  • corepack yarn docs:sql-functions:changed: passed with no findings.
  • corepack yarn docs:features:changed: passed with no findings.
  • corepack yarn docs:links:changed: passed with no errors. The two redirect-review warnings are intentional because the removed V2 pages were introduced only by this unmerged PR.
  • corepack yarn docs:i18n-sync:changed: passed. Current-to-versioned warnings are an intentional version exception because these behaviors start in Doris 4.2 and should not be copied into existing released 4.x/3.x docs.
  • corepack yarn docs:seo:changed: passed; only existing cross-version and cross-locale duplicate-title warnings remain.
  • corepack yarn typecheck: repository baseline still fails on unrelated existing TypeScript errors outside the changed docs and sidebars.

@@ -0,0 +1,177 @@
---
{
"title": "VARIANT V2 Behavior and Semantics",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文档,跟底下的variant的合并了吧。 我们每个类型一个文档,包括这个类型相关的所有的信息。

@@ -0,0 +1,71 @@
---
{
"title": "PARSE_TO_VARIANT_ERROR_TO_NULL",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个标题是啥含义啊


## 概览

实验性 VARIANT V2 扩展了可以消费 `VARIANT` 值的运算,并为分组、去重和集合运算定义了一致的 logical-value 语义。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要暴露variant v2.
我们应该是比如说4.2 之后的variant 具备哪些功能。


## 参数

- `json_text`:包含一个完整 JSON 值的 `VARCHAR` 表达式。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个parse to variant,不可以输入一个jsonb 吗?

SELECT PARSE_TO_VARIANT('null');
```

### 提取值并 CAST 为确定类型

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里少一个cast的文档。
cast 文档中包括两部分:

  1. cast to variant, 把其他类型cast 到variant
  2. cast variant 到其他类型


## Equality 语义

开启 VARIANT V2 后,支持的分组、去重和集合运算会按 logical value 判断相等性,而不是按来源 SQL 类型或表示形式:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要补充一下关于join,order by,group by的支持情况;
hash 值计算的情况

@eldenmoon eldenmoon changed the title [docs](variant) document ColumnVariantV2 compute behavior [docs](variant) document VARIANT behavior in Doris 4.2+ Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants