You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "khaledjameel27 (via GitHub)" <gi...@apache.org> on 2025/10/05 12:02:43 UTC

[I] Bar Chart issue after upgrading to version 5.0 [superset]

khaledjameel27 opened a new issue, #35505:
URL: https://github.com/apache/superset/issues/35505

   ### Bug description
   
   After upgrading from Superset 4.1.1 to Superset 5.0.0, some of  the bar chart are not working with the following error 
   Unable to parse SQL: Error parsing near 'AS' at line 1:39
   SELECT "DATE" - (DAY("DATE")-1) DAYS AS "DATE", sum("TOTAL_FEE") AS "SUM(TOTAL_FEE)" 
   
   and here is the logs, 
   
   2025-10-05 11:05:25,779:WARNING:superset.views.error_handling:SupersetErrorException
   Traceback (most recent call last):
     File "/root/superset-venv/lib/python3.10/site-packages/superset/sql/parse.py", line 267, in _parse
       return sqlglot.parse(script, dialect=dialect)
     File "/root/superset-venv/lib/python3.10/site-packages/sqlglot/__init__.py", line 102, in parse
       return Dialect.get_or_raise(read or dialect).parse(sql, **opts)
     File "/root/superset-venv/lib/python3.10/site-packages/sqlglot/dialects/dialect.py", line 1022, in parse
       return self.parser(**opts).parse(self.tokenize(sql), sql)
     File "/root/superset-venv/lib/python3.10/site-packages/sqlglot/parser.py", line 1592, in parse
       return self._parse(
     File "/root/superset-venv/lib/python3.10/site-packages/sqlglot/parser.py", line 1664, in _parse
       self.raise_error("Invalid expression / Unexpected token")
     File "/root/superset-venv/lib/python3.10/site-packages/sqlglot/parser.py", line 1705, in raise_error
       raise error
   sqlglot.errors.ParseError: Invalid expression / Unexpected token. Line 1, Col: 39.
     SELECT "DATE" - (DAY("DATE")-1) DAYS AS "DATE", sum("TOTAL_FEE") AS "SUM(TOTAL_FEE)" 
   FROM (select l.NUMBER , DATE(l.date_created) as D
   
   The above exception was the direct cause of the following exception:
   
   Traceback (most recent call last):
     File "/root/superset-venv/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request
       rv = self.dispatch_request()
     File "/root/superset-venv/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request
       return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
     File "/root/superset-venv/lib/python3.10/site-packages/flask_appbuilder/security/decorators.py", line 109, in wraps
       return f(self, *args, **kwargs)
     File "/root/superset-venv/lib/python3.10/site-packages/superset/views/base_api.py", line 120, in wraps
       duration, response = time_function(f, self, *args, **kwargs)
     File "/root/superset-venv/lib/python3.10/site-packages/superset/utils/core.py", line 1369, in time_function
       response = func(*args, **kwargs)
     File "/root/superset-venv/lib/python3.10/site-packages/superset/utils/log.py", line 304, in wrapper
       value = f(*args, **kwargs)
     File "/root/superset-venv/lib/python3.10/site-packages/superset/charts/data/api.py", line 260, in data
       return self._get_data_response(
     File "/root/superset-venv/lib/python3.10/site-packages/superset/utils/log.py", line 304, in wrapper
       value = f(*args, **kwargs)
     File "/root/superset-venv/lib/python3.10/site-packages/superset/charts/data/api.py", line 423, in _get_data_response
       result = command.run(force_cached=force_cached)
     File "/root/superset-venv/lib/python3.10/site-packages/superset/commands/chart/data/get_data_command.py", line 45, in run
       payload = self._query_context.get_payload(
     File "/root/superset-venv/lib/python3.10/site-packages/superset/common/query_context.py", line 102, in get_payload
       return self._processor.get_payload(cache_query_context, force_cached)
     File "/root/superset-venv/lib/python3.10/site-packages/superset/common/query_context_processor.py", line 752, in get_payload
       query_results = [
     File "/root/superset-venv/lib/python3.10/site-packages/superset/common/query_context_processor.py", line 753, in <listcomp>
       get_query_results(
     File "/root/superset-venv/lib/python3.10/site-packages/superset/common/query_actions.py", line 227, in get_query_results
       return result_func(query_context, query_obj, force_cached)
     File "/root/superset-venv/lib/python3.10/site-packages/superset/common/query_actions.py", line 103, in _get_full
       payload = query_context.get_df_payload(query_obj, force_cached=force_cached)
     File "/root/superset-venv/lib/python3.10/site-packages/superset/common/query_context.py", line 123, in get_df_payload
       return self._processor.get_df_payload(
     File "/root/superset-venv/lib/python3.10/site-packages/superset/common/query_context_processor.py", line 162, in get_df_payload
       query_result = self.get_query_result(query_obj)
     File "/root/superset-venv/lib/python3.10/site-packages/superset/common/query_context_processor.py", line 265, in get_query_result
       result = query_context.datasource.query(query_object.to_dict())
     File "/root/superset-venv/lib/python3.10/site-packages/superset/connectors/sqla/models.py", line 1748, in query
       df = self.database.get_df(
     File "/root/superset-venv/lib/python3.10/site-packages/superset/models/core.py", line 706, in get_df
       self.db_engine_spec.execute(cursor, sql_, self)
     File "/root/superset-venv/lib/python3.10/site-packages/superset/db_engine_specs/base.py", line 1858, in execute
       if sql_parse.check_sql_functions_exist(query, disallowed_functions, cls.engine):
     File "/root/superset-venv/lib/python3.10/site-packages/superset/sql_parse.py", line 183, in check_sql_functions_exist
       return SQLScript(sql, engine=engine).check_functions_present(function_list)
     File "/root/superset-venv/lib/python3.10/site-packages/superset/sql/parse.py", line 670, in __init__
       self.statements = statement_class.split_script(script, engine)
     File "/root/superset-venv/lib/python3.10/site-packages/superset/sql/parse.py", line 327, in split_script
       ast = cls._parse(remainder, engine)[0]
     File "/root/superset-venv/lib/python3.10/site-packages/superset/sql/parse.py", line 270, in _parse
       raise SupersetParseError(
   superset.exceptions.SupersetParseError: Error parsing near 'AS' at line 1:39
   
   
   ### Screenshots/recordings
   
   <img width="1826" height="299" alt="Image" src="https://github.com/user-attachments/assets/241c55f1-8f57-466e-a8ee-2cb11bdc9d96" />
   
   ### Superset version
   
   5.0.0
   
   ### Python version
   
   3.10
   
   ### Node version
   
   I don't know
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
   - [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.


-- 
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: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Bar Chart issue after upgrading to version 5.0 [superset]

Posted by "khaledjameel27 (via GitHub)" <gi...@apache.org>.
khaledjameel27 commented on issue #35505:
URL: https://github.com/apache/superset/issues/35505#issuecomment-3714096982

   @betodealmeida Can please confirm if this fix have been added in Superset 6.0.0 ? As I have upgrade to 6.0.0 and it's still persist  


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Bar Chart issue after upgrading to version 5.0 [superset]

Posted by "khaledjameel27 (via GitHub)" <gi...@apache.org>.
khaledjameel27 commented on issue #35505:
URL: https://github.com/apache/superset/issues/35505#issuecomment-3419683899

   Did an upgrade to 6.0.0rc2 and the issue still the same. Also restore snapshot from old one and upgrade to 4.1.4 and the barchart working fine.. In 5.0.0 and above the issue exist seems to something within the code because of sqlglot


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Bar Chart issue after upgrading to version 5.0 [superset]

Posted by "ysinghc (via GitHub)" <gi...@apache.org>.
ysinghc commented on issue #35505:
URL: https://github.com/apache/superset/issues/35505#issuecomment-3561989372

   @rusackas I can write a custom dialect definition directly in superset/sql/dialects/db2.py for db2, or should I write a basic fallback function that instead of parsing just treat the query as a string and pass it to the DB2 database directly with just basic security checks.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Bar Chart issue after upgrading to version 5.0 [superset]

Posted by "ysinghc (via GitHub)" <gi...@apache.org>.
ysinghc commented on issue #35505:
URL: https://github.com/apache/superset/issues/35505#issuecomment-3518031044

   I can try to solve this issue, will try to raise a PR by next week if I did.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Bar Chart issue after upgrading to version 5.0 [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #35505:
URL: https://github.com/apache/superset/issues/35505#issuecomment-3583598712

   @betodealmeida might be best qualified to answer that one :)


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Bar Chart issue after upgrading to version 5.0 [superset]

Posted by "khaledjameel27 (via GitHub)" <gi...@apache.org>.
khaledjameel27 commented on issue #35505:
URL: https://github.com/apache/superset/issues/35505#issuecomment-3547532297

   @rusackas  this is the below query : 
   this my query : 
   select CUSTOMER_ID , DATE(date_created) as DATE ,SUM(FEE)/1000 as TOTAL_FEE
   from CUSTOMER.ORDERS 
   where YEAR(date_created) >= YEAR(CURRENT_DATE) - 2  
   and JOB_ID in (27,81,11,28)
   group by  DATE(date_created) ,CUSTOMER_ID
   
   in bar chart it will be like this 
   SELECT "DATE" - (DAY("DATE")-1) DAYS AS "DATE", sum("TOTAL_FEE") AS "SUM(TOTAL_FEE)" 
   FROM (select CUSTOMER_ID , DATE(date_created) as DATE ,SUM(FEE)/1000 as TOTAL_FEE
   from CUSTOMER.ORDERS 
   where YEAR(date_created) >= YEAR(CURRENT_DATE) - 2  
   and JOB_ID in (27,81,11,28)
   group by  DATE(date_created) ,CUSTOMER_ID)
   AS virtual_table 
   WHERE "DATE" >= '2024-01-01 00:00:00.000000' AND "DATE" < '2025-12-31 00:00:00.000000' GROUP BY "DATE" - (DAY("DATE")-1) DAYS ORDER BY "SUM(TOTAL_FEE)" DESC FETCH FIRST 10000 ROWS ONLY; 
   
   please let me know if any sample data needed. 
   
   as of now, i rollback to 4.1.1 and it's working fine 
   
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Bar Chart issue after upgrading to version 5.0 [superset]

Posted by "khaledjameel27 (via GitHub)" <gi...@apache.org>.
khaledjameel27 commented on issue #35505:
URL: https://github.com/apache/superset/issues/35505#issuecomment-3527114815

   Thank you @ysinghc 


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Bar Chart issue after upgrading to version 5.0 [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #35505:
URL: https://github.com/apache/superset/issues/35505#issuecomment-3544172888

   Thanks @ysinghc 
   
   If you have a reproducible query that I can test with example data, @khaledjameel27 , that'd help :D 


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Bar Chart issue after upgrading to version 5.0 [superset]

Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
betodealmeida closed issue #35505: Bar Chart issue after upgrading to version 5.0
URL: https://github.com/apache/superset/issues/35505


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Bar Chart issue after upgrading to version 5.0 [superset]

Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
betodealmeida commented on issue #35505:
URL: https://github.com/apache/superset/issues/35505#issuecomment-3583666558

   We might be able to use https://github.com/thh6282/sqlglot-db2-dialect.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org