forked from StarRocks/starrocks
-
Notifications
You must be signed in to change notification settings - Fork 1
/
SessionVariable.java
1242 lines (997 loc) · 47.6 KB
/
SessionVariable.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// This file is made available under Elastic License 2.0.
// This file is based on code available under the Apache license here:
// https://github.com/apache/incubator-doris/blob/master/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
// 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.
package com.starrocks.qe;
import com.google.common.collect.ImmutableList;
import com.starrocks.common.FeMetaVersion;
import com.starrocks.common.io.Text;
import com.starrocks.common.io.Writable;
import com.starrocks.common.util.CompressionUtils;
import com.starrocks.common.util.TimeUtils;
import com.starrocks.qe.VariableMgr.VarAttr;
import com.starrocks.server.GlobalStateMgr;
import com.starrocks.system.BackendCoreStat;
import com.starrocks.thrift.TCompressionType;
import com.starrocks.thrift.TPipelineProfileLevel;
import com.starrocks.thrift.TQueryOptions;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.json.JSONObject;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.List;
// System variable
@SuppressWarnings("FieldMayBeFinal")
public class SessionVariable implements Serializable, Writable, Cloneable {
private static final Logger LOG = LogManager.getLogger(SessionVariable.class);
public static final String USE_COMPUTE_NODES = "use_compute_nodes";
public static final String PREFER_COMPUTE_NODE = "prefer_compute_node";
public static final String EXEC_MEM_LIMIT = "exec_mem_limit";
/**
* configure the mem limit of load process on BE.
* Previously users used exec_mem_limit to set memory limits.
* To maintain compatibility, the default value of load_mem_limit is 0,
* which means that the load memory limit is still using exec_mem_limit.
* Users can set a value greater than zero to explicitly specify the load memory limit.
* This variable is mainly for INSERT operation, because INSERT operation has both query and load part.
* Using only the exec_mem_limit variable does not make a good distinction of memory limit between the two parts.
*/
public static final String LOAD_MEM_LIMIT = "load_mem_limit";
/**
* The mem limit of query on BE. It takes effects only when enabling pipeline engine.
* - If `query_mem_limit` > 0, use it to limit the memory of a query.
* The memory a query able to be used is just `query_mem_limit`.
* - Otherwise, use `exec_mem_limit` to limit the memory of a query.
* The memory a query able to be used is `exec_mem_limit * num_fragments * pipeline_dop`.
* To maintain compatibility, the default value is 0.
*/
public static final String QUERY_MEM_LIMIT = "query_mem_limit";
public static final String QUERY_TIMEOUT = "query_timeout";
public static final String QUERY_DELIVERY_TIMEOUT = "query_delivery_timeout";
public static final String MAX_EXECUTION_TIME = "max_execution_time";
public static final String IS_REPORT_SUCCESS = "is_report_success";
public static final String PROFILING = "profiling";
public static final String SQL_MODE = "sql_mode";
/**
* Because we modified the default value of sql_mode.
* The default value in v1 version is 0, and in v2 we support sql mode not set only_full_group_by.
* In order to ensure the consistency of logic,
* the storage name of sql_mode is changed here, in order to achieve compatibility
*/
public static final String SQL_MODE_STORAGE_NAME = "sql_mode_v2";
public static final String RESOURCE_GROUP = "resource_group";
public static final String AUTO_COMMIT = "autocommit";
public static final String TX_ISOLATION = "tx_isolation";
public static final String CHARACTER_SET_CLIENT = "character_set_client";
public static final String CHARACTER_SET_CONNNECTION = "character_set_connection";
public static final String CHARACTER_SET_RESULTS = "character_set_results";
public static final String CHARACTER_SET_SERVER = "character_set_server";
public static final String COLLATION_CONNECTION = "collation_connection";
public static final String COLLATION_DATABASE = "collation_database";
public static final String COLLATION_SERVER = "collation_server";
public static final String SQL_AUTO_IS_NULL = "SQL_AUTO_IS_NULL";
public static final String SQL_SELECT_LIMIT = "sql_select_limit";
public static final String MAX_ALLOWED_PACKET = "max_allowed_packet";
public static final String AUTO_INCREMENT_INCREMENT = "auto_increment_increment";
public static final String QUERY_CACHE_TYPE = "query_cache_type";
public static final String INTERACTIVE_TIMTOUT = "interactive_timeout";
public static final String WAIT_TIMEOUT = "wait_timeout";
public static final String NET_WRITE_TIMEOUT = "net_write_timeout";
public static final String NET_READ_TIMEOUT = "net_read_timeout";
public static final String TIME_ZONE = "time_zone";
public static final String SQL_SAFE_UPDATES = "sql_safe_updates";
public static final String NET_BUFFER_LENGTH = "net_buffer_length";
public static final String CODEGEN_LEVEL = "codegen_level";
// mem limit can't smaller than bufferpool's default page size
public static final int MIN_EXEC_MEM_LIMIT = 2097152;
public static final String BATCH_SIZE = "batch_size";
public static final String CHUNK_SIZE = "chunk_size";
public static final String DISABLE_STREAMING_PREAGGREGATIONS = "disable_streaming_preaggregations";
public static final String STREAMING_PREAGGREGATION_MODE = "streaming_preaggregation_mode";
public static final String DISABLE_COLOCATE_JOIN = "disable_colocate_join";
public static final String DISABLE_BUCKET_JOIN = "disable_bucket_join";
public static final String PARALLEL_FRAGMENT_EXEC_INSTANCE_NUM = "parallel_fragment_exec_instance_num";
public static final String ENABLE_INSERT_STRICT = "enable_insert_strict";
public static final String ENABLE_SPILLING = "enable_spilling";
// if set to true, some of stmt will be forwarded to leader FE to get result
public static final String FORWARD_TO_MASTER = "forward_to_master";
// user can set instance num after exchange, no need to be equal to nums of before exchange
public static final String PARALLEL_EXCHANGE_INSTANCE_NUM = "parallel_exchange_instance_num";
public static final String EVENT_SCHEDULER = "event_scheduler";
public static final String STORAGE_ENGINE = "storage_engine";
public static final String DIV_PRECISION_INCREMENT = "div_precision_increment";
// see comment of `starrocks_max_scan_key_num` and `max_pushdown_conditions_per_column` in BE config
public static final String MAX_SCAN_KEY_NUM = "max_scan_key_num";
public static final String MAX_PUSHDOWN_CONDITIONS_PER_COLUMN = "max_pushdown_conditions_per_column";
// use new execution engine instead of the old one if enable_pipeline_engine is true,
// the new execution engine split a fragment into pipelines, then create several drivers
// from the pipeline for parallel executing, threads from global pool pick out the
// ready-to-run drivers to execute and switch the blocked drivers off cores;
// the old one put each fragment into a thread, then pull final result from the root fragment,
// leaf fragments always waiting for disk IO's completion and intermediate fragments wait
// for chunk arrival and blocked on receive queues of its exchange node, so among
// threads allocated for a query in the old execution engine, only small number of
// them do the real work on core.
public static final String ENABLE_PIPELINE = "enable_pipeline";
public static final String ENABLE_PIPELINE_ENGINE = "enable_pipeline_engine";
public static final String ENABLE_DELIVER_BATCH_FRAGMENTS = "enable_deliver_batch_fragments";
// Use resource group. It will influence the CPU schedule, I/O scheduler, and
// memory limit etc. in BE.
public static final String ENABLE_RESOURCE_GROUP = "enable_resource_group";
public static final String ENABLE_TABLET_INTERNAL_PARALLEL = "enable_tablet_internal_parallel";
public static final String ENABLE_SHARED_SCAN = "enable_shared_scan";
public static final String PIPELINE_DOP = "pipeline_dop";
public static final String PIPELINE_PROFILE_LEVEL = "pipeline_profile_level";
public static final String RESOURCE_GROUP_ID = "workgroup_id";
// hash join right table push down
public static final String HASH_JOIN_PUSH_DOWN_RIGHT_TABLE = "hash_join_push_down_right_table";
// disable join reorder
public static final String DISABLE_JOIN_REORDER = "disable_join_reorder";
// open predicate reorder
public static final String ENABLE_PREDICATE_REORDER = "enable_predicate_reorder";
public static final String ENABLE_FILTER_UNUSED_COLUMNS_IN_SCAN_STAGE =
"enable_filter_unused_columns_in_scan_stage";
// the maximum time, in seconds, waiting for an insert statement's transaction state
// transfer from COMMITTED to VISIBLE.
// If the time exceeded but the transaction state is not VISIBLE, the transaction will
// still be considered as succeeded and an OK packet will be sent to the client, but
// the affected records may not be visible to the subsequent queries, even if it's in
// the same session.
public static final String TRANSACTION_VISIBLE_WAIT_TIMEOUT = "tx_visible_wait_timeout";
// only for Aliyun DTS, no actual use.
public static final String FOREIGN_KEY_CHECKS = "foreign_key_checks";
// force schedule local be for HybridBackendSelector
// only for hive external table now
public static final String FORCE_SCHEDULE_LOCAL = "force_schedule_local";
// -------- New planner session variables start --------
public static final String NEW_PLANER_AGG_STAGE = "new_planner_agg_stage";
public static final String BROADCAST_ROW_LIMIT = "broadcast_row_limit";
public static final String NEW_PLANNER_OPTIMIZER_TIMEOUT = "new_planner_optimize_timeout";
public static final String ENABLE_GROUPBY_USE_OUTPUT_ALIAS = "enable_groupby_use_output_alias";
public static final String ENABLE_QUERY_DUMP = "enable_query_dump";
public static final String CBO_MAX_REORDER_NODE_USE_EXHAUSTIVE = "cbo_max_reorder_node_use_exhaustive";
public static final String CBO_ENABLE_DP_JOIN_REORDER = "cbo_enable_dp_join_reorder";
public static final String CBO_MAX_REORDER_NODE_USE_DP = "cbo_max_reorder_node_use_dp";
public static final String CBO_ENABLE_GREEDY_JOIN_REORDER = "cbo_enable_greedy_join_reorder";
public static final String CBO_ENABLE_REPLICATED_JOIN = "cbo_enable_replicated_join";
public static final String CBO_USE_CORRELATED_JOIN_ESTIMATE = "cbo_use_correlated_join_estimate";
public static final String CBO_ENABLE_LOW_CARDINALITY_OPTIMIZE = "cbo_enable_low_cardinality_optimize";
public static final String CBO_USE_NTH_EXEC_PLAN = "cbo_use_nth_exec_plan";
public static final String CBO_CTE_REUSE = "cbo_cte_reuse";
public static final String CBO_CTE_REUSE_RATE = "cbo_cte_reuse_rate";
public static final String ENABLE_SQL_DIGEST = "enable_sql_digest";
public static final String CBO_MAX_REORDER_NODE = "cbo_max_reorder_node";
public static final String CBO_PRUNE_SHUFFLE_COLUMN_RATE = "cbo_prune_shuffle_column_rate";
// -------- New planner session variables end --------
// Type of compression of transmitted data
// Different compression algorithms may be chosen in different hardware environments. For example,
// in the case of insufficient network bandwidth, but excess CPU resources, an algorithm with a
// higher compression ratio may be chosen to use more CPU and make the overall query time lower.
public static final String TRANSMISSION_COMPRESSION_TYPE = "transmission_compression_type";
public static final String RUNTIME_JOIN_FILTER_PUSH_DOWN_LIMIT = "runtime_join_filter_push_down_limit";
public static final String ENABLE_GLOBAL_RUNTIME_FILTER = "enable_global_runtime_filter";
public static final String GLOBAL_RUNTIME_FILTER_BUILD_MAX_SIZE = "global_runtime_filter_build_max_size";
public static final String GLOBAL_RUNTIME_FILTER_PROBE_MIN_SIZE = "global_runtime_filter_probe_min_size";
public static final String GLOBAL_RUNTIME_FILTER_PROBE_MIN_SELECTIVITY =
"global_runtime_filter_probe_min_selectivity";
public static final String ENABLE_COLUMN_EXPR_PREDICATE = "enable_column_expr_predicate";
public static final String ENABLE_EXCHANGE_PASS_THROUGH = "enable_exchange_pass_through";
public static final String SINGLE_NODE_EXEC_PLAN = "single_node_exec_plan";
public static final String ALLOW_DEFAULT_PARTITION = "allow_default_partition";
public static final String ENABLE_HIVE_COLUMN_STATS = "enable_hive_column_stats";
public static final String RUNTIME_FILTER_SCAN_WAIT_TIME = "runtime_filter_scan_wait_time";
public static final String RUNTIME_FILTER_ON_EXCHANGE_NODE = "runtime_filter_on_exchange_node";
public static final String ENABLE_OPTIMIZER_TRACE_LOG = "enable_optimizer_trace_log";
public static final String JOIN_IMPLEMENTATION_MODE = "join_implementation_mode";
public static final String STATISTIC_COLLECT_PARALLEL = "statistic_collect_parallel";
public static final String ENABLE_SHOW_ALL_VARIABLES = "enable_show_all_variables";
public static final String ENABLE_QUERY_DEBUG_TRACE = "enable_query_debug_trace";
public static final List<String> DEPRECATED_VARIABLES = ImmutableList.<String>builder()
.add(CODEGEN_LEVEL)
.add(ENABLE_SPILLING)
.add(MAX_EXECUTION_TIME)
.add(PROFILING)
.add(BATCH_SIZE)
.add(DISABLE_BUCKET_JOIN)
.add(CBO_ENABLE_REPLICATED_JOIN)
.add(FOREIGN_KEY_CHECKS)
.add("enable_cbo")
.add("enable_vectorized_engine")
.add("vectorized_engine_enable")
.add("enable_vectorized_insert")
.add("vectorized_insert_enable")
.add("prefer_join_method")
.add("rewrite_count_distinct_to_bitmap_hll").build();
@VariableMgr.VarAttr(name = ENABLE_PIPELINE, alias = ENABLE_PIPELINE_ENGINE, show = ENABLE_PIPELINE_ENGINE)
private boolean enablePipelineEngine = true;
@VariableMgr.VarAttr(name = USE_COMPUTE_NODES)
private int useComputeNodes = -1;
@VariableMgr.VarAttr(name = PREFER_COMPUTE_NODE)
private boolean preferComputeNode = false;
/**
* If enable this variable (only take effect for pipeline), it will deliver fragment instances
* to BE in batch and concurrently.
* - Uses `exec_batch_plan_fragments` instead of `exec_plan_fragment` RPC API, which all the instances
* of a fragment to the same destination host are delivered in the same request.
* - Send different fragments concurrently according to topological order of the fragment tree
*/
@VariableMgr.VarAttr(name = ENABLE_DELIVER_BATCH_FRAGMENTS)
private boolean enableDeliverBatchFragments = true;
@VariableMgr.VarAttr(name = RUNTIME_FILTER_SCAN_WAIT_TIME, flag = VariableMgr.INVISIBLE)
private long runtimeFilterScanWaitTime = 20L;
@VariableMgr.VarAttr(name = RUNTIME_FILTER_ON_EXCHANGE_NODE)
private boolean runtimeFilterOnExchangeNode = false;
@VariableMgr.VarAttr(name = ENABLE_RESOURCE_GROUP)
private boolean enableResourceGroup = false;
@VariableMgr.VarAttr(name = ENABLE_TABLET_INTERNAL_PARALLEL)
private boolean enableTabletInternalParallel = false;
@VariableMgr.VarAttr(name = ENABLE_SHARED_SCAN)
private boolean enableSharedScan = true;
// max memory used on every backend.
public static final long DEFAULT_EXEC_MEM_LIMIT = 2147483648L;
@VariableMgr.VarAttr(name = EXEC_MEM_LIMIT)
public long maxExecMemByte = DEFAULT_EXEC_MEM_LIMIT;
@VariableMgr.VarAttr(name = LOAD_MEM_LIMIT)
private long loadMemLimit = 0L;
@VariableMgr.VarAttr(name = QUERY_MEM_LIMIT)
private long queryMemLimit = 0L;
// query timeout in second.
@VariableMgr.VarAttr(name = QUERY_TIMEOUT)
private int queryTimeoutS = 300;
// Execution of a query contains two phase.
// 1. Deliver all the fragment instances to BEs.
// 2. Pull data from BEs, after all the fragments are prepared and ready to execute in BEs.
// queryDeliveryTimeoutS is the timeout of the first phase.
@VariableMgr.VarAttr(name = QUERY_DELIVERY_TIMEOUT)
private int queryDeliveryTimeoutS = 300;
// if true, need report to coordinator when plan fragment execute successfully.
@VariableMgr.VarAttr(name = IS_REPORT_SUCCESS)
private boolean isReportSucc = false;
// Default sqlMode is ONLY_FULL_GROUP_BY
@VariableMgr.VarAttr(name = SQL_MODE_STORAGE_NAME, alias = SQL_MODE, show = SQL_MODE)
private long sqlMode = 32L;
// The specified resource group of this session
@VariableMgr.VarAttr(name = RESOURCE_GROUP, flag = VariableMgr.SESSION_ONLY)
private String resourceGroup = "";
// this is used to make mysql client happy
@VariableMgr.VarAttr(name = AUTO_COMMIT)
private boolean autoCommit = true;
// this is used to make c3p0 library happy
@VariableMgr.VarAttr(name = TX_ISOLATION)
private String txIsolation = "REPEATABLE-READ";
// this is used to make c3p0 library happy
@VariableMgr.VarAttr(name = CHARACTER_SET_CLIENT)
private String charsetClient = "utf8";
@VariableMgr.VarAttr(name = CHARACTER_SET_CONNNECTION)
private String charsetConnection = "utf8";
@VariableMgr.VarAttr(name = CHARACTER_SET_RESULTS)
private String charsetResults = "utf8";
@VariableMgr.VarAttr(name = CHARACTER_SET_SERVER)
private String charsetServer = "utf8";
@VariableMgr.VarAttr(name = COLLATION_CONNECTION)
private String collationConnection = "utf8_general_ci";
@VariableMgr.VarAttr(name = COLLATION_DATABASE)
private String collationDatabase = "utf8_general_ci";
@VariableMgr.VarAttr(name = COLLATION_SERVER)
private String collationServer = "utf8_general_ci";
// this is used to make c3p0 library happy
@VariableMgr.VarAttr(name = SQL_AUTO_IS_NULL)
private boolean sqlAutoIsNull = false;
public static final long DEFAULT_SELECT_LIMIT = 9223372036854775807L;
@VariableMgr.VarAttr(name = SQL_SELECT_LIMIT)
private long sqlSelectLimit = DEFAULT_SELECT_LIMIT;
// this is used to make c3p0 library happy
@VariableMgr.VarAttr(name = MAX_ALLOWED_PACKET)
private int maxAllowedPacket = 1048576;
@VariableMgr.VarAttr(name = AUTO_INCREMENT_INCREMENT)
private int autoIncrementIncrement = 1;
// this is used to make c3p0 library happy
@VariableMgr.VarAttr(name = QUERY_CACHE_TYPE)
private int queryCacheType = 0;
// The number of seconds the server waits for activity on an interactive connection before closing it
@VariableMgr.VarAttr(name = INTERACTIVE_TIMTOUT)
private int interactiveTimeout = 3600;
// The number of seconds the server waits for activity on a noninteractive connection before closing it.
@VariableMgr.VarAttr(name = WAIT_TIMEOUT)
private int waitTimeout = 28800;
// The number of seconds to wait for a block to be written to a connection before aborting the write
@VariableMgr.VarAttr(name = NET_WRITE_TIMEOUT)
private int netWriteTimeout = 60;
// The number of seconds to wait for a block to be written to a connection before aborting the write
@VariableMgr.VarAttr(name = NET_READ_TIMEOUT)
private int netReadTimeout = 60;
// The current time zone
@VariableMgr.VarAttr(name = TIME_ZONE)
private String timeZone = TimeUtils.getSystemTimeZone().getID();
@VariableMgr.VarAttr(name = PARALLEL_EXCHANGE_INSTANCE_NUM)
private int exchangeInstanceParallel = -1;
@VariableMgr.VarAttr(name = SQL_SAFE_UPDATES)
private int sqlSafeUpdates = 0;
// only
@VariableMgr.VarAttr(name = NET_BUFFER_LENGTH, flag = VariableMgr.READ_ONLY)
private int netBufferLength = 16384;
@VariableMgr.VarAttr(name = CHUNK_SIZE, flag = VariableMgr.INVISIBLE)
private int chunkSize = 4096;
public static final int PIPELINE_BATCH_SIZE = 4096;
@VariableMgr.VarAttr(name = DISABLE_STREAMING_PREAGGREGATIONS)
private boolean disableStreamPreaggregations = false;
@VariableMgr.VarAttr(name = STREAMING_PREAGGREGATION_MODE)
private String streamingPreaggregationMode = "auto"; // auto, force_streaming, force_preaggregation
@VariableMgr.VarAttr(name = DISABLE_COLOCATE_JOIN)
private boolean disableColocateJoin = false;
@VariableMgr.VarAttr(name = CBO_USE_CORRELATED_JOIN_ESTIMATE, flag = VariableMgr.INVISIBLE)
private boolean useCorrelatedJoinEstimate = true;
@VariableMgr.VarAttr(name = CBO_USE_NTH_EXEC_PLAN, flag = VariableMgr.INVISIBLE)
private int useNthExecPlan = 0;
@VarAttr(name = CBO_CTE_REUSE)
private boolean cboCteReuse = true;
@VarAttr(name = CBO_CTE_REUSE_RATE, flag = VariableMgr.INVISIBLE)
private double cboCTERuseRatio = 1.2;
@VarAttr(name = ENABLE_SQL_DIGEST, flag = VariableMgr.INVISIBLE)
private boolean enableSQLDigest = false;
/*
* the parallel exec instance num for one Fragment in one BE
* 1 means disable this feature
*/
@VariableMgr.VarAttr(name = PARALLEL_FRAGMENT_EXEC_INSTANCE_NUM)
private int parallelExecInstanceNum = 1;
@VariableMgr.VarAttr(name = PIPELINE_DOP)
private int pipelineDop = 0;
@VariableMgr.VarAttr(name = PIPELINE_PROFILE_LEVEL)
private int pipelineProfileLevel = 1;
@VariableMgr.VarAttr(name = RESOURCE_GROUP_ID, flag = VariableMgr.INVISIBLE)
private int resourceGroupId = 0;
@VariableMgr.VarAttr(name = ENABLE_INSERT_STRICT)
private boolean enableInsertStrict = true;
@VariableMgr.VarAttr(name = FORWARD_TO_MASTER)
private boolean forwardToMaster = false;
// compatible with some mysql client connect, say DataGrip of JetBrains
@VariableMgr.VarAttr(name = EVENT_SCHEDULER)
private String eventScheduler = "OFF";
@VariableMgr.VarAttr(name = STORAGE_ENGINE)
private String storageEngine = "olap";
@VariableMgr.VarAttr(name = DIV_PRECISION_INCREMENT)
private int divPrecisionIncrement = 4;
// -1 means unset, BE will use its config value
@VariableMgr.VarAttr(name = MAX_SCAN_KEY_NUM)
private int maxScanKeyNum = -1;
@VariableMgr.VarAttr(name = MAX_PUSHDOWN_CONDITIONS_PER_COLUMN)
private int maxPushdownConditionsPerColumn = -1;
@VariableMgr.VarAttr(name = HASH_JOIN_PUSH_DOWN_RIGHT_TABLE)
private boolean hashJoinPushDownRightTable = true;
@VariableMgr.VarAttr(name = DISABLE_JOIN_REORDER)
private boolean disableJoinReorder = false;
@VariableMgr.VarAttr(name = ENABLE_PREDICATE_REORDER)
private boolean enablePredicateReorder = false;
@VariableMgr.VarAttr(name = ENABLE_FILTER_UNUSED_COLUMNS_IN_SCAN_STAGE)
private boolean enableFilterUnusedColumnsInScanStage = false;
@VariableMgr.VarAttr(name = CBO_MAX_REORDER_NODE_USE_EXHAUSTIVE)
private int cboMaxReorderNodeUseExhaustive = 4;
@VariableMgr.VarAttr(name = CBO_MAX_REORDER_NODE, flag = VariableMgr.INVISIBLE)
private int cboMaxReorderNode = 50;
@VariableMgr.VarAttr(name = CBO_ENABLE_DP_JOIN_REORDER, flag = VariableMgr.INVISIBLE)
private boolean cboEnableDPJoinReorder = true;
@VariableMgr.VarAttr(name = CBO_MAX_REORDER_NODE_USE_DP)
private long cboMaxReorderNodeUseDP = 10;
@VariableMgr.VarAttr(name = CBO_ENABLE_GREEDY_JOIN_REORDER, flag = VariableMgr.INVISIBLE)
private boolean cboEnableGreedyJoinReorder = true;
@VariableMgr.VarAttr(name = TRANSACTION_VISIBLE_WAIT_TIMEOUT)
private long transactionVisibleWaitTimeout = 10;
@VariableMgr.VarAttr(name = FORCE_SCHEDULE_LOCAL)
private boolean forceScheduleLocal = false;
@VariableMgr.VarAttr(name = BROADCAST_ROW_LIMIT)
private long broadcastRowCountLimit = 15000000;
@VariableMgr.VarAttr(name = NEW_PLANNER_OPTIMIZER_TIMEOUT)
private long optimizerExecuteTimeout = 3000;
@VariableMgr.VarAttr(name = ENABLE_QUERY_DUMP)
private boolean enableQueryDump = false;
@VariableMgr.VarAttr(name = CBO_ENABLE_LOW_CARDINALITY_OPTIMIZE)
private boolean enableLowCardinalityOptimize = true;
// value should be 0~4
// 0 represents automatic selection, and 1, 2, 3, and 4 represent forced selection of AGG of
// corresponding stages respectively. However, stages 3 and 4 can only be generated in
// single-column distinct scenarios
@VariableMgr.VarAttr(name = NEW_PLANER_AGG_STAGE)
private int newPlannerAggStage = 0;
@VariableMgr.VarAttr(name = TRANSMISSION_COMPRESSION_TYPE)
private String transmissionCompressionType = "LZ4";
@VariableMgr.VarAttr(name = RUNTIME_JOIN_FILTER_PUSH_DOWN_LIMIT)
private long runtimeJoinFilterPushDownLimit = 1024000;
@VariableMgr.VarAttr(name = ENABLE_GLOBAL_RUNTIME_FILTER)
private boolean enableGlobalRuntimeFilter = true;
// Parameters to determine the usage of runtime filter
// Either the build_max or probe_min equal to 0 would force use the filter,
// otherwise would decide based on the cardinality
@VariableMgr.VarAttr(name = GLOBAL_RUNTIME_FILTER_BUILD_MAX_SIZE, flag = VariableMgr.INVISIBLE)
private long globalRuntimeFilterBuildMaxSize = 64 * 1024 * 1024;
@VariableMgr.VarAttr(name = GLOBAL_RUNTIME_FILTER_PROBE_MIN_SIZE, flag = VariableMgr.INVISIBLE)
private long globalRuntimeFilterProbeMinSize = 100 * 1024;
@VariableMgr.VarAttr(name = GLOBAL_RUNTIME_FILTER_PROBE_MIN_SELECTIVITY, flag = VariableMgr.INVISIBLE)
private float globalRuntimeFilterProbeMinSelectivity = 0.5f;
//In order to be compatible with the logic of the old planner,
//When the column name is the same as the alias name,
//the alias will be used as the groupby column if set to true.
@VariableMgr.VarAttr(name = ENABLE_GROUPBY_USE_OUTPUT_ALIAS)
private boolean enableGroupbyUseOutputAlias = false;
@VariableMgr.VarAttr(name = ENABLE_COLUMN_EXPR_PREDICATE)
private boolean enableColumnExprPredicate = false;
@VariableMgr.VarAttr(name = ENABLE_EXCHANGE_PASS_THROUGH, flag = VariableMgr.INVISIBLE)
private boolean enableExchangePassThrough = true;
@VariableMgr.VarAttr(name = ALLOW_DEFAULT_PARTITION, flag = VariableMgr.INVISIBLE)
private boolean allowDefaultPartition = false;
@VariableMgr.VarAttr(name = SINGLE_NODE_EXEC_PLAN, flag = VariableMgr.INVISIBLE)
private boolean singleNodeExecPlan = false;
@VariableMgr.VarAttr(name = ENABLE_HIVE_COLUMN_STATS)
private boolean enableHiveColumnStats = true;
@VariableMgr.VarAttr(name = JOIN_IMPLEMENTATION_MODE)
private String joinImplementationMode = "hash"; // auto, merge, hash
@VariableMgr.VarAttr(name = ENABLE_OPTIMIZER_TRACE_LOG, flag = VariableMgr.INVISIBLE)
private boolean enableOptimizerTraceLog = false;
@VariableMgr.VarAttr(name = ENABLE_QUERY_DEBUG_TRACE, flag = VariableMgr.INVISIBLE)
private boolean enableQueryDebugTrace = false;
@VarAttr(name = STATISTIC_COLLECT_PARALLEL)
private int statisticCollectParallelism = 1;
@VarAttr(name = ENABLE_SHOW_ALL_VARIABLES, flag = VariableMgr.INVISIBLE)
private boolean enableShowAllVariables = false;
@VarAttr(name = CBO_PRUNE_SHUFFLE_COLUMN_RATE, flag = VariableMgr.INVISIBLE)
private double cboPruneShuffleColumnRate = 0.1;
public double getCboPruneShuffleColumnRate() {
return cboPruneShuffleColumnRate;
}
public void setCboPruneShuffleColumnRate(double cboPruneShuffleColumnRate) {
this.cboPruneShuffleColumnRate = cboPruneShuffleColumnRate;
}
public boolean isEnableShowAllVariables() {
return enableShowAllVariables;
}
public void setEnableShowAllVariables(boolean enableShowAllVariables) {
this.enableShowAllVariables = enableShowAllVariables;
}
public int getStatisticCollectParallelism() {
return statisticCollectParallelism;
}
public int getUseComputeNodes() {
return useComputeNodes;
}
public void setUseComputeNodes(int useComputeNodes) {
this.useComputeNodes = useComputeNodes;
}
public boolean isPreferComputeNode() {
return preferComputeNode;
}
public void setPreferComputeNode(boolean preferComputeNode) {
this.preferComputeNode = preferComputeNode;
}
public boolean enableHiveColumnStats() {
return enableHiveColumnStats;
}
public long getMaxExecMemByte() {
return maxExecMemByte;
}
public long getLoadMemLimit() {
return loadMemLimit;
}
public int getQueryTimeoutS() {
return queryTimeoutS;
}
public boolean isReportSucc() {
return isReportSucc;
}
public void setReportSuccess(boolean isReportSuccess) {
this.isReportSucc = isReportSuccess;
}
public int getWaitTimeoutS() {
return waitTimeout;
}
public long getSqlMode() {
return sqlMode;
}
public void setSqlMode(long sqlMode) {
this.sqlMode = sqlMode;
}
public long getSqlSelectLimit() {
if (sqlSelectLimit < 0) {
return DEFAULT_SELECT_LIMIT;
}
return sqlSelectLimit;
}
public void setSqlSelectLimit(long limit) {
if (limit < 0) {
return;
}
this.sqlSelectLimit = limit;
}
public String getTimeZone() {
return timeZone;
}
public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}
public void setMaxExecMemByte(long maxExecMemByte) {
if (maxExecMemByte < MIN_EXEC_MEM_LIMIT) {
this.maxExecMemByte = MIN_EXEC_MEM_LIMIT;
} else {
this.maxExecMemByte = maxExecMemByte;
}
}
public void setLoadMemLimit(long loadMemLimit) {
this.loadMemLimit = loadMemLimit;
}
public void setQueryTimeoutS(int queryTimeoutS) {
this.queryTimeoutS = queryTimeoutS;
}
public String getResourceGroup() {
return resourceGroup;
}
public void setResourceGroup(String resourceGroup) {
this.resourceGroup = resourceGroup;
}
public boolean isDisableColocateJoin() {
return disableColocateJoin;
}
public int getParallelExecInstanceNum() {
return parallelExecInstanceNum;
}
// when pipeline engine is enabled
// in case of pipeline_dop > 0: return pipeline_dop * parallelExecInstanceNum;
// in case of pipeline_dop <= 0 and avgNumCores < 2: return 1;
// in case of pipeline_dop <= 0 and avgNumCores >=2; return avgNumCores/2;
public int getDegreeOfParallelism() {
if (enablePipelineEngine) {
if (pipelineDop > 0) {
return pipelineDop * parallelExecInstanceNum;
}
return BackendCoreStat.getDefaultDOP();
} else {
return parallelExecInstanceNum;
}
}
public void setParallelExecInstanceNum(int parallelExecInstanceNum) {
this.parallelExecInstanceNum = parallelExecInstanceNum;
}
public int getExchangeInstanceParallel() {
return exchangeInstanceParallel;
}
public boolean getEnableInsertStrict() {
return enableInsertStrict;
}
public void setEnableInsertStrict(boolean enableInsertStrict) {
this.enableInsertStrict = enableInsertStrict;
}
public boolean getForwardToMaster() {
return forwardToMaster;
}
public void setMaxScanKeyNum(int maxScanKeyNum) {
this.maxScanKeyNum = maxScanKeyNum;
}
public void setMaxPushdownConditionsPerColumn(int maxPushdownConditionsPerColumn) {
this.maxPushdownConditionsPerColumn = maxPushdownConditionsPerColumn;
}
public boolean isHashJoinPushDownRightTable() {
return this.hashJoinPushDownRightTable;
}
public String getStreamingPreaggregationMode() {
return streamingPreaggregationMode;
}
public boolean isDisableJoinReorder() {
return disableJoinReorder;
}
public void disableJoinReorder() {
this.disableJoinReorder = true;
}
public void enableJoinReorder() {
this.disableJoinReorder = false;
}
public boolean isEnablePredicateReorder() {
return enablePredicateReorder;
}
public void disablePredicateReorder() {
this.enablePredicateReorder = false;
}
public void enablePredicateReorder() {
this.enablePredicateReorder = true;
}
public boolean isAbleFilterUnusedColumnsInScanStage() {
return enableFilterUnusedColumnsInScanStage;
}
public void disableTrimOnlyFilteredColumnsInScanStage() {
this.enableFilterUnusedColumnsInScanStage = false;
}
public void enableTrimOnlyFilteredColumnsInScanStage() {
this.enableFilterUnusedColumnsInScanStage = true;
}
public boolean isCboEnableDPJoinReorder() {
return cboEnableDPJoinReorder;
}
public void disableDPJoinReorder() {
this.cboEnableDPJoinReorder = false;
}
public void enableDPJoinReorder() {
this.cboEnableDPJoinReorder = true;
}
public long getCboMaxReorderNodeUseDP() {
return cboMaxReorderNodeUseDP;
}
public boolean isCboEnableGreedyJoinReorder() {
return cboEnableGreedyJoinReorder;
}
public void disableGreedyJoinReorder() {
this.cboEnableGreedyJoinReorder = false;
}
public void enableGreedyJoinReorder() {
this.cboEnableGreedyJoinReorder = true;
}
public int getCboMaxReorderNode() {
return cboMaxReorderNode;
}
public long getTransactionVisibleWaitTimeout() {
return transactionVisibleWaitTimeout;
}
public boolean isForceScheduleLocal() {
return forceScheduleLocal;
}
public int getCboMaxReorderNodeUseExhaustive() {
return cboMaxReorderNodeUseExhaustive;
}
public int getNewPlannerAggStage() {
return newPlannerAggStage;
}
public void setNewPlanerAggStage(int stage) {
this.newPlannerAggStage = stage;
}
public void setMaxTransformReorderJoins(int maxReorderNodeUseExhaustive) {
this.cboMaxReorderNodeUseExhaustive = maxReorderNodeUseExhaustive;
}
public long getBroadcastRowCountLimit() {
return broadcastRowCountLimit;
}
public long getOptimizerExecuteTimeout() {
return optimizerExecuteTimeout;
}
public void setOptimizerExecuteTimeout(long optimizerExecuteTimeout) {
this.optimizerExecuteTimeout = optimizerExecuteTimeout;
}
public boolean getEnableGroupbyUseOutputAlias() {
return enableGroupbyUseOutputAlias;
}
public void setEnableGroupbyUseOutputAlias(boolean enableGroupbyUseOutputAlias) {
this.enableGroupbyUseOutputAlias = enableGroupbyUseOutputAlias;
}
public boolean getEnableQueryDump() {
return enableQueryDump;
}
public boolean getEnableGlobalRuntimeFilter() {
return enableGlobalRuntimeFilter;
}
public void setEnableGlobalRuntimeFilter(boolean value) {
enableGlobalRuntimeFilter = value;
}
public long getGlobalRuntimeFilterBuildMaxSize() {
return globalRuntimeFilterBuildMaxSize;
}
public long getGlobalRuntimeFilterProbeMinSize() {
return globalRuntimeFilterProbeMinSize;
}
public float getGlobalRuntimeFilterProbeMinSelectivity() {
return globalRuntimeFilterProbeMinSelectivity;
}
public boolean isEnableDeliverBatchFragments() {
return enableDeliverBatchFragments;
}
public boolean isEnablePipelineEngine() {
return enablePipelineEngine;
}
public boolean isPipelineDopAdaptionEnabled() {
return enablePipelineEngine && pipelineDop <= 0;
}
public void setEnablePipelineEngine(boolean enablePipelineEngine) {
this.enablePipelineEngine = enablePipelineEngine;
}
public boolean isEnableResourceGroup() {
return enableResourceGroup;
}
public void setEnableResourceGroup(boolean enableResourceGroup) {
this.enableResourceGroup = enableResourceGroup;
}
public void setPipelineDop(int pipelineDop) {
this.pipelineDop = pipelineDop;
}
public int getPipelineDop() {
return this.pipelineDop;
}
public boolean isEnableSharedScan() {
return enableSharedScan;
}
public int getResourceGroupId() {
return resourceGroupId;
}
public int getPipelineProfileLevel() {
return pipelineProfileLevel;
}
public boolean isEnableReplicationJoin() {
return false;
}
public boolean isSetUseNthExecPlan() {
return useNthExecPlan > 0;
}
public int getUseNthExecPlan() {
return useNthExecPlan;
}
public void setUseNthExecPlan(int nthExecPlan) {
this.useNthExecPlan = nthExecPlan;
}
public void setEnableReplicationJoin(boolean enableReplicationJoin) {
}
public boolean isUseCorrelatedJoinEstimate() {
return useCorrelatedJoinEstimate;
}
public void setUseCorrelatedJoinEstimate(boolean useCorrelatedJoinEstimate) {
this.useCorrelatedJoinEstimate = useCorrelatedJoinEstimate;
}
public boolean isEnableLowCardinalityOptimize() {
return enableLowCardinalityOptimize;
}
public void setEnableLowCardinalityOptimize(boolean enableLowCardinalityOptimize) {
this.enableLowCardinalityOptimize = enableLowCardinalityOptimize;
}
public boolean isEnableColumnExprPredicate() {
return enableColumnExprPredicate;
}
public boolean isEnableExchangePassThrough() {
return enableExchangePassThrough;
}
public boolean isAllowDefaultPartition() {
return allowDefaultPartition;
}
public void setAllowDefaultPartition(boolean allowDefaultPartition) {
this.allowDefaultPartition = allowDefaultPartition;
}
/**
* check cbo_cte_reuse && enable_pipeline
*/
public boolean isCboCteReuse() {
return cboCteReuse && enablePipelineEngine;
}
public void setCboCteReuse(boolean cboCteReuse) {
this.cboCteReuse = cboCteReuse;
}
public void setSingleNodeExecPlan(boolean singleNodeExecPlan) {
this.singleNodeExecPlan = singleNodeExecPlan;
}