Apache GraphAr C++ Library
The C++ Library for Apache GraphAr
|
The writer for vertex property group chunks. More...
#include <chunk_writer.h>
Public Member Functions | |
VertexPropertyWriter (const std::shared_ptr< VertexInfo > &vertex_info, const std::string &prefix, const ValidateLevel &validate_level=ValidateLevel::no_validate) | |
Initialize the VertexPropertyWriter. More... | |
void | SetValidateLevel (const ValidateLevel &validate_level) |
Set the validate level. More... | |
ValidateLevel | GetValidateLevel () const |
Get the validate level. More... | |
Status | WriteVerticesNum (const IdType &count, ValidateLevel validate_level=ValidateLevel::default_validate) const |
Write the number of vertices into the file. More... | |
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. More... | |
Status | WriteChunk (const std::shared_ptr< arrow::Table > &input_table, IdType chunk_index, ValidateLevel validate_level=ValidateLevel::default_validate) const |
Write all property groups of a single vertex chunk to corresponding files. More... | |
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. More... | |
Status | WriteTable (const std::shared_ptr< arrow::Table > &input_table, IdType start_chunk_index, ValidateLevel validate_level=ValidateLevel::default_validate) const |
Write all property groups for multiple vertex chunks to corresponding files. More... | |
Static Public Member Functions | |
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. More... | |
static Result< std::shared_ptr< VertexPropertyWriter > > | Make (const std::shared_ptr< GraphInfo > &graph_info, const std::string &label, const ValidateLevel &validate_level=ValidateLevel::no_validate) |
Construct a VertexPropertyWriter from graph info and vertex label. More... | |
The writer for vertex 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 count or vertex chunk index is non-negative, the property group exists and the size of input_table is not larger than the vertex 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 number or copying file, the strong_validate is same as weak_validate.
Definition at line 57 of file chunk_writer.h.
|
explicit |
Initialize the VertexPropertyWriter.
vertex_info | The vertex info that describes the vertex type. |
prefix | The absolute prefix. |
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 102 of file chunk_writer.cc.
|
inline |
Get the validate level.
Definition at line 90 of file chunk_writer.h.
|
static |
Construct a VertexPropertyWriter from graph info and vertex label.
graph_info | The graph info that describes the graph. |
label | The vertex label. |
validate_level | The global validate level for the writer, default is no_validate. |
Definition at line 300 of file chunk_writer.cc.
|
static |
Construct a VertexPropertyWriter from vertex info.
vertex_info | The vertex info that describes the vertex type. |
prefix | The absolute prefix. |
validate_level | The global validate level for the writer, default is no_validate. |
Definition at line 293 of file chunk_writer.cc.
|
inline |
Set the validate level.
validate_level | The validate level to set. |
Definition at line 78 of file chunk_writer.h.
Status graphar::VertexPropertyWriter::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.
input_table | The table containing data. |
property_group | The property group. |
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 209 of file chunk_writer.cc.
Status graphar::VertexPropertyWriter::WriteChunk | ( | const std::shared_ptr< arrow::Table > & | input_table, |
IdType | chunk_index, | ||
ValidateLevel | validate_level = ValidateLevel::default_validate |
||
) | const |
Write all property groups of a single vertex chunk to corresponding files.
input_table | The table containing data. |
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 243 of file chunk_writer.cc.
Status graphar::VertexPropertyWriter::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.
input_table | The table containing data. |
property_group | The property group. |
start_chunk_index | The start index of the vertex chunks. |
validate_level | The validate level for this operation, which is the writer's validate level by default. |
Definition at line 254 of file chunk_writer.cc.
Status graphar::VertexPropertyWriter::WriteTable | ( | const std::shared_ptr< arrow::Table > & | input_table, |
IdType | start_chunk_index, | ||
ValidateLevel | validate_level = ValidateLevel::default_validate |
||
) | const |
Write all property groups for multiple vertex chunks to corresponding files.
input_table | The table containing data. |
start_chunk_index | The start index of the vertex chunks. |
validate_level | The validate level for this operation, which is the writer's validate level by default. |
Definition at line 279 of file chunk_writer.cc.
Status graphar::VertexPropertyWriter::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 201 of file chunk_writer.cc.