Skip to content

Conversation

@shouples
Copy link
Contributor

Summary of Changes

This PR migrates the Flink AI models query from SHOW MODELS to use INFORMATION_SCHEMA.MODELS and INFORMATION_SCHEMA.MODEL_OPTIONS with a UNION ALL pattern, enabling access to additional model metadata.

The implementation follows the established pattern from udfSystemCatalogQuery.ts and relationsAndColumnsSystemCatalogQuery.ts:

  • Query combines model definitions and model options using UNION ALL with row type discrimination
  • SAX-style parser processes sorted rows to build complete model objects with their version-specific options
  • Proper error handling for malformed data and unexpected row ordering

Key changes:

  • Query: Replaced SHOW MODELS with INFORMATION_SCHEMA query combining MODELS and MODEL_OPTIONS tables
  • Model enhancement: Added defaultVersion, versionCount, comment, and options (Map) properties to FlinkAIModel
  • Transformation: Implemented row sorting and SAX-style parsing to accumulate version-specific options
  • Cache compatibility: Fixed Map serialization issue in constructor to handle JSON rehydration

Closes #3063

Click-testing instructions

  1. Sign in to CCloud
  2. Select a Flink database that has AI models
  3. Switch to the Flink AI view mode
  4. Expand the Models item
  5. Hover over a model to see the enhanced tooltip with default version, version count, comment, and version-specific options
  6. Switch to another view mode and back; expect Models to load near-instantly from cache

Optional: Any additional details or context that should be provided?

The most interesting technical detail is handling the Map serialization through the workspace state cache. When ResourceManager stores resources as JSON, the nested Map<string, Map<string, string>> structure loses type information. The constructor now includes:

this.options = props.options instanceof Map ? props.options : new Map();

This ensures cached resources properly rehydrate the Map structure.

Pull request checklist

Please check if your PR fulfills the following (if applicable):

Tests

  • Added new
  • Updated existing
  • Deleted existing

Release notes

  • Does anything in this PR need to be mentioned in the user-facing CHANGELOG?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate SHOW MODELS query to use the information schema with UNION ALL

2 participants