dataroaring commented on code in PR #29230:
URL: https://github.com/apache/doris/pull/29230#discussion_r1438000716


##########
docs/zh-CN/docs/advanced/auto-increment.md:
##########
@@ -0,0 +1,329 @@
+---
+{
+    "title": "自增列",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# 自增列
+
+<version since="2.1">
+
+</version>
+
+自增列功能支持了在导入过程中对用户没有在自增列上指定值的数据行分配一个表内唯一的值。
+

Review Comment:
   在导入数据时,Doris 会为在自增列上没有指定值的数据行分配一个表内唯一的值。



##########
docs/zh-CN/docs/advanced/auto-increment.md:
##########
@@ -0,0 +1,329 @@
+---
+{
+    "title": "自增列",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# 自增列
+
+<version since="2.1">
+
+</version>
+
+自增列功能支持了在导入过程中对用户没有在自增列上指定值的数据行分配一个表内唯一的值。
+
+## 功能说明
+
+对于含有自增列的表,用户在在导入数据时:
+- 如果导入的目标列中不包含自增列,则自增列将会被Doris自动生成的值填充。
+- 如果导入的目标列中包含自增列,则导入数据中该列中的null值将会被Doris自动生成的值替换,非null值则保持不变。
+
+### 唯一性
+
+Doris保证了自增列上生成的值具有**表内唯一性**。但需要注意的是,**自增列的唯一性仅保证由Doris自动填充的值具有唯一性,而不考虑由用户提供的值**,如果用户同时对该表通过显示指定自增列的方式插入了用户提供的值,则不能保证这个唯一性。
+

Review Comment:
   ### 聚集性
   在聚集性里最后提下单调性就可以了。



##########
docs/zh-CN/docs/advanced/auto-increment.md:
##########
@@ -0,0 +1,329 @@
+---
+{
+    "title": "自增列",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# 自增列
+
+<version since="2.1">
+
+</version>
+
+自增列功能支持了在导入过程中对用户没有在自增列上指定值的数据行分配一个表内唯一的值。
+
+## 功能说明
+
+对于含有自增列的表,用户在在导入数据时:
+- 如果导入的目标列中不包含自增列,则自增列将会被Doris自动生成的值填充。
+- 如果导入的目标列中包含自增列,则导入数据中该列中的null值将会被Doris自动生成的值替换,非null值则保持不变。
+
+### 唯一性
+
+Doris保证了自增列上生成的值具有**表内唯一性**。但需要注意的是,**自增列的唯一性仅保证由Doris自动填充的值具有唯一性,而不考虑由用户提供的值**,如果用户同时对该表通过显示指定自增列的方式插入了用户提供的值,则不能保证这个唯一性。
+
+### 单调性
+
+Doris保证了在自增列上填充的值**在一个分桶内**是严格单调递增的。但需要注意的是,Doris**不能保证**在物理时间上后一次导入的数据在自增列上填充的值比前一次更大,这是因为处于性能考虑,每个BE上都会缓存一部分预先分配的自增列的值,每个BE上缓存的值互不相交。因此,不能根据自增列分配出的值的大小来判断导入时间上的先后顺序。同时,由于BE上缓存的存在,Doris仅能保证自增列上自动填充的值在一定程度上是稠密的,但**不能保证**在一次导入中自动填充的自增列的值是完全连续的。因此可能会出现一次导入中自增列自动填充的值具有一定的跳跃性的现象。
+
+## 使用场景
+
+基于自增列自动分配、表级唯一和稠密的特性,可以利用自增列构建字符串到BIGINT的编码映射,从而加速精确去重和JOIN的计算过程,还可以进一步结合bitmap类型来加速画像场景中的圈选和去重的计算过程。
+

Review Comment:
   对这两种场景分别给出例子。



##########
docs/zh-CN/docs/advanced/auto-increment.md:
##########
@@ -0,0 +1,329 @@
+---
+{
+    "title": "自增列",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# 自增列
+
+<version since="2.1">
+
+</version>
+
+自增列功能支持了在导入过程中对用户没有在自增列上指定值的数据行分配一个表内唯一的值。
+
+## 功能说明
+
+对于含有自增列的表,用户在在导入数据时:
+- 如果导入的目标列中不包含自增列,则自增列将会被Doris自动生成的值填充。
+- 如果导入的目标列中包含自增列,则导入数据中该列中的null值将会被Doris自动生成的值替换,非null值则保持不变。

Review Comment:
   非 null 值会破坏自增列值的唯一性。



##########
docs/zh-CN/docs/advanced/auto-increment.md:
##########
@@ -0,0 +1,329 @@
+---
+{
+    "title": "自增列",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# 自增列
+
+<version since="2.1">
+
+</version>
+
+自增列功能支持了在导入过程中对用户没有在自增列上指定值的数据行分配一个表内唯一的值。
+
+## 功能说明
+
+对于含有自增列的表,用户在在导入数据时:
+- 如果导入的目标列中不包含自增列,则自增列将会被Doris自动生成的值填充。
+- 如果导入的目标列中包含自增列,则导入数据中该列中的null值将会被Doris自动生成的值替换,非null值则保持不变。
+
+### 唯一性
+
+Doris保证了自增列上生成的值具有**表内唯一性**。但需要注意的是,**自增列的唯一性仅保证由Doris自动填充的值具有唯一性,而不考虑由用户提供的值**,如果用户同时对该表通过显示指定自增列的方式插入了用户提供的值,则不能保证这个唯一性。
+
+### 单调性
+
+Doris保证了在自增列上填充的值**在一个分桶内**是严格单调递增的。但需要注意的是,Doris**不能保证**在物理时间上后一次导入的数据在自增列上填充的值比前一次更大,这是因为处于性能考虑,每个BE上都会缓存一部分预先分配的自增列的值,每个BE上缓存的值互不相交。因此,不能根据自增列分配出的值的大小来判断导入时间上的先后顺序。同时,由于BE上缓存的存在,Doris仅能保证自增列上自动填充的值在一定程度上是稠密的,但**不能保证**在一次导入中自动填充的自增列的值是完全连续的。因此可能会出现一次导入中自增列自动填充的值具有一定的跳跃性的现象。
+
+## 使用场景
+
+基于自增列自动分配、表级唯一和稠密的特性,可以利用自增列构建字符串到BIGINT的编码映射,从而加速精确去重和JOIN的计算过程,还可以进一步结合bitmap类型来加速画像场景中的圈选和去重的计算过程。
+

Review Comment:
   1. 字典编码
        在用户画像场景中使用 bitmap 做人群分析时需要构建用户字典,每个用户对应一个唯一的整数字典值,聚集的字典值可以获得更好的 bitmap 
性能。
   2. 高效分页
        在页面展示数据时,往往需要做分页展示,传统的分页使用 SQL 重的 limit offset 
语法实现,查询涉及的数据量很大时,这种方法比较低效。可以通过自增列给每行数据一个唯一值,就可以使用 where unique_value > xx limit 
100 的方法来实现分页。



-- 
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]

Reply via email to