Skip to content
Advertisement

SparkSQLContext dataframe Select query based on column array

This is my dataframe:

I want to select all books where the author is Udo Haiber.

but of course it didn’t work because authors is array.

Advertisement

Answer

You can use array_contains to check if the author is inside the array:

Use single quotes to quote the author name because you’re using double quotes for the query string.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement