Skip to content

Commit

Permalink
docs: add map desc in create table (#3912)
Browse files Browse the repository at this point in the history
  • Loading branch information
aceforeverd authored May 10, 2024
1 parent c5ecca7 commit ebc4978
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 19 deletions.
2 changes: 2 additions & 0 deletions docs/en/openmldb_sql/data_types/composite_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ select map (1, "12", 2, "100")[2]
1. Generally not recommended to store a map value with too much key-value pairs, since it's a row-based storage model.
2. Map data type can not used as the key or ts column of table index, queries can not be optimized based on specific key value inside a map column neither.
3. Query a key-value in a map takes `O(n)` complexity at most.
4. Currently, it is not allowed to output a map type value from a SQL query, however you can access information about the map value using map-related expressions. For example, you may use `[]` operator over a `map<int, int>` type to extract value of specific key.

19 changes: 10 additions & 9 deletions docs/en/openmldb_sql/ddl/CREATE_TABLE_STATEMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@ ColumnName ::=
Identifier ( '.' Identifier ( '.' Identifier )? )?

ColumnType ::=
'INT' | 'INT32'
|'SMALLINT' | 'INT16'
|'BIGINT' | 'INT64'
|'FLOAT'
|'DOUBLE'
|'TIMESTAMP'
|'DATE'
|'BOOL'
|'STRING' | 'VARCHAR'
'INT' | 'INT32'
|'SMALLINT' | 'INT16'
|'BIGINT' | 'INT64'
|'FLOAT'
|'DOUBLE'
|'TIMESTAMP'
|'DATE'
|'BOOL'
|'STRING' | 'VARCHAR'
| 'MAP' '<' ColumnType ',' ColumnType '>'

ColumnOptionList ::=
ColumnOption*
Expand Down
1 change: 1 addition & 0 deletions docs/zh/openmldb_sql/data_types/composite_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ select map (1, "12", 2, "100")[2]
1. 由于采用行存储形式,不建议表的 MAP 类型存储 key-value pair 特别多的情况,否则可能导致性能问题。
2. map 数据类型不支持作为索引的 key 或 ts 列,无法对 map 列特定 key 做查询优化。
3. map key-value 查询最多消耗 `O(n)` 复杂度
4. 目前暂未支持查询结果直接输出 map 类型,但可以用 map 相关的表达式得到关于 map 值的基本类型结果,例如用 `[]` 获取 `map<int,int>` 中特定 key 的 value。
21 changes: 11 additions & 10 deletions docs/zh/openmldb_sql/ddl/CREATE_TABLE_STATEMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@ ColumnName ::=
Identifier ( '.' Identifier ( '.' Identifier )? )?

ColumnType ::=
'INT' | 'INT32'
|'SMALLINT' | 'INT16'
|'BIGINT' | 'INT64'
|'FLOAT'
|'DOUBLE'
|'TIMESTAMP'
|'DATE'
|'BOOL'
|'STRING' | 'VARCHAR'
'INT' | 'INT32'
|'SMALLINT' | 'INT16'
|'BIGINT' | 'INT64'
|'FLOAT'
|'DOUBLE'
|'TIMESTAMP'
|'DATE'
|'BOOL'
|'STRING' | 'VARCHAR'
| 'MAP' '<' ColumnType ',' ColumnType '>'

ColumnOptionList ::=
ColumnOption*
Expand Down Expand Up @@ -511,4 +512,4 @@ create table t1 (col0 string, col1 int) options (DISTRIBUTION=[('127.0.0.1:30921

[CREATE DATABASE](../ddl/CREATE_DATABASE_STATEMENT.md)

[USE DATABASE](../ddl/USE_DATABASE_STATEMENT.md)
[USE DATABASE](../ddl/USE_DATABASE_STATEMENT.md)

0 comments on commit ebc4978

Please sign in to comment.