aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Storages/MergeTree/MergeTreeIOSettings.h
blob: dbe5d893444f71cc58f6e0aa75add5ff9b960582 (plain) (blame)
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
#pragma once
#include <cstddef>
#include <Core/Settings.h>
#include <Storages/MergeTree/MergeTreeSettings.h>
#include <IO/WriteSettings.h>
#include <Compression/CompressionFactory.h>
#include <Compression/ICompressionCodec.h>


namespace DB
{

class MMappedFileCache;
using MMappedFileCachePtr = std::shared_ptr<MMappedFileCache>;


struct MergeTreeReaderSettings
{
    /// Common read settings.
    ReadSettings read_settings;
    /// If save_marks_in_cache is false, then, if marks are not in cache,
    ///  we will load them but won't save in the cache, to avoid evicting other data.
    bool save_marks_in_cache = false;
    /// Validate checksums on reading (should be always enabled in production).
    bool checksum_on_read = true;
    /// True if we read in order of sorting key.
    bool read_in_order = false;
    /// Deleted mask is applied to all reads except internal select from mutate some part columns.
    bool apply_deleted_mask = true;
    /// Put reading task in a common I/O pool, return Async state on prepare()
    bool use_asynchronous_read_from_pool = false;
    /// If PREWHERE has multiple conditions combined with AND, execute them in separate read/filtering steps.
    bool enable_multiple_prewhere_read_steps = false;
};

struct MergeTreeWriterSettings
{
    MergeTreeWriterSettings() = default;

    MergeTreeWriterSettings(
        const Settings & global_settings,
        const WriteSettings & query_write_settings_,
        const MergeTreeSettingsPtr & storage_settings,
        bool can_use_adaptive_granularity_,
        bool rewrite_primary_key_,
        bool blocks_are_granules_size_ = false)
        : min_compress_block_size(
            storage_settings->min_compress_block_size ? storage_settings->min_compress_block_size : global_settings.min_compress_block_size)
        , max_compress_block_size(
              storage_settings->max_compress_block_size ? storage_settings->max_compress_block_size
                                                        : global_settings.max_compress_block_size)
        , marks_compression_codec(storage_settings->marks_compression_codec)
        , marks_compress_block_size(storage_settings->marks_compress_block_size)
        , compress_primary_key(storage_settings->compress_primary_key)
        , primary_key_compression_codec(storage_settings->primary_key_compression_codec)
        , primary_key_compress_block_size(storage_settings->primary_key_compress_block_size)
        , can_use_adaptive_granularity(can_use_adaptive_granularity_)
        , rewrite_primary_key(rewrite_primary_key_)
        , blocks_are_granules_size(blocks_are_granules_size_)
        , query_write_settings(query_write_settings_)
    {
    }

    size_t min_compress_block_size;
    size_t max_compress_block_size;

    String marks_compression_codec;
    size_t marks_compress_block_size;

    bool compress_primary_key;
    String primary_key_compression_codec;
    size_t primary_key_compress_block_size;

    bool can_use_adaptive_granularity;
    bool rewrite_primary_key;
    bool blocks_are_granules_size;
    WriteSettings query_write_settings;
};

}