Apache GraphAr C++ Library
The C++ Library for Apache GraphAr
Public Member Functions | Static Public Member Functions | List of all members
graphar::EdgeChunkWriter Class Reference

The writer for edge (adj list, offset and property group) chunks. More...

#include <chunk_writer.h>

Public Member Functions

 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. More...
 
void SetValidateLevel (const ValidateLevel &validate_level)
 Set the validate level. More...
 
ValidateLevel GetValidateLevel () const
 Get the validate level. More...
 
Status WriteEdgesNum (IdType vertex_chunk_index, const IdType &count, ValidateLevel validate_level=ValidateLevel::default_validate) const
 Write the number of edges into the file. More...
 
Status WriteVerticesNum (const IdType &count, ValidateLevel validate_level=ValidateLevel::default_validate) const
 Write the number of vertices into the file. More...
 
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. More...
 
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. More...
 
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. More...
 
Status WritePropertyChunk (const std::shared_ptr< arrow::Table > &input_table, IdType vertex_chunk_index, IdType chunk_index, ValidateLevel validate_level=ValidateLevel::default_validate) const
 Write all edge property groups for an edge chunk. More...
 
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. More...
 
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. More...
 
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. More...
 
Status WritePropertyTable (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 all property groups for the edges of a vertex chunk. More...
 
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. More...
 
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. More...
 
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. More...
 
Status SortAndWritePropertyTable (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 all property groups for the edges of a vertex chunk. More...
 
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 chunk. More...
 

Static Public Member Functions

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. More...
 
static Result< std::shared_ptr< EdgeChunkWriter > > Make (const std::shared_ptr< GraphInfo > &graph_info, const std::string &src_label, const std::string &edge_label, const std::string &dst_label, AdjListType adj_list_type, const ValidateLevel &validate_level=ValidateLevel::no_validate)
 Construct an EdgeChunkWriter from graph info and edge label. More...
 

Detailed Description

The writer for edge (adj list, offset and property group) chunks.

Notes: For each writing operation, a validate_level could be set, which will be used to validate the data before writing. The validate_level could be:

ValidateLevel::default_validate: to use the validate_level of the writer, which set through the constructor or the SetValidateLevel method;

ValidateLevel::no_validate: without validation;

ValidateLevel::weak_validate: to validate if the vertex/edge count or vertex/edge chunk index is non-negative, the adj_list type is valid, the property group exists and the size of input_table is not larger than the chunk size;

ValidateLevel::strong_validate: besides weak_validate, also validate the schema of input_table is consistent with that of property group; for writing operations without input_table, such as writing vertices/edges number or copying file, the strong_validate is same as weak_validate.

Definition at line 257 of file chunk_writer.h.

Constructor & Destructor Documentation

◆ EdgeChunkWriter()

graphar::EdgeChunkWriter::EdgeChunkWriter ( const std::shared_ptr< EdgeInfo > &  edge_info,
const std::string &  prefix,
AdjListType  adj_list_type,
const ValidateLevel &  validate_level = ValidateLevel::no_validate 
)
explicit

Initialize the EdgeChunkWriter.

Parameters
edge_infoThe edge info that describes the edge type.
prefixThe absolute prefix.
adj_list_typeThe adj list type for the edges.
validate_levelThe global validate level for the writer, with no validate by default. It could be ValidateLevel::no_validate, ValidateLevel::weak_validate or ValidateLevel::strong_validate, but could not be ValidateLevel::default_validate.

Definition at line 333 of file chunk_writer.cc.

Member Function Documentation

◆ GetValidateLevel()

ValidateLevel graphar::EdgeChunkWriter::GetValidateLevel ( ) const
inline

Get the validate level.

Returns
The validate level of this writer.

Definition at line 292 of file chunk_writer.h.

◆ Make() [1/2]

Result< std::shared_ptr< EdgeChunkWriter > > graphar::EdgeChunkWriter::Make ( const std::shared_ptr< EdgeInfo > &  edge_info,
const std::string &  prefix,
AdjListType  adj_list_type,
const ValidateLevel &  validate_level = ValidateLevel::no_validate 
)
static

Construct an EdgeChunkWriter from edge info.

Parameters
edge_infoThe edge info that describes the edge type.
prefixThe absolute prefix.
adj_list_typeThe adj list type for the edges.
validate_levelThe global validate level for the writer, default is no_validate.

Definition at line 881 of file chunk_writer.cc.

◆ Make() [2/2]

Result< std::shared_ptr< EdgeChunkWriter > > graphar::EdgeChunkWriter::Make ( const std::shared_ptr< GraphInfo > &  graph_info,
const std::string &  src_label,
const std::string &  edge_label,
const std::string &  dst_label,
AdjListType  adj_list_type,
const ValidateLevel &  validate_level = ValidateLevel::no_validate 
)
static

Construct an EdgeChunkWriter from graph info and edge label.

Parameters
graph_infoThe graph info that describes the graph.
src_labelThe source vertex label.
edge_labelThe edge label.
dst_labelThe destination vertex label.
adj_list_typeThe adj list type for the edges.
validate_levelThe global validate level for the writer, default is no_validate.

Definition at line 893 of file chunk_writer.cc.

◆ SetValidateLevel()

void graphar::EdgeChunkWriter::SetValidateLevel ( const ValidateLevel &  validate_level)
inline

Set the validate level.

Parameters
validate_levelThe validate level to set.

Definition at line 280 of file chunk_writer.h.

◆ SortAndWriteAdjListTable()

Status graphar::EdgeChunkWriter::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.

Parameters
input_tableThe table containing data.
vertex_chunk_indexThe index of the vertex chunk.
start_chunk_indexThe start index of the edge chunks inside the vertex chunk.
validate_levelThe validate level for this operation, which is the writer's validate level by default.
Returns
Status: ok or error.

Definition at line 742 of file chunk_writer.cc.

◆ SortAndWritePropertyTable() [1/2]

Status graphar::EdgeChunkWriter::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.

Parameters
input_tableThe table containing data.
property_groupThe property group to write.
vertex_chunk_indexThe index of the vertex chunk.
start_chunk_indexThe start index of the edge chunks inside the vertex chunk.
validate_levelThe validate level for this operation, which is the writer's validate level by default.
Returns
Status: ok or error.

Definition at line 761 of file chunk_writer.cc.

◆ SortAndWritePropertyTable() [2/2]

Status graphar::EdgeChunkWriter::SortAndWritePropertyTable ( 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 all property groups for the edges of a vertex chunk.

Parameters
input_tableThe table containing data.
vertex_chunk_indexThe index of the vertex chunk.
start_chunk_indexThe start index of the edge chunks inside the vertex chunk.
validate_levelThe validate level for this operation, which is the writer's validate level by default.
Returns
Status: ok or error.

Definition at line 773 of file chunk_writer.cc.

◆ SortAndWriteTable()

Status graphar::EdgeChunkWriter::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 chunk.

Parameters
input_tableThe table containing data.
vertex_chunk_indexThe index of the vertex chunk.
start_chunk_indexThe start index of the edge chunks inside the vertex chunk.
validate_levelThe validate level for this operation, which is the writer's validate level by default.
Returns
Status: ok or error.

Definition at line 783 of file chunk_writer.cc.

◆ WriteAdjListChunk()

Status graphar::EdgeChunkWriter::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.

Parameters
input_tableThe table containing data.
vertex_chunk_indexThe index of the vertex chunk.
chunk_indexThe index of the edge chunk inside the vertex chunk.
validate_levelThe validate level for this operation, which is the writer's validate level by default.
Returns
Status: ok or error.

Definition at line 600 of file chunk_writer.cc.

◆ WriteAdjListTable()

Status graphar::EdgeChunkWriter::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.

Parameters
input_tableThe table containing data.
vertex_chunk_indexThe index of the vertex chunk.
start_chunk_indexThe start index of the edge chunks inside the vertex chunk.
validate_levelThe validate level for this operation, which is the writer's validate level by default.
Returns
Status: ok or error.

Definition at line 683 of file chunk_writer.cc.

◆ WriteChunk()

Status graphar::EdgeChunkWriter::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.

Parameters
input_tableThe table containing data.
vertex_chunk_indexThe index of the vertex chunk.
chunk_indexThe index of the edge chunk inside the vertex chunk.
validate_levelThe validate level for this operation, which is the writer's validate level by default.
Returns
Status: ok or error.

Definition at line 674 of file chunk_writer.cc.

◆ WriteEdgesNum()

Status graphar::EdgeChunkWriter::WriteEdgesNum ( IdType  vertex_chunk_index,
const IdType &  count,
ValidateLevel  validate_level = ValidateLevel::default_validate 
) const

Write the number of edges into the file.

Parameters
vertex_chunk_indexThe index of the vertex chunk.
countThe number of edges.
validate_levelThe validate level for this operation, which is the writer's validate level by default.
Returns
Status: ok or error.

Definition at line 563 of file chunk_writer.cc.

◆ WriteOffsetChunk()

Status graphar::EdgeChunkWriter::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.

Parameters
input_tableThe table containing data.
vertex_chunk_indexThe index of the vertex chunk.
validate_levelThe validate level for this operation, which is the writer's validate level by default.
Returns
Status: ok or error.

Definition at line 582 of file chunk_writer.cc.

◆ WritePropertyChunk() [1/2]

Status graphar::EdgeChunkWriter::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.

Parameters
input_tableThe table containing data.
property_groupThe property group to write.
vertex_chunk_indexThe index of the vertex chunk.
chunk_indexThe index of the edge chunk inside the vertex chunk.
validate_levelThe validate level for this operation, which is the writer's validate level by default.
Returns
Status: ok or error.

Definition at line 632 of file chunk_writer.cc.

◆ WritePropertyChunk() [2/2]

Status graphar::EdgeChunkWriter::WritePropertyChunk ( const std::shared_ptr< arrow::Table > &  input_table,
IdType  vertex_chunk_index,
IdType  chunk_index,
ValidateLevel  validate_level = ValidateLevel::default_validate 
) const

Write all edge property groups for an edge chunk.

Parameters
input_tableThe table containing data.
vertex_chunk_indexThe index of the vertex chunk.
chunk_indexThe index of the edge chunk inside the vertex chunk.
validate_levelThe validate level for this operation, which is the writer's validate level by default.
Returns
Status: ok or error.

Definition at line 662 of file chunk_writer.cc.

◆ WritePropertyTable() [1/2]

Status graphar::EdgeChunkWriter::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.

Parameters
input_tableThe table containing data.
property_groupThe property group to write.
vertex_chunk_indexThe index of the vertex chunk.
start_chunk_indexThe start index of the edge chunks inside the vertex chunk.
validate_levelThe validate level for this operation, which is the writer's validate level by default.
Returns
Status: ok or error.

Definition at line 697 of file chunk_writer.cc.

◆ WritePropertyTable() [2/2]

Status graphar::EdgeChunkWriter::WritePropertyTable ( 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 all property groups for the edges of a vertex chunk.

Parameters
input_tableThe table containing data.
vertex_chunk_indexThe index of the vertex chunk.
start_chunk_indexThe start index of the edge chunks inside the vertex chunk.
validate_levelThe validate level for this operation, which is the writer's validate level by default.
Returns
Status: ok or error.

Definition at line 714 of file chunk_writer.cc.

◆ WriteTable()

Status graphar::EdgeChunkWriter::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.

Parameters
input_tableThe table containing data.
vertex_chunk_indexThe index of the vertex chunk.
start_chunk_indexThe start index of the edge chunks inside the vertex chunk.
validate_levelThe validate level for this operation, which is the writer's validate level by default.
Returns
Status: ok or error.

Definition at line 728 of file chunk_writer.cc.

◆ WriteVerticesNum()

Status graphar::EdgeChunkWriter::WriteVerticesNum ( const IdType &  count,
ValidateLevel  validate_level = ValidateLevel::default_validate 
) const

Write the number of vertices into the file.

Parameters
countThe number of vertices.
validate_levelThe validate level for this operation, which is the writer's validate level by default.
Returns
Status: ok or error.

Definition at line 573 of file chunk_writer.cc.


The documentation for this class was generated from the following files: