| 1 | //===----------------------------------------------------------------------===// |
|---|---|
| 2 | // DuckDB |
| 3 | // |
| 4 | // duckdb/parser/parsed_data/sample_options.hpp |
| 5 | // |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "duckdb/common/common.hpp" |
| 12 | #include "duckdb/parser/parsed_expression.hpp" |
| 13 | #include "duckdb/common/vector.hpp" |
| 14 | #include "duckdb/common/types/value.hpp" |
| 15 | |
| 16 | namespace duckdb { |
| 17 | |
| 18 | enum class SampleMethod : uint8_t { SYSTEM_SAMPLE = 0, BERNOULLI_SAMPLE = 1, RESERVOIR_SAMPLE = 2 }; |
| 19 | |
| 20 | // **DEPRECATED**: Use EnumUtil directly instead. |
| 21 | string SampleMethodToString(SampleMethod method); |
| 22 | |
| 23 | struct SampleOptions { |
| 24 | Value sample_size; |
| 25 | bool is_percentage; |
| 26 | SampleMethod method; |
| 27 | int64_t seed = -1; |
| 28 | |
| 29 | unique_ptr<SampleOptions> Copy(); |
| 30 | void Serialize(Serializer &serializer); |
| 31 | static unique_ptr<SampleOptions> Deserialize(Deserializer &source); |
| 32 | static bool Equals(SampleOptions *a, SampleOptions *b); |
| 33 | void FormatSerialize(FormatSerializer &serializer) const; |
| 34 | static unique_ptr<SampleOptions> FormatDeserialize(FormatDeserializer &deserializer); |
| 35 | }; |
| 36 | |
| 37 | } // namespace duckdb |
| 38 |