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

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ VertexPropertyWriter()

graphar::VertexPropertyWriter::VertexPropertyWriter ( const std::shared_ptr< VertexInfo > &  vertex_info,
const std::string &  prefix,
const ValidateLevel &  validate_level = ValidateLevel::no_validate 
)
explicit

Initialize the VertexPropertyWriter.

Parameters
vertex_infoThe vertex info that describes the vertex type.
prefixThe absolute prefix.
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 102 of file chunk_writer.cc.

Member Function Documentation

◆ GetValidateLevel()

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

Get the validate level.

Returns
The validate level of this writer.

Definition at line 90 of file chunk_writer.h.

◆ Make() [1/2]

Result< std::shared_ptr< VertexPropertyWriter > > graphar::VertexPropertyWriter::Make ( const std::shared_ptr< GraphInfo > &  graph_info,
const std::string &  label,
const ValidateLevel &  validate_level = ValidateLevel::no_validate 
)
static

Construct a VertexPropertyWriter from graph info and vertex label.

Parameters
graph_infoThe graph info that describes the graph.
labelThe vertex label.
validate_levelThe global validate level for the writer, default is no_validate.

Definition at line 300 of file chunk_writer.cc.

◆ Make() [2/2]

Result< std::shared_ptr< VertexPropertyWriter > > graphar::VertexPropertyWriter::Make ( const std::shared_ptr< VertexInfo > &  vertex_info,
const std::string &  prefix,
const ValidateLevel &  validate_level = ValidateLevel::no_validate 
)
static

Construct a VertexPropertyWriter from vertex info.

Parameters
vertex_infoThe vertex info that describes the vertex type.
prefixThe absolute prefix.
validate_levelThe global validate level for the writer, default is no_validate.

Definition at line 293 of file chunk_writer.cc.

◆ SetValidateLevel()

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

Set the validate level.

Parameters
validate_levelThe validate level to set.

Definition at line 78 of file chunk_writer.h.

◆ WriteChunk() [1/2]

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.

Parameters
input_tableThe table containing data.
property_groupThe property group.
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 209 of file chunk_writer.cc.

◆ WriteChunk() [2/2]

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.

Parameters
input_tableThe table containing data.
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 243 of file chunk_writer.cc.

◆ WriteTable() [1/2]

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.

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

Definition at line 254 of file chunk_writer.cc.

◆ WriteTable() [2/2]

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.

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

Definition at line 279 of file chunk_writer.cc.

◆ WriteVerticesNum()

Status graphar::VertexPropertyWriter::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 201 of file chunk_writer.cc.


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