Skip to content

Commit

Permalink
Fix failing doctests
Browse files Browse the repository at this point in the history
Signed-off-by: currantw <[email protected]>
  • Loading branch information
currantw committed Feb 12, 2025
1 parent 240c1eb commit 8f6838b
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 52 deletions.
80 changes: 40 additions & 40 deletions docs/user/ppl/cmd/expand.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ PPL query::

os> source=expand_flatten | expand teams | fields city, teams.name
fetched rows / total rows = 7/7
+--------------+--------------------+
| city | teams.name |
|--------------+--------------------|
| Seattle | Seattle Seahawks |
| Seattle | Seattle Kraken |
| Vancouver | Vancouver Canucks |
| Vancouver | BC Lions |
| San Antonio | San Antonio Spurs |
| Null City | null |
| Missing City | null |
+--------------+--------------------+
+--------------+-------------------+
| city | teams.name |
|--------------+-------------------|
| Seattle | Seattle Seahawks |
| Seattle | Seattle Kraken |
| Vancouver | Vancouver Canucks |
| Vancouver | BC Lions |
| San Antonio | San Antonio Spurs |
| Null City | null |
| Missing City | null |
+--------------+-------------------+

Example 2: Expand a nested field
=================================
Expand All @@ -47,15 +47,15 @@ PPL query::

os> source=expand_flatten | where city = 'San Antonio' | expand teams.title | fields teams.name, teams.title
fetched rows / total rows = 5/5
+-------------------+--------------+
| teams.name | teams.title |
|-------------------+--------------|
| San Antonio Spurs | 1999 |
| San Antonio Spurs | 2003 |
| San Antonio Spurs | 2005 |
| San Antonio Spurs | 2007 |
| San Antonio Spurs | 2014 |
+-------------------+--------------+
+-------------------+-------------+
| teams.name | teams.title |
|-------------------+-------------|
| San Antonio Spurs | 1999 |
| San Antonio Spurs | 2003 |
| San Antonio Spurs | 2005 |
| San Antonio Spurs | 2007 |
| San Antonio Spurs | 2014 |
+-------------------+-------------+

Example 3: Expand multiple fields
==================================
Expand All @@ -64,26 +64,26 @@ PPL query::

os> source=expand_flatten | expand teams | expand teams.title | fields teams.name, teams.title
fetched rows / total rows = 16/16
+-------------------+--------------+
| teams.name | teams.title |
|-------------------+--------------|
| Seattle Seahawks | 2014 |
| Seattle Kraken | null |
| Vancouver Canucks | null |
| BC Lions | 1964 |
| BC Lions | 1985 |
| BC Lions | 1994 |
| BC Lions | 2000 |
| BC Lions | 2006 |
| BC Lions | 2011 |
| San Antonio Spurs | 1999 |
| San Antonio Spurs | 2003 |
| San Antonio Spurs | 2005 |
| San Antonio Spurs | 2007 |
| San Antonio Spurs | 2014 |
| null | null |
| null | null |
+-------------------+--------------+
+-------------------+-------------+
| teams.name | teams.title |
|-------------------+-------------|
| Seattle Seahawks | 2014 |
| Seattle Kraken | null |
| Vancouver Canucks | null |
| BC Lions | 1964 |
| BC Lions | 1985 |
| BC Lions | 1994 |
| BC Lions | 2000 |
| BC Lions | 2006 |
| BC Lions | 2011 |
| San Antonio Spurs | 1999 |
| San Antonio Spurs | 2003 |
| San Antonio Spurs | 2005 |
| San Antonio Spurs | 2007 |
| San Antonio Spurs | 2014 |
| null | null |
| null | null |
+-------------------+-------------+

Example 4: Expand and flatten a field
=====================================
Expand Down
20 changes: 10 additions & 10 deletions docs/user/ppl/cmd/flatten.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ PPL query::

os> source=expand_flatten | flatten location | fields city, country, province, coordinates, state
fetched rows / total rows = 5/5
+------------------+---------------+------------------+-----------------------------------------------+------------+
| city | country | province | coordinates | state |
|------------------+---------------+------------------+-----------------------------------------------+------------|
| Seattle | United States | null | {'latitude': 47.6061, 'longitude': -122.3328} | Washington |
| Vancouver | Canada | British Columbia | {'latitude': 49.2827, 'longitude': -123.1207} | null |
| San Antonio | United States | null | {'latitude': 29.4252, 'longitude': -98.4946 | Texas |
| Null City | null | null | null | null |
| Missing City | null | null | null | null |
+------------------+---------------+------------------+-----------------------------------------------+------------+
+--------------+---------------+------------------+-----------------------------------------------+------------+
| city | country | province | coordinates | state |
|--------------+---------------+------------------+-----------------------------------------------+------------|
| Seattle | United States | null | {'latitude': 47.6061, 'longitude': -122.3328} | Washington |
| Vancouver | Canada | British Columbia | {'latitude': 49.2827, 'longitude': -123.1207} | null |
| San Antonio | United States | null | {'latitude': 29.4252, 'longitude': -98.4946} | Texas |
| Null City | null | null | null | null |
| Missing City | null | null | null | null |
+--------------+---------------+------------------+-----------------------------------------------+------------+

Example 2: Flatten multiple object fields
=========================================
Expand Down Expand Up @@ -67,7 +67,7 @@ PPL query::
|--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Seattle | {'coordinates': {'latitude': 47.6061, 'longitude': -122.3328}, 'country': 'United States', 'state': 'Washington', 'latitude': 47.6061, 'longitude': -122.3328} |
| Vancouver | {'coordinates': {'latitude': 49.2827, 'longitude': -123.1207}, 'country': 'Canada', 'province': 'British Columbia', 'latitude': 49.2827, 'longitude': -123.1207} |
| San Antonio | {'coordinates': {'latitude': 29.4252, 'longitude': -98.4946 }, 'country': 'United States', 'state': 'Texas', 'latitude': 29.4252, 'longitude': -98.4946} |
| San Antonio | {'coordinates': {'latitude': 29.4252, 'longitude': -98.4946}, 'country': 'United States', 'state': 'Texas', 'latitude': 29.4252, 'longitude': -98.4946} |
| Null City | null |
| Missing City | null |
+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Expand Down
3 changes: 1 addition & 2 deletions doctest/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
DATASOURCES = ".ql-datasources"
WEBLOGS = "weblogs"
JSON_TEST = "json_test"
EXPAND_FLATTEN = "expand"
FLATTEN = "flatten"
EXPAND_FLATTEN = "expand_flatten"

class DocTestConnection(OpenSearchConnection):

Expand Down

0 comments on commit 8f6838b

Please sign in to comment.