From 8f6838beb7f57a52fd6f5504be861c0ec1e1c9c1 Mon Sep 17 00:00:00 2001 From: currantw Date: Wed, 12 Feb 2025 15:46:46 -0800 Subject: [PATCH] Fix failing doctests Signed-off-by: currantw --- docs/user/ppl/cmd/expand.rst | 80 +++++++++++++++++------------------ docs/user/ppl/cmd/flatten.rst | 20 ++++----- doctest/test_docs.py | 3 +- 3 files changed, 51 insertions(+), 52 deletions(-) diff --git a/docs/user/ppl/cmd/expand.rst b/docs/user/ppl/cmd/expand.rst index b241c6a156..00f179105b 100644 --- a/docs/user/ppl/cmd/expand.rst +++ b/docs/user/ppl/cmd/expand.rst @@ -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 ================================= @@ -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 ================================== @@ -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 ===================================== diff --git a/docs/user/ppl/cmd/flatten.rst b/docs/user/ppl/cmd/flatten.rst index 3a2f812c85..18e0f430b3 100644 --- a/docs/user/ppl/cmd/flatten.rst +++ b/docs/user/ppl/cmd/flatten.rst @@ -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 ========================================= @@ -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 | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+ diff --git a/doctest/test_docs.py b/doctest/test_docs.py index 84fa860fdc..c876800873 100644 --- a/doctest/test_docs.py +++ b/doctest/test_docs.py @@ -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):