zoukankan      html  css  js  c++  java
  • 11.把文本文件的数据导入到Hive表中

    先在hive里面创建一个表

    create table  mydb2.t3(id int,name string,age int) row format delimited fields terminated by ','stored as textfile;
    

    接下来创建数据文件

     把本地的数据文件导入到hive表中

    LOAD DATA LOCAL INPATH '/opt/datas/a.txt' OVERWRITE INTO  TABLE  t3;

     

     接下来把hdfs上的文件导入到hive表中

    现在在hdfs上创建目录,并把本地文件上传到hdfs

     在hive再创建一个表tt

    create table  mydb2.tt(id int,name string,age int) row format delimited fields terminated by ','stored as textfile;

     把hdfs上的文件导入到hive的tt表里面

    LOAD DATA  INPATH '/home/hadoop/testhive/a.txt' OVERWRITE INTO  TABLE  tt;

     

  • 相关阅读:
    (一)单例模式
    mysql数据库知识
    JavaScript
    Spring整合AspectJ的AOP
    Spring-AOP
    JDK代理和CGLIB代理
    mybatis-dao开发
    mybatis-入门
    CSS2.1
    HTML基础
  • 原文地址:https://www.cnblogs.com/braveym/p/10872946.html
Copyright © 2011-2022 走看看