You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/01/08 10:50:12 UTC

[GitHub] [superset] villebro commented on a change in pull request #12350: fix(explore): improve filter translation

villebro commented on a change in pull request #12350:
URL: https://github.com/apache/superset/pull/12350#discussion_r553873942



##########
File path: superset-frontend/src/explore/AdhocFilter.js
##########
@@ -48,22 +48,13 @@ const OPERATORS_TO_SQL = {
 };
 
 function translateToSql(adhocMetric, { useSimple } = {}) {
-  if (
-    (adhocMetric.expressionType === EXPRESSION_TYPES.SIMPLE &&
-      adhocMetric.comparator &&
-      adhocMetric.operator) ||
-    useSimple
-  ) {
-    const isMulti = MULTI_OPERATORS.has(adhocMetric.operator);
-    const { subject } = adhocMetric;
+  if (adhocMetric.expressionType === EXPRESSION_TYPES.SIMPLE || useSimple) {
+    const { subject, comparator } = adhocMetric;

Review comment:
       `getSimpleSQLExpression is now able to handle invalid formatting requests, hence this strict checking isn't necessary anymore (no translation was performed if operator wasn't specified).

##########
File path: superset-frontend/src/explore/AdhocFilter.js
##########
@@ -48,22 +48,13 @@ const OPERATORS_TO_SQL = {
 };
 
 function translateToSql(adhocMetric, { useSimple } = {}) {
-  if (
-    (adhocMetric.expressionType === EXPRESSION_TYPES.SIMPLE &&
-      adhocMetric.comparator &&
-      adhocMetric.operator) ||
-    useSimple
-  ) {
-    const isMulti = MULTI_OPERATORS.has(adhocMetric.operator);
-    const { subject } = adhocMetric;
+  if (adhocMetric.expressionType === EXPRESSION_TYPES.SIMPLE || useSimple) {
+    const { subject, comparator } = adhocMetric;

Review comment:
       `getSimpleSQLExpression` is now able to handle invalid formatting requests, hence this strict checking isn't necessary anymore (no translation was performed if operator wasn't specified).




----------------------------------------------------------------
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:
users@infra.apache.org



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