【问题标题】:How can I set the output directory for a Pig STORE command?如何设置 Pig STORE 命令的输出目录?
【发布时间】:2014-05-15 07:36:21
【问题描述】:

我正在通过 Azure HDInsight 使用 Pig。我可以提交以 STORE 结尾的查询,如下所示:

STORE Ordered INTO 'results' USING PigStorage(',');

这可行,将输出存储在目录/user/hdp/results/ 中。但是我想控制输出目录。我都试过了...

STORE Ordered INTO '/myOutDir/results' USING PigStorage(',');

STORE Ordered INTO 'wasb:///myOutDir/results' USING PigStorage(',');

这些都不起作用。他们都产生了这个错误:

Ordered was unexpected at this time.

我的问题是,我可以控制 Store 命令的输出目录吗?还是必须放到用户目录下?

【问题讨论】:

    标签: hadoop apache-pig azure-hdinsight


    【解决方案1】:

    如果你想用参数设置输出,你可以这样做:

     STORE Ordered INTO '$myOutDir/results' USING...
    

    然后运行你的脚本:

     pig -param myOutDir=/blablabla/... myScript.pig
    

    注意:您还可以为参数设置默认值,在脚本顶部添加:

    %default myOutDir '/blablabla/...'
    

    希望对你有所帮助,祝你好运:)

    【讨论】:

      【解决方案2】:

      使用如下输出路径

      wasb[s]://<BlobStorageContainerName>@<StorageAccountName>.blob.core.windows.net/<path>
      

      如果您的输出路径为/example/data/sample.log,则使用

      wasb://mycontainer@mystorageaccount.blob.core.windows.net/example/data/sample.log
      wasb:///example/data/sample.log
      

      我希望这可以帮助你。 :-)

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-10-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多