//===----------------------------------------------------------------------===// // DuckDB // // duckdb/planner/operator/logical_limit_percent.hpp // // //===----------------------------------------------------------------------===// #pragma once #include "duckdb/planner/logical_operator.hpp" namespace duckdb { //! LogicalLimitPercent represents a LIMIT PERCENT clause class LogicalLimitPercent : public LogicalOperator { public: static constexpr const LogicalOperatorType TYPE = LogicalOperatorType::LOGICAL_LIMIT_PERCENT; public: LogicalLimitPercent(double limit_percent, int64_t offset_val, unique_ptr limit, unique_ptr offset) : LogicalOperator(LogicalOperatorType::LOGICAL_LIMIT_PERCENT), limit_percent(limit_percent), offset_val(offset_val), limit(std::move(limit)), offset(std::move(offset)) { } //! Limit percent and offset values in case they are constants, used in optimizations. double limit_percent; int64_t offset_val; //! The maximum amount of elements to emit unique_ptr limit; //! The offset from the start to begin emitting elements unique_ptr offset; public: vector GetColumnBindings() override { return children[0]->GetColumnBindings(); } void Serialize(FieldWriter &writer) const override; static unique_ptr Deserialize(LogicalDeserializationState &state, FieldReader &reader); idx_t EstimateCardinality(ClientContext &context) override; protected: void ResolveTypes() override { types = children[0]->types; } }; } // namespace duckdb