fix: IS NULL filter operator for numeric columns (#13496)

This commit is contained in:
Jesse Yang
2021-03-10 10:15:25 -08:00
committed by GitHub
parent 70ccc26421
commit b9884fb55b
6 changed files with 51 additions and 39 deletions

View File

@@ -14,6 +14,8 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import re
import pytest
from superset import db
@@ -305,8 +307,15 @@ class TestQueryContext(SupersetTestCase):
assert len(responses) == 1
response = responses["queries"][0]
assert len(response) == 2
sql_text = response["query"]
assert response["language"] == "sql"
assert "SELECT" in response["query"]
assert "SELECT" in sql_text
assert re.search(r'[`"\[]?num[`"\]]? IS NOT NULL', sql_text)
assert re.search(
r"""NOT \([`"\[]?name[`"\]]? IS NULL[\s\n]* """
r"""OR [`"\[]?name[`"\]]? IN \('abc'\)\)""",
sql_text,
)
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_fetch_values_predicate_in_query(self):