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