You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by dk <de...@googlemail.com> on 2017/12/12 22:01:15 UTC
Problems with explain statemenz
Hi,
I am trying to do an explain analysis on an SQL statement:
SqlFieldsQuery sql = new SqlFieldsQuery(
" explain SELECT act.id as id, act.actDef as actDef, act.status,
act.prio as prio, o.orgId, p.userId "
+ " FROM Activity as act left join Orga as o on act.id = o.actId
left join Person as p on act.id = p.actId "
+ " WHERE act.prio = 1 and p.userId = 1 and o.orgId in (1, 2,
3, 4, 5, 6, 7)
+ " ORDER BY actDef FETCH FIRST 101 ROWS ONLY", true);
for(int i = 0; i < 5; i++)
try (FieldsQueryCursor<List<?>> joinCursor =
taskCache.query(sql)) {
for (List<?> row : joinCursor){
System.out.println("Activity data = " + row.get(0) + "&
orga = " + row.get(4) + " " + row.get(1) + " " + row.get(2));
System.out.println("Activity data = " + row.get(0);
...
Unfortunately, an Exception from the resulting list is thrown.
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 4,
Size: 1
at java.util.Collections$SingletonList.get(Collections.java:4815)
at
com.example.demo.DemoIgniteApplication.main(DemoIgniteApplication.java:489)
The program runs fine if the explain command is removed.
What can I do to continue my analysis?
Regards
Desiree
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: Problems with explain statemenz
Posted by vkulichenko <va...@gmail.com>.
The result set is different when you add explain - it only returns execution
plans:
https://apacheignite-sql.readme.io/docs/performance-and-debugging#using-explain-statement
However, you're trying to get values for multiple columns which are not
there, therefore it fails.
-Val
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: Problems with explain statemenz
Posted by dk <de...@googlemail.com>.
Thanks,
that is absolutely correct.
If explain is used only the first colum contains a value.
Thus the following statement prints out the execution plan:
try (FieldsQueryCursor<List<?>> joinCursor = activityCache.query(sql)) {
for (List<?> row : joinCursor){
System.out.println(" explain statement: " + row.get(0);
}
....
}
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/