Skip to content

Escaping $ references in OQL commands #143

@bsfarrell

Description

@bsfarrell

This is more or less a duplicate of #113, but for the more general case of any query that contains a ${...}.

For example, I want to show the sum of some LongAdder objects. Here's the best query I have been able to come up with:

SELECT 
  adder.base AS base, 
  (SELECT cell.value AS value FROM OBJECTS ${adder}.cells[0:-1] cell ) AS cells 
FROM java.util.concurrent.atomic.LongAdder adder 

Which gives results

           base |cells
----------------------------------------------------------------------------------
     14,651,647 |ObjectResultSet@5411f1c0[2][1][{value=23699102},{value=11644251}]
 Total: 1 entry |
----------------------------------------------------------------------------------

I can export this as CSV and post-process it with a script to add up the base and cells values, so this is sufficient for my purposes. (If there's a better query, please let me know!)

Then problem occurs when I want to run this query via the ParseHeapDump script. Regardless of whether I specify the query on the command line along with org.eclipse.mat.api:query, or if I create a custom report XML like the one mentioned in #113, I still get an error because the ${adder} string is removed. I can't seem to find any way to escape it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions