Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: add enablelog per HIVE-4531

Hive Job — POST hive

Table of Contents

Description

Runs a Hive query or set of commands.

...

Name

Description

Required?

Default

execute

String containing an entire, short Hive program to run.

One of either "execute" or "file" is required.

None

file

HDFS file name of a Hive program to run.

One of either "execute" or "file" is required.

None

define

Set a Hive configuration variable using the syntax define=NAME=VALUE.

Optional

None

arg

Set a program argument. This parameter is not available in releases prior to Hive 0.12.0.

Optional in Hive 0.12.0+

None

files

Comma-separated files to be copied to the map reduce cluster. This parameter is not available in releases prior to Hive 0.12.0.

Optional in Hive 0.12.0+

None

statusdir

A directory where WebHCat will write the status of the Hive job. If provided, it is the caller's responsibility to remove this directory when done.

Optional

None

enablelog

If statusdir is set and enablelog is "true", collect Hadoop job configuration and logs into a directory named $statusdir/logs after the job finishes. Both completed and failed attempts are logged. The layout of the logs subdirectories is: 

logs/$job_id (directory for $job_id) 
logs/$job_id/job.xml.html 
logs/$job_id/$attempt_id (directory for $attempt_id) 
logs/$job_id/$attempt_id/stderr 
logs/$job_id/$attempt_id/stdout 
logs/$job_id/$attempt_id/syslog 

This parameter was introduced in Hive 0.12.0. (See HIVE-4531.)

Optional in Hive 0.12.0+None

callback

Define a URL to be called upon job completion. You may embed a specific job ID into this URL using $jobId. This tag will be replaced in the callback URL with this job's job ID.

Optional

None

...

Example

Curl Command

No Format

% curl -s -d user.name=ctdean \
       -d execute="select+*+from+pokes;" \
       -d statusdir="pokes.output" \
       'http://localhost:50111/templeton/v1/hive'

JSON Output

No Format

{
 "id": "job_201111111311_0005",
 "info": {
          "stdout": "templeton-job-id:job_201111111311_0005
                    ",
          "stderr": "",
          "exitcode": 0
         }
}

Example Results

No Format

% hadoop fs -ls pokes.output
Found 2 items
-rw-r--r--   1 ctdean supergroup        610 2011-11-11 13:22 /user/ctdean/pokes.output/stderr
-rw-r--r--   1 ctdean supergroup         15 2011-11-11 13:22 /user/ctdean/pokes.output/stdout

% hadoop fs -cat pokes.output/stdout
1       a
2       bb
3       ccc
Panel
titleColorindigo
titleBGColorsilver
titleNavigation Links

Previous: POST pig
Next: GET queue

General: WebHCat ReferenceWebHCat ManualHCatalog ManualHive Wiki HomeHive Project Site
Old version of this document (HCatalog 0.5.0): POST hive