Skip to content
Merged
6 changes: 5 additions & 1 deletion docs/en/docs/advanced/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ Note that the comment must start with /*+ and can only follow the SELECT.

Used for compatibility with MySQL clients. No practical effect.

* `default_order_by_limit`

Used to control the default number of items returned after OrderBy. The default value is -1, and the maximum number of records after the query is returned by default, and the upper limit is the MAX_VALUE of the long data type.

* `delete_without_partition`

When set to true. When using the delete command to delete partition table data, no partition is required. The delete operation will be automatically applied to all partitions.
Expand Down Expand Up @@ -548,4 +552,4 @@ Translated with www.DeepL.com/Translator (free version)

* `validate_password_policy`

Password strength verification policy. Defaults to `NONE` or `0`, i.e. no verification. Can be set to `STRONG` or `2`. When set to `STRONG` or `2`, when setting a password via the `ALTER USER` or `SET PASSWORD` commands, the password must contain any of "uppercase letters", "lowercase letters", "numbers" and "special characters". 3 items, and the length must be greater than or equal to 8. Special characters include: `~!@#$%^&*()_+|<>,.?/:;'[]{}"`.
Password strength verification policy. Defaults to `NONE` or `0`, i.e. no verification. Can be set to `STRONG` or `2`. When set to `STRONG` or `2`, when setting a password via the `ALTER USER` or `SET PASSWORD` commands, the password must contain any of "uppercase letters", "lowercase letters", "numbers" and "special characters". 3 items, and the length must be greater than or equal to 8. Special characters include: `~!@#$%^&*()_+|<>,.?/:;'[]{}"`.
4 changes: 4 additions & 0 deletions docs/zh-CN/docs/advanced/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ SELECT /*+ SET_VAR(query_timeout = 1, enable_partition_cache=true) */ sleep(3);

用于兼容 MySQL 客户端。无实际作用。

- `default_order_by_limit`

用于控制 OrderBy 以后返回的默认条数。默认值为 -1,默认返回查询后的最大条数,上限为 long 数据类型的 MAX_VALUE 值。

- `delete_without_partition`

设置为 true 时。当使用 delete 命令删除分区表数据时,可以不指定分区。delete 操作将会自动应用到所有分区。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,13 @@ private void unmarkCollectionSlots(QueryStmt stmt) {
private PlanNode createQueryPlan(QueryStmt stmt, Analyzer analyzer, long defaultOrderByLimit)
throws UserException {
long newDefaultOrderByLimit = defaultOrderByLimit;
long defaultLimit = analyzer.getContext().getSessionVariable().defaultOrderByLimit;
if (newDefaultOrderByLimit == -1) {
newDefaultOrderByLimit = 65535;
if (defaultLimit <= -1) {
newDefaultOrderByLimit = Long.MAX_VALUE;
} else {
newDefaultOrderByLimit = defaultLimit;
}
}
PlanNode root;
if (stmt instanceof SelectStmt) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ public class SessionVariable implements Serializable, Writable {

static final String SESSION_CONTEXT = "session_context";

public static final String DEFAULT_ORDER_BY_LIMIT = "default_order_by_limit";

public static final String ENABLE_SINGLE_REPLICA_INSERT = "enable_single_replica_insert";

public static final String ENABLE_FUNCTION_PUSHDOWN = "enable_function_pushdown";
Expand Down Expand Up @@ -244,6 +246,11 @@ public class SessionVariable implements Serializable, Writable {
@VariableMgr.VarAttr(name = ENABLE_EXCHANGE_NODE_PARALLEL_MERGE)
public boolean enableExchangeNodeParallelMerge = false;

// By default, the number of Limit items after OrderBy is changed from 65535 items
// before v1.2.0 (not included), to return all items by default
@VariableMgr.VarAttr(name = DEFAULT_ORDER_BY_LIMIT)
public long defaultOrderByLimit = -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

add document

Copy link
Member Author

Choose a reason for hiding this comment

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

has been completed


// query timeout in second.
@VariableMgr.VarAttr(name = QUERY_TIMEOUT)
public int queryTimeoutS = 300;
Expand Down