Skip to content

Conversation

@pkdotson
Copy link
Member

@pkdotson pkdotson commented Oct 1, 2021

SUMMARY

This pr fixes an issue where in the adhocfilter control null value is not allowed causing the user not able to save.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

after

Screen.Recording.2021-10-01.at.8.55.00.AM.mov

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • [x ] Has associated issue: Fixes [explore][filter] NOT EQUALS NULL doesn't allow to SAVE #16803
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@suddjian
Copy link
Member

suddjian commented Oct 1, 2021

/testenv up

@github-actions
Copy link
Contributor

github-actions bot commented Oct 1, 2021

@suddjian Ephemeral environment spinning up at http://35.167.17.93:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

Copy link
Member

@geido geido left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for the fix

@pull-request-size pull-request-size bot added size/S and removed size/XS labels Oct 5, 2021
@codecov
Copy link

codecov bot commented Oct 5, 2021

Codecov Report

Merging #16936 (db39fbf) into master (a07c9d5) will decrease coverage by 0.04%.
The diff coverage is 82.72%.

❗ Current head db39fbf differs from pull request most recent head 8c45588. Consider uploading reports for the commit 8c45588 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16936      +/-   ##
==========================================
- Coverage   76.97%   76.93%   -0.05%     
==========================================
  Files        1023     1030       +7     
  Lines       54907    55024     +117     
  Branches     7486     7466      -20     
==========================================
+ Hits        42266    42333      +67     
- Misses      12393    12437      +44     
- Partials      248      254       +6     
Flag Coverage Δ
javascript 70.92% <81.25%> (-0.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...d/src/SqlLab/components/AceEditorWrapper/index.tsx 58.75% <ø> (ø)
...erset-frontend/src/SqlLab/components/App/index.jsx 57.14% <ø> (ø)
...tend/src/SqlLab/components/ColumnElement/index.tsx 95.45% <ø> (ø)
...qlLab/components/EstimateQueryCostButton/index.jsx 20.83% <ø> (ø)
...lLab/components/ExploreCtasResultsButton/index.jsx 7.69% <ø> (ø)
...c/SqlLab/components/ExploreResultsButton/index.jsx 92.00% <ø> (ø)
...d/src/SqlLab/components/QueryAutoRefresh/index.jsx 65.90% <ø> (ø)
...c/SqlLab/components/RunQueryActionButton/index.tsx 65.11% <ø> (ø)
...d/src/SqlLab/components/SaveDatasetModal/index.tsx 88.23% <ø> (ø)
...frontend/src/SqlLab/components/SaveQuery/index.tsx 75.55% <ø> (ø)
... and 73 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a07c9d5...8c45588. Read the comment docs.

Copy link
Member

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please hold on this PR. the NULL in the select is serialized SQL NULL. So we should generate a SQL without NULL at here.

def values_for_column(self, column_name: str, limit: int = 10000) -> List[Any]:
"""Runs query against sqla to retrieve some
sample values for the given column.
"""
cols = {col.column_name: col for col in self.columns}
target_col = cols[column_name]
tp = self.get_template_processor()
qry = (
select([target_col.get_sqla_col()])
.select_from(self.get_from_clause(tp))
.distinct()
)
if limit:
qry = qry.limit(limit)
if self.fetch_values_predicate:
qry = qry.where(self.get_fetch_values_predicate())
engine = self.database.get_sqla_engine()
sql = "{}".format(qry.compile(engine, compile_kwargs={"literal_binds": True}))
sql = self.mutate_query_from_config(sql)
df = pd.read_sql_query(sql=sql, con=engine)
return df[column_name].to_list()

@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[explore][filter] NOT EQUALS NULL doesn't allow to SAVE

4 participants