Spark转GemFire任务(二)

ADMG-2.2.1.3 - BRAVO CoA Mapping - TB

Revision 7/11: If Bravo code is not numeric, need to find one level up in FAGL_011PC to find the 6 digits for bravo, look at blue colored text

Create GFS account mapped to Bravo using FAGL_011ZC, write to /tax/gfs_bravo_mapping

and go through /btb_latam/ska1 to check all 10 digit GL account can be mapped, if not, write to exception region /tax/master_data_exception

Use BTB_MDG.SKA1 (if BTB_MDG is not ingested, use BTB_LATAM.SKA1):

  1. For every record of SKA1 (select every record from SKA1 where KTOPL = ‘JNJG’ and XSPEB <> ‘X’ )  -- collection A
  2. select records in BTB_LATAM.FAGL_011ZC (where VERSN=’JNJG’ AND KTOPL=’JNJG’) – collection B
  3. match each A.SAKNR with [B. VONKT , B. BISKT], B.VONKT is the starting number, B. BISKT is the ending number, both numbers are included in the range,  when a match is found, if B.ERGSL is 6 digit numeric, let it be bravoCode, go to 5, if B.ERGSL is not numeric, go to 4
  4. Look into /btb_mdg/fagl_011pc for ergsl : B.ERGSL AND versn:JNJG, once found, let it be C, C.parent is an id, and use the id to look up /btb_mdg/fagl_011pc -- id : %C.parent% AND versn:JNJG, once found, let it be D, if D.ergsl is 6 digits numeric, use it as bravoCode,

go to 5

  1. Get gfsCode (A.SAKNR) and bravoCode (%bravoCode%) description: for gfsCode -- /btb_mdg/skat: spras:E AND ktopl: JNJG AND saknr:%A.SAKNR%, let it be D, D.txt50 is the gfsCode description.

bravoCode -- /btb_mdg/fagl_011qt : versn:JNJG AND spras:E AND ergsl:%bravoCode%, let it be E, E.txt45 is the bravoCode description

  1. save it into /tax/gfs_bravo_mapping: <gfs:A.SAKNR, gfs_description:D.txt50, bravo:B.ERGSL, bravo_description:E.txt45>

Validation:

6.1 If there is no match, write exceptionCode:INVALID_BRAVO_MAPPING, excepitonMessage: No Match on Bravo for GFS code % A.SAKNR%

all  [B. VONKT , B. BISKT] should not have overlap, check all [B. VONKT , B. BISKT] do not overlap by sorting B. VONKT and B. BISKT and make sure B.VONKT(n+1) < B. BISKT (n), ), if there is invalid range, exceptionCode: INVALID_GFS_MAPPING, exceptionMessage  overlapping range is found, [B(n). valfrom, B(n).valto] and [B(n+1). valfrom, B(n+1).valto],

6.2

  1. Saving exception:

Exception should be saved to /tax/master_data_exception

{

sourceSystem: btb_latam,

exceptionCode:

exceptionMessage:

timestamp

}

Example:

A.SAKNR = 111110000, it matches with B. VONK = 111110000, B. BISKT=111110999, because A.SAKNR>= B. VONK, and A.SAKNR<= B. BISKT, add <111110000, 111110> into memory map C.

If A. SAKNR = ABCD, then there is a NoMatch exception

If there are [B. VONK, B. BISKT] = [111110000, 111110999’] , [111110993, 11112000], then there is Overlap Range exception

Helper:

Algorithm can be: sort the column E (to), and use this post of search :

https://stackoverflow.com/questions/19198586/search-sorted-listlong-for-closest-and-less-than to find the E column and return column B

Business scenario:

There are many similar matching a range to a code, so if you can make it generic and not specific on the collection A and collection B, that will be better.

时间: 2024-07-31 01:35:03

Spark转GemFire任务(二)的相关文章

Spark用Java实现二次排序的自定义key

本人在研究Spak,最近看了很多网上的对于SPARK用Java实现二次排序的方法,对于自定义key的做法 基本上都是实现Ordered<>接口,重写$greater.$greater$eq.$less.$less$eq.compare.compareTo方法,定义hashCode.equals····· 感觉好麻烦,其实我们自定义key只是用了里面的compareTo方法,其他的$greater.$greater$eq.$less.$less$eq.compare 不用做任何改动,hashCo

Spark机器学习实战 (十二) - 推荐系统实战

0 相关源码 将结合前述知识进行综合实战,以达到所学即所用.在推荐系统项目中,讲解了推荐系统基本原理以及实现推荐系统的架构思路,有其他相关研发经验基础的同学可以结合以往的经验,实现自己的推荐系统. 1 推荐系统简介 1.1 什么是推荐系统 1.2 推荐系统的作用 1.2.1 帮助顾客快速定位需求,节省时间 1.2.2 大幅度提高销售量 1.3 推荐系统的技术思想 1.3.1 推荐系统是一种机器学习的工程应用 1.3.2 推荐系统基于知识发现原理 1.4 推荐系统的工业化实现 Apache Spa

spark调优(二):调节并行度

并行度:其实就是指的是,Spark作业中,各个stage的task数量,也就代表了Spark作业的在各个阶段(stage)的并行度. 如果不调节并行度,导致并行度过低,会怎么样? 假设,现在已经在spark-submit脚本里面,给我们的spark作业分配了足够多的资源,比如50个executor,每个executor有10G内存,每个executor有3个cpu core.基本已经达到了集群或者yarn队列的资源上限. task没有设置,或者设置的很少,比如就设置了,100个task.50个e

Spark RDD编程(二)

转载请注明出处:http://blog.csdn.net/gamer_gyt @高阳团 博主微博:http://weibo.com/234654758 Github:https://github.com/thinkgamer ============================================================ SparkRDD编程(一) Spark 的键值对(pair RDD)操作,Scala实现 RDD的分区函数 目前Spark中实现的分区函数包括两种 Ha

Azure HDInsight 和 Spark 大数据实战(二)

HDInsight cluster on Linux 登录 Azure portal (https://manage.windowsazure.com ) 点击左下角的 NEW 按钮,然后点击 DATA SERVICES 按钮,点击 HDINSIGHT,选择 HADOOP ON LINUX,如下图所示. 输入集群名称,选择集群大小和账号,设定集群的密码和存储账号,下表是各个参数的含义和配置说明. Name Value Cluster Name Name of the cluster. Clust

spark调优(二)------合理调节作业中的并行度

原理介绍: 并行度:其实就是指的是,spark作业中,各个stage的task数量,也代表了spark作业做得各个阶段的stage的并行度 设置参数: spark.default.parallelism 官网推荐 此参数设置成cpu core数量的2~3倍,比如150个cpu core,分配了150个task,那么这个参数基本要设置为300~500 原文地址:https://www.cnblogs.com/SupperMan/p/9035484.html

【spark】示例:二次排序

我们有这样一个文件          首先我们的思路是把输入文件数据转化成键值对的形式进行比较不就好了嘛! 但是你要明白这一点,我们平时所使用的键值对是不具有比较意义的,也就说他们没法拿来直接比较. 我们可以通过sortByKey,sortBy(pair._2)来进行单列的排序,但是没法进行两列的同时排序. 那么我们该如何做呢? 我们可以自定义一个键值对的比较类来实现比较, 类似于JAVA中自定义类实现可比较性实现comparable接口. 我们需要继承Ordered和Serializable特

spark als scala实现(二)

Vi  t1.txt 1,101,5.01,102,3.01,103,2.52,101,2.02,102,2.52,103,5.02,104,2.03,101,2.53,104,4.03,105,4.53,107,5.04,101,5.04,103,3.04,104,4.54,106,4.05,101,4.05,102,3.05,103,2.05,104,4.05,105,3.5 1.装载数据scala> import org.apache.spark.mllib.recommendation.

Spark(五十二):Spark Scheduler模块之DAGScheduler流程

导入 从一个Job运行过程中来看DAGScheduler是运行在Driver端的,其工作流程如下图: 图中涉及到的词汇概念: 1. RDD——Resillient Distributed Dataset 弹性分布式数据集. 2. Operation——作用于RDD的各种操作分为transformation和action. 3. Job——作业,一个JOB包含多个RDD及作用于相应RDD上的各种operation. 4. Stage——一个作业分为多个阶段. 5. Partition——数据分区,