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


Java LoadMetadata类代码示例

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


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

示例1: getInputSizeFromLoader

import org.apache.pig.LoadMetadata; //导入依赖的package包/类
/**
 * Get the total input size in bytes by looking at statistics provided by
 * loaders that implement @{link LoadMetadata}.
 * @param ld
 * @param job
 * @return total input size in bytes, or -1 if unknown or incomplete
 * @throws IOException on error
 */
static long getInputSizeFromLoader(POLoad ld, Job job) throws IOException {
    if (ld.getLoadFunc() == null
            || !(ld.getLoadFunc() instanceof LoadMetadata)
            || ld.getLFile() == null
            || ld.getLFile().getFileName() == null) {
        return -1;
    }

    ResourceStatistics statistics;
    try {
        statistics = ((LoadMetadata) ld.getLoadFunc())
                    .getStatistics(ld.getLFile().getFileName(), job);
    } catch (Exception e) {
        log.warn("Couldn't get statistics from LoadFunc: " + ld.getLoadFunc(), e);
        return -1;
    }

    if (statistics == null || statistics.getSizeInBytes() == null) {
        return -1;
    }

    return statistics.getSizeInBytes();
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:32,代码来源:InputSizeReducerEstimator.java

示例2: getSchemaFromMetaData

import org.apache.pig.LoadMetadata; //导入依赖的package包/类
private LogicalSchema getSchemaFromMetaData() throws FrontendException {
    if (getLoadFunc()!=null && getLoadFunc() instanceof LoadMetadata) {
        try {
            ResourceSchema resourceSchema = ((LoadMetadata)loadFunc).getSchema(getFileSpec().getFileName(), new Job(conf));
            Schema oldSchema = Schema.getPigSchema(resourceSchema);
            return Util.translateSchema(oldSchema);
        } catch (IOException e) {
            throw new FrontendException( this, "Cannot get schema from loadFunc " + loadFunc.getClass().getName(), 2245, e);
        }
    }
    return null;
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:13,代码来源:LOLoad.java

示例3: check

import org.apache.pig.LoadMetadata; //导入依赖的package包/类
@Override
        public boolean check(OperatorPlan matched) throws FrontendException {
            loLoad = (LOLoad)matched.getSources().get(0);
            // Match filter.
            List<Operator> succeds = currentPlan.getSuccessors( loLoad );
            if( succeds == null || succeds.size() == 0 || !( succeds.get(0) instanceof LOFilter ) )
                return false;
            loFilter =  (LOFilter)succeds.get(0);
            
            // Filter has dependency other than load, skip optimization
            if (currentPlan.getSoftLinkPredecessors(loFilter)!=null)
                return false;
            
            // we have to check more only if LoadFunc implements LoadMetada
            loadFunc = loLoad.getLoadFunc();
            if(!( loadFunc instanceof LoadMetadata ) ) {
                return false;
            }
            
            loadMetadata = (LoadMetadata)loadFunc;
            try {
				partitionKeys = loadMetadata.getPartitionKeys(
						loLoad.getFileSpec().getFileName(), new Job( loLoad.getConfiguration() ) );
			} catch (IOException e) {
				throw new FrontendException( e );
			}
            if( partitionKeys == null || partitionKeys.length == 0 ) {
            	return false;
            }
            
//            LogicalExpressionPlan filterExpr = filter.getFilterPlan();
            
            // we found a load-filter pattern where the load returns partition keys
            return true;
        }
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:36,代码来源:PartitionFilterOptimizer.java

示例4: getSchema

import org.apache.pig.LoadMetadata; //导入依赖的package包/类
@Override
public ResourceSchema getSchema(String location, Job job) throws IOException {
    if (wrappedLoadFunc instanceof LoadMetadata) {
        return ((LoadMetadata) wrappedLoadFunc).getSchema(location, job);
    } else {
        return null;
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:9,代码来源:ReadToEndLoader.java

示例5: getStatistics

import org.apache.pig.LoadMetadata; //导入依赖的package包/类
@Override
public ResourceStatistics getStatistics(String location, Job job) throws IOException {
    if (wrappedLoadFunc instanceof LoadMetadata) {
        return ((LoadMetadata) wrappedLoadFunc).getStatistics(location, job);
    } else {
        return null;
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:9,代码来源:ReadToEndLoader.java

示例6: getPartitionKeys

import org.apache.pig.LoadMetadata; //导入依赖的package包/类
@Override
public String[] getPartitionKeys(String location, Job job) throws IOException {
    if (wrappedLoadFunc instanceof LoadMetadata) {
        return ((LoadMetadata) wrappedLoadFunc).getPartitionKeys(location, job);
    } else {
        return null;
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:9,代码来源:ReadToEndLoader.java

示例7: check

import org.apache.pig.LoadMetadata; //导入依赖的package包/类
@Override
     public boolean check(OperatorPlan matched) throws FrontendException {
         loLoad = (LOLoad)matched.getSources().get(0);
         // Match filter.
         List<Operator> succeds = currentPlan.getSuccessors( loLoad );
         if( succeds == null || succeds.size() == 0 || !( succeds.get(0) instanceof LOFilter ) )
             return false;
         loFilter =  (LOFilter)succeds.get(0);

         // Filter has dependency other than load, skip optimization
         if (currentPlan.getSoftLinkPredecessors(loFilter)!=null)
             return false;

         // we have to check more only if LoadFunc implements LoadMetada
         loadFunc = loLoad.getLoadFunc();
         if(!( loadFunc instanceof LoadMetadata ) ) {
             return false;
         }

         loadMetadata = (LoadMetadata)loadFunc;
         try {
	partitionKeys = loadMetadata.getPartitionKeys(
			loLoad.getFileSpec().getFileName(), new Job( loLoad.getConfiguration() ) );
} catch (IOException e) {
	throw new FrontendException( e );
}
         if( partitionKeys == null || partitionKeys.length == 0 ) {
             return false;
         }

         return true;
     }
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:33,代码来源:PartitionFilterOptimizer.java

示例8: setPartitionFilter

import org.apache.pig.LoadMetadata; //导入依赖的package包/类
@Override
public void setPartitionFilter(Expression partitionFilter) throws IOException {
    if (wrappedLoadFunc instanceof LoadMetadata) {
         ((LoadMetadata) wrappedLoadFunc).setPartitionFilter(partitionFilter);
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:7,代码来源:ReadToEndLoader.java

示例9: init

import org.apache.pig.LoadMetadata; //导入依赖的package包/类
private void init(LoadMetadata loadMetadata) {
    setLoadFunc(loadMetadata);
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:4,代码来源:ParquetLoader.java


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