2017-03-21 6 views
0

sparksqlのストアドプロシージャや関数のようなSQLの機能を実現する方法はありますか?

私はhbaseでhpl sqlとコプロセッサを認識しています。しかし、同様のものがスパークで利用できるかどうかを知りたい。SparkSqlのストアドプロシージャ/関数

答えて

1

あなたは

val dataset = Seq((0, "hello"), (1, "world")).toDF("id", "text") 
val upper: String => String = _.toUpperCase  
import org.apache.spark.sql.functions.udf 
val upperUDF = udf(upper) 

// Apply the UDF to change the source dataset 
scala> dataset.withColumn("upper", upperUDF('text)).show 

結果

| id| text|upper| 

+---+-----+-----+ 

| 0|hello|HELLO| 

| 1|world|WORLD| 
使用 User Defined Functionと作り付けの機能

の簡単な例を考えることができます

関連する問題