Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Memory Analyzer » Examples of eval function use(Can't find any info :()
Examples of eval function use [message #1760243] Tue, 25 April 2017 07:22 Go to next message
Ilya Ermolin is currently offline Ilya ErmolinFriend
Messages: 1
Registered: April 2017
Junior Member
Hi!

A want to deeply anderstand OQL in MAT for use and get some trouble to make some computations in MAT itself.

So I want to anderstand what I can do with eval function - for completness of functions. Any Info will be great!
Re: Examples of eval function use [message #1764689 is a reply to message #1760243] Thu, 01 June 2017 12:02 Go to previous message
Andrew Johnson is currently offline Andrew JohnsonFriend
Messages: 205
Registered: July 2009
Senior Member
I put it in as I was trying some complex operations and the grammar wouldn't let me do some things.
E.g.
SELECT t FROM OBJECTS (SELECT s, s.count FROM java.lang.StringBuilder s ) t
gives the error:
Query:
SELECT t FROM OBJECTS (SELECT s, s.count FROM java.lang.StringBuilder s ) t

Problem reported:
Sub-Select must return an object list: SELECT s, s.count FROM java.lang.StringBuilder s

whereas
SELECT t FROM OBJECTS ( eval((SELECT s, s.count FROM java.lang.StringBuilder s )) ) t
did work, though the result:
t
-------------------------------------------------------------------
org.eclipse.mat.parser.internal.oql.OQLQueryImpl$ResultSet@b4096667
-------------------------------------------------------------------
wasn't particular useful.

Sometimes adding extra parentheses also worked:
SELECT t FROM OBJECTS ((SELECT s, s.count FROM java.lang.StringBuilder s )) t
but the extra ones got stripped out when the OQL was executed, so redoing the query failed.

I still haven't found a useful case since I relaxed the grammar to allow a SimpleExpression instead of a PathExpression or EnvVarPathExpression for a SelectItem and a ConditionalOrExpression for a FROM OBJECTS.

Perhaps a SELECT FROM OBJECTS of a subselect returning SelectItems should iterate over that (accessing each SelectItem as an array or map??), but I would like to see a use case.
Previous Topic:Eclipse memory analyzer unit of measurement
Next Topic:Strange unknown string instance
Goto Forum:
  


Current Time: Wed Apr 24 17:01:23 GMT 2024

Powered by FUDForum. Page generated in 0.03208 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top