java - writable collection questions -
when reading book of hadoop, definitive guide
, found following paragraph. seems me code segment marked yellow example scenario marked green.
i not clear why have super(text.class);
, , part of code shows “set type statically” , marked red.
the problem, , 1 of worst things hadoop, everything (input , output formats, keys, values, mappers, reducers, combiners, partitioners, comparators, ...) constructed using reflection, assumption provided class has 0-arg constructor. means can't use arraywritable class of key or value because there no 0-arg constructor hadoop can use instantiate key or value type. creating trivial subclass textarraywritable, 0-arg constructor, around annoying limitation. it's weird use of "statically"; constructor still setting element type @ runtime, though it's constant.
Comments
Post a Comment