首页 \ 问答 \ Hadoop为每个映射器使用一个实例(Hadoop use one instance for each mapper)

Hadoop为每个映射器使用一个实例(Hadoop use one instance for each mapper)

我正在使用Hadoop的map reduce来解析xml文件。 所以我有一个名为Parser的类,它可以有一个方法parse()来解析xml文件。 所以我应该在Mapper的map()函数中使用它。

但是,这意味着每次当我想调用Parser ,我都需要创建一个Parser实例。 但是对于每个地图作业,此实例应该相同。 所以我想知道我是否可以只将这个Parser实例化一次?

还有另外一个附加问题,为什么Mapper类总是静态的?


I'm using Hadoop 's map reduce to parse xml files. So I have a class called Parser that can have a method parse() to parse the xml files. And So I should use it in the Mapper's map() function.

However it means that every time, when I want to call a Parser, I need to create a Parser instance. But this instance should be the same for each map job. So I'm wondering if I can just instantize this Parser just once?

And just another add-on question, why the Mapper class is always static?


原文:https://stackoverflow.com/questions/37547118
更新时间:2023-09-23 22:09

最满意答案

您创建的任何内容都在美国隐含版权。 然而,无论如何要发布通知并将其放置在人们实际有权使用该网站的地方是有帮助的。


Anything you create is implicitly copyrighted in the US. It is however helpful to place a notice anyway, and to put somewhere that people actually have permission to actually use the site.

相关问答

更多
  • 我不知道法律问题,但接受的做法是在每一个开源代码之前加上一个版权注释块。 在flickr中,我们使用YUI,并在将YUI代码包含在我们的组合文件中之前放置该块: /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html version: 3.3.0 build: 3167 */ 正如您所看到的 ...
  • 如果他们有权访问源代码,就无法绝对阻止他们。 你能做的最好的事情就是让它们很难将它移除。 PHP混淆器将是使它们复杂化的最佳方法。 但请看这个答案为什么你不应该打扰。 There is no way to absolutely stop them if they have access to the source code. The best you can do is make it difficult for them to remove it. A PHP obfuscator would be th ...
  • 我不相信PHP本身包含一个函数来编辑JPEG文件中的EXIF数据,但是有一个PEAR扩展可以读写EXIF数据。 pear channel-discover pearhub.org pear install pearhub/PEL 该模块的网站位于http://lsolesen.github.io/pel/ ,设置描述的示例位于https://github.com/lsolesen/pel/blob/master/examples/edit-description.php 更新: 看起来,pearhub. ...
  • 您创建的任何内容都在美国隐含版权。 然而,无论如何要发布通知并将其放置在人们实际有权使用该网站的地方是有帮助的。 Anything you create is implicitly copyrighted in the US. It is however helpful to place a notice anyway, and to put somewhere that people actually have permission to actually use the site.
  • 如果您要在GPL下分发代码,那么请查看GNU Hello程序,了解如何使用适当的注释来装饰源代码。 If you're going to distribute code under the GPL, then have a look at the GNU Hello program for examples of how to decorate your source code with appropriate comments.
  • 无法给出法律意见 - IANAL,并且没有看到您的网站。 从我的记忆来看,你所描述的布局并不是推特独有的 - 只有那么多的页眉/页脚/列排列很有用 - 所以很难找到一个真正独特的排列。 我会问自己的歧视性问题: “如果我处于另一个位置,我是否可以认为我的设计被扯掉了?” 回答时不要自己BS。 如果你可以诚实地对这个问题回答否,没有使用他们的图形,并且没有使它成为像素完美的布局克隆,那么你应该没问题。 按照Jhourlad所说的那样,如果真的感觉不对,那将在你回答上述问题时出现。 听起来就像你在路上想到的那样 ...
  • XAML只是XML的基础,因此您可以使用XML注释 您甚至可以在注释中使用XML文档格式(尽管没有实际意义,因为XML文档生成器不会处理XAML文件。) 但是,如果您使用XML,那么可能已经知道了一个小警告:您无法嵌套XML注释。 这没关系,但可能会违反优先考虑在适当的XSD注释中查看所有文档的策略。 另外,请确保不要在XSD中存在的任何XML声明( )之上添加这样的行,以保持XSD 格式良好 。 XSD级文档(如您所述): ...
  • 如果原作者同意将Apache 2.0下的软件许可给您,您应该收到一份所谓的LICENSE或COPYING文件,其中包含您需要保留的确切版权声明旁边的使用条款和条件。 此外,因为这是Apache 2.0许可证,并且您写这是一些例外,您可能已经收到了一个NOTICE文件,该文件通知了这种情况。 您通常需要的只是将这些信息[这些文件]传递给最终用户。 另外,不要在这里询问项目X,因为这是现实生活,为项目命名,这将允许提供更好的示例,并使这个问题对于未来用户与他们的情况进行比较更有用。 If the origina ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)