• Hive beeline update


    Hive cli vs beeline

    The primary difference between the two involves how the clients connect to Hive.

    The Hive CLI connects directly to the Hive Driver and requires that Hive be installed on the same machine as the client. 

    Beeline connects to HiveServer2 and does not require the installation of Hive libraries on the same machine as the client. Beeline is a thin client that also uses the Hive JDBC driver but instead executes queries through HiveServer2, which allows multiple concurrent client connections and supports authentication.

    1.load data local inpath is not support in beeline.

    Solution:  a. we can use 'put'  and 'load data inpath' to replace this command.

                       b. create these stage table as external table, then we just add new partitions and then just put file, not need load.

    beeline -n username -u "jdbc:hive2://hiveserver:10000/dbname;principal=hive/hiveserve@domain"

       

    run kinit before run beeline.

    Echo 'password' | kinit

       

    drop table evan_test2;

    CREATE EXTERNAL TABLE evan_test2 (

    userId BIGINT,

    type INT,

    filename String

    )

    COMMENT 'User Infomation'

    PARTITIONED BY (country String)

    ROW FORMAT DELIMITED FIELDS TERMINATED BY ','

    STORED AS TEXTFILE

    LOCATION 'hdfs:////evan_test/';

    alter table evan_test2 add partition(country='tet');

     2.

    INSERT OVERWRITE LOCAL DIRECTORY 'temp'

    FIELDS TERMINATED BY ','

    select * from evan_test2;

       

    This is not support in beeline .

    Solution: we can use beeline's new command to implement the same function.

                   beeline --showHeader=false --outputformat=dsv --delimiterForDSV=$'01' -e 'select * from evan_test3' >test.csv

    Show data test.csv

    Cat -a test.csv

    Cat -a test.csv | tr $'01' ' '

  • 相关阅读:
    vim字符串替换命令
    Android中View的事件分发机制——Android开发艺术探索笔记
    jQuery源代码框架思路
    C指针——C语言手记
    Python基础二--基本控制语句
    C++中的链式操作
    求一个字串中最长的连续字符串
    C# -- 推断字符能否转化为整形
    Loadrunner检查点使用总结
    LoadRunner设置检查点的几种方法介绍
  • 原文地址:https://www.cnblogs.com/huaxiaoyao/p/4672316.html
Copyright © 2020-2023  润新知