How to use Scala defined function in Cassandra interpreter on Zeppelin Notebook? -


i have next function defined on zeppelin notebook:

import java.util.date  def timeformat(d: long) : string = {     val l = (d * 1000).tolong     val time = new date(l)     time.tostring() } 

using single item:

timeformat(1471887281116l) res2: string = thu apr 02 10:05:16 utc 48612 

and want format timestamps cassandra using:

%cassandra select timeformat(timestamp) time keyspace.table; 

without function query return result output is:

com.datastax.driver.core.exceptions.invalidqueryexception:     unknown function 'timeformat' 

in zeppelin tutorial, shows how get , format data using functions, concretely registering function with:

sqlc.udf.register("functionname", functionname _) 

which allows access %sql interpreter, wonder how on %cassandra interpreter.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -