• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MapReduceIterable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: performMapReduce

import com.mongodb.client.MapReduceIterable; //导入依赖的package包/类
private Stream<JsonObject> performMapReduce(String dbIP, String tableName, String mapRedDir)
{
  MongoClient mClient = new MongoClient(dbIP, 27017);
  MapReduceSources mrs = MapReduceSources.fromDir(mapRedDir);
  MongoDatabase database = mClient.getDatabase(tableName);
  Map<String, MapReduceIterable<Document>> mapRedMap = new HashMap<String, MapReduceIterable<Document>>();

  for (String collName : database.listCollectionNames())
  {
    MongoCollection<Document> collection = database.getCollection(collName);
    mapRedMap.put(collName, collection.mapReduce(mrs.getMapJSCode(), mrs.getReduceJSCode()));
  }

  Stream<JsonObject> result = adapter.adaptStream(mapRedMap);
  result = result.onClose(() -> { mClient.close();});

  return result;
}
 
开发者ID:catedrasaes-umu,项目名称:NoSQLDataEngineering,代码行数:19,代码来源:MongoDBImport.java


示例2: adaptStream

import com.mongodb.client.MapReduceIterable; //导入依赖的package包/类
public Stream<JsonObject> adaptStream(Map<String, MapReduceIterable<Document>> mapRedMap)
{
  Stream<JsonObject> result = Stream.empty();
  JsonParser parser = new JsonParser();

  result = mapRedMap.entrySet().stream().flatMap(e ->
    StreamSupport.stream(e.getValue().spliterator(), false).map(doc ->
    {
      JsonObject jObj = (JsonObject)(parser).parse(doc.get("_id").toString());
      jObj.addProperty("_type", e.getKey());

      return jObj;
    }));

  return result;
}
 
开发者ID:catedrasaes-umu,项目名称:NoSQLDataEngineering,代码行数:17,代码来源:MongoDBStreamAdapter.java


示例3: applyPropertiesToCursor

import com.mongodb.client.MapReduceIterable; //导入依赖的package包/类
private void applyPropertiesToCursor( MongoIterable<Document> mongoIterable, QueryProperties queryProps, 
         boolean includeMetaDataSearchLimit, boolean includeSortExpr )
 {
     if( includeMetaDataSearchLimit )
     {
         Integer searchLimit = getModel().getEffectiveMDSearchLimit( queryProps ); 
         if( searchLimit > 0 )
{
             // Apply to FindIterable or MapReduceIterable
	if ( mongoIterable instanceof FindIterable )
	{
		FindIterable<Document> findIterable = (FindIterable<Document>) mongoIterable;
		findIterable.limit( searchLimit.intValue( ) );
	}
	else if ( mongoIterable instanceof MapReduceIterable )
	{
		MapReduceIterable<Document> mapReduceIterable = (MapReduceIterable<Document>) mongoIterable;
		mapReduceIterable.limit( searchLimit.intValue( ) );
	}       
}
     }
     
     applyPropertiesToCursor( mongoIterable, queryProps, includeSortExpr );
 }
 
开发者ID:eclipse,项目名称:birt,代码行数:25,代码来源:MDbOperation.java


示例4: ProfiledMapReduceIterable

import com.mongodb.client.MapReduceIterable; //导入依赖的package包/类
public ProfiledMapReduceIterable(String mapFunction, String reduceFunction, MapReduceIterable<TResult> mapReduce, ProfiledMongoCollection<TDocument> collection)
{
    super();
    this.mapFunction = mapFunction;
    this.reduceFunction = reduceFunction;
    this.mapReduceIterable = mapReduce;
    this.collection = collection;
}
 
开发者ID:dd00f,项目名称:ibm-performance-monitor,代码行数:9,代码来源:ProfiledMapReduceIterable.java


示例5: getMapReduceIterable

import com.mongodb.client.MapReduceIterable; //导入依赖的package包/类
public MapReduceIterable<TResult> getMapReduceIterable()
{
    return mapReduceIterable;
}
 
开发者ID:dd00f,项目名称:ibm-performance-monitor,代码行数:5,代码来源:ProfiledMapReduceIterable.java


示例6: execute

import com.mongodb.client.MapReduceIterable; //导入依赖的package包/类
public cfData execute(cfSession _session, cfArgStructData argStruct ) throws cfmRunTimeException {
	MongoDatabase	db	= getMongoDatabase( _session, argStruct );
	
	String collection	= getNamedStringParam(argStruct, "collection", null);
	if ( collection == null )
		throwException(_session, "please specify a collection");
	
	String map	= getNamedStringParam(argStruct, "map", null );
	if ( map == null )
		throwException(_session, "please specify a map");
	
	String reduce	= getNamedStringParam(argStruct, "reduce", null );
	if ( reduce == null )
		throwException(_session, "please specify a reduce");
	
	String outputcollection	= getNamedStringParam(argStruct, "outputcollection", null );
	if ( outputcollection == null )
		throwException(_session, "please specify a outputcollection");
	
	String action		= getNamedStringParam(argStruct, "type", "replace" ).toLowerCase();
	String finalize	= getNamedStringParam(argStruct, "finalize", null );
	cfData	query		= getNamedParam(argStruct, "query", null );
	
	try{
		MapReduceIterable<Document>	mi	= db.getCollection( collection ).mapReduce( map, reduce );
		
		if ( query != null )
			mi.filter( getDocument( query ) );
		
		if ( finalize != null )
			mi.finalizeFunction( finalize );
		
		mi.collectionName( outputcollection );
		mi.action( MapReduceAction.valueOf( action ) );
		
		
		// Kick start the map reduce
		mi.first();
		
		return cfBooleanData.TRUE;

	} catch (MongoException me){
		throwException(_session, me.getMessage());
		return null;
	}
}
 
开发者ID:OpenBD,项目名称:openbd-core,代码行数:47,代码来源:MongoCollectionMapReduce.java


示例7: mapReduce

import com.mongodb.client.MapReduceIterable; //导入依赖的package包/类
<T extends IEntity, RESULT> MapReduceIterable<RESULT> mapReduce(Class<T> entity, Class<RESULT> resultClass, String mapFunction, String reduceFunction) throws Exception; 
开发者ID:suninformation,项目名称:ymate-platform-v2,代码行数:2,代码来源:IMongoSession.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RepairJobDesc类代码示例发布时间:2022-05-23
下一篇:
Java ILocationListener类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap