There are a couple of egg-ache problems when writing hive SQL and shell scripts!

Source: Internet
Author: User

Error One:

The alias of the field cannot be used after Hive's where,

Error Two:

A custom function cannot be used in Hive's groupby, otherwise an error (replaced with a nested select)

Error Three:

When executing: $./hive_game_operationstatis5.sh, the error message is as follows:

./hive_game_operationstatis5.sh:line: [: Missing '] './hive_game_operationstatis5.sh:line:/tmp/statis_ Activitysourcestatis20141014/statis_activitysourcestatis120141014.txt:no such file or directory./hive_game_ Operationstatis5.sh:line 36:/tmp/statis_activitysourcestatis20141014/statis_activitysourcestatis220141014.txt: No such file or Directoryerror 2 (HY000) atline 1:file '/tmp/statis_activitysourcestatis20141014/statis_ Activitysourcestatis120141014.txt ' not Found (errcode:2) ERROR 2 (HY000) atline 1:file '/tmp/statis_ Activitysourcestatis20141014/statis_activitysourcestatis220141014.txt ' not Found (errcode:2)

Error Analysis:

The creation of the 11-row directory code did not work, resulting in a series of errors that could not be found in the file path.

The code when the error occurs:

if [!-D $output]then        mkdir-p $outputfi <span style= "font-family:arial, Helvetica, Sans-serif;" > </span>

The Modified code:

if [!-D $output]then        mkdir-p $outputfi

See the difference? There should be a space between $output and]!!

error Four:date not recognized

When executing the./hive_game_operationstatis6.sh script, the error is as follows:

Analysis:

In the shell script, I wrote:

output= '/tmp/statis_suspendedwindowstatis ' $datefile _name1= ' statis_suspendedwindowstatis1 ' $date '. txt '

Error display refers to "fuzzy redirection" when called!

Single from the error message can not see why, please look directly at the error code:

To modify the previous code:

Date= ' Date +%y%m%d '

After modifying this bug code:

Date= ' Date +%y%m%d '

Did you see what went wrong? Haha, yes, too pit! The shell is going to use the ' skimming ' on the 1 front of the keyboard, not the ' apostrophe ' in double quotes.

If a variable is a string then directly to the left of the ' off ' can be,

For my first contact with the shell, it was a headache! I hope you will not make a similar mistake.


There are a couple of egg-ache problems when writing hive SQL and shell scripts!

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.