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 Plain View
Hive >> mail # user >> Question regarding serde2.s3.S3LogDeserializer.java


Copy link to this message
-
Question regarding serde2.s3.S3LogDeserializer.java
Hello all,

I recently came across the following piece of code in
https://svn.apache.org/repos/asf/hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/serde2/s3/S3LogDeserializer.java
:

  *static* *{*

    StackTraceElement*[]* sTrace *=* *new* Exception*().*getStackTrace*();*

    sTrace*[*0*].*getClassName*();*

  *}*

*
*

One question: What is this used for?

>From what I can tell its dead code.
Also there is similar code at
http://javasourcecode.org/html/open-source/hive/hive-0.9.0/org/apache/hadoop/hive/serde2/TestSerDe.java.html
:

  static {
    StackTraceElement
<http://javasourcecode.org/html/open-source/jdk/jdk-6u23/java/lang/StackTraceElement.java.html>[]
sTrace = new Exception
<http://javasourcecode.org/html/open-source/jdk/jdk-6u23/java/lang/Exception.java.html>().getStackTrace();
    String <http://javasourcecode.org/html/open-source/jdk/jdk-6u23/java/lang/String.java.html>
className = sTrace[0].getClassName();
    try {
      SerDeUtils.registerSerDe(shortName(), Class.forName(className));
      // For backward compatibility: this class replaces the following
class.      SerDeUtils.registerSerDe("org.apache.hadoop.hive.serde.TestSerDe",
Class
          .forName(className));
    } catch (Exception
<http://javasourcecode.org/html/open-source/jdk/jdk-6u23/java/lang/Exception.java.html>
e) {
      throw new RuntimeException
<http://javasourcecode.org/html/open-source/jdk/jdk-6u23/java/lang/RuntimeException.java.html>(e);
    }
  }

Which seems to do something, however I can't tell the difference between
the above and simple hard coding the class name; other than you can blindly
copy paste this code without changing that hard coded class name?

Any help in understanding this?

Thanks,

Brandon
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