本文介绍了如何在MAT Eclipse中使用OQL进行嵌入式查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以通过使用以下查询获取所有线程对象
SELECT OBJECTS dominators(s)FROM java.lang.Thread s
那么如果我想对返回的结果对象进行进一步分析,我认为应该是如下所示:
SELECT * from(SELECT OBJECTS dominators(s)FROM java.lang.Thread s)
但它转向ClassCastException。
报告问题:
发生ClassCastException。记住:具有修饰符INSTANCESOF或INCLUDING SUBCLASSES的子查询必须只返回类对象
java.lang.ClassCastException:org.eclipse.mat.parser.model.InstanceImpl不能转换为org.eclipse.mat .snapshot.model.IClass
在org.eclipse.mat.parser.internal.oql.OQLQueryImpl.doSubQuery(OQLQueryImpl.java:752)
在org.eclipse.mat.parser.internal.oql。 OQLQueryImpl.internalExecute(OQLQueryImpl.java:642)
在org.eclipse.mat.parser.internal.oql.OQLQueryImpl.execute(OQLQueryImpl.java:627)
在org.eclipse.mat.inspections。 OQLQuery.execute(OQLQuery.java:50)
在org.eclipse.mat.inspections.OQLQuery.execute(OQLQuery.java:1)
在org.eclipse.mat.query.registry.ArgumentSet。 execute(ArgumentSet.java:129)
在org.eclipse.mat.ui.snapshot.panes.OQLPane $ OQLJob.doRun(OQLPane.java:339)
在org.eclipse.mat.ui。 editor.AbstractPaneJob.run(AbstractPaneJob.java:34)
在org.eclipse.core.internal.jobs.Worker.run(Worker.jav a:54)
MATLAB中的OQL是否支持嵌入式查询,如何获取结果想要?
解决方案
使子查询工作有点棘手。尝试以下操作:
SELECT * from OBJECTS(SELECT OBJECTS dominators(s)FROM java.lang.Thread s)
我从下面的链接获得了解决方案:
I can get all Thread objects by using query as below
SELECT OBJECTS dominators(s) FROM java.lang.Thread s
then if I want to do further analysis of the returned result objects, the OQL I think should be like below:
SELECT * from (SELECT OBJECTS dominators(s) FROM java.lang.Thread s)
But it turns to ClassCastException.
Problem reported:
ClassCastException occured. Remember: sub queries with the modifier INSTANCESOF or INCLUDING SUBCLASSES must return only class objects
java.lang.ClassCastException: org.eclipse.mat.parser.model.InstanceImpl cannot be cast to org.eclipse.mat.snapshot.model.IClass
at org.eclipse.mat.parser.internal.oql.OQLQueryImpl.doSubQuery(OQLQueryImpl.java:752)
at org.eclipse.mat.parser.internal.oql.OQLQueryImpl.internalExecute(OQLQueryImpl.java:642)
at org.eclipse.mat.parser.internal.oql.OQLQueryImpl.execute(OQLQueryImpl.java:627)
at org.eclipse.mat.inspections.OQLQuery.execute(OQLQuery.java:50)
at org.eclipse.mat.inspections.OQLQuery.execute(OQLQuery.java:1)
at org.eclipse.mat.query.registry.ArgumentSet.execute(ArgumentSet.java:129)
at org.eclipse.mat.ui.snapshot.panes.OQLPane$OQLJob.doRun(OQLPane.java:339)
at org.eclipse.mat.ui.editor.AbstractPaneJob.run(AbstractPaneJob.java:34)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Does OQL in MAT Eclipse supports embedded query, and how can I get the results I want?
解决方案 It is a little bit tricky to make the sub-query work. Try following:
SELECT * from OBJECTS (SELECT OBJECTS dominators(s) FROM java.lang.Thread s)
I got the solution from below link:https://www.eclipse.org/forums/index.php/t/608746/
这篇关于如何在MAT Eclipse中使用OQL进行嵌入式查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!