FROM titanic    Observation: [('5.449689683556195',)]    Thought:I now know the final answer    Final Answer: The square root of the average age is approximately 5.45.        > Finished chain.    'The square root of the average age is approximately 5.45.'agent_executor.run("What's the name of the oldest survived passenger?")            > Entering new AgentExecutor chain...    Action: list_tables_sql_db    Action Input:     Observation: titanic    Thought:I should check the schema of the titanic table to see what columns are available.    Action: schema_sql_db    Action Input: titanic    Observation: CREATE TABLE langchain_example.titanic (      PassengerId INT,      Survived INT,      Pclass INT,      Name STRING,      Sex STRING,      Age DOUBLE,      SibSp INT,      Parch INT,      Ticket STRING,      Fare DOUBLE,      Cabin STRING,      Embarked STRING)    ;        /*    3 rows from titanic table:    PassengerId Survived    Pclass  Name    Sex Age SibSp   Parch   Ticket  Fare    Cabin   Embarked    1   0   3   Braund, Mr. Owen Harris male    22.0    1   0   A/5 21171   7.25    None    S    2   1   1   Cumings, Mrs. John Bradley (Florence Briggs Thayer) female  38.0    1   0   PC 17599    71.2833 C85 C    3   1   3   Heikkinen, Miss. Laina  female  26.0    0   0   STON/O2. 3101282    7.925   None    S    */    Thought:I can use the titanic table to find the oldest survived passenger. I will query the Name and Age columns, filtering by Survived and ordering by Age in descending order.    Action: query_checker_sql_db    Action Input: SELECT Name, Age FROM titanic WHERE Survived = 1 ORDER BY Age DESC LIMIT 1    Observation: SELECT Name, Age FROM titanic WHERE Survived = 1 ORDER BY Age DESC LIMIT 1    Thought:The query is correct. Now I will execute it to find the oldest survived passenger.    Action: query_sql_db    Action Input: SELECT Name, Age FROM titanic WHERE Survived = 1 ORDER BY Age DESC LIMIT 1    Observation: [('Barkworth, Mr. Algernon Henry Wilson',
This notebook shows how to use agents to interact with Spark SQL. Similar to SQL Database Agent, it is designed to address general inquiries about Spark SQL and facilitate error recovery.
This notebook shows how to use agents to interact with Spark SQL. Similar to SQL Database Agent, it is designed to address general inquiries about Spark SQL and facilitate error recovery. ->: FROM titanic    Observation: [('5.449689683556195',)]    Thought:I now know the final answer    Final Answer: The square root of the average age is approximately 5.45.        > Finished chain.    'The square root of the average age is approximately 5.45.'agent_executor.run("What's the name of the oldest survived passenger?")            > Entering new AgentExecutor chain...    Action: list_tables_sql_db    Action Input:     Observation: titanic    Thought:I should check the schema of the titanic table to see what columns are available.    Action: schema_sql_db    Action Input: titanic    Observation: CREATE TABLE langchain_example.titanic (      PassengerId INT,      Survived INT,      Pclass INT,      Name STRING,      Sex STRING,      Age DOUBLE,      SibSp INT,      Parch INT,      Ticket STRING,      Fare DOUBLE,      Cabin STRING,      Embarked STRING)    ;        /*    3 rows from titanic table:    PassengerId Survived    Pclass  Name    Sex Age SibSp   Parch   Ticket  Fare    Cabin   Embarked    1   0   3   Braund, Mr. Owen Harris male    22.0    1   0   A/5 21171   7.25    None    S    2   1   1   Cumings, Mrs. John Bradley (Florence Briggs Thayer) female  38.0    1   0   PC 17599    71.2833 C85 C    3   1   3   Heikkinen, Miss. Laina  female  26.0    0   0   STON/O2. 3101282    7.925   None    S    */    Thought:I can use the titanic table to find the oldest survived passenger. I will query the Name and Age columns, filtering by Survived and ordering by Age in descending order.    Action: query_checker_sql_db    Action Input: SELECT Name, Age FROM titanic WHERE Survived = 1 ORDER BY Age DESC LIMIT 1    Observation: SELECT Name, Age FROM titanic WHERE Survived = 1 ORDER BY Age DESC LIMIT 1    Thought:The query is correct. Now I will execute it to find the oldest survived passenger.    Action: query_sql_db    Action Input: SELECT Name, Age FROM titanic WHERE Survived = 1 ORDER BY Age DESC LIMIT 1    Observation: [('Barkworth, Mr. Algernon Henry Wilson',