aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/minikql/computation/mkql_block_transport.h
blob: bda06d5a496b97937719921b2c37c9e8af788f04 (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
#pragma once

#include <yql/essentials/minikql/mkql_node.h>

#include <yql/essentials/utils/chunked_buffer.h>

#include <arrow/datum.h>

#include <functional>
#include <memory>

namespace NKikimr::NMiniKQL {

class IBlockSerializer {
public:
    virtual ~IBlockSerializer() = default;

    virtual size_t ArrayMetadataCount() const = 0;

    using TMetadataSink = std::function<void(ui64 meta)>;
    virtual void StoreMetadata(const arrow::ArrayData& data, const TMetadataSink& metaSink) const = 0;
    virtual void StoreArray(const arrow::ArrayData& data, NYql::TChunkedBuffer& dst) const = 0;
};

class IBlockDeserializer {
public:
    virtual ~IBlockDeserializer() = default;

    using TMetadataSource = std::function<ui64()>;
    virtual void LoadMetadata(const TMetadataSource& metaSource) = 0;
    virtual std::shared_ptr<arrow::ArrayData> LoadArray(NYql::TChunkedBuffer& src, ui64 blockLen, ui64 offset) = 0;
};


std::unique_ptr<IBlockSerializer> MakeBlockSerializer(const NYql::NUdf::ITypeInfoHelper& typeInfoHelper, const NYql::NUdf::TType* type);
std::unique_ptr<IBlockDeserializer> MakeBlockDeserializer(const NYql::NUdf::ITypeInfoHelper& typeInfoHelper, const NYql::NUdf::TType* type);

}