fx19880617 opened a new issue #10168: URL: https://github.com/apache/incubator-superset/issues/10168
When select a time column in filter box, the query send out is wrong, it contains an extra count(*) in ORDER BY clause without using it. ### Expected results Expected query is: ``` SELECT COUNT(*), mergedTimeMillis FROM "pullRequestMergedEvents" WHERE mergedTimeMillis >= 1592438400000 AND mergedTimeMillis < 1593043200000 GROUP BY mergedTimeMillis ORDER BY COUNT(*) DESC LIMIT 1000 ``` or ``` SELECT mergedTimeMillis FROM "pullRequestMergedEvents" WHERE mergedTimeMillis >= 1592438400000 AND mergedTimeMillis < 1593043200000 GROUP BY mergedTimeMillis LIMIT 1000 ``` or ``` SELECT distinct mergedTimeMillis FROM "pullRequestMergedEvents" WHERE mergedTimeMillis >= 1592438400000 AND mergedTimeMillis < 1593043200000 LIMIT 1000 ``` ### Actual results The actual query sent is: `SELECT mergedTimeMillis FROM "pullRequestMergedEvents" WHERE mergedTimeMillis >= 1592438400000 AND mergedTimeMillis < 1593043200000 GROUP BY mergedTimeMillis ORDER BY COUNT(*) DESC LIMIT 1000` #### Screenshots  ### Environment (please complete the following information): - superset version: `0.36.0` - python version: `3.6.9` ### Checklist Make sure these boxes are checked before submitting your issue - thank you! - [x] I have checked the superset logs for python stacktraces and included it here as text if there are any. - [x] I have reproduced the issue with at least the latest released version of superset. - [x] I have checked the issue tracker for the same issue and I haven't found one similar. ### Additional context Add any other context about the problem here. ``` { cache_key: null, cached_dttm: null, cache_timeout: 86400, error: "pinot error: {'errorCode': 200, 'message': 'QueryExecutionError:\n' 'java.lang.IllegalStateException\n' '\tat ' 'shaded.com.google.common.base.Preconditions.checkState(Preconditions.java:429)\n' '\tat ' 'org.apache.pinot.core.query.request.context.ExpressionContext.toTransformExpressionTree(ExpressionContext.java:102)\n' '\tat ' 'org.apache.pinot.core.plan.SelectionPlanNode.collectExpressions(SelectionPlanNode.java:89)\n' '\tat ' 'org.apache.pinot.core.plan.SelectionPlanNode.<init>(SelectionPlanNode.java:50)\n' '\tat ' 'org.apache.pinot.core.plan.maker.InstancePlanMakerImplV2.makeSegmentPlanNode(InstancePlanMakerImplV2.java:136)\n' '\tat ' 'org.apache.pinot.core.plan.maker.InstancePlanMakerImplV2.makeInstancePlan(InstancePlanMakerImplV2.java:101)\n' '\tat ' 'org.apache.pinot.core.query.executor.ServerQueryExecutorV1Impl.processQuery(ServerQueryExecutorV1Impl.java:213)\n' '\tat ' 'org.apache.pinot.core.query.scheduler.QueryScheduler.processQueryAndSerialize(QueryScheduler.java:152)\n' '\tat ' 'org.apache.pinot.core.query.scheduler.QueryScheduler.lambda$createQueryFutureTask$0(QueryScheduler.java:136)\n' '\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n' '\tat ' 'java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\n' '\tat ' 'shaded.com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:111)\n' '\tat ' 'shaded.com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:58)\n' '\tat ' 'shaded.com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:75)'}", form_data: { datasource: "2__table", viz_type: "filter_box", url_params: {}, time_range_endpoints: [ "inclusive", "exclusive" ], granularity_sqla: "mergedTimeMillis", time_range: "Last week", filter_configs: [{ key: "iZn_0neWH", column: "mergedTimeMillis", asc: true, clearable: true, multiple: true }], date_filter: true, instant_filtering: true, show_sqla_time_granularity: false, show_sqla_time_column: false, show_druid_time_granularity: false, show_druid_time_origin: false, adhoc_filters: [], where: "", having: "", having_filters: [], filters: [] }, is_cached: false, query: "SELECT mergedTimeMillis FROM " pullRequestMergedEvents " WHERE mergedTimeMillis >= 1592438400000 AND mergedTimeMillis < 1593043200000 GROUP BY mergedTimeMillis ORDER BY COUNT(*) DESC LIMIT 1000", status: "failed", stacktrace: null, rowcount: 0 } ``` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
