计算机毕业设计PySpark+Hadoop+Hive机票航班数据分析可视化大屏 机票预测 航班预测系统 机票爬虫 飞机票推荐系统 大数据毕业设计

培养大数据应用开发工程师,学生综合运用所学软件系统开发的基础理论和专业知识,掌握软件系统开发的设计与实现的流程、方法与技术,并具备解决软件系统开发过程中出现的一般问题的能力;同时培养学生务实、细致、严格、认真和吃苦耐劳的工作作风。

进一步提高学生所学的软件系统开发的理论知识水平,训练学生软件开发的动手能力,掌握软件系统开发过程中需求分析、概要设计、详细设计、功能测试等流程所需技能;贴近工作实际,让学生在对某个项目进行需求分析、功能确认后,完成整个系统架构的搭建以及功能实现,能独立完成开发工具的选择、功能模块的划分、数据库的设计以及软件功能的测试等任务,达到提高软件系统的设计与实现能力的目的。

通过毕业设计,使学生对软件系统的设计和实现的全过程有比较全面的了解,熟悉软件开发的有关流程、软件平台和开发工具的特点,为今后独立工作打下基础。

核心算法代码分享如下:

python 复制代码
#Flink连接HDFS上面的CSV文件 使用Flink_SQL分析完入表
## 启动hadoop
## cd /data/hadoop/sbin
## sh /data/hadoop/sbin/start-all.sh
## 启动hive
## cd /data/hive
## nohup hive --service metastore &
## nohup hive --service hiveserver2 &
import os
from pyflink.common import Row
from pyflink.table import (EnvironmentSettings, TableEnvironment, TableDescriptor, Schema,
                           DataTypes, FormatDescriptor)
from pyflink.table.expressions import lit, col
from pyflink.table.udf import udtf
import logging
import sys

logging.basicConfig(stream=sys.stdout, level=logging.INFO, format="%(message)s")

env_settings = EnvironmentSettings.in_streaming_mode()
table_env = TableEnvironment.create(env_settings)


jars = []
for file in os.listdir(os.path.abspath(os.path.dirname(__file__))):
    if file.endswith('.jar'):
        file_path = os.path.abspath(file)
        jars.append(file_path)

str_jars = ';'.join(['file:///' + jar for jar in jars])
table_env.get_config().get_configuration().set_string("pipeline.jars", str_jars)
# table_env.get_config().get_configuration().set_float('taskmanager.memory.network.fraction',0.8)
# table_env.get_config().get_configuration().set_string('taskmanager.memory.network.min','8gb')
# table_env.get_config().get_configuration().set_string('taskmanager.memory.network.max','16gb')
table_env.get_config().get_configuration().set_string('parallelism.default','1')
#先读取hadoop_hdfs上的CSV文件
table_env.execute_sql(
                """
                    CREATE  TABLE `ods_flight` (
                          `start_city` string COMMENT '出发城市',
                          `end_city` string  COMMENT '到达城市',
                          `stime` string  COMMENT '出发日期',
                          `airline_name` string  COMMENT '航班名称',
                          `flight_info` string  COMMENT '飞机详细信息',
                          `flight_type1` string  COMMENT '飞机型号',
                          `flight_type2` string  COMMENT '飞机系列',
                          `setup_time` string  COMMENT '出发时间',
                          `arr_time` string  COMMENT '到达时间',
                          `start_airport` string  COMMENT '起飞机场和航站楼',
                          `arr_airport` string  COMMENT '到达机场和航站楼',
                          `ontime_rate` bigint  COMMENT '准点率',
                          `flight_total_time` string  COMMENT '飞行时间字符串',
                          `price` bigint  COMMENT '价格',
                          `price_desc` string  COMMENT '优惠折扣力度',
                          `flight_company` string  COMMENT '航空公司',
                          `flight_type3` string  COMMENT '飞行性质',
                          `setup_time_math` double  COMMENT '出发时间_数字辅助',
                          `arr_time_math` double  COMMENT '到达时间_数字辅助',
                          `arr_time2` string  COMMENT '第几天到达',
                          `start_airport_simple` string  COMMENT '起飞机场',
                          `arr_airport_simple` string  COMMENT '到达机场',
                          `flight_total_time_math` bigint  COMMENT '飞行时长_数字辅助',
                          `price_desc_math` double  COMMENT '优惠折扣力度_数字辅助'
                        ) WITH(
                           'connector' = 'filesystem',
                            'path' ='hdfs://bigdata:9000/flink_fliggy_flight/flight/hdfs_flights.csv',
                            'format' = 'csv'
                )   
                """
                      )

#设置下沉到mysql的表
table_env.execute_sql(
                """
                create  table tables01(
                    `airline_name` string primary key ,
                    `price_desc_math` double  ,
                    `price_desc` string  ,
                    `stime` string
                ) WITH(
                    'connector' = 'jdbc',
                    'url' = 'jdbc:mysql://bigdata:3306/Flink_Fliggy_Flight',
                    'table-name' = 'tables01',
                    'username' = 'root',
                    'password' = '123456',
                    'driver' = 'com.mysql.jdbc.Driver'


                )   
                """
                      )


#数据分析并且导入
#result=table_env.sql_query("select * from ods_zymk limit 10 ")
table_env.execute_sql("""
                        insert into tables01
                        select distinct airline_name,price_desc_math,price_desc,stime
                        from ods_flight
                        order by stime desc,price_desc_math asc
                        limit 30


                  """).wait()
#print("表结构",result.get_schema())
#print("数据检查",result.to_pandas())
相关推荐
pao__pao_2 小时前
计算机系统大作业 程序人生-Hello’s P2P
程序人生·职场和发展·课程设计
程序媛一枚~2 小时前
✨✨✨使用Python,OpenCV及图片拼接生成❤️LOVE❤️字样图,每张小图加随机颜色边框,大图加随机大小随机颜色边框
图像处理·python·opencv·numpy·图像拼接
MediaTea2 小时前
Python:collections.Counter 常用函数及应用
开发语言·python
如若1233 小时前
flash-attn 安装失败?从报错到成功的完整排雷指南(CUDA 12.8 + PyTorch 2.7)
人工智能·pytorch·python
007张三丰3 小时前
知乎高赞回答爬虫:从零开始,建立你的专属知识库
爬虫·python·知识库·python爬虫·知乎·高赞回答
简佐义的博客3 小时前
转录组数据分析实战,仅需99元(视频版)
大数据·人工智能·数据挖掘·数据分析·音视频
李昊哲小课3 小时前
Python json模块完整教程
开发语言·python·json
易醒是好梦3 小时前
Python flask demo
开发语言·python·flask
怪侠_岭南一只猿3 小时前
爬虫工程师入门阶段一:基础知识点完全学习文档
css·爬虫·python·学习·html
APO Research3 小时前
工业连接件的隐形升级:杆端轴承正在从“标准件”走向“结构安全件”
大数据·安全·#工业零部件·#机械设计·#工业自动化·#杆端轴承·#机械结构件