22#include "../include/common/error.h"
33#include "../include/index/label.h"
44#include "../include/index/order.h"
5+ #include "../include/index/original_id.h"
56#include "../include/partition/partition.h"
67#include "../include/partition/reference.h"
78#include "../include/partition/topology.h"
@@ -25,6 +26,9 @@ GRIN_GRAPH get_graph(int argc, char** argv) {
2526 GRIN_PARTITION partition =
2627 grin_get_partition_from_list (pg , local_partitions , 0 );
2728 GRIN_GRAPH g = grin_get_local_graph_by_partition (pg , partition );
29+ grin_destroy_partition (pg , partition );
30+ grin_destroy_partition_list (pg , local_partitions );
31+ grin_destroy_partitioned_graph (pg );
2832#else
2933 GRIN_GRAPH g = grin_get_graph_from_storage (argc - 1 , & (argv [1 ]));
3034#endif
@@ -99,7 +103,7 @@ void test_property_type(int argc, char** argv) {
99103 const char * vt_name = grin_get_vertex_type_name (g , vt );
100104 printf ("vertex type name: %s\n" , vt_name );
101105 GRIN_VERTEX_TYPE vt0 = grin_get_vertex_type_by_name (g , vt_name );
102- grin_destroy_name (g , vt_name );
106+ // grin_destroy_name(g, vt_name);
103107 if (!grin_equal_vertex_type (g , vt , vt0 )) {
104108 printf ("vertex type name not match\n" );
105109 }
@@ -132,7 +136,7 @@ void test_property_type(int argc, char** argv) {
132136 } else {
133137 const char * vt2_name = grin_get_vertex_type_name (g , vt2 );
134138 printf ("vertex type name: %s\n" , vt2_name );
135- grin_destroy_name (g , vt2_name );
139+ // grin_destroy_name(g, vt2_name);
136140 }
137141#else
138142 GRIN_VERTEX_TYPE vt2 = get_one_vertex_type (g );
@@ -161,7 +165,7 @@ void test_property_type(int argc, char** argv) {
161165 const char * et_name = grin_get_edge_type_name (g , et );
162166 printf ("edge type name: %s\n" , et_name );
163167 GRIN_EDGE_TYPE et0 = grin_get_edge_type_by_name (g , et_name );
164- grin_destroy_name (g , et_name );
168+ // grin_destroy_name(g, et_name);
165169 if (!grin_equal_edge_type (g , et , et0 )) {
166170 printf ("edge type name not match\n" );
167171 }
@@ -195,9 +199,9 @@ void test_property_type(int argc, char** argv) {
195199 const char * dst_vt_name = grin_get_vertex_type_name (g , dst_vt );
196200 const char * et_name = grin_get_edge_type_name (g , et );
197201 printf ("edge type name: %s-%s-%s\n" , src_vt_name , et_name , dst_vt_name );
198- grin_destroy_name (g , src_vt_name );
199- grin_destroy_name (g , dst_vt_name );
200- grin_destroy_name (g , et_name );
202+ // grin_destroy_name(g, src_vt_name);
203+ // grin_destroy_name(g, dst_vt_name);
204+ // grin_destroy_name(g, et_name);
201205 grin_destroy_vertex_type (g , src_vt );
202206 grin_destroy_vertex_type (g , dst_vt );
203207 }
@@ -221,7 +225,7 @@ void test_property_type(int argc, char** argv) {
221225 } else {
222226 const char * et2_name = grin_get_edge_type_name (g , et2 );
223227 printf ("edge type name: %s\n" , et2_name );
224- grin_destroy_name (g , et2_name );
228+ // grin_destroy_name(g, et2_name);
225229 }
226230#else
227231 GRIN_EDGE_TYPE et2 = get_one_edge_type (g );
@@ -297,17 +301,17 @@ void test_property_topology(int argc, char** argv) {
297301 grin_destroy_vertex_list (g , vl );
298302#endif
299303
300- #ifdef GRIN_ASSUME_BY_TYPE_VERTEX_ORIGINAL_ID
301- GRIN_DATATYPE dt = grin_get_vertex_original_id_data_type (g );
304+ #ifdef GRIN_ENABLE_VERTEX_ORIGINAL_ID_OF_INT64
305+ GRIN_DATATYPE dt = grin_get_vertex_original_id_datatype (g );
302306 if (dt == Int64 ) {
303307 long long int v0id = 4 ;
304- GRIN_VERTEX v0 = grin_get_vertex_by_original_id_by_type (g , vt , dt , & v0id );
308+ GRIN_VERTEX v0 = grin_get_vertex_by_original_id_of_int64 (g , v0id );
305309 if (v0 == GRIN_NULL_VERTEX ) {
306310 printf ("(Wrong) vertex of id %lld can not be found\n" , v0id );
307311 } else {
308312 printf ("vertex of original id %lld found\n" , v0id );
309- const void * oid0 = grin_get_vertex_original_id_value (g , v0 );
310- printf ("get vertex original id: %lld\n" , * (( long long int * ) oid0 ) );
313+ long long int oid0 = grin_get_vertex_original_id_of_int64 (g , v0 );
314+ printf ("get vertex original id: %lld\n" , oid0 );
311315 }
312316 grin_destroy_vertex (g , v0 );
313317 } else {
@@ -362,8 +366,8 @@ void test_property_topology(int argc, char** argv) {
362366 grin_destroy_edge_list (g , el );
363367#endif
364368
365- grin_destroy_name (g , vt_name );
366- grin_destroy_name (g , et_name );
369+ // grin_destroy_name(g, vt_name);
370+ // grin_destroy_name(g, et_name);
367371 grin_destroy_vertex_type (g , vt );
368372 grin_destroy_edge_type (g , et );
369373 grin_destroy_graph (g );
@@ -438,7 +442,7 @@ void test_property_vertex_table(int argc, char** argv) {
438442#else
439443 const char * vp_name = "unknown" ;
440444#endif
441- GRIN_DATATYPE dt = grin_get_vertex_property_data_type (g , vp );
445+ GRIN_DATATYPE dt = grin_get_vertex_property_datatype (g , vp );
442446 const void * pv =
443447 grin_get_value_from_vertex_property_table (g , vpt , v , vp );
444448 if (grin_get_last_error_code () == NO_ERROR ) {
@@ -454,8 +458,8 @@ void test_property_vertex_table(int argc, char** argv) {
454458 printf ("vp_id %u v%zu %s value: %s %s\n" , id , i , vp_name , (char * ) pv ,
455459 (char * ) rv );
456460 }
457- grin_destroy_value (g , dt , pv );
458- grin_destroy_value (g , dt , rv );
461+ // grin_destroy_value(g, dt, pv);
462+ // grin_destroy_value(g, dt, rv);
459463 grin_destroy_vertex_property (g , vp );
460464 }
461465 grin_destroy_row (g , row );
@@ -517,8 +521,8 @@ void test_property_vertex_table(int argc, char** argv) {
517521 vp5_name );
518522 grin_destroy_vertex_property (g , vp5 );
519523 grin_destroy_vertex_type (g , vt5 );
520- grin_destroy_name (g , vt5_name );
521- grin_destroy_name (g , vp5_name );
524+ // grin_destroy_name(g, vt5_name);
525+ // grin_destroy_name(g, vp5_name);
522526 }
523527 grin_destroy_vertex_property_list (g , vpl2 );
524528 }
@@ -599,7 +603,7 @@ void test_property_edge_table(int argc, char** argv) {
599603#else
600604 unsigned int id = ~0 ;
601605#endif
602- GRIN_DATATYPE dt = grin_get_edge_property_data_type (g , ep );
606+ GRIN_DATATYPE dt = grin_get_edge_property_datatype (g , ep );
603607 const void * pv = grin_get_value_from_edge_property_table (g , ept , e , ep );
604608 const void * rv = grin_get_value_from_row (g , row , dt , k );
605609 if (dt == Int64 ) {
@@ -613,9 +617,9 @@ void test_property_edge_table(int argc, char** argv) {
613617 * ((double * ) pv ), * ((double * ) rv ));
614618 }
615619 grin_destroy_edge_property (g , ep );
616- grin_destroy_name (g , ep_name );
617- grin_destroy_value (g , dt , pv );
618- grin_destroy_value (g , dt , rv );
620+ // grin_destroy_name(g, ep_name);
621+ // grin_destroy_value(g, dt, pv);
622+ // grin_destroy_value(g, dt, rv);
619623 }
620624
621625 grin_destroy_row (g , row );
@@ -646,8 +650,8 @@ void test_property_edge_table(int argc, char** argv) {
646650 et_name );
647651
648652 grin_destroy_edge_type (g , et1 );
649- grin_destroy_name (g , ep_name1 );
650- grin_destroy_name (g , et_name );
653+ // grin_destroy_name(g, ep_name1);
654+ // grin_destroy_name(g, et_name);
651655
652656#ifdef GRIN_WITH_EDGE_PROPERTY_NAME
653657 const char * ep_name = grin_get_edge_property_name (g , et , ep );
@@ -704,8 +708,8 @@ void test_property_edge_table(int argc, char** argv) {
704708 ep5_name );
705709 grin_destroy_edge_property (g , ep5 );
706710 grin_destroy_edge_type (g , et5 );
707- grin_destroy_name (g , et5_name );
708- grin_destroy_name (g , ep5_name );
711+ // grin_destroy_name(g, et5_name);
712+ // grin_destroy_name(g, ep5_name);
709713 }
710714 grin_destroy_edge_property_list (g , epl2 );
711715 }
@@ -735,7 +739,7 @@ void test_property_primary_key(int argc, char** argv) {
735739 GRIN_VERTEX_TYPE vt = grin_get_vertex_type_from_list (g , vtl , i );
736740 const char * vt_name = grin_get_vertex_type_name (g , vt );
737741 printf ("vertex type name: %s\n" , vt_name );
738- grin_destroy_name (g , vt_name );
742+ // grin_destroy_name(g, vt_name);
739743
740744 GRIN_VERTEX_PROPERTY_LIST vpl = grin_get_primary_keys_by_vertex_type (g , vt );
741745 size_t vpl_size = grin_get_vertex_property_list_size (g , vpl );
@@ -745,29 +749,25 @@ void test_property_primary_key(int argc, char** argv) {
745749 GRIN_VERTEX_PROPERTY vp = grin_get_vertex_property_from_list (g , vpl , j );
746750 const char * vp_name = grin_get_vertex_property_name (g , vt , vp );
747751 printf ("primary key name: %s\n" , vp_name );
748- grin_destroy_name (g , vp_name );
752+ // grin_destroy_name(g, vp_name);
749753 grin_destroy_vertex_property (g , vp );
750754 }
751755
752756 GRIN_VERTEX_PROPERTY vp = grin_get_vertex_property_from_list (g , vpl , 0 );
753- GRIN_DATATYPE dt = grin_get_vertex_property_data_type (g , vp );
757+ GRIN_DATATYPE dt = grin_get_vertex_property_datatype (g , vp );
754758
755759 for (size_t j = 1 ; j <= 6 ; ++ j ) {
756760 GRIN_ROW r = grin_create_row (g );
757- grin_insert_value_to_row (g , r , dt , (void * ) (& j ));
761+ if (dt == Int64 ) {
762+ grin_insert_int64_to_row (g , r , j );
763+ } else {
764+ printf ("(Wrong) the primary key type is not int64" );
765+ }
758766 GRIN_VERTEX v = grin_get_vertex_by_primary_keys (g , vt , r );
759767 if (id_type [j ] == i ) {
760768 if (v == GRIN_NULL_VERTEX ) {
761769 printf ("(Wrong) vertex of primary keys %zu does not exist\n" , j );
762770 } else {
763- GRIN_DATATYPE dt0 = grin_get_vertex_original_id_data_type (g );
764- const void * oid0 = grin_get_vertex_original_id_value (g , v );
765- if (dt0 == Int64 ) {
766- printf ("(Correct) vertex of primary keys %zu exists %lld\n" , j ,
767- * ((long long int * ) oid0 ));
768- } else {
769- printf ("(Wrong) unmatch original id type\n" );
770- }
771771 grin_destroy_vertex (g , v );
772772 }
773773 } else {
0 commit comments