mystichronicle opened a new pull request, #35933:
URL: https://github.com/apache/superset/pull/35933

   ### SUMMARY
   
   This PR fixes issue #35930 where deck.gl scatterplot charts failed to create 
with the error `'int' object has no len()`. The root cause was that deck.gl 
visualizations send integer column and metric IDs, but the backend validation 
and type system only expected strings or adhoc metric/column objects.
   
   **Changes:**
   
   **Backend:**
   - Updated `Column` and `Metric` type definitions to include `int` in 
addition to strings and adhoc objects
   - Added custom `validate_orderby_column()` validator to accept integers, 
replacing Marshmallow's `Length` validator
   - Updated `_set_metrics()` in `QueryObject` to handle integer metric IDs
   - Added integer handling in `get_metric_name()` and `get_column_name()` 
utility functions
   
   **Frontend:**
   - Added column deduplication in deck.gl Scatter `buildQuery` to prevent 
duplicate columns when the same column is used for both latitude and longitude
   - Fixed static point size handling to only use as metric when `type === 
'metric'`, not when `type === 'fix'`
   - Added duplicate filter prevention in `addSpatialNullFilters()` for spatial 
columns
   
   **Tests:**
   - Added unit tests for orderby and metrics field validation with integers
   - Added unit tests for `get_metric_name()` and `get_column_name()` with 
integer IDs
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   **Before:** Creating a deck.gl scatterplot chart resulted in error:
   ```
   TypeError: object of type 'int' has no len()
   ```
   
   **After:** deck.gl scatterplot charts create successfully with integer 
column/metric IDs.
   
   ### TESTING INSTRUCTIONS
   
   1. Ensure Superset is running with the changes
   2. Navigate to a dataset with numeric columns
   3. Create a new deck.gl Scatterplot chart
   4. Select columns for Longitude and Latitude (using the same column for both 
to test deduplication)
   5. Configure point radius as either:
      - Static value (type: "fix") - should not be treated as metric
      - Dynamic metric (type: "metric") - should be included in query
   6. Click "Update Chart" or "Run"
   7. Verify chart creates successfully without errors
   8. Run backend tests:
      ```bash
      pytest 
tests/unit_tests/charts/test_schemas.py::test_chart_data_query_object_schema_orderby_validation
      pytest 
tests/unit_tests/charts/test_schemas.py::test_chart_data_query_object_schema_metrics_validation
      pytest 
tests/unit_tests/utils/test_core.py::test_get_metric_name_with_integers
      pytest 
tests/unit_tests/utils/test_core.py::test_get_column_name_with_integers
      ```
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: Fixes #35930
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to