hadoop-hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zheng Shao (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HIVE-471) A UDF for simple reflection
Date Tue, 09 Feb 2010 18:47:28 GMT

    [ https://issues.apache.org/jira/browse/HIVE-471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12831584#action_12831584
] 

Zheng Shao commented on HIVE-471:
---------------------------------

In most cases, the class name/method name will be passed in as a Text (StringWritable) or
a Java String (there can be other cases but relatively rare).
Also, the class name/method name usually do not change.

With the current implementation, we avoid doing object creation for most of the time (the
only function called is ObjectInspectorUtils.compare()).
If we convert the name to String and compare with String.equals, then we have to do an object
conversion (which may involve object creation) for each of the rows.

I will add these as the comments in the code. Thanks for asking. That's a good question to
answer in the code comments.


> A UDF for simple reflection
> ---------------------------
>
>                 Key: HIVE-471
>                 URL: https://issues.apache.org/jira/browse/HIVE-471
>             Project: Hadoop Hive
>          Issue Type: New Feature
>          Components: Query Processor
>    Affects Versions: 0.6.0
>            Reporter: Edward Capriolo
>            Assignee: Edward Capriolo
>            Priority: Minor
>         Attachments: hive-471-gen.diff, HIVE-471.1.patch, hive-471.diff
>
>
> There are many methods in java that are static and have no arguments or can be invoked
with one simple parameter. More complicated functions will require a UDF but one generic one
can work as a poor-mans UDF.
> {noformat}
> SELECT reflect("java.lang.String", "valueOf", 1), reflect("java.lang.String", "isEmpty")
> FROM src LIMIT 1;
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message