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


Java LoadFuncHelper类代码示例

本文整理汇总了Java中org.apache.pig.piggybank.storage.allloader.LoadFuncHelper的典型用法代码示例。如果您正苦于以下问题:Java LoadFuncHelper类的具体用法?Java LoadFuncHelper怎么用?Java LoadFuncHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LoadFuncHelper类属于org.apache.pig.piggybank.storage.allloader包,在下文中一共展示了LoadFuncHelper类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setLocation

import org.apache.pig.piggybank.storage.allloader.LoadFuncHelper; //导入依赖的package包/类
@Override
public void setLocation(String location, Job job) throws IOException {
    FileInputFormat.setInputPaths(job, location);
    // called on the front end
    conf = job.getConfiguration();
    loadFuncHelper = new LoadFuncHelper(conf);

    if (constructorPassedPartitionFilter != null) {

        pathPartitionerHelper.setPartitionFilterExpression(
                constructorPassedPartitionFilter, AllLoader.class,
                signature);

    }

    getPartitionKeys(location, job);
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:18,代码来源:AllLoader.java

示例2: initialize

import org.apache.pig.piggybank.storage.allloader.LoadFuncHelper; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void initialize(InputSplit inputSplit,
        TaskAttemptContext taskAttemptContext) throws IOException,
        InterruptedException {

    FileSplit fileSplit = (FileSplit) inputSplit;

    path = fileSplit.getPath();
    String fileName = path.toUri().toString();

    // select the correct load function and initialise
    loadFuncHelper = new LoadFuncHelper(
            taskAttemptContext.getConfiguration());

    FuncSpec funcSpec = loadFuncHelper.determineFunction(fileName);

    if (funcSpec == null) {
        throw new IOException("Cannot determine LoadFunc for "
                + fileName);
    }

    selectedLoadFunc = (LoadFunc) PigContext
            .instantiateFuncFromSpec(funcSpec);

    selectedLoadFunc.setUDFContextSignature(udfSignature);
    selectedLoadFunc.setLocation(fileName,
            new Job(taskAttemptContext.getConfiguration(),
                    taskAttemptContext.getJobName()));

    selectedReader = selectedLoadFunc.getInputFormat()
            .createRecordReader(fileSplit, taskAttemptContext);

    selectedReader.initialize(fileSplit, taskAttemptContext);

    LOG.info("Using LoadFunc " + selectedLoadFunc.getClass().getName()
            + " on " + fileName);

}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:40,代码来源:AllLoader.java

示例3: setUp

import org.apache.pig.piggybank.storage.allloader.LoadFuncHelper; //导入依赖的package包/类
@Before
public void setUp() throws Exception {

    Configuration hadoopConf = new Configuration();
    FileSystem.setDefaultUri(hadoopConf,
            LocalFileSystem.getDefaultUri(hadoopConf));

    if (baseDir == null) {
        configuration = new Properties();
        configuration.setProperty(LoadFuncHelper.FILE_EXTENSION_LOADERS,
                extensionLoaders);

        baseDir = new File("build/test/testAllLoader");
        if (baseDir.exists()) {
            FileUtil.fullyDelete(baseDir);
        }

        assertTrue(baseDir.mkdirs());

        createSimpleDir();
        createDatePartitionDir();
        createLogicPartitionDir();
        createTaggedLogicPartitionDir();
        createFileByContentDir();

        server = new PigServer(ExecType.LOCAL, configuration);

        server.setBatchOn();
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:31,代码来源:TestAllLoader.java

示例4: setUp

import org.apache.pig.piggybank.storage.allloader.LoadFuncHelper; //导入依赖的package包/类
@Before
public void setUp() throws Exception {

    if (baseDir == null) {

        // we need this here for some strange reason while running ant test
        // the FileSystem.get call in the LoadFuncHelper will try and
        // connect to localhost??
        PigServer pig = new PigServer(ExecType.LOCAL);

        configuration = new Configuration(false);

        configuration.set(LoadFuncHelper.FILE_EXTENSION_LOADERS,
                extensionLoaders);

        helper = new LoadFuncHelper(configuration);

        baseDir = new File("build/test/testLoadFuncHelper");
        if (baseDir.exists()) {
            FileUtil.fullyDelete(baseDir);
        }

        assertTrue(baseDir.mkdirs());

        testFile = new File(baseDir, "testFile.txt");
        FileWriter writer = new FileWriter(testFile);
        try {
            for (int i = 0; i < 100; i++) {
                writer.append("test test\n");
            }
        } finally {
            writer.close();
        }

    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:37,代码来源:TestLoadFuncHelper.java

示例5: testFilesByContentDir

import org.apache.pig.piggybank.storage.allloader.LoadFuncHelper; //导入依赖的package包/类
/**
 * Test that we can load files with the correct loaders as per file content.
 * 
 * @throws IOException
 */
@Test
public void testFilesByContentDir() throws IOException {

    server.shutdown();

    configuration.setProperty(LoadFuncHelper.FILE_EXTENSION_LOADERS,
            contentLoaders);

    server = new PigServer(ExecType.LOCAL, configuration);

    server.setBatchOn();
    server.registerFunction(allLoaderName, new FuncSpec(allLoaderFuncSpec));

    server.registerQuery("a = LOAD '" + filesByContentDir.getAbsolutePath()
            + "' using " + allLoaderFuncSpec + " as (p:float, q:float);");

    readRecordsFromLoader(server, "a", fileRecords);

}
 
开发者ID:kaituo,项目名称:sedge,代码行数:25,代码来源:TestAllLoader.java

示例6: testTaggedLogicPartitionDir

import org.apache.pig.piggybank.storage.allloader.LoadFuncHelper; //导入依赖的package包/类
/**
 * Test that we can read a tagged logic partitioned directory
 * 
 * @throws IOException
 */
@Test
public void testTaggedLogicPartitionDir() throws IOException {

    server.shutdown();

    configuration.setProperty(LoadFuncHelper.FILE_EXTENSION_LOADERS,
            taggedExtensionLoaders);

    server = new PigServer(ExecType.LOCAL, configuration);

    server.setBatchOn();
    server.registerFunction(allLoaderName, new FuncSpec(allLoaderFuncSpec));

    int i = 0;
    for (String tag : tags) {

        String schema = taggedSchemas[i++];

        server.registerQuery(tag + " = LOAD '"
                + taggedLogicPartitionDir.getAbsolutePath() + "/" + tag
                + "' using " + allLoaderFuncSpec + " as " + schema + ";");

        readRecordsFromLoader(server, tag, fileRecords
                * logicPartitions.length * fileTypes.length);
    }

}
 
开发者ID:kaituo,项目名称:sedge,代码行数:33,代码来源:TestAllLoader.java


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