alamb commented on code in PR #445:
URL: 
https://github.com/apache/arrow-datafusion-python/pull/445#discussion_r1288367545


##########
docs/source/user-guide/basics.rst:
##########
@@ -0,0 +1,89 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+.. or more contributor license agreements.  See the NOTICE file
+.. distributed with this work for additional information
+.. regarding copyright ownership.  The ASF licenses this file
+.. to you under the Apache License, Version 2.0 (the
+.. "License"); you may not use this file except in compliance
+.. with the License.  You may obtain a copy of the License at
+
+..   http://www.apache.org/licenses/LICENSE-2.0
+
+.. Unless required by applicable law or agreed to in writing,
+.. software distributed under the License is distributed on an
+.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+.. KIND, either express or implied.  See the License for the
+.. specific language governing permissions and limitations
+.. under the License.
+
+Concepts
+========
+
+In this section, we will cover a basic example to introduce a few key concepts.
+
+.. code-block:: python
+
+    import datafusion
+    from datafusion import col
+    import pyarrow
+
+    # create a context
+    ctx = datafusion.SessionContext()
+
+    # create a RecordBatch and a new DataFrame from it
+    batch = pyarrow.RecordBatch.from_arrays(
+        [pyarrow.array([1, 2, 3]), pyarrow.array([4, 5, 6])],
+        names=["a", "b"],
+    )
+    df = ctx.create_dataframe([[batch]])
+
+    # create a new statement
+    df = df.select(
+        col("a") + col("b"),
+        col("a") - col("b"),
+    )
+
+    # execute and collect the first (and only) batch
+    result = df.collect()[0]
+
+The first statement group:
+
+.. code-block:: python
+
+    # create a context
+    ctx = datafusion.SessionContext()
+
+creates a :code:`SessionContext`, that is, the main interface for executing 
queries with DataFusion. It maintains the state
+of the connection between a user and an instance of the DataFusion engine. 
Additionally it provides the following functionality:
+
+- Create a DataFrame from a CSV or Parquet data source.
+- Register a CSV or Parquet data source as a table that can be referenced from 
a SQL query.
+- Register a custom data source that can be referenced from a SQL query.
+- Execution a SQL query

Review Comment:
   ```suggestion
   - Execute a SQL query
   ```



##########
docs/source/user-guide/introduction.rst:
##########
@@ -0,0 +1,44 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+.. or more contributor license agreements.  See the NOTICE file
+.. distributed with this work for additional information
+.. regarding copyright ownership.  The ASF licenses this file
+.. to you under the Apache License, Version 2.0 (the
+.. "License"); you may not use this file except in compliance
+.. with the License.  You may obtain a copy of the License at
+
+..   http://www.apache.org/licenses/LICENSE-2.0
+
+.. Unless required by applicable law or agreed to in writing,
+.. software distributed under the License is distributed on an
+.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+.. KIND, either express or implied.  See the License for the
+.. specific language governing permissions and limitations
+.. under the License.
+
+.. _guide:
+
+Introduction
+============
+
+Welcome to the User Guide for the Python bindings of Arrow DataFusion. This 
guide aims to provide an introduction to
+DataFusion through various examples and highlight the most effective ways of 
using it.
+
+Installation
+------------
+
+DataFusion is a Python library and, as such, can be installed via pip from 
`PyPI <https://pypi.org/project/datafusion>`__.
+
+.. code-block:: shell
+
+    pip install datafusion
+
+You can verify the installation by running:
+
+.. code-block:: python
+
+    >>> import datafusion
+    >>> datafusion.__version__
+    '0.6.0'

Review Comment:
   ```suggestion
       '28.0.0'
   ```



##########
docs/source/user-guide/basics.rst:
##########
@@ -0,0 +1,89 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+.. or more contributor license agreements.  See the NOTICE file
+.. distributed with this work for additional information
+.. regarding copyright ownership.  The ASF licenses this file
+.. to you under the Apache License, Version 2.0 (the
+.. "License"); you may not use this file except in compliance
+.. with the License.  You may obtain a copy of the License at
+
+..   http://www.apache.org/licenses/LICENSE-2.0
+
+.. Unless required by applicable law or agreed to in writing,
+.. software distributed under the License is distributed on an
+.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+.. KIND, either express or implied.  See the License for the
+.. specific language governing permissions and limitations
+.. under the License.
+
+Concepts
+========
+
+In this section, we will cover a basic example to introduce a few key concepts.

Review Comment:
   this is a really nice section



##########
docs/source/user-guide/common-operations/aggregations.rst:
##########
@@ -0,0 +1,59 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+.. or more contributor license agreements.  See the NOTICE file
+.. distributed with this work for additional information
+.. regarding copyright ownership.  The ASF licenses this file
+.. to you under the Apache License, Version 2.0 (the
+.. "License"); you may not use this file except in compliance
+.. with the License.  You may obtain a copy of the License at
+
+..   http://www.apache.org/licenses/LICENSE-2.0
+
+.. Unless required by applicable law or agreed to in writing,
+.. software distributed under the License is distributed on an
+.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+.. KIND, either express or implied.  See the License for the
+.. specific language governing permissions and limitations
+.. under the License.
+
+Aggregation
+============
+
+An aggregate or aggregation is a function where the values of multiple rows 
are processed together to form a single summary value.
+For performing an aggregation, DataFusion provides the 
:meth:`.DataFrame.aggregate`
+
+.. ipython:: python
+
+    from datafusion import SessionContext
+    from datafusion import column, lit
+    from datafusion import functions as f
+    import random
+
+    ctx = SessionContext()
+    df = ctx.from_pydict(
+        {
+            "a": ["foo", "bar", "foo", "bar", "foo", "bar", "foo", "foo"],
+            "b": ["one", "one", "two", "three", "two", "two", "one", "three"],
+            "c": [random.randint(0, 100) for _ in range(8)],
+            "d": [random.random() for _ in range(8)],
+        }
+    )
+
+    col_a = column("a")
+    col_b = column("b")
+    col_c = column("c")
+    col_d = column("d")
+
+    df.aggregate([], [f.approx_distinct(col_c), f.approx_median(col_d), 
f.approx_percentile_cont(col_d, lit(0.5))])

Review Comment:
   This is great. Thank you. One thing I noticed is that the name of the 
columns looks like some sort of hash or UUID which is somewhat less than 
appealing
   
   ![Screenshot 2023-08-09 at 7 55 01 
AM](https://github.com/apache/arrow-datafusion-python/assets/490673/f27b1633-9666-4b8e-a1cf-6339750e6f51)
   



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to