The shell script encapsulates the HIVEF command in Hive

Source: Internet
Author: User

There is a HIVE-E command in hive that can pass parameters, but when the HQL statement is more, the entire shell script will look messy, of course someone might say hive-f can implement a direct call to a file,bingo indeed, but there is a big flaw, This is not a parameter can not be passed in the actual work is intolerable. So I think of the encapsulation of a command hivef, both directly into the file, but also to pass parameters. In fact, the implementation is very simple, the following code to share out. Of course, it's not perfect.

#!/bin/bash

. /etc/profile


Cat $ > $1.tmp

For ARG in "[Email protected]"

Do

echo "Arg" $arg

Flag= ' echo $arg | grep '-'

if [$arg! = $];then

if [$flag];then

Tmp= ' echo $flag | Sed s/-//'


Else

Sed-i s/{$tmp}/$arg/g $1.tmp

echo "Nothing"

Fi

Fi


Done

Hive-f $1.tmp

Rm-f $1.tmp

I hope I can say help to everyone.

This article is from the "Askjoey" blog, make sure to keep this source http://askjoey.blog.51cto.com/7594056/1791712

The shell script encapsulates the HIVEF command in Hive

Related Article

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.