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:

You cannot define a function in Hive's groupby, otherwise an error (replaced with a nested select)

Error Three:

When running: $./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:

Because the 11-row Creation folder code did not work, it resulted 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 changed code:

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

Did you see the difference? There should be a space between $output and]!

error Four:date not recognized

When you run the./hive_game_operationstatis6.sh script. An error such as the following:

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!

I can not see the problem from the error message alone. Please look directly at the error code:

Change the previous code:

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

After you change 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 ' of the double-cited.

If a variable is followed by a string, it can be used directly to the left.

For my first contact with the shell. It's a pain in the neck!

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.