We need a HFactory.createColumn(N name, V value) ... #329

Closed
patricioe opened this Issue Nov 4, 2011 · 9 comments

Comments

Projects
None yet
4 participants
Collaborator

patricioe commented Nov 4, 2011

and pick up the serializers automatically.

It looks to verbose that way it is currently and it can save a lot of code.

patricioe was assigned Nov 4, 2011

Collaborator

btoddb commented Nov 4, 2011

in HOM there is a method that essentially does this,
HectorObjectMapper.determineSerializer() ... in fact a bug was filed
that wanted HOM to support all the core serializers. move this method
into core and then HOM can stay in sync with core serializers.

On Fri, Nov 4, 2011 at 11:34 AM, Patricio Echague
reply@reply.github.com
wrote:

and pick up the serializers automatically.

It looks to verbose that way it is currently and it can save a lot of code.


Reply to this email directly or view it on GitHub:
https://github.com/rantav/hector/issues/329

Collaborator

patricioe commented Nov 4, 2011

I was going to use TypeInferringSerializer for it.

How about that ?

Collaborator

btoddb commented Nov 4, 2011

well look at that! ok, sounds good - just need to add all the serializers. however i think you should only use ObjectSerializer if the object implements Serializable.

Contributor

jsotelo commented Nov 5, 2011

I filled that issue, #326. TypeInferringSerializer would be nice. Can we add char, float, double and short since those Serializer already exist in addition to btoddb's comment about Serializables?

Collaborator

btoddb commented Nov 14, 2011

related to issue Issue #341

Collaborator

zznate commented Feb 1, 2012

Another thing in here that I forgot about: ThrfitColumnFactory (and iface). I would like to see the methods encapsulated therein so folks could have some plug-ability in how they wanted to control column generation.

Collaborator

zznate commented Feb 1, 2012

Also, this should be called internally from HFactory for consolidation. Def. TypeInferringSerializer additions as is the flavor of this original issue as well. This was discussed offline, but I broke out some SerializingTypeInferrer stuff to it's own loosely related issue: #409

Collaborator

patricioe commented Feb 17, 2012

This should do the trick

  /**
   * Creates a column without specifying serializers. 
   */
  @SuppressWarnings("unchecked")
  public static <N, V> HColumn<N, V> createColumn(N name, V value, long clock) {
    return new HColumnImpl<N, V>(name, value, clock, (Serializer<N>) SerializerTypeInferer.getSerializer(name.getClass()), 
        (Serializer<V>) SerializerTypeInferer.getSerializer(value.getClass()));
  }

  /**
   * Creates a column without specifying serializers. 
   */
  public static <N, V> HColumn<N, V> createColumn(N name, V value) {
    return createColumn(name, value, createClock());
  }
Collaborator

patricioe commented Feb 17, 2012

Will write a test and check it in if there are no comments :)

@patricioe patricioe added a commit that referenced this issue Feb 18, 2012

@patricioe patricioe Add test for #329 960d835

patricioe closed this Feb 18, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment