Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive >> mail # user >> protobuf 2.4.1 and ObjectInspector


Copy link to this message
-
protobuf 2.4.1 and ObjectInspector
I am trying to use the ReflectionStructObjectInspector to extract fields
from a protobuf generated from 2.4.1 compiler. I am seeing that reflections
fails to extract fields out of the generated protobuf class. Specifically,
this code snippet:

public static Field[] getDeclaredNonStaticFields(Class<?> c) {

    Field[] f = c.getDeclaredFields();    // This returns back the correct
number of fields

    ArrayList<Field> af = new ArrayList<Field>();

    for (int i = 0; i < f.length; ++i) {

      *//* *The logic here falls flat as it is looking only for the
non-static fields and all generated fields *

*     // seem to be static*

      if (!Modifier.isStatic(f[i].getModifiers())) {

        af.add(f[i]);

      }

    }

    Field[] r = new Field[af.size()];

    for (int i = 0; i < af.size(); ++i) {

      r[i] = af.get(i);

    }

    return r;

  }

This causes the whole ObjectInspector to fail. Has anyone else seen this
issue too?
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB