下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
實(shí)驗(yàn)8-10大數(shù)據(jù)實(shí)時(shí)分析一、實(shí)驗(yàn)?zāi)康恼莆帐褂肧park和Hsql進(jìn)行數(shù)據(jù)分析的方法。二、數(shù)據(jù)處理基于Spark引擎來進(jìn)行數(shù)據(jù)開發(fā),所有的應(yīng)用程序都將運(yùn)行在Spark集群上,這樣可以保證數(shù)據(jù)被高性能地處理,然后使用Zeppelin來快速將數(shù)據(jù)進(jìn)行SQL指令交互,使用處理好的數(shù)據(jù)編寫HQL語句并進(jìn)行實(shí)時(shí)分析。由于在處理大規(guī)模數(shù)據(jù)時(shí)每次都需要占用較長時(shí)間,并將計(jì)算好的數(shù)據(jù)直接保存下來,以便快速查詢數(shù)據(jù)結(jié)果,因此需要?jiǎng)?chuàng)建應(yīng)用層表,保存的數(shù)據(jù)為某天的總訂單數(shù)。三、實(shí)訓(xùn)內(nèi)容步驟.總訂單筆數(shù)創(chuàng)建表創(chuàng)建保存日期對應(yīng)訂單筆數(shù)的app表createtableifnotexistsapp_didi.t_order_total(date_valstringcomment,0期(年月日)',countintcomment'訂單筆數(shù),)partitionedby(monthstringcomment'年月,yyyy-MM')rowformatdelimitedfieldsterminatedby加載表-加載數(shù)據(jù)到app表insertoverwritetableapp_didi.t_order_totalpartition(month=,2020-04,)select,2020-04-12;count(orderid)astotal_cntfromdw_didi.t_user_order_widewheredl='2020-04-12'.預(yù)約和非預(yù)約用戶占比創(chuàng)建表-創(chuàng)建保存日期對應(yīng)訂單筆數(shù)的app表createtableifnotexistsapp_didi.t_order_subscribe_percent(date_valstringcomment'日期',subscribe_namestringcomment是否預(yù)約',percent_valstringcomment'百分比‘)partitionedby(monthstringcommenl'年月yyyy-MM')rowformatdelimitedfieldsterminatedby;加載表-加載數(shù)據(jù)到app表insertoverwritetableapp_didi.t_order_subscribe_percentpartition(month="2020-04,)select,2020-04-12',預(yù)約’,concat(round(tl.total_cnt/t2.total_cnt*100,2),,%*)assubscribefromI(selectcount(ordcrid)astotal_cntfromdw_didi.t_user_order_widewheresubscribe=1anddt=*2020-04-12,)th■selectcount(orderid)astotal_cntfromdw_didi.t_user_order_widewheredt='2020-04-12,)t2unionallselect,2020-04-12;'非預(yù)約',concat(round(tI.total_cnt/t2.total_cnt*100,2),"%')asnosubscribefromI(selectcount(orderid)astotal_cntfromdw_didi.t_user_order_widcwheresubscribe=0anddt=*2020-04-121)tl,(selectcount(orderid)astotal_cntfromdw_didi.t_user_order_widewheredt='2020-04-121)t2;3不同時(shí)段的占比分析創(chuàng)建表-創(chuàng)建APP層表createtableifnotexistsapp_didi.t_order_timerange_total(date_valstringcomment'日期',timcrangcstringcomment'時(shí)間段',countintcomment'訂單數(shù)量’)partitionedby(monthstringcomment'年月,yyyy-MM')rowformatdelimitedfieldsterminatedby加載表-加載數(shù)據(jù)到app表insertoverwritetableapp_didi.t_order_timerange_totalpartition(month='2020-04')select,2020-04-12;order_time_range,count(*)asorder_cntfromdw_didi.t_user_order_widewheredt='2020-04-12'groupbyorder_time_range4不同地域訂單占比創(chuàng)建表-創(chuàng)建APP表createtableifnotexistsapp_didi.t_order_province_total(date_valstringcomment'日期provincestringcomment'省份',countintcomment'訂單數(shù)量’)partitionedby(monthsiringcomment'年月,yyyy-MM*)rowformatdelimitedfieldsterminatedby加載表一數(shù)據(jù)力口載至IJAPP表insertoverwritetableapp_didi.t_order_province_totalpartition(month='2020-04')select,2020-04-12;province,count(*)asorder_cntfromdw_didi.t_user_ordcr_widewheredt=2020-04-121groupbyprovinceorderbyorder_cntdesc5.不同年齡段,不同時(shí)段訂單占比創(chuàng)建表createtableifnotexistsapp_didi.t_order_age_and_time_range_total(date_valstringcomment'日期',age_rangestringcomment'年齡段,order_time_rangestringcomment'時(shí)段',countintcomment'訂單數(shù)量’)partitionedby(monthstringcomment'年月,yyyy-MM')rowformatdelimitedfieldsterminatedby加載表-加載數(shù)據(jù)到APP表insertoverwritetableapp_didi.t_order_age_and_time_range_totalpartition(month='2020-041)select,2020-04-12',age_range,order_time_range,count(*)asorder_cntfromdw_didi.t_user_order_widewheredt=7020-04-12,groupbyage_range,order_time_range6不同職業(yè)訂單統(tǒng)計(jì)top5創(chuàng)建表createtableifnotexistsapp_didi.t_order_profession_total_topn(date_valstringcomment'日期',professionstringcomment'職業(yè)Order_cntintcomment'訂單數(shù)量',rkintcomment'排名,)Iparlilionedby(monthstringcommenl'年月,yyyy-MM')rowformatdelimitedfieldsterminatedby;加載表insertoverwritetableapp_didi.t_order_profession_total_topnpartition(month=*2020-04,)select*fromselect*dense_rank()over(orderbytotal_cnidesc)asrkfrom(select,2020-04-12;profession,count(orderid)astotal_cntfromdw_didi.t_user_order_widegroupbyprofession)ttwhererk<=3;7.求取消訂單百分比創(chuàng)建表-創(chuàng)建app表createtableifnotexistsapp_didi.l_order_cancel_order_percenl(date_valstringcomment'日期',cancel_order_percentstringcomment'百分比')partitionedby(monthstringcomment'年月,yyyy-MM')rowformatdelimitedfieldsterminatedby加載表--插入數(shù)據(jù)insertoverwritetabicapp_didi.t_ordcr_canccl_ordcr_pcrccntpartition(month=12020-04,)select,2020-04-121date_valconcat(roun
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 常州市溧陽中學(xué)高三地理二輪復(fù)習(xí)區(qū)域地理作業(yè)
- 2026年珠寶鑒定師能力(品質(zhì)評估)考題及答案
- 2025年大學(xué)環(huán)境工程(污水處理工藝設(shè)計(jì))試題及答案
- 2026年專利代理師(專利法律知識(shí))試題及答案
- 2026下半年托福(iBT)口語話題素材與應(yīng)答技巧
- 2025年中職水產(chǎn)養(yǎng)殖技術(shù)(成魚養(yǎng)殖)試題及答案
- 高一生物(真題演練)2027年上學(xué)期期末考核卷
- 2026年注冊公路工程師(專業(yè)考試)試題及答案
- 2025年大學(xué)自動(dòng)化(機(jī)器人減排研究)試題及答案
- 金融科技 習(xí)題及答案題庫匯 - 第1-6章
- DB53∕T 1269-2024 改性磷石膏用于礦山廢棄地生態(tài)修復(fù)回填技術(shù)規(guī)范
- GB/T 43935-2024礦山土地復(fù)墾與生態(tài)修復(fù)監(jiān)測評價(jià)技術(shù)規(guī)范
- 酸棗種植知識(shí)講座
- Axure RP9 網(wǎng)站與App原型設(shè)計(jì)實(shí)戰(zhàn)案例教程PPT完整全套教學(xué)課件
- 《生于憂患死于安樂》文章結(jié)構(gòu)
- 1+X測繪地理信息智能應(yīng)用練習(xí)題(含參考答案)
- 譯林版五年級英語上冊全冊課件
- 磷石膏基公路基層材料 技術(shù)規(guī)范 編制說明
- 電大??啤豆芾碛⒄Z1》歷年期末考試試題及答案匯編
- 《非政府組織管理》教學(xué)大綱
- GB/T 19809-2005塑料管材和管件聚乙烯(PE)管材/管材或管材/管件熱熔對接組件的制備
評論
0/150
提交評論