Hi team, actually I’m stuck in one issue, from yesterday onwards, and my demo is also stucked because of this issue Please guide
recently I moved my code base from 3.4.0 TG cloud to 3.5.0 to Docker
here below code is for Age Based segments which requires parameters to run
[
{ "name": "Tenagers (<18)", "value":"below 18" },
{ "name": "Youth (19 to 30)", "value": "19-30"},
{ "name": "Recently Settled (31 to 37)", "value": "31-37"},
{ "name": "Middle Age( 38 to 50)", "value": "38-50"},
{ "name": "Early Retires( 55 to 60)", "value": "55-60"},
{ "name": "Recently retired(60 to 65))", "value": "60-65"},
{ "name": "Senior Citizen > 66 ", "value": "above 66"}
]
CREATE QUERY ageBasedSegment(String str) FOR GRAPH clientA_analytic {
/* Write query logic here */
JSONARRAY arr;
arr = parse_json_array(str);
DATETIME today = now();
foreach ageindx in range[0,arr.size()-1] do
STRING agekey= arr.getJsonObject(ageindx).getString("name");
STRING agevalue=arr.getJsonObject(ageindx).getString("value");
if instr(agevalue, "below") != -1 THEN
# Below Found
#begin = substr(value,0, instr(value, " "));
STRING lastagevalue = substr(agevalue,instr(agevalue, " ")+1, length(agevalue));
age_filter_customers = select s from customer:s where
floor((datetime_diff(today, s.dob)/86400)/365.2425) <= str_to_int(lastagevalue);
else if instr(agevalue, "-") != -1 THEN
# in between case
STRING beginagevalue = substr(agevalue,0, instr(agevalue, "-"));
STRING lastagevalue = substr(agevalue,instr(agevalue, "-")+1, length(agevalue));
age_filter_customers = select s from customer:s where
floor((datetime_diff(today, s.dob)/86400)/365.2425) >= str_to_int(beginagevalue)
and floor((datetime_diff(today, s.dob)/86400)/365.2425) <= str_to_int(lastagevalue);
else if instr(agevalue, "above") != -1 THEN
# Above Case
STRING lastagevalue = substr(agevalue,instr(agevalue, " ")+1, length(agevalue));
age_filter_customers = select s from customer:s where
floor((datetime_diff(today, s.dob)/86400)/365.2425) <= str_to_int(lastagevalue);
end;
age_filter_customers = select s from age_filter_customers:s POST-ACCUM
INSERT INTO segment_types (PRIMARY_ID, label)
VALUES ("ageBasedSegments", "Age Based Segments"),
INSERT INTO profile_attribute_segment (PRIMARY_ID, label) VALUES (agekey, agekey),
Insert into segment_profile_attribute_segment(FROM, To) VALUES("ageBasedSegments", agekey),
INSERT into customer_profile_attribute_segment (FROM, TO) VALUES (s.customer_id, agekey);
end;
}
Now here the Problem is when I checked this above code in 3.4.0 (works perfect)
but when i migrated everything to 3.5.0 this one is not working.
As i checked my Laptop Hard disk completely full, and its showing me Red Line, I deleted lakhs of vertices and edges from the Graph and then I run this above age segment and in that time also vertex won’t create and no error in console , i tried my other segments logic and all segments will create like a charm without hassle.
Can you please help me why this above code is not working in 3.5.0.
Here below is the Log which i checked in log/gsql folder
tigergraph@d96d0911cb37:~/tigergraph/log/gsql$ sudo tail -f ERROR.20220710-175309.501 E@20220710 18:15:46.318 tigergraph|127.0.0.1:54530|00000000197 (ExternalUtil.java:530) from gsdk/include/core/gpe/gapi4/baseedgesfilter.hpp:20, E@20220710 18:15:46.318 tigergraph|127.0.0.1:54530|00000000197 (ExternalUtil.java:530) from gsdk/include/core/gpe/gapi4/graphapi.hpp:17, E@20220710 18:15:46.318 tigergraph|127.0.0.1:54530|00000000197 (ExternalUtil.java:530) from gsdk/include/gle/engine/cpplib/TypeUtil.hpp:16, E@20220710 18:15:46.318 tigergraph|127.0.0.1:54530|00000000197 (ExternalUtil.java:530) from /home/tigergraph/tigergraph/tmp/gsql/codegen/schema/clientA_analytic_schemaIndex.hpp:3, E@20220710 18:15:46.318 tigergraph|127.0.0.1:54530|00000000197 (ExternalUtil.java:530) from clientA_analytic_tester.cpp:2: E@20220710 18:15:46.318 tigergraph|127.0.0.1:54530|00000000197 (ExternalUtil.java:530) gsdk/include/thirdparty/boost/functional/hash/hash.hpp: In member function ‘void UDIMPL::clientA_analytic::UDF_tester::VertexMap_146(const VERTEX&, UDIMPL::clientA_analytic::UDF_tester::V_ATTR*, const V_VALUE&, gpelib4::SingleValueMapContext<UDIMPL::clientA_analytic::UDF_tester::__GQUERY__Delta__000097>*)’: E@20220710 18:15:46.319 tigergraph|127.0.0.1:54530|00000000197 (ExternalUtil.java:530) gsdk/include/thirdparty/boost/functional/hash/hash.hpp:282:42: warning: ‘pc_date_int64_t’ may be used uninitialized in this function [-Wmaybe-uninitialized] E@20220710 18:15:46.320 tigergraph|127.0.0.1:54530|00000000197 (ExternalUtil.java:530) return static_cast<std::size_t>(v); E@20220710 18:15:46.320 tigergraph|127.0.0.1:54530|00000000197 (ExternalUtil.java:530) ^ E@20220710 18:15:46.321 tigergraph|127.0.0.1:54530|00000000197 (ExternalUtil.java:530) clientA_analytic_tester.cpp:5226:12: note: ‘pc_date_int64_t’ was declared here
and what other is see as well
if we assume there is an issue of memory (exhaust) then after deleting everything I give the first priority to this above segment code to create , but wont work , other works.
and second thing
only one segment is created (Recently Retired), then why these two below basic lines of INSERT wont work in the above GSQL? even though these line works in 3.4.0
INSERT INTO segment_types (PRIMARY_ID, label) VALUES ("ageBasedSegments", "Age Based Segments"),
Insert into segment_profile_attribute_segment(FROM, To) VALUES("ageBasedSegments", agekey),
Thanks