fix(scatter): Fix ad-hoc metric for pointsize#37669
Draft
alexandrusoare wants to merge 1 commit intomasterfrom
Draft
fix(scatter): Fix ad-hoc metric for pointsize#37669alexandrusoare wants to merge 1 commit intomasterfrom
alexandrusoare wants to merge 1 commit intomasterfrom
Conversation
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
When creating a deck.gl Scatterplot chart, it's possible to choose between a fixed point size, or a dynamic one (calculated with a metric). The metric popover allows you to either select an existing metric from the dataset, or create a new one via custom SQL. Charts using a custom SQL metric are showing errors.
Root Cause
This is a regression from a previous fix that addressed fixed point size not working. That fix introduced
extractMetricKey()which converts adhoc metric objects to plain strings, losing theexpressionTypeproperty that the backend needs to identify custom SQL metrics.What happens:
count(*) * 1.1expressionType: "SQL"andsqlExpressionextractMetricKey()strips it down to just the string"count(*) * 1.1"expressionType), and it's not a saved metric eitherFix
Modified
buildQuery.tsto preserve the full metric object instead of extracting only the label string. UsedgetMetricLabel()only where a string representation is actually needed (for theorderbyclause).Alternative Considered
Fix
extractMetricKey()to optionally return full objects - This would be a more "correct" fix at the utility level, but touches shared code used by other components, increasing risk of unintended side effects. The minimal fix inbuildQuery.tsis safer and achieves the same result.Tests Added
5 new tests to prevent future regressions:
count(*) * 1.1)AVG(column))BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
BEFORE
Screen.Recording.2026-02-04.at.15.28.12.mov
AFTER
Screen.Recording.2026-02-04.at.15.25.04.mov
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION