Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BEAM-10708] Added an example notebook for beam_sql magic #15518

Merged
merged 1 commit into from Sep 21, 2021

Conversation

KevinGG
Copy link
Contributor

@KevinGG KevinGG commented Sep 15, 2021

  1. An example notebook demonstrating the usage of the beam_sql magic.
  2. Supported show/collect for beam_sql outputs.
  3. Added a parser for beam_sql inputs.

Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

ValidatesRunner compliance status (on master branch)

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- Build Status Build Status Build Status Build Status ---
Java Build Status Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Python --- Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status ---
XLang Build Status Build Status Build Status Build Status Build Status ---

Examples testing status on various runners

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- --- --- --- --- --- ---
Java --- Build Status
Build Status
Build Status
--- --- --- --- ---
Python --- --- --- --- --- --- ---
XLang --- --- --- --- --- --- ---

Post-Commit SDK/Transform Integration Tests Status (on master branch)

Go Java Python
Build Status Build Status Build Status
Build Status
Build Status

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website Whitespace Typescript
Non-portable Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status Build Status Build Status
Portable --- Build Status Build Status --- --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

@KevinGG
Copy link
Contributor Author

KevinGG commented Sep 15, 2021

R: @rohdesamuel
PTAL, thx!

@codecov
Copy link

codecov bot commented Sep 15, 2021

Codecov Report

Merging #15518 (3b09cd4) into master (6947fa2) will decrease coverage by 0.01%.
The diff coverage is 83.58%.

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

@@            Coverage Diff             @@
##           master   #15518      +/-   ##
==========================================
- Coverage   83.77%   83.75%   -0.02%     
==========================================
  Files         444      444              
  Lines       60255    60318      +63     
==========================================
+ Hits        50479    50520      +41     
- Misses       9776     9798      +22     
Impacted Files Coverage Δ
sdks/python/apache_beam/dataframe/schemas.py 96.85% <ø> (ø)
...che_beam/runners/interactive/augmented_pipeline.py 69.38% <ø> (ø)
...apache_beam/typehints/native_type_compatibility.py 86.57% <ø> (ø)
sdks/python/apache_beam/typehints/schemas.py 94.20% <ø> (ø)
...ks/python/apache_beam/runners/worker/sdk_worker.py 89.16% <20.00%> (+0.15%) ⬆️
...ks/python/apache_beam/runners/worker/data_plane.py 87.50% <40.00%> (ø)
...he_beam/runners/interactive/sql/beam_sql_magics.py 54.54% <53.16%> (-2.92%) ⬇️
...ython/apache_beam/runners/interactive/sql/utils.py 84.00% <62.50%> (-5.59%) ⬇️
...ache_beam/runners/interactive/recording_manager.py 96.55% <66.66%> (ø)
...ache_beam/runners/interactive/caching/cacheable.py 97.61% <94.11%> (ø)
... and 45 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 6c1c19d...a6bb4ae. Read the comment docs.

@KevinGG
Copy link
Contributor Author

KevinGG commented Sep 15, 2021

Run Python PreCommit

@KevinGG KevinGG force-pushed the beam_sql_out_cache branch 2 times, most recently from e96e00a to a87a3c8 Compare September 20, 2021 22:49
max_duration_secs: float,
dynamic_plotting_interval: Optional[int] = None,
include_window_info: bool = False,
display_facets: bool = False) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add some comments for these new parameters? I have to look at the implementation to understand their meanings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes!

"metadata": {},
"source": [
"## Query#1 - A simple static query\n",
"`beam_sql` is an IPython [custom magic](https://ipython.readthedocs.io/en/stable/config/custommagics.html). If you're not familiar with magics, here are some [built-in examples](https://ipython.readthedocs.io/en/stable/interactive/magics.html).\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this sentence is better placed when you mentioned "magic" above (i.e., first let's load the beam_sql magic), which gives reader more context about magic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll move the explanation to the very beginning, immediately after mentioning the beam_sql magic.

beam_sql is an IPython custom magic ...

"source": [
"The `beam_sql` magic shows you the result of the SQL query.\n",
"\n",
"It also creates and outputs a PCollection named `query1_data` with element_type like `BeamSchema_...(id: int32, str: str)`.\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

element_type does not display properly.
Please check other name with '_' in this doc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Enclosing literal words with _ with backticks.

"id": "05d2b688",
"metadata": {},
"source": [
"To introspect the data again with more knobs, we can use `show`."
Copy link
Contributor

Choose a reason for hiding this comment

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

This doc mixes the usage of you and we, sometimes is "you can do something" and sometimes is "we can do something", consider making it consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change to use you.

"id": "6faa7df8",
"metadata": {},
"source": [
"To materialize the PCollection into a pandas DataFrame object, we can use `collect`."
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a link to pandas DataFrame object? I have no idea what is that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@andyxiexu andyxiexu left a comment

Choose a reason for hiding this comment

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

Some nits.

Copy link
Contributor

@andyxiexu andyxiexu left a comment

Choose a reason for hiding this comment

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

LGTM

@KevinGG
Copy link
Contributor Author

KevinGG commented Sep 21, 2021

Run PythonDocker PreCommit

1. Supported show/collect for beam_sql outputs.
2. Added a parser for beam_sql inputs.
@KevinGG
Copy link
Contributor Author

KevinGG commented Sep 21, 2021

Squashed the commits

@KevinGG KevinGG merged commit 919fdef into apache:master Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants