Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes value getters for date/time/timestamp arrays #1853

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading