'mismatched input ';' expecting <EOF>(line 1, pos 90)

I am trying to fetch multiple rows in zeppelin using spark SQL.

Here's my SQL statement:

select id, name from target where updated_at = "val1", "val2","val3"

This is the error message I'm getting:

mismatched input ';' expecting < EOF >(line 1, pos 90)



Solution 1:[1]

Not sure what your exact requirement is but your match condition doesn't conform to SQL syntax standards. Below statement will work if your requirement does match this:

select id, name from target where updated_at in ('val1', 'val2','val3')

Solution 2:[2]

In case someone gets this error in the selectExpr function from Spark like me: the correct usage of selectExpr is not a string which contains a comma separated list of column names, but a list of column names:

spark_df.selectExpr("id, name")  # ouch, wrong
> mismatched input ';' expecting <EOF>(line 1, pos xy)

spark_df.selectExpr("id", "name")     # right!
> DataFrame[..]

spark_df.selectExpr(*["id", "name"])  # correct too!
> DataFrame[..]

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 knowone
Solution 2 0x4a6f4672