-
Notifications
You must be signed in to change notification settings - Fork 590
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
DOC: Document core parts of ibis #1351
Conversation
| The main user-facing component of ibis is expressions. The base class of all | ||
| expressions in ibis is the :class:`~ibis.expr.types.Expr` class. | ||
|
|
||
| Expressions provide the user facing API, defined in ``ibis/expr/api.py`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could actually put in the links to code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, will do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! If I recall correctly I've tried to click on Ibis design internals three times :)
| - [SQLite](http://sqlite.org/) | ||
| - [Pandas DataFrames](https://pandas.pydata.org/) (Experimental) | ||
| - [SQLite](https://www.sqlite.org/) | ||
| - [Pandas](https://pandas.pydata.org/) [DataFrames](http://pandas.pydata.org/pandas-docs/stable/dsintro.html#dataframe) (Experimental) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you marking this experimental?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it hasn't been around that long.
docs/source/design.rst
Outdated
|
|
||
| More to come here. | ||
| Primary Goals | ||
| ************* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be '----' otherwise you have too many levels of nesting (compared to other sections)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, done
docs/source/design.rst
Outdated
| #. Composability | ||
| #. Familiarty | ||
|
|
||
| Flow of execution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe should capitalize all works in sections (or not), just do this consistently
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/source/design.rst
Outdated
| (EXAMPLE) | ||
| #. Some optimizations happen at compile time? (EXAMPLE) | ||
| #. Expressions are compiled | ||
| #. The SQL string that generated by the compiler is sent to the database and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is true for SQL but not for other backends where the execution can happen locally / remote (e.g. pandas / spark / file based)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a note
docs/source/design.rst
Outdated
| #. The database returns some data that is then turned into a pandas DataFrame | ||
| by ibis | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you might want to have reference tags to each sub-section
docs/source/design.rst
Outdated
| expressions. | ||
|
|
||
| The compiler works by translating the different pieces of SQL expression into a | ||
| string or SQLAlchemy expression. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ref to SQLAlchemy docs
docs/source/design.rst
Outdated
| :class:`~ibis.impala.compiler.ImpalaExprTranslator` is one of the subclasses | ||
| that will perform this translation. | ||
|
|
||
| Execution |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe have another section on 'local execution' (pandas / spark / file based)
docs/source/extending.rst
Outdated
| Adding a new operation (``Node`` subclass) | ||
| ------------------------------------------ | ||
|
|
||
| Let's go through adding a `sha1`_ method to ibis, implemented in the BigQuery |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ref to BQ (maybe doc-section in ibis)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll link to the sha1 wikipedia article here https://en.wikipedia.org/wiki/SHA-1
docs/source/extending.rst
Outdated
| function in BigQuery takes a string or bytes and returns a bytestring of length | ||
| 20. | ||
|
|
||
| .. code-block:: python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could do these as ipython blocks (I think) esp if you want to use them later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually going to move this into a notebook
| execute the arguments of the current node | ||
|
|
||
| execute the current node with its executed arguments | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this rather belongs in the docs proper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I put this here so that I could start a trend of adding module level docs for each backend, rather than have one rst file for each backend which will tend to get out of date less often than the module docs.
|
Will endeavor to review tomorrow |
e406325
to
ae5d981
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments, but looks like a great start!
docs/source/design.rst
Outdated
| #. Type safety | ||
| #. Expressiveness | ||
| #. Composability | ||
| #. Familiarty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you
docs/source/design.rst
Outdated
| #. Expressions are type checked as you create them | ||
| #. Some expressions have some optimizations that happen as the user builds them | ||
| (EXAMPLE) | ||
| #. Some optimizations happen at compile time? (EXAMPLE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backend-specific rewrites
docs/source/design.rst
Outdated
| #. The SQL string that generated by the compiler is sent to the database and | ||
| executed (this step is skipped for the Pandas backend) | ||
| #. The database returns some data that is then turned into a pandas DataFrame | ||
| by ibis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should decide on Ibis vs ibis in prose and be consistent (pandas is of course styled as lowercase)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll arbitrarily decide to follow the pandas convention.
docs/source/design.rst
Outdated
|
|
||
| Here's an example of each type of expression: | ||
|
|
||
| .. code-block:: python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could do IPython directive (with graphviz disabled)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't show them anyways, since I'm not repring the expression, just the type.
| Separation of the :class:`~ibis.expr.types.Node` and | ||
| :class:`~ibis.expr.types.Expr` classes also allows the API to be tied to the | ||
| physical type of the expression rather than the particular operation, making it | ||
| easy to define the API in terms of types rather than specific operations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another key point here is that the operator output type will often depend on the input type(s). So the "user API" for the result of an operation is a strongly-typed expression having only the behavior of the actual output type of the operator.
- Add strings -> get strings, do things with strings
- Add numbers -> get numbers, do things with numbers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, added a blurb about this.
| the instance of the :class:`~ibis.sql.compiler.ExprTranslator` subclass | ||
| specific to the backend being compiled. For example, the | ||
| :class:`~ibis.impala.compiler.ImpalaExprTranslator` is one of the subclasses | ||
| that will perform this translation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be worth noting explicitly that SQL is only one target, however the library was designed with first-class SQL support in mind, being the lingua franca of analytics.
|
Merging on green |
No description provided.