HCatalog
 

POST hive

Description

Runs a Hive query or set of commands.

URL

http://www.myserver.com/templeton/v1/hive

Parameters

NameDescriptionRequired?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 "exec" or "file" is required None
define Set a Hive configuration variable using the syntax define=NAME=VALUE. Optional None
statusdir A directory where Templeton will write the status of the Hive job. If provided, it is the caller's responsibility to remove this directory when done. Optional 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

Results

NameDescription
id A string containing the job ID similar to "job_201110132141_0001".
info A JSON object containing the information returned when the job was queued. See the Hadoop documentation (Class TaskController) for more information.

Example

Curl Command

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

JSON Output

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

Results

% 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