Skip to content

Commit

Permalink
Fixes value getters for date/time/timestamp arrays (#1853)
Browse files Browse the repository at this point in the history
Fixes #1849

Signed-off-by: Tao He <[email protected]>
  • Loading branch information
sighingnow authored Apr 1, 2024
1 parent 4cfbaa7 commit 41a9db0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 deletions.
10 changes: 5 additions & 5 deletions modules/basic/ds/arrow_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -925,19 +925,19 @@ const void* get_arrow_array_data(std::shared_ptr<arrow::Array> const& array) {
std::dynamic_pointer_cast<arrow::LargeStringArray>(array).get());
} else if (array->type()->Equals(arrow::date32())) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::Date32Array>(array).get());
std::dynamic_pointer_cast<arrow::Date32Array>(array)->raw_values());
} else if (array->type()->Equals(arrow::date64())) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::Date64Array>(array).get());
std::dynamic_pointer_cast<arrow::Date64Array>(array)->raw_values());
} else if (array->type()->id() == arrow::Type::TIME32) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::Time32Array>(array).get());
std::dynamic_pointer_cast<arrow::Time32Array>(array)->raw_values());
} else if (array->type()->id() == arrow::Type::TIME64) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::Time64Array>(array).get());
std::dynamic_pointer_cast<arrow::Time64Array>(array)->raw_values());
} else if (array->type()->id() == arrow::Type::TIMESTAMP) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::TimestampArray>(array).get());
std::dynamic_pointer_cast<arrow::TimestampArray>(array)->raw_values());
} else if (array->type()->id() == arrow::Type::LIST) {
return reinterpret_cast<const void*>(
std::dynamic_pointer_cast<arrow::ListArray>(array).get());
Expand Down
20 changes: 1 addition & 19 deletions modules/graph/fragment/arrow_fragment.vineyard-mod
Original file line number Diff line number Diff line change
Expand Up @@ -141,25 +141,7 @@ class [[vineyard]] ArrowFragment

const std::string oid_typename() const override { return oid_type; }

void PostConstruct(const vineyard::ObjectMeta& meta) override {
vid_parser_.Init(fnum_, vertex_label_num_);
this->schema_.FromJSON(schema_json_);

// init pointers for arrays and tables
initPointers();

// init edge numbers
oenum_ = 0;
ienum_ = 0;
for (label_id_t i = 0; i < vertex_label_num_; i++) {
for (auto& v : InnerVertices(i)) {
for (label_id_t j = 0; j < edge_label_num_; j++) {
oenum_ += GetLocalOutDegree(v, j);
ienum_ += GetLocalInDegree(v, j);
}
}
}
}
void PostConstruct(const vineyard::ObjectMeta& meta) override;

fid_t fid() const { return fid_; }

Expand Down
22 changes: 22 additions & 0 deletions modules/graph/fragment/arrow_fragment_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,28 @@ limitations under the License.

namespace vineyard {

template <typename OID_T, typename VID_T, typename VERTEX_MAP_T, bool COMPACT>
void ArrowFragment<OID_T, VID_T, VERTEX_MAP_T, COMPACT>::PostConstruct(
const vineyard::ObjectMeta& meta) {
vid_parser_.Init(fnum_, vertex_label_num_);
this->schema_.FromJSON(schema_json_);

// init pointers for arrays and tables
initPointers();

// init edge numbers
oenum_ = 0;
ienum_ = 0;
for (label_id_t i = 0; i < vertex_label_num_; i++) {
for (auto& v : InnerVertices(i)) {
for (label_id_t j = 0; j < edge_label_num_; j++) {
oenum_ += GetLocalOutDegree(v, j);
ienum_ += GetLocalInDegree(v, j);
}
}
}
}

template <typename OID_T, typename VID_T, typename VERTEX_MAP_T, bool COMPACT>
void ArrowFragment<OID_T, VID_T, VERTEX_MAP_T, COMPACT>::PrepareToRunApp(
const grape::CommSpec& comm_spec, grape::PrepareConf conf) {
Expand Down

0 comments on commit 41a9db0

Please sign in to comment.