greenplum

How to specify subquery in the option “dbtable” in Spark-jdbc application while reading data from a table on Greenplum? [duplicate]

江枫思渺然 提交于 2019-12-02 23:41:55
问题 This question already has an answer here : How to give table name in spark-jdbc application for reading data on an RDBMS database? (1 answer) Closed 10 months ago . I am trying to read data from a table on Greenplum into HDFS using Spark. I gave a subquery in options to read the greenplum table as below. val execQuery = s"(select ${allColumns}, 0 as ${flagCol} from dbanscience.xx_lines where year=2017 and month=12) as xx_lines_periodYear" println("ExecQuery: " + execQuery) val dataDF = spark

mysql迁移mpp数据库Greenplum

匿名 (未验证) 提交于 2019-12-02 22:06:11
因兄弟项目中mysql有点扛不住了,要做sql优化,但是业务有点小复杂,优化起来有点麻烦(sql嵌套有点多),便想着用Mpp数据库Greenplum测试下,看性能和复杂度怎么样,趟趟水。 初步的想法是:因为mysql和postgresql(Greenplum建立在postgresql之上,i'm 软件老王)都是使用的标准sql,直接把mysql的建表语句在Greenplum建一边,把数据导入过来测试一下就行了,应该半天内就能搞定。 2.1 Greenplum寤鸿〃 将mysql的表结构通过navicat for mysql导出(navivat中只导出表结构,如下图),但是发现导出的结构在 Greenplum中执行不了,mysql中的ddl语句: `CONFIG_ID` varchar(36) COLLATE utf8_unicode_ci NOT NULL COMMENT '软件老王' 解决办法 (1)网上找了mysql转postgresql的java代码,写的不是太全面,改了几次还是有点问题,放弃。 (2)问了下dba,用的Navicat Premium 12 可以转,网址: https://www.navicat.com.cn/ Navicat Premium可以同时操作多个数据库,包括:mysql和greenplum(postgresql),以前使用navicat for

How to use a SQL window function to calculate a percentage of an aggregate

☆樱花仙子☆ 提交于 2019-12-02 19:30:26
I need to calculate percentages of various dimensions in a table. I'd like to simplify things by using window functions to calculate the denominator, however I am having an issue because the numerator has to be an aggregate as well. As a simple example, take the following table: create temp table test (d1 text, d2 text, v numeric); insert into test values ('a','x',5), ('a','y',5), ('a','y',10), ('b','x',20); If I just want to calculate the share of each individual row out of d1, then windowing functions work fine: select d1, d2, v/sum(v) over (partition by d1) from test; "b";"x";1.00 "a";"x";0

How to specify subquery in the option “dbtable” in Spark-jdbc application while reading data from a table on Greenplum? [duplicate]

若如初见. 提交于 2019-12-02 13:35:18
This question already has an answer here: How to give table name in spark-jdbc application for reading data on an RDBMS database? 1 answer I am trying to read data from a table on Greenplum into HDFS using Spark. I gave a subquery in options to read the greenplum table as below. val execQuery = s"(select ${allColumns}, 0 as ${flagCol} from dbanscience.xx_lines where year=2017 and month=12) as xx_lines_periodYear" println("ExecQuery: " + execQuery) val dataDF = spark.read.format("io.pivotal.greenplum.spark.GreenplumRelationProvider").option("url", conUrl) .option("dbtable", execQuery) .option(

How to give table name in spark-jdbc application for reading data on an RDBMS database?

爱⌒轻易说出口 提交于 2019-12-02 10:09:40
问题 I am trying to read a table present on greenplum database using spark as below: val execQuery = s"select ${allColumns}, 0 as ${flagCol} from schema.table where period_year=2017 and period_num=12" val yearDF = spark.read.format("io.pivotal.greenplum.spark.GreenplumRelationProvider").option("url", connectionUrl).option("dbtable", s"(${execQuery}) as year2016") .option("user", devUserName) .option("password", devPassword) .option("partitionColumn","header_id") .option("lowerBound", 16550)

第三个视频作品《小白快速入门greenplum》上线了

廉价感情. 提交于 2019-11-30 22:03:57
1.场景描述 第三个视频作品出炉了,《 小白快速入门greenplum 》上线了,有需要的朋友可以直接点击链接观看。(如需购买,请通过本文链接购买) 2. 课程内容 课程地址: https://edu.51cto.com/sd/2b7c8 课程目录: 目录 第一章 课程介绍 第二章 greenplum之背景介绍与下载 第三章 greenplum之系统架构与技术架构说明 第四章 greenplum之完整部署与说明 第五章 greenplum之greenplum-cc-web安装 第六章 greenplum之我对gp的理解 第七章 greenplum之高可用方案 第八章 greenplum之问题总结 第九章 课程总结 来源: 51CTO 作者: 软件老王 链接: https://blog.51cto.com/14130291/2454949

greenplum和gptext安装

这一生的挚爱 提交于 2019-11-30 13:21:22
准备环境 centos6 3台 1台master 192.168.8.201 2台segment 192.168.8.202 192.168.8.203 (网络连接选择桥连接) 修改hosts文件(所有机器) Vi hosts 192.168.8.201 master 192.168.8.202 segment01 192.168.8.203 segment02 *如果需要修改hostname 必须修改/etc/sysconfig/network NETWORKING=yes HOSTNAME=master 创建用户和用户组(所有机器)root 用户 创建用户名:gpadmin 密码:gpadmin [root@master ~]# groupadd -g 530 gpadmin [root@master~]# useradd -g 530 -u530 -m -d /home/gpadmin -s /bin/bash gpadmin [root@master ~]# passwd gpadmin 修改所有机器内核(注意所有机器都必须修改不然初始化不成功) [root@master ~]# vi /etc/sysctl.conf kernel.shmmax = 500000000 kernel.shmmni = 4096 kernel.shmall = 4000000000

PG、GP与MySQL的特点和区别

自作多情 提交于 2019-11-30 11:54:01
PostgreSQL数据库 介绍 :PostgreSQL是一种运行在Unix和Linux操作系统(在NT平台借助Cygnus也可以运行)平台上的免费的开放源码的关系数据库。最早是由美国加州大学伯克利分校开发的,开始只是作为一个演示系统发表,但是随着时间的推移,逐步分发,得到很多实际的应用,才逐步流行起来。 网址 : https://www.postgresql.org/ 特点 :1.省钱,可以运行在Unix和Lunux操作系统上。    2.支持SQL。    3.有丰富的数据类型。许多数据类型是一些商业数据库都没有提供的。    4.面向对象,它包含了一些面向对象的技术,如继承和类。    5.支持大数据,它不同于一般的桌面数据库,能够支持几乎不受限制大小的数据库,而且性能稳定。     描述:这个特点也是绝大多数考虑使用PostgreSQL数据库的原因之一,当然这种场景应该是有要求的,比如一些并发不高,但涉及统计分析类业务的场景相对比较适合。    6.方便集成web,提供一些接口方便 PHP,Perl等语言操作数据库。    7.事务处理。相对一些其他免费数据库如MySQL,PostgreSQL提供了 事务处理 ,可以满足一些商业领域的数据需要。     描述:事务对数据库来真的是太重要了。    8.PostgreSQL 运行速度 明显低于MySQL

Greenplum(PostgreSql)使用 with recursive 实现树形结构递归查询并插入新表

时间秒杀一切 提交于 2019-11-30 09:41:24
本代码目的是替代Oracle的connect by语句,并实现后者的path和idleaf功能。 正文开始:   假设表org,字段有 id(编号),name(名称),pid(上级编号), 最上级的记录pid为空。 如: id name pid 1 集团 null 2 财务部 1 3 行政部 1 4 主办会计 2   实现目标表neworg: id name pid pname path_id path_name leve is_leaf(叶子节点) 1 集团 null null /1 /集团 1 0 2 财务部 1 集团 /1/2 /集团/财务部 2 0 3 行政部 1 集团 /1/3 /集团/行政部 2 1 4 主办会计 2 财务部 /1/2 /集团/财务部/主办会计 2 1   代码手写,如有拼写错误请见谅: set gp_recursive_cte_prototype to ture; -- 部分低版本greenplum必须加 insert into neworg ( id, name, pid, path_id, path_name, leve, is_leaf ) with recursive result_ as -- 递归主体开始 ( select id -- 首先是顶层节点 , name , pid , cast(id as varchar(100)) as