大数据开发
一个想当作家的程序员
大数据开发工程师
博客主要方向
基础数据分析-基础算法-数据挖掘-人工智能相关算法-部分大数据基础与技术
展开
-
flink-java基本demo
【代码】flink-java基本demo。原创 2023-04-12 15:02:19 · 271 阅读 · 0 评论 -
Clickhouse sql-时间戳
clickhouse 时间戳原创 2022-07-26 20:30:21 · 5719 阅读 · 0 评论 -
python 打包成第三方工具时 加载包里文件
get_module_res = lambda *res: os.path.normpath(os.path.join(os.getcwd(), os.path.dirname(__file__), *res))最近需要将python代码放在集群上,在加载如dict.txt的本地文件时存在问题想要文件和python文件一起打包主要在集群上运行时不能够识别到包里的路径通过以上的代码可以成功识别到,灵感来自于jieba分词第三方包中对于词典文件的加载...原创 2022-02-14 16:11:01 · 315 阅读 · 0 评论 -
pyspark设置Hadoop参数
sc._jsc.hadoopConfiguration().set('my.mapreduce.setting', 'someVal')注意一个细节也不要放过链接来源:https://www.it1352.com/1934092.html转载 2021-08-19 19:44:07 · 740 阅读 · 0 评论 -
Pyspark UDF的几种方式
1.注册 可在sql中运行from pyspark.sql.types import *def pow1(m,n): return float(m)**float(n)udf = spark.udfudf.register('pow1',pow1,returnType=DoubleType())df = spark.range(0,10,2,3)df.createOrReplaceTempView('A')print spark.sql('select pow1(id,2) fr.原创 2021-08-06 19:02:59 · 2247 阅读 · 0 评论 -
hive sql 函数 合并行 未完待续
1 concatconcat(year,month,day)202107012 concat_wsconcat_ws('-',year,month,day)2021-07-013 collect_set合并同一组下 某个字段内容,去重4 collect_list合并同一组下 某个字段内容,不去重https://www.cnblogs.com/cc11001100/p/9043946.html...原创 2021-08-06 15:30:25 · 300 阅读 · 0 评论 -
StructType can not accept object u‘372063‘ in type <type ‘unicode‘> Can not infer schema for type: <
If you find the follwing errors:如果你发现了如下的错误Can not infer schema for type: <type 'unicode'>StructType can not accept object u'372063' in type <type 'unicode'>And you try all kinds ofStructType or scheam, the errors arealways here并...原创 2021-04-25 19:52:00 · 532 阅读 · 0 评论 -
hive sql 中时间函数(未完待续)
Part 1 时间戳相关1.获取当前时间戳--例如:select unix_timestamp() --15658583892.时间转换成时间戳--输入的时间戳格式必须为'yyyy-MM-dd HH:mm:ss',并且为String类型select unix_timestamp('2019-08-15 16:40:00') --15658584003.时间戳转换成时间--例如:select from_unixtime(1565858389,'yyyy-MM-dd.原创 2021-04-23 19:52:51 · 500 阅读 · 0 评论 -
hadoop 文件操作(未完待续)
1. 查看文件大小hadoop fs -du -h /user/filename-h 没有则按照byte显示,否则按照G2. 查看文件行数hadoop fs -cat /文件* | wc -lhadoop fs -cat /datastream/portal/jinritoutiao/video/2018-08-11/portal_jinritoutiao_video_20180811*|wc -l 查看该目录下所有文件名包含portal_jinritoutiao_video转载 2021-03-31 14:25:57 · 889 阅读 · 0 评论 -
Hive实现数据抽样的三种方法
在大规模数据量的数据分析及建模任务中,往往针对全量数据进行挖掘分析时会十分耗时和占用集群资源,因此一般情况下只需要抽取一小部分数据进行分析及建模操作。Hive提供了数据取样(SAMPLING)的功能,能够根据一定的规则进行数据抽样,目前支持数据块抽样,分桶抽样和随机抽样,具体如下所示:数据块抽样(tablesample()函数)1) tablesample(n percent) 根据hive表数据的大小按比例抽取数据,并保存到新的hive表中。如:抽取原hive表中10%的数据(注意:测试过程中转载 2021-03-31 10:25:44 · 273 阅读 · 0 评论