Modifiers that can be used for table, table function and subquery in JOIN TREE. * * Example: SELECT * FROM test_table SAMPLE 0.1 OFFSET 0.1 FINAL */
| 15 | * Example: SELECT * FROM test_table SAMPLE 0.1 OFFSET 0.1 FINAL |
| 16 | */ |
| 17 | class TableExpressionModifiers |
| 18 | { |
| 19 | public: |
| 20 | using Rational = ASTSampleRatio::Rational; |
| 21 | |
| 22 | struct StreamSettings |
| 23 | { |
| 24 | /// Null means "no cursor" (read from the beginning of the table). |
| 25 | CursorTreeNodePtr cursor_tree; |
| 26 | }; |
| 27 | |
| 28 | TableExpressionModifiers() = default; |
| 29 | TableExpressionModifiers(bool has_final_, |
| 30 | std::optional<Rational> sample_size_ratio_, |
| 31 | std::optional<Rational> sample_offset_ratio_, |
| 32 | std::optional<StreamSettings> stream_settings_ = {}) |
| 33 | : has_final(has_final_) |
| 34 | , sample_size_ratio(sample_size_ratio_) |
| 35 | , sample_offset_ratio(sample_offset_ratio_) |
| 36 | , stream_settings(std::move(stream_settings_)) |
| 37 | {} |
| 38 | |
| 39 | /// Returns true if final is specified, false otherwise |
| 40 | bool hasFinal() const |
| 41 | { |
| 42 | return has_final; |
| 43 | } |
| 44 | |
| 45 | /// Set has final value |
| 46 | void setHasFinal(bool value) |
| 47 | { |
| 48 | has_final = value; |
| 49 | } |
| 50 | |
| 51 | /// Returns true if sample size ratio is specified, false otherwise |
| 52 | bool hasSampleSizeRatio() const |
| 53 | { |
| 54 | return sample_size_ratio.has_value(); |
| 55 | } |
| 56 | |
| 57 | /// Get sample size ratio |
| 58 | std::optional<Rational> getSampleSizeRatio() const |
| 59 | { |
| 60 | return sample_size_ratio; |
| 61 | } |
| 62 | |
| 63 | /// Returns true if sample offset ratio is specified, false otherwise |
| 64 | bool hasSampleOffsetRatio() const |
| 65 | { |
| 66 | return sample_offset_ratio.has_value(); |
| 67 | } |
| 68 | |
| 69 | /// Get sample offset ratio |
| 70 | std::optional<Rational> getSampleOffsetRatio() const |
| 71 | { |
| 72 | return sample_offset_ratio; |
| 73 | } |
| 74 |
no outgoing calls
no test coverage detected