`
lookqlp
  • 浏览: 342105 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论
文章列表
使用sqoop导入数据至hive常用语句 直接导入hive表 sqoop import --connect jdbc:postgresql://ip/db_name--username user_name  --table table_name  --hive-import -m 5 内部执行实际分三部,1.将数据导入hdfs(可在hdfs上找到相应目录),2.创建hive表名相同的表,3,将hdfs上数据传入hive表中 sqoop根据postgresql表创建hive表 sqoop create-hive-table --connect jdbc:postgresql://ip/db_n ...
场景: sqoop import --connect jdbc:postgresql://...../..... --username ....  --query "select * from retail_tb_order_qiulp_test where status = 'TRADE_FINISHED' or status = 'TRADE_CLOSED' or status = 'TRADE_CLOSED_BY_TAOBAO' and \$CONDITIONS"  --hive-import -m 6 --hive-table custom_analyse_db. ...

mysql时区问题

在做数据处理时,mongo导出的数据是CET(格林)时间,直接导入mysql后,时间没有转化成+8,有两种方便的方式进行转化: 1.select convert_tz(import_start,'+00:00','+8:00') from import_ods_log; 将+0时区转化成+8时区 2.将mysql time_zone设置成+8,那么查询的时间字段将会自动加8小时。 第一种相对灵活,建议使用第一种。
select count(1) from s_ods_trade where part ='2012-10-31'; 22076 select count(1) from s_ods_trade 104343 select count(1) from s_ods_trade_full where part ='2012-10-31'; 11456 select count(1) from s_ods_trade_full 53049 SELECT count(1) FROM s_ods_trade a left outer JOIN s_ods_tr ...
参考 http://blog.csdn.net/chenyi8888/article/details/7601781 http://blog.csdn.net/daihui05/article/details/7266914 MySQL-python/1.2.4包下载地址: http://pypi.python.org/pypi/MySQL-python/1.2.4b5 我使用的ubuntu 安装mysqlclient
使用sqoop导入数据至hive常用语句     直接导入hive表      sqoop import --connect jdbc:postgresql://ip/db_name--username user_name  --table table_name  --hive-import -m 5     内部执行实际分三部,1.将数据导入hdfs(可在hdfs上找到相应目录),2.创建 ...
print datetime.date.today()-datetime.timedelta(days=29)

几个经典sql

    博客分类:
  • sql
几个经典的sql语句 1.关于group by的sql语句 表结构: year          month        amount 1991      1         1.1       1991      2         1.2       1991      3         1.3       1992      1       ...

最短编辑距离

public static int editDist(String s1,String s2){ int m=s1.length(); int n=s2.length(); int i=0,j=0; int[][] d=new int[m+1][n+1]; for(i=0;i<=m;i++){ d[i][0]=i; } for(j=0;j<=n;j++){ d[0][j]=j; } ...
public class ThreadPrint { /** * @author my_corner * @param * @return * @throws InterruptedException */ public static void main(String[] args) throws InterruptedException { PrintTask task = new PrintTask(); Thread a = new Thread(task); ...
public static List<Integer> merge(List<Integer> list1,List<Integer> list2){ List<Integer> list=new ArrayList<Integer>(); int size1=list1.size(); int size2=list2.size(); int i=0,j=0,k=0; while(i<size1&&j<size ...

最大子列

public static int maxSub(int[] arr) { int maxSum = 0; int currentSum = 0; for (int i = 0; i < arr.length; i++) { currentSum += arr[i]; if (currentSum > maxSum) { maxSum = currentSum; } else if (currentSum < ...
mapreduce的TextInputFormat很方便的处理行行的文本,但遇到xml的时候就很纠结了,曾经采用</property>分隔数据重写FileInputFormat(网上有资料),可以解决此问题,但会获取很多噪音数据。 后来想到以起始<property>结束</property>来获取数据,重写FileInputFormat没有这个技术能力,呵呵。 后来一直找资料,看了一篇http://www.linezing.com/blog/?p=489,可以借助mahout工程的XmlInputFormat.java很方便的解决问题。 根据mahout的版 ...
使用的0.20.2版本hadoop 查了许久,如何在map方法中获取当前数据块所在的文件名,方法如下: //获取文件名 InputSplit inputSplit=(InputSplit)context.getInputSplit(); String filename=((FileSplit)inputSplit).getPath().getName();
又折腾了大半天,只解决了一半的问题吧。 已经解决部分: 可以通过web查看运行job的systemout及其他信息 访问地址http://ip:50030,找到相应job往下查即可。 最后有stdout logs hello world!信息。即为systemout输出信息。 通过查询hadoop官方文档,集群搭建部分可以看到logging部分,有关hadoop的日志配置信息。 未解决部分:在map或者reduce函数上写io将一些必要信息进行落地成文本,可执行成功,但文件未能参见也未能写入信息,io具体写法如下: File dir = new File("/root/bin/ ...
Global site tag (gtag.js) - Google Analytics