Composing a Pig Query¶
You can compose a Pig query using the query composer available in the Analyze page. See Running a Pig Job and Pig in Qubole for more information.
Note
Hadoop-2 (Hive) clusters support Pig queries. See Mapping of Cluster and Command Types for more information.
You can configure the Pig version on an Hadoop 2 (Hive) cluster. Pig 0.11 is the default version. Pig 0.15 and Pig 0.17 (beta) are the other supported versions. You can also choose between MapReduce and Tez as the execution engine when you set the Pig 0.17 (beta) version. Pig 0.17 (beta) is only supported with Hive 1.2.0.
Perform the following steps to compose a Pig query:
Note
Using the Supported Keyboard Shortcuts in Analyze describes the supported keyboard shortcuts.
Navigate to the Analyze page and click Compose. Select Pig Query from the Command Type drop-down list.
Query Statement is selected by default from the drop-down list, which has Query Path as the other option. A sample Pig query in the composer is shown below.
In the text field, enter the Pig query. If you select Query Path, specify the S3 bucket directory path that contains the Pig query file. See Composing a Pig Query by Specifying a Query Path for more information.
Click Run to execute the query. Click Save if you want to run the same query later. (See Workspace for more information on saving queries.)
The query result is displayed in the Results tab and the query logs in the Logs tab. The Logs tab has the Errors and Warnings filter. For more information on how to download command results and logs, see Downloading Results and Logs.
For REST API-related information, see Submit a Pig Command.
Composing a Pig Query by Specifying a Query Path¶
- Navigate to the Analyze page and click Compose. Select Pig Query from the Command Type drop-down list.
- Select Query Path from the drop-down list that contains Query Statement selected by default. A sample query composer for a Pig query path is as shown below.
![../../_images/ComposePigQ1.png](../../_images/ComposePigQ1.png)
- In the text field, enter the S3 location that contains the pig query path. Enter the script parameters in the Pig S3 script parameters in the key1=value1!key2=value2… format.
- Click Run to execute the query. Click Save if you want to run the same query later. (See Workspace for more information on saving queries.)
- The query result is displayed in the Results tab and the query logs in the Logs tab. The Logs tab has the Errors and Warnings filter. For more information on how to download command results and logs, see Downloading Results and Logs.