26 #include "graphar/fwd.h"
27 #include "graphar/writer_util.h"
70 const std::shared_ptr<VertexInfo>& vertex_info,
const std::string& prefix,
71 const ValidateLevel& validate_level = ValidateLevel::no_validate);
79 if (validate_level == ValidateLevel::default_validate) {
82 validate_level_ = validate_level;
102 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
116 const std::shared_ptr<arrow::Table>& input_table,
117 const std::shared_ptr<PropertyGroup>& property_group, IdType chunk_index,
118 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
131 const std::shared_ptr<arrow::Table>& input_table, IdType chunk_index,
132 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
146 const std::shared_ptr<arrow::Table>& input_table,
147 const std::shared_ptr<PropertyGroup>& property_group,
148 IdType start_chunk_index,
149 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
162 const std::shared_ptr<arrow::Table>& input_table,
163 IdType start_chunk_index,
164 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
174 static Result<std::shared_ptr<VertexPropertyWriter>>
Make(
175 const std::shared_ptr<VertexInfo>& vertex_info,
const std::string& prefix,
176 const ValidateLevel& validate_level = ValidateLevel::no_validate);
186 static Result<std::shared_ptr<VertexPropertyWriter>>
Make(
187 const std::shared_ptr<GraphInfo>& graph_info,
const std::string& label,
188 const ValidateLevel& validate_level = ValidateLevel::no_validate);
198 Status validate(
const IdType& count, ValidateLevel validate_level)
const;
208 Status validate(
const std::shared_ptr<PropertyGroup>& property_group,
209 IdType chunk_index, ValidateLevel validate_level)
const;
220 Status validate(
const std::shared_ptr<arrow::Table>& input_table,
221 const std::shared_ptr<PropertyGroup>& property_group,
222 IdType chunk_index, ValidateLevel validate_level)
const;
224 Result<std::shared_ptr<arrow::Table>> addIndexColumn(
225 const std::shared_ptr<arrow::Table>& table, IdType chunk_index,
226 IdType chunk_size)
const;
229 std::shared_ptr<VertexInfo> vertex_info_;
231 std::shared_ptr<FileSystem> fs_;
232 ValidateLevel validate_level_;
271 const std::shared_ptr<EdgeInfo>& edge_info,
const std::string& prefix,
272 AdjListType adj_list_type,
273 const ValidateLevel& validate_level = ValidateLevel::no_validate);
281 if (validate_level == ValidateLevel::default_validate) {
284 validate_level_ = validate_level;
304 IdType vertex_chunk_index,
const IdType& count,
305 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
317 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
329 const std::shared_ptr<arrow::Table>& input_table,
330 IdType vertex_chunk_index,
331 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
344 const std::shared_ptr<arrow::Table>& input_table,
345 IdType vertex_chunk_index, IdType chunk_index,
346 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
360 const std::shared_ptr<arrow::Table>& input_table,
361 const std::shared_ptr<PropertyGroup>& property_group,
362 IdType vertex_chunk_index, IdType chunk_index,
363 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
376 const std::shared_ptr<arrow::Table>& input_table,
377 IdType vertex_chunk_index, IdType chunk_index,
378 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
391 const std::shared_ptr<arrow::Table>& input_table,
392 IdType vertex_chunk_index, IdType chunk_index,
393 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
407 const std::shared_ptr<arrow::Table>& input_table,
408 IdType vertex_chunk_index, IdType start_chunk_index = 0,
409 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
425 const std::shared_ptr<arrow::Table>& input_table,
426 const std::shared_ptr<PropertyGroup>& property_group,
427 IdType vertex_chunk_index, IdType start_chunk_index = 0,
428 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
443 const std::shared_ptr<arrow::Table>& input_table,
444 IdType vertex_chunk_index, IdType start_chunk_index = 0,
445 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
460 const std::shared_ptr<arrow::Table>& input_table,
461 IdType vertex_chunk_index, IdType start_chunk_index = 0,
462 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
477 const std::shared_ptr<arrow::Table>& input_table,
478 IdType vertex_chunk_index, IdType start_chunk_index = 0,
479 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
495 const std::shared_ptr<arrow::Table>& input_table,
496 const std::shared_ptr<PropertyGroup>& property_group,
497 IdType vertex_chunk_index, IdType start_chunk_index = 0,
498 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
513 const std::shared_ptr<arrow::Table>& input_table,
514 IdType vertex_chunk_index, IdType start_chunk_index = 0,
515 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
530 const std::shared_ptr<arrow::Table>& input_table,
531 IdType vertex_chunk_index, IdType start_chunk_index = 0,
532 ValidateLevel validate_level = ValidateLevel::default_validate)
const;
543 static Result<std::shared_ptr<EdgeChunkWriter>>
Make(
544 const std::shared_ptr<EdgeInfo>& edge_info,
const std::string& prefix,
545 AdjListType adj_list_type,
546 const ValidateLevel& validate_level = ValidateLevel::no_validate);
559 static Result<std::shared_ptr<EdgeChunkWriter>>
Make(
560 const std::shared_ptr<GraphInfo>& graph_info,
561 const std::string& src_label,
const std::string& edge_label,
562 const std::string& dst_label, AdjListType adj_list_type,
563 const ValidateLevel& validate_level = ValidateLevel::no_validate);
575 Status validate(IdType count_or_index1, IdType count_or_index2,
576 ValidateLevel validate_level)
const;
588 Status validate(
const std::shared_ptr<PropertyGroup>& property_group,
589 IdType vertex_chunk_index, IdType chunk_index,
590 ValidateLevel validate_level)
const;
601 Status validate(
const std::shared_ptr<arrow::Table>& input_table,
602 IdType vertex_chunk_index,
603 ValidateLevel validate_level)
const;
615 Status validate(
const std::shared_ptr<arrow::Table>& input_table,
616 IdType vertex_chunk_index, IdType chunk_index,
617 ValidateLevel validate_level)
const;
630 Status validate(
const std::shared_ptr<arrow::Table>& input_table,
631 const std::shared_ptr<PropertyGroup>& property_group,
632 IdType vertex_chunk_index, IdType chunk_index,
633 ValidateLevel validate_level)
const;
642 Result<std::shared_ptr<arrow::Table>> getOffsetTable(
643 const std::shared_ptr<arrow::Table>& input_table,
644 const std::string& column_name, IdType vertex_chunk_index)
const;
652 static std::string getSortColumnName(AdjListType adj_list_type);
661 static Result<std::shared_ptr<arrow::Table>> sortTable(
662 const std::shared_ptr<arrow::Table>& input_table,
663 const std::string& column_name);
666 std::shared_ptr<EdgeInfo> edge_info_;
667 IdType vertex_chunk_size_;
669 AdjListType adj_list_type_;
671 std::shared_ptr<FileSystem> fs_;
672 ValidateLevel validate_level_;
The writer for edge (adj list, offset and property group) chunks.
void SetValidateLevel(const ValidateLevel &validate_level)
Set the validate level.
Status WritePropertyChunk(const std::shared_ptr< arrow::Table > &input_table, const std::shared_ptr< PropertyGroup > &property_group, IdType vertex_chunk_index, IdType chunk_index, ValidateLevel validate_level=ValidateLevel::default_validate) const
Validate and write a single edge property group for an edge chunk.
Status SortAndWriteAdjListTable(const std::shared_ptr< arrow::Table > &input_table, IdType vertex_chunk_index, IdType start_chunk_index=0, ValidateLevel validate_level=ValidateLevel::default_validate) const
Sort the edges, and write the adj list chunks for the edges of a vertex chunk.
Status WriteAdjListTable(const std::shared_ptr< arrow::Table > &input_table, IdType vertex_chunk_index, IdType start_chunk_index=0, ValidateLevel validate_level=ValidateLevel::default_validate) const
Write the adj list chunks for the edges of a vertex chunk.
Status WritePropertyTable(const std::shared_ptr< arrow::Table > &input_table, const std::shared_ptr< PropertyGroup > &property_group, IdType vertex_chunk_index, IdType start_chunk_index=0, ValidateLevel validate_level=ValidateLevel::default_validate) const
Write chunks of a single property group for the edges of a vertex chunk.
EdgeChunkWriter(const std::shared_ptr< EdgeInfo > &edge_info, const std::string &prefix, AdjListType adj_list_type, const ValidateLevel &validate_level=ValidateLevel::no_validate)
Initialize the EdgeChunkWriter.
static Result< std::shared_ptr< EdgeChunkWriter > > Make(const std::shared_ptr< EdgeInfo > &edge_info, const std::string &prefix, AdjListType adj_list_type, const ValidateLevel &validate_level=ValidateLevel::no_validate)
Construct an EdgeChunkWriter from edge info.
Status WriteOffsetChunk(const std::shared_ptr< arrow::Table > &input_table, IdType vertex_chunk_index, ValidateLevel validate_level=ValidateLevel::default_validate) const
Validate and write the offset chunk for a vertex chunk.
Status WriteChunk(const std::shared_ptr< arrow::Table > &input_table, IdType vertex_chunk_index, IdType chunk_index, ValidateLevel validate_level=ValidateLevel::default_validate) const
Write the adj list and all property groups for an edge chunk.
Status SortAndWriteTable(const std::shared_ptr< arrow::Table > &input_table, IdType vertex_chunk_index, IdType start_chunk_index=0, ValidateLevel validate_level=ValidateLevel::default_validate) const
Sort the edges, and write chunks of the adj list and all property groups for the edges of a vertex ch...
Status SortAndWritePropertyTable(const std::shared_ptr< arrow::Table > &input_table, const std::shared_ptr< PropertyGroup > &property_group, IdType vertex_chunk_index, IdType start_chunk_index=0, ValidateLevel validate_level=ValidateLevel::default_validate) const
Sort the edges, and write chunks of a single property group for the edges of a vertex chunk.
Status WriteAdjListChunk(const std::shared_ptr< arrow::Table > &input_table, IdType vertex_chunk_index, IdType chunk_index, ValidateLevel validate_level=ValidateLevel::default_validate) const
Validate and write the adj list chunk for an edge chunk.
Status WriteEdgesNum(IdType vertex_chunk_index, const IdType &count, ValidateLevel validate_level=ValidateLevel::default_validate) const
Write the number of edges into the file.
Status WriteTable(const std::shared_ptr< arrow::Table > &input_table, IdType vertex_chunk_index, IdType start_chunk_index=0, ValidateLevel validate_level=ValidateLevel::default_validate) const
Write chunks of the adj list and all property groups for the edges of a vertex chunk.
ValidateLevel GetValidateLevel() const
Get the validate level.
Status WriteVerticesNum(const IdType &count, ValidateLevel validate_level=ValidateLevel::default_validate) const
Write the number of vertices into the file.
Status outcome object (success or error)
The writer for vertex property group chunks.
VertexPropertyWriter(const std::shared_ptr< VertexInfo > &vertex_info, const std::string &prefix, const ValidateLevel &validate_level=ValidateLevel::no_validate)
Initialize the VertexPropertyWriter.
ValidateLevel GetValidateLevel() const
Get the validate level.
Status WriteChunk(const std::shared_ptr< arrow::Table > &input_table, const std::shared_ptr< PropertyGroup > &property_group, IdType chunk_index, ValidateLevel validate_level=ValidateLevel::default_validate) const
Validate and write a single property group for a single vertex chunk.
void SetValidateLevel(const ValidateLevel &validate_level)
Set the validate level.
Status WriteVerticesNum(const IdType &count, ValidateLevel validate_level=ValidateLevel::default_validate) const
Write the number of vertices into the file.
Status WriteTable(const std::shared_ptr< arrow::Table > &input_table, const std::shared_ptr< PropertyGroup > &property_group, IdType start_chunk_index, ValidateLevel validate_level=ValidateLevel::default_validate) const
Write a single property group for multiple vertex chunks to corresponding files.
static Result< std::shared_ptr< VertexPropertyWriter > > Make(const std::shared_ptr< VertexInfo > &vertex_info, const std::string &prefix, const ValidateLevel &validate_level=ValidateLevel::no_validate)
Construct a VertexPropertyWriter from vertex info.