Creates an alias for a resource.
The ALIAS statement can be used in MapReduce or UDF code to read different resources based on a specified resource name. During this process, you do not need to modify the code.
Syntax
alias <alias>=<real>;
Parameters
- alias: the alias that you create for a resource.
- real: the original name of a resource.
Examples
-- Add resources res_20121208 and res_20121209.
add table sale_detail partition (ds='20121208') as res_20121208;
add table sale_detail partition (ds='20121209') as res_20121209;
-- Create the alias resName for the resource res_20121208 and call this resource.
alias resName=res_20121208;
jar -resources resName -libjars work.jar -classpath ./work.jar com.company.MainClass args ...;
-- Create the alias resName for the resource res_20121209 and call this resource.
alias resName=res_20121209;
jar -resources resName -libjars work.jar -classpath ./work.jar com.company.MainClass args ...;
In this example, the resName
alias references different resource tables in two jobs. You can read different copies
of data without the need to modify the code.
Related statements
- ADD ARCHIVE: Adds an archive file as a resource.
- ADD FILE: Adds a file as a resource.
- ADD JAR: Adds a JAR file as a resource.
- ADD PY: Adds Python code as a resource.
- ADD TABLE: Adds a table as a resource.
- DESC RESOURCE: Views resource information.
- LIST RESOURCES: Views the resource list.
- GET RESOURCE: Downloads a resource.
- DROP RESOURCE: Deletes a resource.