Coverage Report

Created: 2026-02-14 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/apps/gdalalg_vector_partition.h
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Project:  GDAL
4
 * Purpose:  "partition" step of "vector pipeline"
5
 * Author:   Even Rouault <even dot rouault at spatialys.com>
6
 *
7
 ******************************************************************************
8
 * Copyright (c) 2025, Even Rouault <even dot rouault at spatialys.com>
9
 *
10
 * SPDX-License-Identifier: MIT
11
 ****************************************************************************/
12
13
#ifndef GDALALG_VECTOR_PARTITION_INCLUDED
14
#define GDALALG_VECTOR_PARTITION_INCLUDED
15
16
#include "gdalalg_vector_pipeline.h"
17
18
//! @cond Doxygen_Suppress
19
20
/************************************************************************/
21
/*                     GDALVectorPartitionAlgorithm                     */
22
/************************************************************************/
23
24
class GDALVectorPartitionAlgorithm /* non final */
25
    : public GDALVectorPipelineStepAlgorithm
26
{
27
  public:
28
    static constexpr const char *NAME = "partition";
29
    static constexpr const char *DESCRIPTION =
30
        "Partition a vector dataset into multiple files.";
31
    static constexpr const char *HELP_URL =
32
        "/programs/gdal_vector_partition.html";
33
34
    explicit GDALVectorPartitionAlgorithm(bool standaloneStep = false);
35
36
    bool CanBeLastStep() const override
37
0
    {
38
0
        return true;
39
0
    }
40
41
    bool IsNativelyStreamingCompatible() const override
42
0
    {
43
0
        return false;
44
0
    }
45
46
    static constexpr const char *SCHEME_HIVE = "hive";
47
    static constexpr const char *SCHEME_FLAT = "flat";
48
49
  private:
50
    static ConstructorOptions GetConstructorOptions(bool standaloneStep);
51
    bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override;
52
    bool RunStep(GDALPipelineStepRunContext &ctxt) override;
53
54
    std::vector<std::string> m_fields{};
55
    int m_featureLimit = 0;
56
    std::string m_maxFileSizeStr{};
57
    GIntBig m_maxFileSize = 0;
58
    bool m_omitPartitionedFields = false;
59
    int m_maxCacheSize = 400;
60
    int m_transactionSize = 65536;
61
    std::string m_scheme = SCHEME_HIVE;
62
    std::string m_pattern{};
63
64
    // Computed
65
    bool m_partDigitLeadingZeroes = true;
66
    size_t m_partDigitCount = 10;
67
};
68
69
/************************************************************************/
70
/*                GDALVectorPartitionAlgorithmStandalone                */
71
/************************************************************************/
72
73
class GDALVectorPartitionAlgorithmStandalone final
74
    : public GDALVectorPartitionAlgorithm
75
{
76
  public:
77
    GDALVectorPartitionAlgorithmStandalone()
78
0
        : GDALVectorPartitionAlgorithm(/* standaloneStep = */ true)
79
0
    {
80
0
    }
81
82
    ~GDALVectorPartitionAlgorithmStandalone() override;
83
};
84
85
//! @endcond
86
87
#endif /* GDALALG_VECTOR_PARTITION_INCLUDED */