ktmud commented on a change in pull request #13496:
URL: https://github.com/apache/superset/pull/13496#discussion_r589191076



##########
File path: superset-frontend/src/explore/exploreUtils.js
##########
@@ -319,20 +320,14 @@ export const getSimpleSQLExpression = (subject, operator, 
comparator) => {
     expression += ` ${operator}`;
     const firstValue =
       isMulti && Array.isArray(comparator) ? comparator[0] : comparator;
-    let comparatorArray;
-    if (comparator === undefined || comparator === null) {
-      comparatorArray = [];
-    } else if (Array.isArray(comparator)) {
-      comparatorArray = comparator;
-    } else {
-      comparatorArray = [comparator];
-    }
+    const comparatorArray = ensureIsArray(comparator);
     const isString =
       firstValue !== undefined && Number.isNaN(Number(firstValue));
     const quote = isString ? "'" : '';
     const [prefix, suffix] = isMulti ? ['(', ')'] : ['', ''];
     const formattedComparators = comparatorArray.map(
-      val => `${quote}${isString ? val.replace("'", "''") : val}${quote}`,
+      val =>
+        `${quote}${isString ? String(val).replace("'", "''") : val}${quote}`,

Review comment:
       This fixes a rare case when `<NULL>` is used as the first filter value 
for a numeric column, saving the filter will throw a JS error:
   
   
![null-first](https://user-images.githubusercontent.com/335541/110282005-9794db80-7f92-11eb-98db-424291a29f4b.png)
   




----------------------------------------------------------------
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]

Reply via email to