第72课:Spark SQL UDF和UDAF解密与实战 每天晚上20:00YY频道现场授课频道68917580

/* * *王家林老师授课http://weibo.com/ilovepains */  
每天晚上20:00YY频道现场授课频道68917580

 

输入数据

 

"Spark", "Spark","Hadoop", "Spark", "Hadoop", "Spark","Spark", "Hadoop", "Spark", "Hadoop"

 

   sqlContext.sql("select word, computeLength(word) as length frombigDataTable").show

 

输出数据

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

word|length|

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

| Spark|     5|

| Spark|     5|

|Hadoop|     6|

| Spark|     5|

|Hadoop|     6|

| Spark|     5|

| Spark|     5|

|Hadoop|     6|

| Spark|     5|

|Hadoop|     6|

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

 

 

sqlContext.sql("selectword,wordCount(word) as count,computeLength(word) as length" +

     " from bigDataTable group by word").show()

 

输出数据

 

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

word|count|length|

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

| Spark|    6|    5|

|Hadoop|    4|    6|

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

 

第72课:Spark SQL UDF和UDAF解密与实战 每天晚上20:00YY频道现场授课频道68917580_第1张图片

 

第72课:Spark SQL UDF和UDAF解密与实战 每天晚上20:00YY频道现场授课频道68917580_第2张图片

 

 

 

你可能感兴趣的:(第72课:Spark SQL UDF和UDAF解密与实战 每天晚上20:00YY频道现场授课频道68917580)