Hamid Reza Darash
Hamid Reza Darash

Reputation: 23

cassandra CQL not use UDF in where

Why can not UDF be used in Where?

select * from user_by_location
where distanceOf(latlng.lat,latlng.lng,42.15444,34.58511) > 1;

SyntaxException: line 1:47 no viable alternative at input '(' (select * from user_by_location where [distanceOf](...)

Upvotes: 1

Views: 265

Answers (1)

Valerie Parham-Thompson
Valerie Parham-Thompson

Reputation: 1566

You cannot use UDFs in where clauses (to filter queries).

The feature request to allow this is here if you'd like to follow it. To summarize, it requires rearranging some major parts of code and could result in slow performance and/or stale data.

(By the way, it looks like you're trying to work with geospatial data, so you might find it helpful to look into how to handle that with Spark or DSE.)

Upvotes: 1

Related Questions