Skip to content

Commit 3c6b783

Browse files
committed
fix get string bug
1 parent 6fd6086 commit 3c6b783

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

modules/graph/grin/rust/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
authors = ["dijie"]
55

66
[features]
7-
default = ["grin_assume_has_directed_graph", "grin_assume_has_undirected_graph", "grin_assume_has_multi_edge_graph", "grin_enable_vertex_list", "grin_enable_vertex_list_array", "grin_enable_vertex_list_iterator", "grin_enable_adjacent_list", "grin_enable_adjacent_list_array", "grin_enable_adjacent_list_iterator", "grin_enable_graph_partition", "grin_trait_natural_id_for_partition", "grin_enable_vertex_ref", "grin_trait_fast_vertex_ref", "grin_assume_edge_cut_partition", "grin_trait_select_master_for_vertex_list", "grin_enable_row", "grin_trait_const_value_ptr", "grin_with_vertex_property", "grin_with_vertex_property_name", "grin_with_vertex_type_name", "grin_trait_natural_id_for_vertex_type", "grin_enable_vertex_primary_keys", "grin_trait_natural_id_for_vertex_property", "grin_with_edge_property", "grin_with_edge_property_name", "grin_with_edge_type_name", "grin_trait_natural_id_for_edge_type", "grin_trait_natural_id_for_edge_property", "grin_trait_select_type_for_vertex_list", "grin_trait_select_edge_type_for_adjacent_list", "grin_assume_column_store_for_vertex_property", "grin_assume_column_store_for_edge_property", "grin_assume_all_vertex_list_sorted", "grin_enable_vertex_original_id_of_int64"]
7+
default = ["grin_assume_has_directed_graph", "grin_assume_has_undirected_graph", "grin_assume_has_multi_edge_graph", "grin_enable_vertex_list", "grin_enable_vertex_list_array", "grin_enable_vertex_list_iterator", "grin_enable_adjacent_list", "grin_enable_adjacent_list_array", "grin_enable_adjacent_list_iterator", "grin_enable_graph_partition", "grin_trait_natural_id_for_partition", "grin_enable_vertex_ref", "grin_trait_fast_vertex_ref", "grin_assume_edge_cut_partition", "grin_trait_select_master_for_vertex_list", "grin_enable_row", "grin_trait_const_value_ptr", "grin_with_vertex_property", "grin_with_vertex_property_name", "grin_with_vertex_type_name", "grin_trait_natural_id_for_vertex_type", "grin_enable_vertex_primary_keys", "grin_trait_natural_id_for_vertex_property", "grin_with_edge_property", "grin_with_edge_property_name", "grin_with_edge_type_name", "grin_trait_natural_id_for_edge_type", "grin_trait_natural_id_for_edge_property", "grin_trait_select_type_for_vertex_list", "grin_trait_select_edge_type_for_adjacent_list", "grin_assume_all_vertex_list_sorted", "grin_enable_vertex_original_id_of_int64"]
88
grin_assume_has_directed_graph = []
99
grin_assume_has_undirected_graph = []
1010
grin_assume_has_multi_edge_graph = []
@@ -68,8 +68,6 @@ grin_assume_split_master_mirror_partition_for_vertex_property = []
6868
grin_assume_master_only_partition_for_edge_property = []
6969
grin_assume_replicate_master_mirror_partition_for_edge_property = []
7070
grin_assume_split_master_mirror_partition_for_edge_property = []
71-
grin_assume_column_store_for_vertex_property = []
72-
grin_assume_column_store_for_edge_property = []
7371
grin_with_vertex_label = []
7472
grin_with_edge_label = []
7573
grin_assume_all_vertex_list_sorted = []

modules/graph/grin/rust/grin_v6d.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,9 @@ extern "C" {
408408
arg3: GrinRow,
409409
) -> GrinVertex;
410410

411+
#[allow(unused)]
412+
pub fn grin_destroy_string_value(arg1: GrinGraph, arg2: *const ::std::os::raw::c_char);
413+
411414
#[doc = " @brief get the vertex property name\n @param GrinGraph the graph\n @param GrinVertexProperty the vertex property"]
412415
#[cfg(feature = "grin_with_vertex_property_name")]
413416
#[allow(unused)]
@@ -786,9 +789,6 @@ extern "C" {
786789
arg3: GrinEdgeProperty,
787790
) -> GrinEdgePropertyId;
788791

789-
#[allow(unused)]
790-
pub fn grin_destroy_string_value(arg1: GrinGraph, arg2: *const ::std::os::raw::c_char);
791-
792792
#[cfg(feature = "grin_enable_row")]
793793
#[allow(unused)]
794794
pub fn grin_destroy_row(arg1: GrinGraph, arg2: GrinRow);
@@ -943,12 +943,12 @@ extern "C" {
943943
arg4: usize,
944944
) -> *const ::std::os::raw::c_void;
945945

946-
#[doc = " @brief get vertex row directly from the graph, this API only works for row store system\n @param GrinGraph the graph\n @param GrinVertex the vertex which is the row index\n @param GrinVertexPropertyList the vertex property list as columns"]
946+
#[doc = " @brief get vertex row directly from the graph, this API only works for row store system\n @param GrinGraph the graph\n @param GrinVertex the vertex which is the row index"]
947947
#[cfg(all(feature = "grin_with_vertex_property", feature = "grin_enable_row"))]
948948
#[allow(unused)]
949949
pub fn grin_get_vertex_row(arg1: GrinGraph, arg2: GrinVertex) -> GrinRow;
950950

951-
#[doc = " @brief get edge row directly from the graph, this API only works for row store system\n @param GrinGraph the graph\n @param GrinEdge the edge which is the row index\n @param GrinEdgePropertyList the edge property list as columns"]
951+
#[doc = " @brief get edge row directly from the graph, this API only works for row store system\n @param GrinGraph the graph\n @param GrinEdge the edge which is the row index"]
952952
#[cfg(all(feature = "grin_with_edge_property", feature = "grin_enable_row"))]
953953
#[allow(unused)]
954954
pub fn grin_get_edge_row(arg1: GrinGraph, arg2: GrinEdge) -> GrinRow;

modules/graph/grin/src/property/property.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ double grin_get_vertex_property_value_of_double(GRIN_GRAPH g, GRIN_VERTEX v, GRI
136136
const char* grin_get_vertex_property_value_of_string(GRIN_GRAPH g, GRIN_VERTEX v, GRIN_VERTEX_PROPERTY vp) {
137137
const void* result = _get_value_from_vertex_property_table(g, v, vp);
138138
if (result == NULL) return NULL;
139-
return static_cast<const char*>(result);
139+
return static_cast<const std::string*>(result)->c_str();
140140
}
141141

142142
int grin_get_vertex_property_value_of_date32(GRIN_GRAPH g, GRIN_VERTEX v, GRIN_VERTEX_PROPERTY vp) {
@@ -253,7 +253,7 @@ double grin_get_edge_property_value_of_double(GRIN_GRAPH g, GRIN_EDGE e, GRIN_ED
253253
const char* grin_get_edge_property_value_of_string(GRIN_GRAPH g, GRIN_EDGE e, GRIN_EDGE_PROPERTY ep) {
254254
const void* result = _get_value_from_edge_property_table(g, e, ep);
255255
if (result == NULL) return NULL;
256-
return static_cast<const char*>(result);
256+
return static_cast<const std::string*>(result)->c_str();
257257
}
258258

259259
int grin_get_edge_property_value_of_date32(GRIN_GRAPH g, GRIN_EDGE e, GRIN_EDGE_PROPERTY ep) {

modules/graph/grin/src/property/row.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,10 @@ GRIN_ROW grin_get_edge_row(GRIN_GRAPH g, GRIN_EDGE e) {
203203

204204
auto r = new GRIN_ROW_T();
205205
r->resize(_g->edge_property_num(etype));
206-
for (auto ep = 0; ep < _g->edge_property_num(etype); ++ep) {
206+
for (auto ep = 1; ep < _g->edge_property_num(etype); ++ep) {
207207
auto array = _cache->etables[etype]->column(ep)->chunk(0);
208208
auto result = vineyard::get_arrow_array_data_element(array, offset);
209-
(*r)[ep] = result;
209+
(*r)[ep-1] = result;
210210
}
211211
return r;
212212
}

0 commit comments

Comments
 (0)