-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
442 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/include/processor/operator/copy_to/csv_parquet_writer.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#pragma once | ||
|
||
#include "common/copier_config/copier_config.h" | ||
#include "processor/result/result_set.h" | ||
|
||
namespace kuzu { | ||
namespace processor { | ||
|
||
class CSVParquetWriter { | ||
public: | ||
virtual ~CSVParquetWriter(){}; | ||
virtual void open(const std::string& filePath) = 0; | ||
virtual void init() = 0; | ||
virtual void closeFile() = 0; | ||
virtual void writeValues(std::vector<common::ValueVector*>& outputVectors) = 0; | ||
|
||
// TODO (Rui): check setters and getters vs directly access | ||
inline void setColumns(const std::vector<std::string>& columnNames, | ||
const std::vector<common::LogicalTypeID>& columnTypes) { | ||
this->columnNames = columnNames; | ||
this->columnTypes = columnTypes; | ||
} | ||
inline std::vector<std::string>& getColumnNames() { return columnNames; } | ||
inline std::vector<common::LogicalTypeID>& getColumnTypes() { return columnTypes; } | ||
|
||
private: | ||
std::vector<std::string> columnNames; | ||
std::vector<common::LogicalTypeID> columnTypes; | ||
}; | ||
|
||
} // namespace processor | ||
} // namespace kuzu |
16 changes: 9 additions & 7 deletions
16
...cessor/operator/copy_to/csv_file_writer.h → ...e/processor/operator/copy_to/csv_writer.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#pragma once | ||
|
||
#include "arrow/io/file.h" | ||
#include "parquet/stream_writer.h" | ||
#include "processor/operator/copy_to/csv_parquet_writer.h" | ||
|
||
namespace kuzu { | ||
namespace processor { | ||
|
||
class ParquetWriter : public CSVParquetWriter { | ||
public: | ||
ParquetWriter(){}; | ||
// TODO (Rui): rename to openFile to not confuse with open syscall | ||
void open(const std::string& filePath) override; | ||
void init() override; | ||
void closeFile() override; | ||
void writeValues(std::vector<common::ValueVector*>& outputVectors) override; | ||
|
||
private: | ||
static std::shared_ptr<parquet::schema::Node> kuzuTypeToParquetType( | ||
std::string& columnName, common::LogicalTypeID& typeID, int length = -1); | ||
|
||
void streamWrite(common::ValueVector* vector); | ||
|
||
parquet::StreamWriter streamWriter; | ||
std::shared_ptr<arrow::io::FileOutputStream> outputStream; | ||
std::shared_ptr<arrow::io::FileOutputStream> outFile; | ||
std::shared_ptr<parquet::ParquetFileWriter> fileWriter; | ||
parquet::RowGroupWriter* rowWriter; | ||
}; | ||
|
||
} // namespace processor | ||
} // namespace kuzu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.