当前位置: 首页>>代码示例>>Java>>正文


Java Utils.isLocal方法代码示例

本文整理汇总了Java中org.apache.pig.impl.util.Utils.isLocal方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.isLocal方法的具体用法?Java Utils.isLocal怎么用?Java Utils.isLocal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.pig.impl.util.Utils的用法示例。


在下文中一共展示了Utils.isLocal方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addSingleFileToDistributedCache

import org.apache.pig.impl.util.Utils; //导入方法依赖的package包/类
private static String addSingleFileToDistributedCache(
        PigContext pigContext, Configuration conf, String filename,
        String prefix) throws IOException {

    if (!pigContext.inIllustrator && !FileLocalizer.fileExists(filename, pigContext)) {
        throw new IOException(
                "Internal error: skew join partition file "
                        + filename + " does not exist");
    }

    String symlink = filename;

    // XXX Hadoop currently doesn't support distributed cache in local mode.
    // This line will be removed after the support is added by Hadoop team.
    if (!Utils.isLocal(pigContext, conf)) {
        symlink = prefix + "_"
                + Integer.toString(System.identityHashCode(filename)) + "_"
                + Long.toString(System.currentTimeMillis());
        filename = filename + "#" + symlink;
        setupDistributedCache(pigContext, conf, new String[] { filename },
                false);
    }

    return symlink;
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:26,代码来源:JobControlCompiler.java

示例2: visitMergeJoin

import org.apache.pig.impl.util.Utils; //导入方法依赖的package包/类
@Override
public void visitMergeJoin(POMergeJoin join) throws VisitorException {

    // XXX Hadoop currently doesn't support distributed cache in local mode.
    // This line will be removed after the support is added
    if (Utils.isLocal(pigContext, conf)) return;

    String indexFile = join.getIndexFile();

    // merge join may not use an index file
    if (indexFile == null) return;

    try {
        String symlink = addSingleFileToDistributedCache(pigContext,
                conf, indexFile, "indexfile_");
        join.setIndexFile(symlink);
    } catch (IOException e) {
        String msg = "Internal error. Distributed cache could not " +
                "be set up for merge join index file";
        throw new VisitorException(msg, e);
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:23,代码来源:JobControlCompiler.java

示例3: visitMergeCoGroup

import org.apache.pig.impl.util.Utils; //导入方法依赖的package包/类
@Override
public void visitMergeCoGroup(POMergeCogroup mergeCoGrp)
        throws VisitorException {

    // XXX Hadoop currently doesn't support distributed cache in local mode.
    // This line will be removed after the support is added
    if (Utils.isLocal(pigContext, conf)) return;

    String indexFile = mergeCoGrp.getIndexFileName();

    if (indexFile == null) throw new VisitorException("No index file");

    try {
        String symlink = addSingleFileToDistributedCache(pigContext,
                conf, indexFile, "indexfile_mergecogrp_");
        mergeCoGrp.setIndexFileName(symlink);
    } catch (IOException e) {
        String msg = "Internal error. Distributed cache could not " +
                "be set up for merge cogrp index file";
        throw new VisitorException(msg, e);
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:23,代码来源:JobControlCompiler.java

示例4: visitFRJoin

import org.apache.pig.impl.util.Utils; //导入方法依赖的package包/类
@Override
public void visitFRJoin(POFRJoin join) throws VisitorException {

    // XXX Hadoop currently doesn't support distributed cache in local mode.
    // This line will be removed after the support is added
    if (Utils.isLocal(pigContext, conf)) return;

    // set up distributed cache for the replicated files
    FileSpec[] replFiles = join.getReplFiles();
    ArrayList<String> replicatedPath = new ArrayList<String>();

    FileSpec[] newReplFiles = new FileSpec[replFiles.length];
    long maxSize = Long.valueOf(pigContext.getProperties().getProperty(
            PigConfiguration.PIG_JOIN_REPLICATED_MAX_BYTES, "1000000000"));

    // the first input is not replicated
    long sizeOfReplicatedInputs = 0;
    try {
        for (int i = 0; i < replFiles.length; i++) {
            // ignore fragmented file
            String symlink = "";
            if (i != join.getFragment()) {
                symlink = "pigrepl_" + join.getOperatorKey().toString() + "_"
                        + Integer.toString(System.identityHashCode(
                                replFiles[i].getFileName()))
                                + "_" + Long.toString(System.currentTimeMillis())
                                + "_" + i;
                replicatedPath.add(replFiles[i].getFileName() + "#"
                        + symlink);

                Path path = new Path(replFiles[i].getFileName());
                FileSystem fs = path.getFileSystem(conf);
                sizeOfReplicatedInputs +=
                        MapRedUtil.getPathLength(fs, fs.getFileStatus(path), maxSize);
            }
            newReplFiles[i] = new FileSpec(symlink,
                    (replFiles[i] == null ? null : replFiles[i].getFuncSpec()));
        }

        join.setReplFiles(newReplFiles);

        if (sizeOfReplicatedInputs > maxSize) {
            throw new VisitorException("Replicated input files size: "
                    + sizeOfReplicatedInputs + " exceeds " +
                    PigConfiguration.PIG_JOIN_REPLICATED_MAX_BYTES + ": " + maxSize);
        }

        setupDistributedCache(pigContext, conf, replicatedPath
                .toArray(new String[0]), false);
    } catch (IOException e) {
        String msg = "Internal error. Distributed cache could not " +
                "be set up for the replicated files";
        throw new VisitorException(msg, e);
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:56,代码来源:JobControlCompiler.java


注:本文中的org.apache.pig.impl.util.Utils.isLocal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。