Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

viz tries to convert to number for a calculated (db function) column which is string #5082

Closed
zyclonite opened this issue May 25, 2018 · 4 comments
Labels
inactive Inactive for >= 30 days

Comments

@zyclonite
Copy link

Superset version

0.25.5

Expected results

Table View shows my query data for the following clickhouse (sqlalchemy) query

SELECT EventID AS EventID,
       COUNT(*) AS count,
       dictGetString('events', 'Name', toUInt64(EventID)) AS EventName,
       sum(Value) AS TotalValue,
FROM production.fact_game
WHERE EventID == 1000
GROUP BY EventID
ORDER BY TotalValue DESC
LIMIT 50000;

Actual results

Unable to parse string "EventNameABC" at position 0

is displayed with the following stacktrage

Traceback (most recent call last):
  File "pandas/_libs/src/inference.pyx", line 1125, in pandas._libs.lib.maybe_convert_numeric
ValueError: Unable to parse string "EventNameABC"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/superset/viz.py", line 364, in get_df_payload
    df = self.get_df(query_obj)
  File "/usr/local/lib/python3.6/site-packages/superset/viz.py", line 187, in get_df
    self.df_metrics_to_num(df, query_obj.get('metrics') or [])
  File "/usr/local/lib/python3.6/site-packages/superset/viz.py", line 199, in df_metrics_to_num
    df[col] = pd.to_numeric(df[col])
  File "/usr/local/lib/python3.6/site-packages/pandas/core/tools/numeric.py", line 133, in to_numeric
    coerce_numeric=coerce_numeric)
  File "pandas/_libs/src/inference.pyx", line 1158, in pandas._libs.lib.maybe_convert_numeric
ValueError: Unable to parse string "EventNameABC" at position 0

Potential cause

could be related to the following PR/FIX #4726

@rumbin
Copy link
Contributor

rumbin commented May 25, 2018

Maybe unrelated, but does the query really work in other clients? To me the EventName column does not look like an aggregation function (dictGetString). I.e., doesn't it need to be in the group by clause?
I'm not experienced with Clickhouse, though...

@zyclonite
Copy link
Author

it was not changed since we upgraded from a 0.23.x version... so yes...
the function is no aggregation function, it's simply a lookup in an inmemory map, translating an id to a name

@zyclonite
Copy link
Author

maybe fixed with #5176 ?

@stale
Copy link

stale bot commented Apr 10, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale bot added the inactive Inactive for >= 30 days label Apr 10, 2019
@stale stale bot closed this as completed Apr 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive Inactive for >= 30 days
Projects
None yet
Development

No branches or pull requests

2 participants