Repository navigation
SQL editor: schema browser, Open in SQL Editor, cancel, date functions (2/4) - #122
Open
miguelnieto wants to merge 2 commits into
Open
miguelnieto wants to merge 2 commits into
miguelnieto wants to merge 2 commits into
Conversation
This was referenced Oct 17, 2026
miguelnieto
force-pushed
the
02_sql-editor
branch
2 times, most recently
from
October 17, 2026 01:21
58c3f0d to
f54a26e
Compare
miguelnieto
force-pushed
the
02_sql-editor
branch
from
November 7, 2026 17:12
f54a26e to
2bbc792
Compare
BREAKING: requires MAT 1.17.0+ and Java 21. org.eclipse.mat.api 1.17.0 declares Bundle-RequiredExecutionEnvironment: JavaSE-21, so the execution environment cannot go lower. Users on older MAT must stay on 1.6.x. Platform - Target platform moved from Eclipse 2022-12 to Eclipse 4.40, matching the Eclipse release MAT 1.17.0 builds against. - MAT bundles come from the MAT 1.17.0 update site rather than an Eclipse simultaneous release, so the MAT API version matches the MAT users run. Only the units this plugin needs are listed; the full org.eclipse.mat.feature.feature.group would drag in mat.chart and therefore BIRT and Rhino, which are unused. - Java 21: BREE, executionEnvironment, compiler source/target, CI matrix, README requirements. Calcite 1.36 -> 1.42.0 - Aligned Calcite/Guava versions between MatCalcitePlugin/pom.xml and MatCalciteTargetPlatform.target (Guava 33.7.2-jre in both, after Renovate updated the pom only). They had drifted apart (1.41.0 vs 1.36.0) because Renovate only updates poms, not Tycho target definitions. - Avatica 1.29.0 instead of the 1.28.0 Calcite 1.42.0 asks for: Avatica before 1.29.0 has CVE-2026-70410 (unsafe reflection in plugin instantiation, CVSS 8.8). Declared before calcite-core so Maven compiles against the Jackson 2.22.2 it brings, which the target ships. - Added httpclient5/httpcore5 (new Avatica 1.28 dependencies) and org.jooq:joou-java-6 to the target platform and to Import-Package. Without them: NoClassDefFoundError for org/apache/hc/core5/util/Timeout and org/joou/UInteger. - Excluded jakarta.transaction:jakarta.transaction-api from commons-dbcp2: it has an unsatisfiable Import-Package (javax.enterprise.context) and blocked geronimo-jta_1.1_spec from supplying javax.transaction. ORDER BY and joins on heap objects - Calcite 1.37+ sorts Map-typed values with Functions.compareMaps(), which calls entrySet(); HeapReference is a Map only for this['field'] and threw from entrySet(), so every ORDER BY over a heap object failed. entrySet() now returns one entry that orders like compareTo. - Calcite sorts merge-join inputs through entrySet() but merges them with compareTo, so both must give the same order, or matches are dropped (the class/class loader join counted 469 instead of 985). Both now order by address, which is also constant time: ordering by label rebuilt the label on every comparison (ORDER BY this on 4M objects: about 2 min vs 10 s). ORDER BY toString(this) gives label order. SQL functions - getHexAddress(x): the object address as 0x..., as MAT shows it. - getDominator(x) returned an error for objects dominated by the virtual root; it now returns null. Tests - testStackTraces tolerates MAT's own stack frame formatting, which changed in MAT commit 0c72944e ("Bug 581644"): "(Native Method)" became "(Object.java(Native Method))". - New: ORDER BY this in both directions, a merge join over a strict subset, the class/class loader join phrased three ways (985 each). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r, date functions Editor - Right-click menu (Run, Explain, Undo/Redo, Cut/Copy/Paste, Delete, Select All, Toggle Comment); keys are workbench commands in their own context, so F5, Ctrl+Enter and Ctrl+Space no longer go to MAT's OQL commands. - Schema browser beside the editor: classes by package, instanceof, thread stacks and functions, with columns and sizes; double-click inserts the name, quoted where SQL needs it. The filter is debounced and uses cached sorted names. - "SQL Reference" tab; theme colors (with dark theme defaults); completion pops up after '.' and '"'; object icons in results; navigation history restores and reruns a query. - Error underline at the right place for a selection and for Explain, and cleared on the next run. Cancel in the progress view and closing the tab stop a running query (QueryCancellation, checked by the heap scan). - Fixes: keys lost after a table result on GTK/Wayland (no active shell), editor scroll jump on a transient resize, Undo/Redo keys, leaked title image and colors, closed-tab cleanup, debug output on stdout. Open in SQL Editor - On MAT's object menus: a query for the selected objects (by address, one statement per class) or for a class row (all instances, or the row's objects for a partial histogram), added to the SQL tab of the objects' own dump. SQL - Date and time functions: toDateTime, toEpochMillis, millisToDateTime, secondsToDateTime, toDuration. - instanceof."java.lang.ref.Reference" (full class name as one identifier); identifiers quoted by Calcite's reserved words, not only SQL-92's. - CALCITE-1.42-QUERIES.md: what Calcite 1.37-1.42 adds to heap queries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
miguelnieto
force-pushed
the
02_sql-editor
branch
from
November 7, 2026 21:51
2bbc792 to
e1d5ea1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings the SQL editor pane up to the standard of MAT's own panes, and adds:
Editor
.or", not only on Ctrl+Space.QueryCancellation. Calcite itself only checks for cancel between result rows, so an aggregation could not be stopped before.Schema browser
A toolbar toggle shows a tree beside the editor, listing:
instanceof);Each class shows its columns and its
this['@shallow']/this['@retained']sizes. Double-click inserts a name at the cursor, quoted where SQL needs it. The filter box lists matching tables; it is debounced and works from cached sorted names, so it stays fast on dumps with many classes.Open in SQL Editor
"SQL › Open in SQL Editor" appears on the context menu of objects and classes in MAT's views (histogram, dominator tree, object lists, …). It adds a query for the selection to the SQL tab of the objects' own dump, selects it, and doesn't run it:
SQL
toDateTime(x[, zone]),toEpochMillis,millisToDateTime,secondsToDateTime,toDuration.java.util.Date,java.sql.*,Calendarand thejava.timetypes.Datechanged with a deprecated setter, or aCalendarchanged withset(...), can hold a stale time; these return null rather than a wrong time.Long.MAX_VALUEseconds.instanceof."java.lang.ref.Reference"accepts a full class name as one identifier. Identifiers are quoted by Calcite's own reserved words, not only SQL-92's:java.lang.refdoesn't parse unquoted, becauseREFis reserved.instanceof.java.util.AbstractMapas its example. Heap dumps record superclasses but not interfaces, soinstanceof.java.util.Mapis always empty.CALCITE-1.42-QUERIES.mdexplains what Calcite 1.37–1.42 adds for heap queries.Fixes
Testing
./mvnw verifywith JDK 21: 69 tests pass, 1 skipped (@Ignoreonmaintoo). New tests cover the SQL generated for selections, the date functions, cancellation, result icons,instanceofnames and reserved-word quoting.Checked by hand in MAT 1.17.0 on Linux (GTK/Wayland):
Cancel from the Progress view is covered by a unit test only.
🤖 Generated with Claude Code