sparkstrteaming的視窗函式的使用

2021-10-23 08:16:37 字數 1125 閱讀 9507

直接上**例子:詞頻統計

import com.bcht.xl.common.

import com.bcht.xl.constant.constants

import org.apache.kafka.common.serialization.stringdeserializer

import org.apache.spark.sparkconf

import org.apache.spark.streaming.dstream.dstream

import org.apache.spark.streaming.kafka010.

import org.apache.spark.streaming.

/** *sparkstreaming 的視窗函式使用

* */

object test_csxs_five

ssc.start()

ssc.awaittermination()

}}

**執行結果

消費者插入資料:

注意:視窗函式還有其他的幾個

1、window(windowlength, slideinterval)

2、countbywindow(windowlength,slideinterval)

3、reducebywindow(func, windowlength, slideinterval)

4、reducebykeyandwindow(func, windowlength, slideinterval, [numtasks])

5、reducebykeyandwindow(func, invfunc, windowlength, slideinterval, [numtasks])

6、countbyvalueandwindow(windowlength, slideinterval, [numtasks])

含義就不一一說明:有興趣可以參考:

漂亮的彈視窗外掛程式 sweetAlert的使用

想必你已經受夠了單調的alert彈窗吧?為了更好的使用者體驗性,現在介紹一款漂亮的彈視窗外掛程式 sweetalert,現在就來介紹它的使用 2 在頁面的頭部初始化外掛程式 stylesheet type text css href dist sweetalert.css 3 頁面載入完成後呼叫sw...

Sql Server REPLACE函式的使用

replace 用第三個表示式替換第乙個字串表示式中出現的所有第二個給定字串表示式。語法replace string replace1 string replace2 string replace3 引數 string replace1 待搜尋的字串表示式。string replace1 可以是字元...

Sql Server REPLACE函式的使用

replace 更新替換資料庫某個欄位的的部分的值,比如替換資料庫中url欄位的網域名稱,語法 replace cloum string old string old 引數 cloum 待替換欄位的字串表示式。string old 待查詢的字串表示式。string old 替換用的字串表示式。示列 ...