- 博客(14)
- 收藏
- 关注
原创 sparkSQL报Schema for type Any is not supported异常问题解决办法
sparkSQL报Schema for type Any is not supported异常问题解决办法
2024-09-19 11:50:42
561
原创 数仓Hive的使用指南
在日常工作中,数据工程师常常需要将处理完毕的数据存到Hadoop的dfs上或者其他分布式数据库中,本文要介绍的是如何将数据输出到hive中,借此梳理下hive的入门使用指南。
2024-08-21 18:15:34
305
原创 spark的sortShuffleManager解析
标题sortShuffleManager 一、注册ShuffleHandle的策略 首先,在shuffle过程中满足以下条件,选择BypassMergeSortShuffleHandle: 1)map端没有聚合操作 2)shuffle read partitions <= spark.shuffle.sort.bypassMergeThreshold(阈值默认为200) 其次,满足以下条件,选择SerializedShuffleHandle: 1)序列化方式支持对象重新定位(意思是可以对已经序列化的对
2021-09-18 17:28:10
880
原创 spark中RDD转DS
情景1. RDD[Row] -> DF 方法一:先定义类型为StructType的schema,按字段先后顺序映射到schema spark.createDataFrame(rdd, schema) 方法二:先将其转换成case class类型的RDD,然后按情景2方式转换 情景2. RDD[_] -> DF/DS 调用toDF/toDS函数转换 ...
2021-08-20 18:25:20
420
原创 sparkSQL报Unable to find encoder for type stored in a Dataset异常问题解决办法
背景 sparkSQL中DataFrame在聚合后按规则在每组中选取一条记录,出现异常报错: error: Unable to find encoder for type stored in a Dataset. Primitive types (Int, String, etc) and Product types (case classes) are supported by importing spark.implicits._ Support for serializing other types
2021-08-19 18:48:06
1540
原创 spark读取嵌套数据
spark读取嵌套数据 背景:最近,我遇到一种场景,需要从复杂的源数据(含有嵌套字段)中抽取部分嵌套字段,经过一番摸索,发现可以通过以下方式来抽取数据。 import org.apache.spark.sql.types._ val schema = new StructType() .add("typeId", IntegerType) .add("offsetId", LongType) .add("data", ArrayType( new StructType() .add("f1", Long
2021-01-12 17:26:16
434
1
原创 RoaringBitmap运行机制解析
背景 用于将int类型转换成bitmap类型 public static RoaringBitmap bitmapOf(final int... dat) { final RoaringBitmap ans = new RoaringBitmap(); ans.add(dat); return ans; } 运行机制 初始化bitmap final RoaringBitmap ans = new RoaringBitmap(); 在初始化过程中,无参构造器会新建一个Roari
2020-12-22 22:25:07
639
1
原创 刨析Spark的shuffleManager原理
刨析Spark的shuffleManager原理 发展史 sortShuffleManager shuffleWriter 数据写入缓存时,如果是聚合类的shuffle算子【比如reduceByKey】,那么会选用MAP数据结构,如果是非聚合类的shuffle算子【比如join】,那么会选用Array数据结构。 private[spark] class SortShuffleWriter[K, V, C]( shuffleBlockResolver: IndexShuffleBlockResol
2020-12-11 18:29:37
257
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅