aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Formats/TemporaryFileStreamLegacy.h
blob: 90e318c970aa44899e0045f26c16e8db70a6e49d (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
#pragma once

#include <Processors/ISource.h>
#include <QueryPipeline/QueryPipelineBuilder.h>
#include <Compression/CompressedReadBuffer.h>
#include <IO/ReadBufferFromFile.h>
#include <Formats/NativeReader.h>

namespace DB
{

/// Used only in MergeJoin
/// TODO: use `TemporaryDataOnDisk` instead
/// To read the data that was flushed into the temporary data file.
struct TemporaryFileStreamLegacy
{
    struct Stat
    {
        size_t compressed_bytes = 0;
        size_t uncompressed_bytes = 0;
    };

    ReadBufferFromFile file_in;
    CompressedReadBuffer compressed_in;
    std::unique_ptr<NativeReader> block_in;

    explicit TemporaryFileStreamLegacy(const std::string & path);
    TemporaryFileStreamLegacy(const std::string & path, const Block & header_);

    /// Flush data from input stream into file for future reading
    static Stat write(const std::string & path, const Block & header, QueryPipelineBuilder builder, const std::string & codec);
};

}