Apache GraphAr C++ Library
The C++ Library for Apache GraphAr
|
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... | |
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.
|
explicit |
Initialize the EdgeChunkWriter.
edge_info | The edge info that describes the edge type. |
prefix | The absolute prefix. |
adj_list_type | The adj list type for the edges. |
validate_level | The 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.
|
inline |
Get the validate level.
Definition at line 292 of file chunk_writer.h.
|
static |
Construct an EdgeChunkWriter from edge info.
edge_info | The edge info that describes the edge type. |
prefix | The absolute prefix. |
adj_list_type | The adj list type for the edges. |
validate_level | The global validate level for the writer, default is no_validate. |
Definition at line 881 of file chunk_writer.cc.
|
static |
Construct an EdgeChunkWriter from graph info and edge label.
graph_info | The graph info that describes the graph. |
src_label | The source vertex label. |
edge_label | The edge label. |
dst_label | The destination vertex label. |
adj_list_type | The adj list type for the edges. |
validate_level | The global validate level for the writer, default is no_validate. |
Definition at line 893 of file chunk_writer.cc.
|
inline |
Set the validate level.
validate_level | The validate level to set. |
Definition at line 280 of file chunk_writer.h.
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.
input_table | The table containing data. |
vertex_chunk_index | The index of the vertex chunk. |
start_chunk_index | The start index of the edge chunks inside the vertex chunk. |
validate_level | The validate level for this operation, which is the writer's validate level by default. |
Definition at line 742 of file chunk_writer.cc.
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.
input_table | The table containing data. |
property_group | The property group to write. |
vertex_chunk_index | The index of the vertex chunk. |
start_chunk_index | The start index of the edge chunks inside the vertex chunk. |
validate_level | The validate level for this operation, which is the writer's validate level by default. |
Definition at line 761 of file chunk_writer.cc.
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.
input_table | The table containing data. |
vertex_chunk_index | The index of the vertex chunk. |
start_chunk_index | The start index of the edge chunks inside the vertex chunk. |
validate_level | The validate level for this operation, which is the writer's validate level by default. |
Definition at line 773 of file chunk_writer.cc.
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.
input_table | The table containing data. |
vertex_chunk_index | The index of the vertex chunk. |
start_chunk_index | The start index of the edge chunks inside the vertex chunk. |
validate_level | The validate level for this operation, which is the writer's validate level by default. |
Definition at line 783 of file chunk_writer.cc.
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.
input_table | The table containing data. |
vertex_chunk_index | The index of the vertex chunk. |
chunk_index | The index of the edge chunk inside the vertex chunk. |
validate_level | The validate level for this operation, which is the writer's validate level by default. |
Definition at line 600 of file chunk_writer.cc.
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.
input_table | The table containing data. |
vertex_chunk_index | The index of the vertex chunk. |
start_chunk_index | The start index of the edge chunks inside the vertex chunk. |
validate_level | The validate level for this operation, which is the writer's validate level by default. |
Definition at line 683 of file chunk_writer.cc.
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.
input_table | The table containing data. |
vertex_chunk_index | The index of the vertex chunk. |
chunk_index | The index of the edge chunk inside the vertex chunk. |
validate_level | The validate level for this operation, which is the writer's validate level by default. |
Definition at line 674 of file chunk_writer.cc.
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.
vertex_chunk_index | The index of the vertex chunk. |
count | The number of edges. |
validate_level | The validate level for this operation, which is the writer's validate level by default. |
Definition at line 563 of file chunk_writer.cc.
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.
input_table | The table containing data. |
vertex_chunk_index | The index of the vertex chunk. |
validate_level | The validate level for this operation, which is the writer's validate level by default. |
Definition at line 582 of file chunk_writer.cc.
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.
input_table | The table containing data. |
property_group | The property group to write. |
vertex_chunk_index | The index of the vertex chunk. |
chunk_index | The index of the edge chunk inside the vertex chunk. |
validate_level | The validate level for this operation, which is the writer's validate level by default. |
Definition at line 632 of file chunk_writer.cc.
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.
input_table | The table containing data. |
vertex_chunk_index | The index of the vertex chunk. |
chunk_index | The index of the edge chunk inside the vertex chunk. |
validate_level | The validate level for this operation, which is the writer's validate level by default. |
Definition at line 662 of file chunk_writer.cc.
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.
input_table | The table containing data. |
property_group | The property group to write. |
vertex_chunk_index | The index of the vertex chunk. |
start_chunk_index | The start index of the edge chunks inside the vertex chunk. |
validate_level | The validate level for this operation, which is the writer's validate level by default. |
Definition at line 697 of file chunk_writer.cc.
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.
input_table | The table containing data. |
vertex_chunk_index | The index of the vertex chunk. |
start_chunk_index | The start index of the edge chunks inside the vertex chunk. |
validate_level | The validate level for this operation, which is the writer's validate level by default. |
Definition at line 714 of file chunk_writer.cc.
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.
input_table | The table containing data. |
vertex_chunk_index | The index of the vertex chunk. |
start_chunk_index | The start index of the edge chunks inside the vertex chunk. |
validate_level | The validate level for this operation, which is the writer's validate level by default. |
Definition at line 728 of file chunk_writer.cc.
Status graphar::EdgeChunkWriter::WriteVerticesNum | ( | const IdType & | count, |
ValidateLevel | validate_level = ValidateLevel::default_validate |
||
) | const |
Write the number of vertices into the file.
count | The number of vertices. |
validate_level | The validate level for this operation, which is the writer's validate level by default. |
Definition at line 573 of file chunk_writer.cc.