#pragma once #include "counting_raw_reader.h" #include #include #include #include namespace NYT { namespace NDetail { //////////////////////////////////////////////////////////////////////////////// class TSkiffTableReader : public INodeReaderImpl { public: TSkiffTableReader( ::TIntrusivePtr input, const std::shared_ptr& schema); ~TSkiffTableReader() override; virtual const TNode& GetRow() const override; virtual void MoveRow(TNode* row) override; bool IsValid() const override; void Next() override; ui32 GetTableIndex() const override; ui32 GetRangeIndex() const override; ui64 GetRowIndex() const override; void NextKey() override; TMaybe GetReadByteCount() const override; bool IsRawReaderExhausted() const override; private: struct TSkiffTableSchema; private: void EnsureValidity() const; void ReadRow(); static TVector CreateSkiffTableSchemas(const std::shared_ptr& schema); private: NDetail::TCountingRawTableReader Input_; TBufferedInput BufferedInput_; std::optional Parser_; TVector Schemas_; TNode Row_; bool Valid_ = true; bool AfterKeySwitch_ = false; bool Finished_ = false; TMaybe RangeIndex_; ui64 RangeIndexShift_ = 0; TMaybe RowIndex_; ui32 TableIndex_ = 0; }; //////////////////////////////////////////////////////////////////////////////// } // namespace NDetail } // namespace NYT