首页 \ 问答 \ 二级排序 - 将其留给Hadoop框架或在reducer中自行完成(Secondary sort - leave it to Hadoop framework or do it yourself in reducer)

二级排序 - 将其留给Hadoop框架或在reducer中自行完成(Secondary sort - leave it to Hadoop framework or do it yourself in reducer)

我读到了关于二级排序的问题,其中需要对每个键进行排序,不仅是键,还要是值的一部分。

有两种方法可以做到这一点:

  • 在每个键的reducer中缓存值并自己对值进行排序
  • 将作业留给Hadoop框架,通过指定自定义Comparator,Partitioner ...您需要的所有内容不仅要按键排序,还要按值排序

我的问题是,你什么时候会推荐第一种方法?

正如我目前所看到的那样 - 如果框架已经执行了排序,为什么不同时按键和值对其进行排序...如果有一些副作用,请纠正我。 例如,哪个应该更快?

我知道“in-Reducer排序”的最大问题是记录的数量,但我想全面了解。


I read about secondary sorting, where there is a need to sort not only be key, but also by part of value, for each of the keys.

There are two ways to do this:

  • Cache values in reducer for each key and sort the values yourself
  • Leave the job to Hadoop framework, by specifying custom Comparator, Partitioner...all that you need to enable not only to sort by key, but also by value

My question is, when would you recommend first and when the second approach?

As I currently see it - if the framework already performs sorting, why not sort it by key and value at the same time...please correct me if there is some side-effect. For example, which should be faster?

I understand that the biggest problem of "in-Reducer sorting" is the number of records, but I would like to get the whole picture.


原文:https://stackoverflow.com/questions/30050848
更新时间:2022-11-04 18:11

最满意答案

innerHeight上的jQuery页面说:“此方法不适用于窗口和文档对象;对于这些,请使用.height()代替。” - 李斯特先生于2013年8月28日6:54

利斯特先生是对的。 我将代码更改为:

var resizeBg = function() 
{
    var newHeight = window.innerHeight - $("#navBar").height() - $("#mainHeader").height());

    $("#mainContent").css("height", newHeight + "px");
}

The jQuery page on innerHeight says, "This method is not applicable to window and document objects; for these, use .height() instead." – Mr Lister Aug 28 '13 at 6:54

Mr Lister is right. I changed the code to:

var resizeBg = function() 
{
    var newHeight = window.innerHeight - $("#navBar").height() - $("#mainHeader").height());

    $("#mainContent").css("height", newHeight + "px");
}

相关问答

更多
  • 你正在整数溢出! 你只能使用uint来计算一个uint的大小; 一旦你超越它的界限,它将(静静地)再次回绕。 在你的情况下,它看起来好像是64位长。 (它的大小取决于您运行的平台。)这意味着您将能够存储最大值为2 64 -1的值。 如果你再添加一个,它会回到0,并且不会返回错误。 如果你把你得到的答案和正确的答案转换成十六进制,那么你会发现情况是这样的。 你正在结束 33DB76A7C594BFC3 而正确的答案是 1333DB76A7C594BFC3 请注意,你的答案是正确的......它只是不够 ...
  • 您不能在初始化器中重新使用初始化的属性。 我喜欢Erik的技术。 如果查询表达式语法很麻烦,可以使用全功能匿名方法。 List y = new List() { 1, 2, 3, 4 }; var x = y.Select(a => { int b = a + 1; int c = a + 2; int d = b / c; ...
  • 获取ul的高度,然后设置#expandable动画高度。 $("#expandable").click(function() { var ulHeight = $(this).children("ul").height() + 50; $(this).stop().animate({"height":ulHeight + "px"},1000).addClass("dropped"); }); DEMO Get the height of the ul and then set the ...
  • 表达式a = b的值是a赋值后的值,所以: wr = (wtemp = wr) * wpr - wi * wpi + wr; 相当于: wtemp = wr; wr = wtemp * wpr - wi * wpi + wr; 要么: wtemp = wr; wr = wr * wpr - wi * wpi + wr; 参考: 6.5.16作业操作员 赋值表达式具有赋值(...)后左操作数的值。 The value of the expression a = b is the value of a a ...
  • innerHeight上的jQuery页面说:“此方法不适用于窗口和文档对象;对于这些,请使用.height()代替。” - 李斯特先生于2013年8月28日6:54 利斯特先生是对的。 我将代码更改为: var resizeBg = function() { var newHeight = window.innerHeight - $("#navBar").height() - $("#mainHeader").height()); $("#mainContent").css("hei ...
  • 这是我疯狂猜测面对一些缺失的部分时发生的事情...... 你可能有某种绑定设置,这样当数组发生变化时(由map调用变异),它会重新渲染模板; 我在假设。 原始模板(预map调用)在style属性中包含width和height值,但不清楚它们来自何处。 很清楚的是,它们不包含在您的重新计算中。 因此,我的猜测是它们被map调用覆盖,因为它仅使用transform重写整个 style属性。 将width和height值添加回style属性的动态渲染值,您就可以了。 编辑:完整的代码发布基本上我说的一切都是真的, ...
  • 我不确定我理解你的问题,但你的代码中有一个明显的问题。 更新: Private Sub btnproses_Click(sender As System.Object, e As System.EventArgs) Handles btnproses.Click If Me.txtinputan.Text = "1" Then _bilangan = 000 Me.txthasil.Text = inputan + bilangan ...
  • 在更改preferredMaxLayoutWidth之前要求单元格布局contentView似乎可以解决问题。 - (void)layoutSubviews { [super layoutSubviews]; [self.contentView layoutIfNeeded]; self.titleLabel.preferredMaxLayoutWidth = self.titleLabel.frame.size.width; self.detailLabel.preferr ...
  • 听起来您需要在总和中使用的字段的控件的After Update事件中添加一些代码。 该代码可以调用执行计算的控件的.Refresh方法并更新总计。 编辑 另一种可能性是,如果控制值和字段值具有相同的名称,则可能存在歧义。 在“报表的设计视图”中,如果从“字段列表”中拖动字段并将其拖放到报表中,则Access会创建一个与该字段同名的报表控件。 这可能会在以后混淆,因为如果任何表达式引用=[SomeColumn]那么它是否指向字段或控件是不明确的。 通常只需将控件重命名为txtSomeColumn就可以在报告异 ...
  • 您可以替换自己的Scrollable实现来获得各种效果。 特别是,覆盖getPreferredScrollableViewportSize()并返回行高的合适倍数。 设N是您希望滚动条出现的行数。 JTable table = new JTable(tableModel) { @Override public Dimension getPreferredScrollableViewportSize() { return new Dimension(SOME_WIDTH, N ...

相关文章

更多

最新问答

更多
  • 您如何使用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)