You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/01/28 15:47:29 UTC

[GitHub] [arrow] romankarlstetter opened a new pull request #9351: ARROW-11412: [Python] Improve Expression docs

romankarlstetter opened a new pull request #9351:
URL: https://github.com/apache/arrow/pull/9351


   Slightly improve documentation on how to create and combine expressions
   for filtering datasets. Including one example.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [arrow] romankarlstetter commented on pull request #9351: ARROW-11412: [Python] Improve Expression docs

Posted by GitBox <gi...@apache.org>.
romankarlstetter commented on pull request #9351:
URL: https://github.com/apache/arrow/pull/9351#issuecomment-769595405


   I tried to fix the issues you mentioned and also updated dataset.rst to clarify the use of &, | ~ vs and or not


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [arrow] jorisvandenbossche commented on a change in pull request #9351: ARROW-11412: [Python] Improve Expression docs

Posted by GitBox <gi...@apache.org>.
jorisvandenbossche commented on a change in pull request #9351:
URL: https://github.com/apache/arrow/pull/9351#discussion_r566220109



##########
File path: python/pyarrow/_dataset.pyx
##########
@@ -84,7 +84,25 @@ cdef CFileSource _make_file_source(object file, FileSystem filesystem=None):
 
 
 cdef class Expression(_Weakrefable):
-
+    """
+    A logical expression to be evaluated against some input.
+
+    To create an expression:
+     - Use the factory function ``pyarrow.dataset.scalar()`` to create a
+       scalar (not necessary when combined, see example below).
+     - Use the factory function ``pyarrow.dataset.field()`` to reference
+       a field (column in table).
+     - Compare fields and scalars with ``<``, ``<=``, ``==``, ``>=``, ``>``.
+     - Combine expressions using python operators ``&`` (logical and),
+       ``|`` (logical or) and ``~`` (logical not).
+       Note: python keywords ``and``, ``or`` and ``not`` do not work to combine expressions.
+
+    Examples:
+    --------
+    >>> from pyarrow.dataset import scalar, field

Review comment:
       In the other part of the docs, we use `import pyarrow.dataset as ds`, we should probably be consistent (https://arrow.apache.org/docs/python/dataset.html)

##########
File path: python/pyarrow/_dataset.pyx
##########
@@ -84,7 +84,25 @@ cdef CFileSource _make_file_source(object file, FileSystem filesystem=None):
 
 
 cdef class Expression(_Weakrefable):
-
+    """
+    A logical expression to be evaluated against some input.
+
+    To create an expression:
+     - Use the factory function ``pyarrow.dataset.scalar()`` to create a

Review comment:
       Can you leave a blank line above this one (to separate the text from the list)?
   
   And the `-` has one extra space before it as indentation, which needs to be removed in order to render it correctly with sphinx.
   
   (restructured text is quite picky ... ;))




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [arrow] jorisvandenbossche closed pull request #9351: ARROW-11412: [Python] Improve Expression docs

Posted by GitBox <gi...@apache.org>.
jorisvandenbossche closed pull request #9351:
URL: https://github.com/apache/arrow/pull/9351


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [arrow] github-actions[bot] commented on pull request #9351: ARROW-11412: [Python] Improve Expression docs

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #9351:
URL: https://github.com/apache/arrow/pull/9351#issuecomment-769198889


   https://issues.apache.org/jira/browse/ARROW-11412


----------------------------------------------------------------
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:
users@infra.apache.org