| 1 | //===----------------------------------------------------------------------===// |
| 2 | // DuckDB |
| 3 | // |
| 4 | // duckdb/main/client_config.hpp |
| 5 | // |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "duckdb/common/case_insensitive_map.hpp" |
| 12 | #include "duckdb/common/common.hpp" |
| 13 | #include "duckdb/common/enums/output_type.hpp" |
| 14 | #include "duckdb/common/enums/profiler_format.hpp" |
| 15 | #include "duckdb/common/types/value.hpp" |
| 16 | #include "duckdb/common/progress_bar/progress_bar.hpp" |
| 17 | |
| 18 | namespace duckdb { |
| 19 | class ClientContext; |
| 20 | class PhysicalResultCollector; |
| 21 | class PreparedStatementData; |
| 22 | |
| 23 | typedef std::function<unique_ptr<PhysicalResultCollector>(ClientContext &context, PreparedStatementData &data)> |
| 24 | get_result_collector_t; |
| 25 | |
| 26 | struct ClientConfig { |
| 27 | //! The home directory used by the system (if any) |
| 28 | string home_directory; |
| 29 | //! If the query profiler is enabled or not. |
| 30 | bool enable_profiler = false; |
| 31 | //! If detailed query profiling is enabled |
| 32 | bool enable_detailed_profiling = false; |
| 33 | //! The format to print query profiling information in (default: query_tree), if enabled. |
| 34 | ProfilerPrintFormat profiler_print_format = ProfilerPrintFormat::QUERY_TREE; |
| 35 | //! The file to save query profiling information to, instead of printing it to the console |
| 36 | //! (empty = print to console) |
| 37 | string profiler_save_location; |
| 38 | |
| 39 | //! Allows suppressing profiler output, even if enabled. We turn on the profiler on all test runs but don't want |
| 40 | //! to output anything |
| 41 | bool emit_profiler_output = true; |
| 42 | |
| 43 | //! system-wide progress bar disable. |
| 44 | const char *system_progress_bar_disable_reason = nullptr; |
| 45 | //! If the progress bar is enabled or not. |
| 46 | bool enable_progress_bar = false; |
| 47 | //! If the print of the progress bar is enabled |
| 48 | bool print_progress_bar = true; |
| 49 | //! The wait time before showing the progress bar |
| 50 | int wait_time = 2000; |
| 51 | |
| 52 | //! Preserve identifier case while parsing. |
| 53 | //! If false, all unquoted identifiers are lower-cased (e.g. "MyTable" -> "mytable"). |
| 54 | bool preserve_identifier_case = true; |
| 55 | //! The maximum expression depth limit in the parser |
| 56 | idx_t max_expression_depth = 1000; |
| 57 | |
| 58 | //! Whether or not aggressive query verification is enabled |
| 59 | bool query_verification_enabled = false; |
| 60 | //! Whether or not verification of external operators is enabled, used for testing |
| 61 | bool verify_external = false; |
| 62 | //! Whether or not we should verify the serializer |
| 63 | bool verify_serializer = false; |
| 64 | //! Enable the running of optimizers |
| 65 | bool enable_optimizer = true; |
| 66 | //! Enable caching operators |
| 67 | bool enable_caching_operators = true; |
| 68 | //! Force parallelism of small tables, used for testing |
| 69 | bool verify_parallelism = false; |
| 70 | //! Force index join independent of table cardinality, used for testing |
| 71 | bool force_index_join = false; |
| 72 | //! Force out-of-core computation for operators that support it, used for testing |
| 73 | bool force_external = false; |
| 74 | //! Force disable cross product generation when hyper graph isn't connected, used for testing |
| 75 | bool force_no_cross_product = false; |
| 76 | //! Force use of IEJoin to implement AsOfJoin, used for testing |
| 77 | bool force_asof_iejoin = false; |
| 78 | //! If this context should also try to use the available replacement scans |
| 79 | //! True by default |
| 80 | bool use_replacement_scans = true; |
| 81 | //! Maximum bits allowed for using a perfect hash table (i.e. the perfect HT can hold up to 2^perfect_ht_threshold |
| 82 | //! elements) |
| 83 | idx_t perfect_ht_threshold = 12; |
| 84 | //! The maximum number of rows to accumulate before sorting ordered aggregates. |
| 85 | idx_t ordered_aggregate_threshold = (idx_t(1) << 18); |
| 86 | |
| 87 | //! Callback to create a progress bar display |
| 88 | progress_bar_display_create_func_t display_create_func = nullptr; |
| 89 | |
| 90 | //! Override for the default extension repository |
| 91 | string custom_extension_repo = "" ; |
| 92 | |
| 93 | //! The explain output type used when none is specified (default: PHYSICAL_ONLY) |
| 94 | ExplainOutputType explain_output_type = ExplainOutputType::PHYSICAL_ONLY; |
| 95 | |
| 96 | //! The maximum amount of pivot columns |
| 97 | idx_t pivot_limit = 100000; |
| 98 | |
| 99 | //! Whether or not the "/" division operator defaults to integer division or floating point division |
| 100 | bool integer_division = false; |
| 101 | |
| 102 | //! Generic options |
| 103 | case_insensitive_map_t<Value> set_variables; |
| 104 | |
| 105 | //! Function that is used to create the result collector for a materialized result |
| 106 | //! Defaults to PhysicalMaterializedCollector |
| 107 | get_result_collector_t result_collector = nullptr; |
| 108 | |
| 109 | public: |
| 110 | static ClientConfig &GetConfig(ClientContext &context); |
| 111 | static const ClientConfig &GetConfig(const ClientContext &context); |
| 112 | |
| 113 | string () const; |
| 114 | |
| 115 | bool AnyVerification() { |
| 116 | return query_verification_enabled || verify_external || verify_serializer; |
| 117 | } |
| 118 | }; |
| 119 | |
| 120 | } // namespace duckdb |
| 121 | |