Skip to content

Common Bodo SQL Errors

BodoSQL can raise a number of different errors when parsing SQL queries. Below is a list of the most commonly encountered parsing errors and their causes.

  • A binary operation was used on two types for which it is not supported.

    "Cannot apply 'OP' to arguments of type '<SQL_TYPE_ENUM> OP <SQL_TYPE_ENUM>'"
    

    This error can be resolved by casting either side of the expression to a common type.


  • The format string passed to STR_TO_DATE is not a valid SQL format string.

    "STR_TO_DATE contains an invalid format string"
    

    See DATE_FORMAT for the list of supported SQL format characters.


  • The format string passed to STR_TO_DATE is a valid SQL format string, which contains one or more escape characters that BodoSQL does not currently support.

    "STR_TO_DATE contains an invalid escape character (escape char)"
    

    For the list of supported SQL format characters, see DATE_FORMAT.


  • The specified column (COL_NAME) of one of the pandas DataFrames used to initialize a BodoSQLContext has an unsupported type.

    "Pandas column 'COL_NAME' with type PANDAS_TYPE not supported in BodoSQL."
    

    For the list of supported pandas types, see here.


  • The parser encountered something other than a query at a location where a query was expected.

    "Non-query expression encountered in illegal context"
    

    See here for the syntax of a select clause.


  • The table name specified in a SQL query doesn't match a table name registered in the BodoSQLContext.

    "Object 'tablename' not found"
    

    Generally, this is caused by misnaming a table when initializing the BodoSqlContext, or misnaming a table in the query itself.


  • The query attempted to select a column from one or more tables, and the column wasn't present in any of them.

    "Column 'COL_NAME' not found in any table"
    

    Generally, this is caused by misnaming a column while initializing the BodoSQLContext, or misnaming a column in the query itself.``


  • The query attempted to select a column for two or more tables, and the column was present in multiple tables.

    "Column 'COL_NAME' is ambiguous"
    


  • The types of arguments supplied to the function don't match the types supported by the function.

    "Cannot apply 'FN_NAME' to arguments of type 'FN_NAME(<ARG1_SQL_TYPE>, <ARG2_SQL_TYPE>, ...)'. Supported form(s): 'FN_NAME(<ARG1_SQL_TYPE>, <ARG2_SQL_TYPE>, ...)'"
    

    Generally, this can be resolved by the specifying the origin table like so:

    Select A from table1, table2Select table1.A from table1, table2

    This can be resolved by explicitly casting the problematic argument(s) to the appropriate type. For the list of functions and the argument types they support, see here.


  • Either BodoSQL doesn't support the function or an incorrect number of arguments was supplied.

    "No match found for function signature FN_NAME(<ARG1_SQL_TYPE>, <ARG2_SQL_TYPE>, ...)"
    

    In both cases, the list of functions which we support, and their calling conventions can be found here.


  • A Window function that does not support windows with a ROWS_BETWEEN clause was called over a window containing a ROWS_BETWEEN clause.

    "ROW/RANGE not allowed with RANK, DENSE_RANK or ROW_NUMBER functions"
    

    In addition to the RANK, DENSE_RANK, or ROW_NUMBER functions listed in the error message, LEAD and LAG also have this requirement. The list of window aggregations we support, and their calling syntax can be found here.


  • BodoSQL was unable to parse your SQL because the query contained unsupported syntax.

    "Encountered "KEYWORD" at line X, column Y. Was expecting one of: ..."
    

    There are a variety of reasons this could occur, but here are some of the common ones:

    • A typo in one of the query words, for example groupby instead of group by. In this situation line X, column Y should point you to the first typo.
    • All the components are legal SQL keywords, but they are used in an incorrect order. Please refer to our support syntax to check for legal constructions. If you believe your query should be supported please file an issue.
    • Trying to use double-quotes for a string literal (i.e. py"example" instead of 'example')
    • Unclosed parenthesis or trailing commas


  • A parameter was not properly registered in the BodoSQLContext.

    "SQL query contains a unregistered parameter: '@param_name'"
    

    This is often caused by failing to pass the parameter to BodoSQLContext.sql() or using an incorrect name in either the query or the registration. For more information on named parameters, see here.


  • A non-dataframe value was used to initialize a BodoSQLContext.

    "BodoSQLContext(): 'table' values must be DataFrames"
    

    The dictionary used to initialize a BodoSQLContext must map string table names to pandas DataFrames.

Back to top