Hive non-interactive mode

Source: Internet
Author: User
Run $ HIVE_HOMEbinhive on a linux terminal to enter the interactive mode; $ HIVE_HOMEbinhive-e or-f is always in non-interactive mode 1. Execute the HQL statement in non-interactive mode $ HIVE_HOMEbinhive-eselect * frommovielimit10 to see mapreduce progress, but it does not enter the hive interaction mode, and the final real-world Query

Run $ HIVE_HOME/bin/hive on a linux terminal to enter the interaction mode; $ HIVE_HOME/bin/hive-e or-f are always in non-interactive mode. 1. Execute the HQL statement $ HIVE_HOME/bin/hive-e select * from movie limit 10 to implement mapreduce. progress, but it does not enter the hive interaction mode, and the final real-world Query

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
[hadoop@gaoyuan 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=true1113382172063197110411095751161610611978771214588122118913751710140623
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

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.