Query installation failures

I am experiencing failures installing the following queries:


USE GRAPH mag

BEGIN

CREATE QUERY count_all_vertices() FOR GRAPH mag {

SumAccum @@vertexCount;

vertices = {paper., author., affiliation., journal., fieldofstudy., conferenceinstance., conferenceseries.*};

tmp = SELECT v FROM vertices:v POST_ACCUM @@vertexCount += 1;

PRINT @@vertexCount;

}

END

INSTALL QUERY count_all_vertices


and


USE GRAPH mag

BEGIN

CREATE QUERY lte_four_hop_neighbors(VERTEX p) FOR GRAPH mag {

OrAccum @visited = false;

Start = {p};

FirstNeighbors = SELECT tgt

                 FROM Start:s -(refers_to:e)-> paper:tgt

                ACCUM tgt.@visited += true, s.@visited += true;

SecondNeighbors = SELECT tgt

                  FROM FirstNeighbors:s -(refers_to:e)-> paper:tgt

                 WHERE tgt.@visited == false

                 ACCUM tgt.@visited += true, s.@visited += true;

ThirdNeighbors = SELECT tgt

                 FROM SecondNeighbors:s -(refers_to:e)-> paper:tgt

                WHERE tgt.@visited == false

                ACCUM tgt.@visited += true, s.@visited += true;

FourthNeighbors = SELECT tgt

                  FROM ThirdNeighbors -(refers_to:e)-> paper:tgt

                 WHERE tgt.@visited == false;

All = FirstNeighbors UNION SecondNeighbors UNION ThirdNeighbors UNION FourthNeighbors;

PRINT All;

}

END

INSTALL QUERY lte_four_hop_neighbors


The GSQL_LOG after trying to execute the queries looks like this:


I@20190909 15:26:00.225 tigergraph|127.0.0.1:43196|249273347 (FileHandler.java:45) USE GRAPH mag

BEGIN

CREATE QUERY count_all_vertices() FOR GRAPH mag {

SumAccum @@vertexCount;

vertices = {paper., author., affiliation., journal., fieldofstudy., conferenceinstance., conferenceseries.*};

tmp = SELECT v FROM vertices:v POST_ACCUM @@vertexCount += 1;

PRINT @@vertexCount;

}

END

INSTALL QUERY count_all_vertices

I@20190909 15:26:00.228 tigergraph|127.0.0.1:43196|249273347 (CatalogLock.java:223) Lock: Short && Read

I@20190909 15:26:00.458 tigergraph|127.0.0.1:43196|249273347 (CatalogManager.java:811) getCatalog: null

I@20190909 15:26:00.459 tigergraph|127.0.0.1:43196|249273347 (CatalogManager.java:768) switch to graph ‘mag’.

I@20190909 15:26:00.461 tigergraph|127.0.0.1:43196|249273347 (CatalogLock.java:273) Unlock: Short && Read

I@20190909 15:26:00.461 tigergraph|127.0.0.1:43196|249273347 (CatalogManager.java:811) getCatalog: mag

I@20190909 15:26:00.461 tigergraph|127.0.0.1:43196|249273347 (QueryBlockHandler.java:184) Unknown QB com.tigergraph.schema.ast.ddl.other.s@e0f18e20

I@20190909 15:26:00.461 tigergraph|127.0.0.1:43196|249273347 (CatalogManager.java:811) getCatalog: mag

I@20190909 15:26:00.465 tigergraph|127.0.0.1:43196|249273347 (CatalogLock.java:208) Lock: Short && Write

I@20190909 15:26:00.692 tigergraph|127.0.0.1:43196|249273347 (Util.java:1805) This query use sytax version v1

I@20190909 15:26:00.693 tigergraph|127.0.0.1:43196|249273347 (Util.java:1805) This query use syntax v1 for backward compatibility transformation.

I@20190909 15:26:00.809 tigergraph|127.0.0.1:43196|249273347 (CatalogLock.java:270) Unlock: Short && Write

I@20190909 15:26:00.809 tigergraph|127.0.0.1:43196|249273347 (CatalogManager.java:811) getCatalog: mag

I@20190909 15:26:00.810 tigergraph|127.0.0.1:43196|249273347 (QueryBlockHandler.java:184) Unknown QB com.tigergraph.schema.ast.ddl.other.t@e0f1a1d0

I@20190909 15:26:00.813 tigergraph|127.0.0.1:43196|249273347 (CatalogLock.java:194) Lock: Long && Write

I@20190909 15:26:01.016 tigergraph|127.0.0.1:43196|249273347 (CatalogManager.java:811) getCatalog: mag

I@20190909 15:26:01.016 tigergraph|127.0.0.1:43196|249273347 (Catalog.java:1191) Install query [count_all_vertices]

I@20190909 15:26:01.017 tigergraph|127.0.0.1:43196|249273347 (Util.java:1429) GSQL_COMPILE_THREADS:0

I@20190909 15:26:01.017 tigergraph|127.0.0.1:43196|249273347 (Util.java:1434) sys proc:2

I@20190909 15:26:01.017 tigergraph|127.0.0.1:43196|249273347 (Util.java:1441) sys mem:7

I@20190909 15:26:01.030 tigergraph|127.0.0.1:43196|249273347 (Util.java:1805) This query use sytax version v1

I@20190909 15:26:01.031 tigergraph|127.0.0.1:43196|249273347 (Util.java:1805) This query use syntax v1 for backward compatibility transformation.

I@20190909 15:26:01.108 tigergraph|127.0.0.1:43196|249273347 (Util.java:1567) /home/tigergraph/.syspre/usr/bin/g++ --sysroot=/home/tigergraph/.syspre -Isrc -Igsdk/include -Igsdk/include/thirdparty -Igsdk/include/thirdparty/sparsehash -Igsdk/include/thirdparty/glog -Igsdk/include/thirdparty/jsoncpp -Igsdk/include/thirdparty/cereal -c -Wall -fmessage-length=0 -Wno-unused -fpermissive -fno-omit-frame-pointer -ldl -DRELEASE -O3 -DREMOVETESTASSERT -D__STDC_FORMAT_MACROS -fPIC -std=c++11 -I/home/tigergraph/tigergraph/dev/gdk/gsql/src/QueryUdf -xc++ -fPIC - -o objs/gq_count_all_vertices.o

I@20190909 15:26:01.115 tigergraph|127.0.0.1:43196|249273347 (Util.java:1567) /home/tigergraph/.syspre/usr/bin/g++ --sysroot=/home/tigergraph/.syspre -Isrc -Igsdk/include -Igsdk/include/thirdparty -Igsdk/include/thirdparty/sparsehash -Igsdk/include/thirdparty/glog -Igsdk/include/thirdparty/jsoncpp -Igsdk/include/thirdparty/cereal -c -Wall -fmessage-length=0 -Wno-unused -fpermissive -fno-omit-frame-pointer -ldl -DRELEASE -O3 -DREMOVETESTASSERT -D__STDC_FORMAT_MACROS -fPIC -std=c++11 -I/home/tigergraph/tigergraph/dev/gdk/gsql/src/QueryUdf -xc++ -fPIC - -o objs/querydispatcher.o

:113:27: error: redeclaration of ‘int UDIMPL::mag::UDF_count_all_vertices::VATT_paper_PaperId’

:112:27: note: previous declaration ‘int UDIMPL::mag::UDF_count_all_vertices::VATT_paper_PaperId’

:134:29: error: redeclaration of ‘int UDIMPL::mag::UDF_count_all_vertices::VATT_author_AuthorId’

:133:29: note: previous declaration ‘int UDIMPL::mag::UDF_count_all_vertices::VATT_author_AuthorId’

:144:39: error: redeclaration of ‘int UDIMPL::mag::UDF_count_all_vertices::VATT_affiliation_AffiliationId’

:143:39: note: previous declaration ‘int UDIMPL::mag::UDF_count_all_vertices::VATT_affiliation_AffiliationId’

:156:53: error: redeclaration of ‘int UDIMPL::mag::UDF_count_all_vertices::VATT_conferenceinstance_ConferenceInstanceId’

:155:53: note: previous declaration ‘int UDIMPL::mag::UDF_count_all_vertices::VATT_conferenceinstance_ConferenceInstanceId’

:172:49: error: redeclaration of ‘int UDIMPL::mag::UDF_count_all_vertices::VATT_conferenceseries_ConferenceSeriesId’

:171:49: note: previous declaration ‘int UDIMPL::mag::UDF_count_all_vertices::VATT_conferenceseries_ConferenceSeriesId’

:181:31: error: redeclaration of ‘int UDIMPL::mag::UDF_count_all_vertices::VATT_journal_JournalId’

:180:31: note: previous declaration ‘int UDIMPL::mag::UDF_count_all_vertices::VATT_journal_JournalId’

:193:41: error: redeclaration of ‘int UDIMPL::mag::UDF_count_all_vertices::VATT_fieldofstudy_FieldOfStudyId’

:192:41: note: previous declaration ‘int UDIMPL::mag::UDF_count_all_vertices::VATT_fieldofstudy_FieldOfStudyId’

I@20190909 15:26:09.289 tigergraph|127.0.0.1:43196|249273347 (Util.java:1587) querydispatcher finished 0

I@20190909 15:26:11.244 tigergraph|127.0.0.1:43196|249273347 (Util.java:1587) count_all_vertices finished 1

I@20190909 15:26:11.248 tigergraph|127.0.0.1:43196|249273347 (CatalogLock.java:267) Unlock: Long && Write

I@20190909 15:26:11.248 tigergraph|127.0.0.1:43196|249273347 (QueryBlockHandler.java:142) exit on error 0

I@20190909 15:26:11.259 tigergraph|127.0.0.1:43196|249273347 (BaseHandler.java:16) BaseHandler: a

I@20190909 15:26:11.259 tigergraph|127.0.0.1:43196|249273347 (AbortClientSessionHandler.java:29) AbortSession added for session = 249273347

I@20190909 15:26:11.259 tigergraph|127.0.0.1:43196|249273347 (AbortClientSessionHandler.java:30) AbortLoadingProgress added for session = 249273347


I am not sure how to interpret the ‘redaclaration’ error. Can you give me any pointers?

gadmin status shows:


=== zk ===

[SUMMARY][ZK] process is up

[SUMMARY][ZK] /home/tigergraph/tigergraph/zk is ready

=== kafka ===

[SUMMARY][KAFKA] process is up

[SUMMARY][KAFKA] queue is ready

=== gse ===

[SUMMARY][GSE] process is up

[SUMMARY][GSE] id service is ready (online)

=== dict ===

[SUMMARY][DICT] process is up

[SUMMARY][DICT] dict server is ready

=== ts3 ===

[SUMMARY][TS3] process is down

[SUMMARY][TS3] ts3 is ready

=== graph ===

[SUMMARY][GRAPH] graph is ready

=== nginx ===

[SUMMARY][NGINX] process is up

[SUMMARY][NGINX] nginx is ready

=== restpp ===

[SUMMARY][RESTPP] process is up

[SUMMARY][RESTPP] restpp is ready

=== gpe ===

[SUMMARY][GPE] process is up

[SUMMARY][GPE] graph is ready (online)

=== gsql ===

[SUMMARY][GSQL] process is up

[SUMMARY][GSQL] gsql is ready

=== Visualization ===

[SUMMARY][VIS] process is up (VIS server PID: 20809)

[SUMMARY][VIS] gui server is up


P. S. The graph schema for these queries is the following:


CREATE VERTEX paper (PRIMARY_ID PaperId INT, PaperId INT, Rank INT, Doi STRING, DocType STRING, PaperTitle STRING, OriginalTitle STRIN\

G, BookTitle STRING, Year INT, DatePublished DATETIME, Publisher STRING, Volume STRING, Issue STRING, FirstPage STRING, LastPage STRIN\

G, ReferenceCount INT, CitationCount INT, EstimatedCitation INT, OriginalVenue STRING, CreatedDate DATETIME) WITH primary_id_as_attrib\

ute=“true”

CREATE VERTEX author (PRIMARY_ID AuthorId INT, AuthorId INT, Rank INT, NormalizedName STRING, DisplayName STRING, LastKnownAffiliation\

Id INT, PaperCount INT, CitationCount INT, CreatedDate DATETIME) WITH primary_id_as_attribute=“true”

CREATE VERTEX affiliation (PRIMARY_ID AffiliationId INT, AffiliationId INT, Rank INT, NormalizedName STRING, DisplayName STRING, GridI\

d STRING, OfficialPage STRING, WikiPage STRING, PaperCount INT, CitationCount INT, CreatedDate DATETIME) WITH primary_id_as_attribute=\

“true”

CREATE VERTEX conferenceinstance (PRIMARY_ID ConferenceInstanceId INT, ConferenceInstanceId INT, NormalizedName STRING, DisplayName ST\

RING, Location STRING, OfficialUrl STRING, StartDate DATETIME, EndDate DATETIME, AbstractRegistrationDate DATETIME, SubmissionDeadline\

Date DATETIME, NotificationDueDate DATETIME, FinalVersionDueDate DATETIME, PaperCount INT, CitationCount INT, CreatedDate DATETIME) WI\

TH primary_id_as_attribute=“true”

CREATE VERTEX conferenceseries (PRIMARY_ID ConferenceSeriesId INT, ConferenceSeriesId INT, Rank INT, NormalizedName STRING, DisplayNam\

e STRING, PaperCount INT, CitationCount INT, CreatedDate DATETIME) WITH primary_id_as_attribute=“true”

CREATE VERTEX journal (PRIMARY_ID JournalId INT, JournalId INT, Rank INT, NormalizedName STRING, DisplayName STRING, Issn STRING, Publ\

isher STRING, Webpage STRING, PaperCount INT, CitationCount INT, CreatedDate DATETIME) WITH primary_id_as_attribute=“true”

CREATE VERTEX fieldofstudy (PRIMARY_ID FieldOfStudyId INT, FieldOfStudyId INT, Rank INT, NormalizedName STRING, DisplayName STRING, Ma\

inType STRING, Level INT, PaperCount INT, CitationCount INT, CreatedDate DATETIME) WITH primary_id_as_attribute=“true”

CREATE DIRECTED EDGE is_author_of (FROM author, TO paper)

CREATE DIRECTED EDGE is_affiliated_with (FROM author, TO affiliation)

CREATE DIRECTED EDGE is_published_in (FROM paper, TO journal)

CREATE DIRECTED EDGE is_presented_at (FROM paper, TO conferenceinstance)

CREATE DIRECTED EDGE belongs_to (FROM paper, TO fieldofstudy)

CREATE DIRECTED EDGE causes_to_recommend (FROM paper, TO paper)

CREATE DIRECTED EDGE refers_to (FROM paper, TO paper)

CREATE DIRECTED EDGE is_instance_of (FROM conferenceinstance, TO conferenceseries)

CREATE GRAPH mag (paper, author, affiliation, conferenceinstance, conferenceseries, journal, fieldofstudy, is_author_of, is_affiliated\

_with, is_published_in, is_presented_at, belongs_to, causes_to_recommend, refers_to, is_instance_of)


It probably to be a problem when one define primary_id_as_attrib and have an attribute has the same name with the primary_id.

In this case, seems attributes of PaperId, AuthorId, ConferenceInstanceId and so on are not needed. By removing them may solve the problem.

Please let me know.

Thanks.

Thank you. You are right, I had forgotten to remove the redeclaration of the attribute when I added “with primary_id_as_attribute=‘true’”. Removing the unnecessary attributes solved the issue.

A follow-up question: is there a better way to write the second query? I want all the nodes that are 1 to 4 hops from a given one, so each hop is a separate SELECT during which the accumulator is updated. I take it there isn’t the notion of a loop in GSQL?

There is WHILE loop.

Please refer to the user document.

https://docs.tigergraph.com/dev/gsql-ref/querying/control-flow-statements#while-statement