apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
62.31k stars 13.68k forks source link

deck.gl Path failed to render data from database UDF output #30531

Open sunng87 opened 1 week ago

sunng87 commented 1 week ago

Bug description

I'm getting a frontend error when trying to rendering my path data:

An error occurred while rendering the visualization: TypeError: t is undefined

The error detail doesn't give much information.

My dataset is a saved query that use a UDF called geojson_encode_path to generate json data required by deckgl path. The result has shown up in the results path and it looks correct. If I copy the UDF output data into a new table, it works correctly so I believe the data is correct.

The SQL query sent to server while rendering:

SELECT
  path AS path
FROM (
  SELECT
    recorder,
    GEOJSON_ENCODE_PATH(lat, lon, ts) AS path
  FROM caltrack
  GROUP BY
    recorder
) AS virtual_table
WHERE
  NOT path IS NULL
GROUP BY
  path
LIMIT 10000

The result:

                                       path                    

---------------------------------------------------------------
--------------------
 [[-118.23100280761719,34.06100082397461],[-118.23100280761719,
33.06100082397461]]

Note: the data type of UDF output is varchar.

I didn't see any error from database or superset itself. The data is hosted in GreptimeDB, a postgres compatible database, the driver is based on original postgres' one.

Let me know if you need more information from me.

Screenshots/recordings

image

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Firefox

Additional context

No response

Checklist

dosubot[bot] commented 1 week ago

The error "TypeError: t is undefined" in the context of deck.gl visualizations can be challenging to diagnose without specific details. However, here are a few things you might consider checking:

  1. Data Format: Ensure that the output of your geojson_encode_path UDF is in the correct format expected by the deck.gl Path layer. The expected input format should match the deserialization process used in Superset, which involves JSON, polyline, or geohash formats [1].

  2. Data Deserialization: Verify that the data is being deserialized correctly. Superset uses a deserialization map (deser_map) to handle different line types. Make sure that the data type returned by your UDF is compatible with the expected deserialization function.

  3. Frontend Error Handling: Superset's frontend uses an ErrorBoundary component to catch errors during rendering. The error "TypeError: t is undefined" might indicate an issue with how the data is being processed or rendered on the frontend. Check if there are any additional logs or error messages that might provide more context [2].

  4. Database Compatibility: Since you're using a PostgreSQL-compatible database, ensure that the JSON data types are correctly mapped and handled by Superset. Superset maps JSON data types to the JSON type in SQLAlchemy, which should be compatible with PostgreSQL databases [3].

  5. UDF Output: Since copying the UDF output data into a new table works correctly, there might be an issue with how the UDF output is being handled in the query. Double-check the query logic and ensure that the UDF output is correctly formatted and not altered during the query execution.

If these steps do not resolve the issue, consider simplifying the query or the data to isolate the problem further.

To continue talking to Dosu, mention @dosu.