Class ShowModifierProfile

java.lang.Object
dev.frostlake.executor.commands.ShowModifierProfile

public final class ShowModifierProfile extends Object
What the TERSE / STARTS WITH / LIMIT modifiers actually do to one SHOW listing.

They do not do the same thing to all of them, and the differences are not guessable — this class is a transcription of what a real account answered on listing by listing, and the per-listing branches below each cite the reply that pins them.

Three facts drive the shape of this class:

  • STARTS WITH and LIMIT are accepted far more widely than they are honoured. Snowflake parses both on nearly every listing and then silently ignores them on seven or eight of them — SHOW STAGES STARTS WITH 'ZZZ' returns both stages, SHOW SEQUENCES LIMIT 1 returns both sequences, SHOW FUNCTIONS LIMIT 2 returns all 1136 rows. Frostlake has to ignore them in exactly the same places, so the two booleans here are per-listing.
  • The honour sets for the two modifiers are not the same set. TAGS honours LIMIT (SHOW TAGS LIMIT 1 → 1 of 2) but ignores STARTS WITH (SHOW TAGS STARTS WITH 'ZZZ' → both). Nothing about the object type predicts it.
  • TERSE is not one projection. It trims to five columns on TABLES/VIEWS/SCHEMAS/DATABASES/ OBJECTS, to those five plus a sixth on STREAMS (tableOn) and TASKS (schedule), to an unrelated subset on ROLES and USERS, and to nothing at all — the full listing, unchanged — on the dozen others that still accept the keyword.

The TERSE column list is a target shape, not a filter: terseColumns() names the columns the row must end up with, in order, and the projection fills each from the source listing when it has a column of that name and with null when it does not. That keeps the column contract right even where Frostlake's underlying listing models less than a real account's does.

  • Method Details

    • sortsByName

      public boolean sortsByName()
      Whether the listing is returned ordered by name — see sorted(boolean, boolean, java.util.List<java.lang.String>, java.lang.String, boolean).
    • honorsStartsWith

      public boolean honorsStartsWith()
      Whether STARTS WITH 'prefix' filters this listing or is parsed and dropped.
    • honorsLimit

      public boolean honorsLimit()
      Whether LIMIT n [FROM 'name'] paginates this listing or is parsed and dropped.
    • terseColumns

      public List<String> terseColumns()
      The columns TERSE projects onto, in order; empty when TERSE leaves the listing alone.
    • terseKind

      public String terseKind()
      The literal kind TERSE reports when the untrimmed listing has no such column.
    • terseKindFromMaterializedFlag

      public boolean terseKindFromMaterializedFlag()
      Whether kind is MATERIALIZED_VIEW / VIEW per row, read off is_materialized.
    • forStatement

      The profile for one parsed SHOW statement.

      The order of the tests mirrors ShowCommandHandler: the compound listings (MATERIALIZED VIEWS, DYNAMIC TABLES, FILE FORMATS, the two POLICIES) have to be recognised before the bare keyword they contain, or SHOW MATERIALIZED VIEWS would be answered as VIEWS.