'X-ray' or 'Compare to the rest' error

Describe the bug
'X-ray' or 'Compare to the rest' error

error logs

2021-04-16 14:09:07,079 [qtp969392621-167] ERRORmetabase.server.middleware.log - GET /api/automagic-dashboards/adhoc/eyJkYXRhYmFzZSI6MSwicXVlcnkiOnsic291cmNlLXRhYmxlIjoiY2FyZF9fMTE4IiwiYWdncmVnYXRpb24iOltbImNvdW50Il1dLCJicmVha291dCI6W1siZmllbGQtbGl0ZXJhbCIsIlNUQVRFIiwidHlwZS9UZXh0Il1dfSwidHlwZSI6InF1ZXJ5In0=/cell/WyI9IixbImZpZWxkLWxpdGVyYWwiLCJTVEFURSIsInR5cGUvVGV4dCJdLCJUWCJd 500 158.8 ms(38个数据库调用) 
{:via
 [{:type java.sql.SQLSyntaxErrorException,
   :message
   "(conn=297) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')))' at line 1",
   :at [org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory createException "ExceptionFactory.java" 62]}
  {:type org.mariadb.jdbc.internal.util.exceptions.MariaDbSqlException,
   :message
   "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')))' at line 1",
   :at [org.mariadb.jdbc.internal.util.exceptions.MariaDbSqlException of "MariaDbSqlException.java" 34]}
  {:type java.sql.SQLException,
   :message
   "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')))' at line 1",
   :at [org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol readErrorPacket "AbstractQueryProtocol.java" 1688]}],
 :trace
 [[org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol readErrorPacket "AbstractQueryProtocol.java" 1688]
  [org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol readPacket "AbstractQueryProtocol.java" 1550]
  [org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol getResult "AbstractQueryProtocol.java" 1513]
  [org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol executeQuery "AbstractQueryProtocol.java" 318]
  [org.mariadb.jdbc.ClientSidePreparedStatement executeInternal "ClientSidePreparedStatement.java" 220]
  [org.mariadb.jdbc.ClientSidePreparedStatement execute "ClientSidePreparedStatement.java" 149]
  [org.mariadb.jdbc.ClientSidePreparedStatement executeQuery "ClientSidePreparedStatement.java" 163]
  [com.mchange.v2.c3p0.impl.NewProxyPreparedStatement executeQuery "NewProxyPreparedStatement.java" 431]
  [clojure.java.jdbc$execute_query_with_params invokeStatic "jdbc.clj" 1090]
  [clojure.java.jdbc$execute_query_with_params invoke "jdbc.clj" 1084]
  [clojure.java.jdbc$db_query_with_resultset_STAR_ invokeStatic "jdbc.clj" 1113]
  [clojure.java.jdbc$db_query_with_resultset_STAR_ invoke "jdbc.clj" 1093]
  [clojure.java.jdbc$query invokeStatic "jdbc.clj" 1182]
  [clojure.java.jdbc$query invoke "jdbc.clj" 1144]
  [toucan.db$query invokeStatic "db.clj" 288]
  [toucan.db$query doInvoke "db.clj" 284]
  [clojure.lang.RestFn invoke "RestFn.java" 410]
  [toucan.db$simple_select invokeStatic "db.clj" 394]
  [toucan.db$simple_select invoke "db.clj" 383]
  [toucan.db$select invokeStatic "db.clj" 662]
  [toucan.db$select doInvoke "db.clj" 656]
  [clojure.lang.RestFn invoke "RestFn.java" 486]
  [metabase.automagic_dashboards.filters$add_filters invokeStatic "filters.clj" 169]
  [metabase.automagic_dashboards.filters$add_filters invoke "filters.clj" 153]
  [metabase.automagic_dashboards.populate$create_dashboard invokeStatic "populate.clj" 281]
  [metabase.automagic_dashboards.populate$create_dashboard invoke "populate.clj" 253]
  [metabase.automagic_dashboards.core$automagic_dashboard invokeStatic "core.clj" 1003]
  [metabase.automagic_dashboards.core$automagic_dashboard invoke "core.clj" 980]
  [metabase.automagic_dashboards.core$fn__53235 invokeStatic "core.clj" 1031]
  [metabase.automagic_dashboards.core$fn__53235 invoke "core.clj" 1029]
  [clojure.lang.MultiFn invoke "MultiFn.java" 234]
  [metabase.automagic_dashboards.core$decompose_question$fn__53242 invoke "core.clj" 1057]
  [clojure.core$map$fn__5866 invoke "core.clj" 2753]
  [clojure.lang.LazySeq sval "LazySeq.java" 42]
  [clojure.lang.LazySeq seq "LazySeq.java" 51]
  [clojure.lang.RT seq "RT.java" 535]
  [clojure.core$seq__5402 invokeStatic "core.clj" 137]
  [clojure.core.protocols$seq_reduce invokeStatic "protocols.clj" 24]
  [clojure.core.protocols$fn__8146 invokeStatic "protocols.clj" 75]
  [clojure.core.protocols$fn__8146 invoke "protocols.clj" 75]
  [clojure.core.protocols$fn__8088$G__8083__8101 invoke "protocols.clj" 13]
  [clojure.core$reduce invokeStatic "core.clj" 6828]
  [clojure.core$reduce invoke "core.clj" 6810]
  [metabase.automagic_dashboards.core$fn__53301 invokeStatic "core.clj" 1200]
  [metabase.automagic_dashboards.core$fn__53301 invoke "core.clj" 1186]
  [clojure.lang.MultiFn invoke "MultiFn.java" 234]
  [metabase.api.automagic_dashboards$fn__53589 invokeStatic "automagic_dashboards.clj" 131]
  [metabase.api.automagic_dashboards$fn__53589 invoke "automagic_dashboards.clj" 121]
  [compojure.core$wrap_response$fn__1996 invoke "core.clj" 160]
  [compojure.core$wrap_route_middleware$fn__1980 invoke "core.clj" 132]
  [compojure.core$wrap_route_info$fn__1985 invoke "core.clj" 139]
  [compojure.core$wrap_route_matches$fn__1989 invoke "core.clj" 151]
  [compojure.core$routes$fn__2008$f__2009 invoke "core.clj" 198]
  [compojure.core$routes$fn__2008$f__2009$respond_SINGLEQUOTE___2010 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__1989 invoke "core.clj" 152]
  [compojure.core$routes$fn__2008$f__2009 invoke "core.clj" 198]
  [compojure.core$routes$fn__2008 invoke "core.clj" 200]
  [metabase.server.middleware.auth$enforce_authentication$fn__73892 invoke "auth.clj" 14]
  [compojure.core$routes$fn__2008$f__2009 invoke "core.clj" 198]
  [compojure.core$routes$fn__2008 invoke "core.clj" 200]
  [compojure.core$make_context$handler__2036 invoke "core.clj" 287]
  [compojure.core$make_context$fn__2038 invoke "core.clj" 296]
  [compojure.core$routes$fn__2008$f__2009 invoke "core.clj" 198]
  [compojure.core$routes$fn__2008$f__2009$respond_SINGLEQUOTE___2010 invoke "core.clj" 197]
  [compojure.core$make_context$fn__2038 invoke "core.clj" 297]
  [compojure.core$routes$fn__2008$f__2009 invoke "core.clj" 198]
  [compojure.core$routes$fn__2008$f__2009$respond_SINGLEQUOTE___2010 invoke "core.clj" 197]
  [compojure.core$make_context$fn__2038 invoke "core.clj" 297]
  [compojure.core$routes$fn__2008$f__2009 invoke "core.clj" 198]
  [compojure.core$routes$fn__2008$f__2009$respond_SINGLEQUOTE___2010 invoke "core.clj" 197]
  [metabase.api.routes$fn__74014$fn__74016 invoke "routes.clj" 69]
  [compojure.core$routes$fn__2008$f__2009 invoke "core.clj" 198]
  [compojure.core$routes$fn__2008 invoke "core.clj" 200]
  [clojure.lang.AFn applyToHelper "AFn.java" 160]
  [clojure.lang.AFn applyTo "AFn.java" 144]
  [clojure.core$apply invokeStatic "core.clj" 665]
  [clojure.core$apply invoke "core.clj" 660]
  [metabase.server.routes$fn__76247$fn__76248 doInvoke "routes.clj" 57]
  [clojure.lang.RestFn invoke "RestFn.java" 436]
  [compojure.core$routes$fn__2008$f__2009 invoke "core.clj" 198]
  [compojure.core$routes$fn__2008 invoke "core.clj" 200]
  [compojure.core$make_context$handler__2036 invoke "core.clj" 287]
  [compojure.core$make_context$fn__2038 invoke "core.clj" 296]
  [compojure.core$routes$fn__2008$f__2009 invoke "core.clj" 198]
  [compojure.core$routes$fn__2008$f__2009$respond_SINGLEQUOTE___2010 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__1989 invoke "core.clj" 152]
  [compojure.core$routes$fn__2008$f__2009 invoke "core.clj" 198]
  [compojure.core$routes$fn__2008$f__2009$respond_SINGLEQUOTE___2010 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__1989 invoke "core.clj" 152]
  [compojure.core$routes$fn__2008$f__2009 invoke "core.clj" 198]
  [compojure.core$routes$fn__2008$f__2009$respond_SINGLEQUOTE___2010 invoke "core.clj" 197]
  [compojure.core$wrap_route_matches$fn__1989 invoke "core.clj" 152]
  [compojure.core$routes$fn__2008$f__2009 invoke "core.clj" 198]
  [compojure.core$routes$fn__2008$f__2009$respond_SINGLEQUOTE___2010 invoke "core.clj" 197]
  [metabase.server.routes$fn__76235$fn__76237 invoke "routes.clj" 41]
  [compojure.core$routes$fn__2008$f__2009 invoke "core.clj" 198]
  [compojure.core$routes$fn__2008 invoke "core.clj" 200]
  [metabase.server.middleware.exceptions$catch_uncaught_exceptions$fn__74005 invoke "exceptions.clj" 98]
  [metabase.server.middleware.exceptions$catch_api_exceptions$fn__74002 invoke "exceptions.clj" 86]
  [metabase.server.middleware.log$log_api_call$fn__76163$fn__76164 invoke "log.clj" 195]
  [toucan.db$_do_with_call_counting invokeStatic "db.clj" 216]
  [toucan.db$_do_with_call_counting invoke "db.clj" 209]
  [metabase.server.middleware.log$log_api_call$fn__76163 invoke "log.clj" 189]
  [metabase.server.middleware.security$add_security_headers$fn__73967 invoke "security.clj" 142]
  [metabase.server.middleware.json$wrap_json_body$fn__75944 invoke "json.clj" 62]
  [metabase.server.middleware.json$wrap_streamed_json_response$fn__75962 invoke "json.clj" 98]
  [ring.middleware.keyword_params$wrap_keyword_params$fn__76504 invoke "keyword_params.clj" 55]
  [ring.middleware.params$wrap_params$fn__76520 invoke "params.clj" 69]
  [metabase.server.middleware.misc$maybe_set_site_url$fn__34784 invoke "misc.clj" 58]
  [metabase.server.middleware.session$bind_current_user$fn__41763$fn__41764 invoke "session.clj" 277]
  [metabase.server.middleware.session$do_with_current_user invokeStatic "session.clj" 258]
  [metabase.server.middleware.session$do_with_current_user invoke "session.clj" 250]
  [metabase.server.middleware.session$bind_current_user$fn__41763 invoke "session.clj" 276]
  [metabase.server.middleware.session$wrap_current_user_info$fn__41750 invoke "session.clj" 236]
  [metabase.server.middleware.session$wrap_session_id$fn__41736 invoke "session.clj" 182]
  [metabase.server.middleware.auth$wrap_api_key$fn__73900 invoke "auth.clj" 27]
  [ring.middleware.cookies$wrap_cookies$fn__76424 invoke "cookies.clj" 216]
  [metabase.server.middleware.misc$add_content_type$fn__34767 invoke "misc.clj" 27]
  [metabase.server.middleware.misc$disable_streaming_buffering$fn__34792 invoke "misc.clj" 75]
  [ring.middleware.gzip$wrap_gzip$fn__76466 invoke "gzip.clj" 86]
  [metabase.server.middleware.misc$bind_request$fn__34795 invoke "misc.clj" 92]
  [metabase.server.middleware.ssl$redirect_to_https_middleware$fn__76180 invoke "ssl.clj" 38]
  [metabase.server$async_proxy_handler$fn__75777 invoke "server.clj" 71]
  [metabase.server.proxy$org.eclipse.jetty.server.handler.AbstractHandler$ff19274a handle nil -1]
  [org.eclipse.jetty.server.handler.HandlerWrapper handle "HandlerWrapper.java" 127]
  [org.eclipse.jetty.server.Server handle "Server.java" 516]
  [org.eclipse.jetty.server.HttpChannel lambda$handle$1 "HttpChannel.java" 383]
  [org.eclipse.jetty.server.HttpChannel dispatch "HttpChannel.java" 556]
  [org.eclipse.jetty.server.HttpChannel handle "HttpChannel.java" 375]
  [org.eclipse.jetty.server.HttpConnection onFillable "HttpConnection.java" 273]
  [org.eclipse.jetty.io.AbstractConnection$ReadCallback succeeded "AbstractConnection.java" 311]
  [org.eclipse.jetty.io.FillInterest fillable "FillInterest.java" 105]
  [org.eclipse.jetty.io.ChannelEndPoint$1 run "ChannelEndPoint.java" 104]
  [org.eclipse.jetty.util.thread.strategy.EatWhatYouKill runTask "EatWhatYouKill.java" 336]
  [org.eclipse.jetty.util.thread.strategy.EatWhatYouKill doProduce "EatWhatYouKill.java" 313]
  [org.eclipse.jetty.util.thread.strategy.EatWhatYouKill tryProduce "EatWhatYouKill.java" 171]
  [org.eclipse.jetty.util.thread.strategy.EatWhatYouKill run "EatWhatYouKill.java" 129]
  [org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread run "ReservedThreadExecutor.java" 375]
  [org.eclipse.jetty.util.thread.QueuedThreadPool runJob "QueuedThreadPool.java" 773]
  [org.eclipse.jetty.util.thread.QueuedThreadPool$Runner run "QueuedThreadPool.java" 905]
  [java.lang.Thread run nil -1]],
 :cause
 "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')))' at line 1",
 :message
 "(conn=297) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')))' at line 1",
 :sql-exception-chain
 ["SQLSyntaxErrorException:"
  "Message: (conn=297) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')))' at line 1"
  "SQLState: 42000"
  "Error Code: 1064"]}


To Reproduce
Steps to reproduce the behavior:

  1. Go to 'native sql' > Sample Dataset
  2. Write sql select * from people
  3. execute sql
  4. Save as Q1
  5. Simple question > Q1 > Summarize Counts of rows and by STATE > Visualize
  6. Click on Visualization > Map > United States
  7. Click 'Texas' on the map
  8. Click on 'X-ray' or 'Compare to the rest'

Expected behavior
can show X-ray or Compare to the rest, or give a friendly error message

Screenshots
image

Information about your Metabase Installation:

{
  "browser-info": {
    "language": "zh-CN",
    "platform": "Win32",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "GBK",
    "java.runtime.name": "Java(TM) SE Runtime Environment",
    "java.runtime.version": "1.8.0_101-b13",
    "java.vendor": "Oracle Corporation",
    "java.vendor.url": "http://java.oracle.com/",
    "java.version": "1.8.0_101",
    "java.vm.name": "Java HotSpot(TM) 64-Bit Server VM",
    "java.vm.version": "25.101-b13",
    "os.name": "Windows 10",
    "os.version": "10.0",
    "user.language": "zh",
    "user.timezone": "Asia/Shanghai"
  },
  "metabase-info": {
    "databases": [
      "h2",
      "mysql",
      "oracle"
    ],
    "hosting-env": "unknown",
    "application-database": "mysql",
    "application-database-details": {
      "database": {
        "name": "MySQL",
        "version": "5.7.26"
      },
      "jdbc-driver": {
        "name": "MariaDB Connector/J",
        "version": "2.6.2"
      }
    },
    "run-mode": "prod",
    "version": {
      "tag": "v0.38.4",
      "date": "2021-04-08",
      "branch": "release-x.38.x",
      "hash": "057b6bb"
    },
    "settings": {
      "report-timezone": "Asia/Shanghai"
    }
  }
}

Hi @asdfghjkl
Drill-through actions are not available on Native queries, so I'm not sure how you're getting that error, or even being able to click on the map to see the Actions-menu.

Sorry, the reproduction steps were wrong, I have corrected it.
The logs are copied after the error message is displayed on the page.

@asdfghjkl I have created an issue for it:
https://github.com/metabase/metabase/issues/15655 - upvote by clicking :+1: on the first post