Hive non-interactive mode

Source: Internet
Author: User

Run $ HIVE_HOME/bin/hive on a linux Terminal to enter the interaction mode;

$ HIVE_HOME/bin/hive-e or-f is always in non-interactive mode.

1. Execute HQL statements in non-interactive mode

$ HIVE_HOME/bin/hive-e 'select * from movie limit 10'
Mapreduce progress will be realized, but it will not enter the hive interaction mode, and the final query result will be


2. Execute HQL statements in non-interactive mode (-S mute mode)

$ HIVE_HOME/bin/hive-S-e 'select * from movie limit 10'
Adding the-S option does not display the mapreduce progress

[[Email protected] hive-0.14] $ bin/hive-S-e 'select * from movie limit 10' SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar: file:/home/hadoop/hadoop-2.4.0/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar! /Org/slf4j/impl/StaticLoggerBinder. class] SLF4J: Found binding in [jar: file:/home/hadoop/hive-0.14/lib/hive-jdbc-0.14.0-SNAPSHOT-standalone.jar! /Org/slf4j/impl/StaticLoggerBinder. class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org. slf4j. impl. log4jLoggerFactory] Error rolling back: Can't call rollback when autocommit = true1113382172063197110411095751091610911978771214588122118913751710140623


3. Export hive query to a file

$ HIVE_HOME/bin/hive-S-e 'select * from movie limit 10'>/gaoyuan/ouput.txt
This will import the execution result of the hivequery statement to the output.txt file.


4. Run the hive script instead of entering hive interaction mode.

$ HIVE_HOME/bin/hive-f hiveScript. SQL

You can also save the output result to a file.

$ HIVE_HOME/bin/hive-f hiveScript. SQL>/home/username/output.txt








Hive non-interactive mode

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.