27 #include "graphar/fwd.h"
28 #include "graphar/reader_util.h"
52 const std::shared_ptr<VertexInfo>& vertex_info,
53 const std::shared_ptr<PropertyGroup>& property_group,
69 Result<std::shared_ptr<arrow::Table>>
GetChunk();
89 void Filter(util::Filter filter =
nullptr);
97 void Select(util::ColumnNames column_names = std::nullopt);
107 static Result<std::shared_ptr<VertexPropertyArrowChunkReader>>
Make(
108 const std::shared_ptr<VertexInfo>& vertex_info,
109 const std::shared_ptr<PropertyGroup>& property_group,
121 static Result<std::shared_ptr<VertexPropertyArrowChunkReader>>
Make(
122 const std::shared_ptr<GraphInfo>& graph_info,
const std::string& label,
123 const std::shared_ptr<PropertyGroup>& property_group,
124 const util::FilterOptions& options = {});
136 static Result<std::shared_ptr<VertexPropertyArrowChunkReader>>
Make(
137 const std::shared_ptr<GraphInfo>& graph_info,
const std::string& label,
138 const std::string& property_name,
139 const util::FilterOptions& options = {});
142 std::shared_ptr<VertexInfo> vertex_info_;
143 std::shared_ptr<PropertyGroup> property_group_;
149 std::shared_ptr<arrow::Schema> schema_;
150 std::shared_ptr<arrow::Table> chunk_table_;
151 util::FilterOptions filter_options_;
152 std::shared_ptr<FileSystem> fs_;
160 using range_t = std::pair<IdType, IdType>;
169 AdjListType adj_list_type,
const std::string& prefix);
203 Result<std::shared_ptr<arrow::Table>>
GetChunk();
235 static Result<std::shared_ptr<AdjListArrowChunkReader>>
Make(
236 const std::shared_ptr<EdgeInfo>& edge_info, AdjListType adj_list_type,
237 const std::string& prefix);
248 static Result<std::shared_ptr<AdjListArrowChunkReader>>
Make(
249 const std::shared_ptr<GraphInfo>& graph_info,
250 const std::string& src_label,
const std::string& edge_label,
251 const std::string& dst_label, AdjListType adj_list_type);
254 Status initOrUpdateEdgeChunkNum();
257 std::shared_ptr<EdgeInfo> edge_info_;
258 AdjListType adj_list_type_;
260 IdType vertex_chunk_index_, chunk_index_;
262 std::shared_ptr<arrow::Table> chunk_table_;
263 IdType vertex_chunk_num_, chunk_num_;
264 std::string base_dir_;
265 std::shared_ptr<FileSystem> fs_;
273 using range_t = std::pair<IdType, IdType>;
284 AdjListType adj_list_type,
285 const std::string& prefix);
300 Result<std::shared_ptr<arrow::Array>>
GetChunk();
321 static Result<std::shared_ptr<AdjListOffsetArrowChunkReader>>
Make(
322 const std::shared_ptr<EdgeInfo>& edge_info, AdjListType adj_list_type,
323 const std::string& prefix);
334 static Result<std::shared_ptr<AdjListOffsetArrowChunkReader>>
Make(
335 const std::shared_ptr<GraphInfo>& graph_info,
336 const std::string& src_label,
const std::string& edge_label,
337 const std::string& dst_label, AdjListType adj_list_type);
340 std::shared_ptr<EdgeInfo> edge_info_;
341 AdjListType adj_list_type_;
345 std::shared_ptr<arrow::Table> chunk_table_;
346 IdType vertex_chunk_num_;
347 IdType vertex_chunk_size_;
348 std::string base_dir_;
349 std::shared_ptr<FileSystem> fs_;
357 using range_t = std::pair<IdType, IdType>;
368 const std::shared_ptr<EdgeInfo>& edge_info,
369 const std::shared_ptr<PropertyGroup>& property_group,
370 AdjListType adj_list_type,
const std::string prefix,
405 Result<std::shared_ptr<arrow::Table>>
GetChunk();
431 void Filter(util::Filter filter =
nullptr);
439 void Select(util::ColumnNames column_names = std::nullopt);
450 static Result<std::shared_ptr<AdjListPropertyArrowChunkReader>>
Make(
451 const std::shared_ptr<EdgeInfo>& edge_info,
452 const std::shared_ptr<PropertyGroup>& property_group,
453 AdjListType adj_list_type,
const std::string& prefix,
469 static Result<std::shared_ptr<AdjListPropertyArrowChunkReader>>
Make(
470 const std::shared_ptr<GraphInfo>& graph_info,
471 const std::string& src_label,
const std::string& edge_label,
472 const std::string& dst_label,
473 const std::shared_ptr<PropertyGroup>& property_group,
489 static Result<std::shared_ptr<AdjListPropertyArrowChunkReader>>
Make(
490 const std::shared_ptr<GraphInfo>& graph_info,
491 const std::string& src_label,
const std::string& edge_label,
492 const std::string& dst_label,
const std::string& property_name,
496 Status initOrUpdateEdgeChunkNum();
499 std::shared_ptr<EdgeInfo> edge_info_;
500 std::shared_ptr<PropertyGroup> property_group_;
501 AdjListType adj_list_type_;
503 IdType vertex_chunk_index_, chunk_index_;
505 std::shared_ptr<arrow::Schema> schema_;
506 std::shared_ptr<arrow::Table> chunk_table_;
508 IdType vertex_chunk_num_, chunk_num_;
509 std::string base_dir_;
510 std::shared_ptr<FileSystem> fs_;
The arrow chunk reader for adj list topology chunk.
Status seek_src(IdType id)
Sets chunk position indicator for reader by source vertex id.
Status seek(IdType offset)
Sets chunk position indicator for reader by edge index.
AdjListArrowChunkReader(const std::shared_ptr< EdgeInfo > &edge_info, AdjListType adj_list_type, const std::string &prefix)
Initialize the AdjListArrowChunkReader.
Result< IdType > GetRowNumOfChunk()
Get the number of rows of the current chunk table.
Status seek_chunk_index(IdType vertex_chunk_index, IdType chunk_index=0)
Sets chunk position to the specific vertex chunk and edge chunk.
Result< std::shared_ptr< arrow::Table > > GetChunk()
Return the current chunk of chunk position indicator as arrow::Table, if the chunk is empty,...
static Result< std::shared_ptr< AdjListArrowChunkReader > > Make(const std::shared_ptr< EdgeInfo > &edge_info, AdjListType adj_list_type, const std::string &prefix)
Create an AdjListArrowChunkReader instance from edge info.
Status next_chunk()
Sets chunk position indicator to next chunk.
Status seek_dst(IdType offset)
Sets chunk position indicator for reader by destination vertex id.
The arrow chunk reader for edge offset.
Status seek(IdType id)
Sets chunk position indicator for reader by internal vertex id. If internal vertex id is not found,...
Result< std::shared_ptr< arrow::Array > > GetChunk()
Get the current offset chunk as arrow::Array.
AdjListOffsetArrowChunkReader(const std::shared_ptr< EdgeInfo > &edge_info, AdjListType adj_list_type, const std::string &prefix)
Initialize the AdjListOffsetArrowChunkReader.
static Result< std::shared_ptr< AdjListOffsetArrowChunkReader > > Make(const std::shared_ptr< EdgeInfo > &edge_info, AdjListType adj_list_type, const std::string &prefix)
Create an AdjListOffsetArrowChunkReader instance from edge info.
Status next_chunk()
Sets chunk position indicator to next chunk. if current chunk is the last chunk, will return Status::...
IdType GetChunkIndex() const noexcept
Get current vertex chunk index.
The arrow chunk reader for edge property group chunks.
Status seek_src(IdType id)
Sets chunk position indicator for reader by source vertex id.
Status seek_dst(IdType id)
Sets chunk position indicator for reader by destination vertex id.
Status seek_chunk_index(IdType vertex_chunk_index, IdType chunk_index=0)
Sets chunk position to the specific vertex chunk and edge chunk.
static Result< std::shared_ptr< AdjListPropertyArrowChunkReader > > Make(const std::shared_ptr< EdgeInfo > &edge_info, const std::shared_ptr< PropertyGroup > &property_group, AdjListType adj_list_type, const std::string &prefix, const util::FilterOptions &options={})
Create an AdjListPropertyArrowChunkReader instance from edge info.
AdjListPropertyArrowChunkReader(const std::shared_ptr< EdgeInfo > &edge_info, const std::shared_ptr< PropertyGroup > &property_group, AdjListType adj_list_type, const std::string prefix, const util::FilterOptions &options={})
Initialize the AdjListPropertyArrowChunkReader.
void Filter(util::Filter filter=nullptr)
Apply the row filter to the table. No parameter call Filter() will clear the filter.
Result< std::shared_ptr< arrow::Table > > GetChunk()
Return the current chunk of chunk position indicator as arrow::Table, if the chunk is empty,...
Status next_chunk()
Sets chunk position indicator to next chunk.
Status seek(IdType offset)
Sets chunk position indicator for reader by edge index.
void Select(util::ColumnNames column_names=std::nullopt)
Apply the projection to the table to be read. No parameter call Select() will clear the projection.
Status outcome object (success or error)
The arrow chunk reader for vertex property group.
IdType GetChunkNum() const noexcept
Get the chunk number of current vertex property group.
Result< std::shared_ptr< arrow::Table > > GetChunk()
Return the current arrow chunk table of chunk position indicator.
VertexPropertyArrowChunkReader(const std::shared_ptr< VertexInfo > &vertex_info, const std::shared_ptr< PropertyGroup > &property_group, const std::string &prefix, const util::FilterOptions &options={})
Initialize the VertexPropertyArrowChunkReader.
void Filter(util::Filter filter=nullptr)
Apply the row filter to the table. No parameter call Filter() will clear the filter.
Status next_chunk()
Sets chunk position indicator to next chunk.
Status seek(IdType id)
Sets chunk position indicator for reader by internal vertex id. If internal vertex id is not found,...
void Select(util::ColumnNames column_names=std::nullopt)
Apply the projection to the table to be read. No parameter call Select() will clear the projection.
static Result< std::shared_ptr< VertexPropertyArrowChunkReader > > Make(const std::shared_ptr< VertexInfo > &vertex_info, const std::shared_ptr< PropertyGroup > &property_group, const std::string &prefix, const util::FilterOptions &options={})
Create a VertexPropertyArrowChunkReader instance from vertex info.