HIVE&&SQOOP


    create table score_table (
  subject        string,
  student       string,
  score           int
)partitioned by (date string); 


create table score_table_2(
subject string,student string,score  int)
partitioned by (y string  ,m string, d string);


sqoop import
--connect jdbc:oracle:thin:@10.25.18.36:1524:ldqd0
--username LIFEMAN --password LIFETEST
--table SCORE_TABLE  --split-by STUDENT -m 2
  --verbose  --hive-table SCORE_TABLE_2
  --where update >&1
  --hive-partition-key y,m,d 
  --hive-partition-value 2013,03,02
    --hive-import


分享一个小东西,在编辑hadoop版本1源码(hive相似)的过程中,发现ant eclipse-files时(其实就是把源码目录下面的eclipse-files文件里面的东西拷贝到src目录下),生成的项目中有些代码并没有导入到eclipse src目录下面,只是当做了项目的一个文件夹,从而eclipse无法进行语法检测,研究了一下,可以通过编辑hadoop源码下面的.classpath文件把相应的src目录加入进去即可,另外还可以加入lib库等,比如:
<classpathentry kind="src" path="src/contrib/capacity-scheduler/src/java"/>
        <classpathentry kind="src" path="src/contrib/capacity-scheduler/src/test"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
        <classpathentry kind="var" path="ANT_HOME/lib/ant.jar"/>
        <classpathentry kind="lib" path="lib/commons-cli-1.2.jar"/>

网上有一个博客,专门讲了这个东西,可以参考一下
http://www.ibm.com/developerworks/opensource/tutorials/os-eclipse-classpath/section2.html#listing1


//*** 查看语句
select subject,student,score from (
    select subject,student,score,row_number()
           over (
           distribute by subject,student,score
           sort by subject desc
           ) rownum  
from score_table  ) aa  where aa.rownum = 1;
**//

//执行语句
select subject,student,score from ( select subject,student,score,row_number() over (distribute by subject,student,score sort by subject desc) rownum   from score_table  ) aa  where aa.rownum = 1;

猜你喜欢

转载自jonas-wang.iteye.com/blog/1922675