#pragma once #include "binder/binder.h" #include "binder/bound_statement.h" #include "binder/query/bound_regular_query.h" #include "common/copier_config/file_scan_info.h" namespace lbug { namespace binder { struct ExportedTableData { std::string tableName; std::string fileName; // True for CSR indptr tables, which are computed (prefix-summed) rather than // plain-copied, and need the dedicated indptr export function in the planner. bool isIndptr = false; std::unique_ptr regularQuery; std::vector columnNames; std::vector columnTypes; const std::vector& getColumnTypesRef() const { return columnTypes; } const BoundRegularQuery* getRegularQuery() const { return regularQuery.get(); } }; class BoundExportDatabase final : public BoundStatement { static constexpr common::StatementType type_ = common::StatementType::EXPORT_DATABASE; public: BoundExportDatabase(std::string filePath, common::FileTypeInfo fileTypeInfo, std::vector exportData, common::case_insensitive_map_t csvOption, bool schemaOnly) : BoundStatement{type_, BoundStatementResult::createSingleStringColumnResult()}, exportData(std::move(exportData)), boundFileInfo(std::move(fileTypeInfo), std::vector{std::move(filePath)}), schemaOnly{schemaOnly} { boundFileInfo.options = std::move(csvOption); } std::string getFilePath() const { return boundFileInfo.filePaths[0]; } common::FileType getFileType() const { return boundFileInfo.fileTypeInfo.fileType; } common::case_insensitive_map_t getExportOptions() const { return boundFileInfo.options; } const common::FileScanInfo* getBoundFileInfo() const { return &boundFileInfo; } const std::vector* getExportData() const { return &exportData; } bool exportSchemaOnly() const { return schemaOnly; } private: std::vector exportData; common::FileScanInfo boundFileInfo; bool schemaOnly; }; } // namespace binder } // namespace lbug