すべてのプロダクト
Search
ドキュメントセンター

MaxCompute:ALIAS

最終更新日:Dec 10, 2024

リソースのaliasを作成します。

ALIASステートメントは、MapReduceまたはUDFコードで使用して、指定されたリソース名に基づいてさまざまなリソースを読み取ることができます。 このプロセス中に、コードを変更する必要はありません。

構文

alias <alias>=<real>;

パラメーター

  • alias: リソース用に作成したエイリアス。

  • real: リソースの元の名前。

-- 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 ...; 

この例では、resNameエイリアスは2つのジョブの異なるリソーステーブルを参照します。 コードを変更することなく、データの異なるコピーを読み取ることができます。

関連ステートメント