You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sylvain Lebresne (JIRA)" <ji...@apache.org> on 2016/02/12 14:41:18 UTC

[jira] [Commented] (CASSANDRA-10818) Evaluate exposure of DataType instances from JavaUDF class

    [ https://issues.apache.org/jira/browse/CASSANDRA-10818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15144587#comment-15144587 ] 

Sylvain Lebresne commented on CASSANDRA-10818:
----------------------------------------------

Not sure how I feel about silently injecting bindings, that sounds like a bit hacky to me. Not that I have a much cleaner to suggest.

But if we're gonna silently inject something, I'd have a preference for injecting a single "environment" object that would be used for this but could be reused later if we realize there is more such information that could be useful inside UDF bodies.  So for instance, we'd just expose some {{getEnv()}} method usable inside UDF which would return an {{Environment}} object looking something like:
{noformat}
interface Environment
{
    UDTValue newArgUDTValue(String argName);
    UDTValue newReturnUDTValue();

    TupleValue newArgTupleValue(String argName);
    TupleValue newReturnTupleValue();
}
{noformat}
and to which we could add more function along the way.

I still don't love this solution, but it feels a bit less hacky than exposing a bunch of generated names and has some future-proofness advantage. Also feels a bit easier to document (because it's slightly less magic).


> Evaluate exposure of DataType instances from JavaUDF class
> ----------------------------------------------------------
>
>                 Key: CASSANDRA-10818
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10818
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: CQL
>            Reporter: Robert Stupp
>            Assignee: Robert Stupp
>            Priority: Minor
>             Fix For: 3.x
>
>
> Currently UDF implementations cannot create new UDT instances.
> There's no way to create a new UT instance without having the {{com.datastax.driver.core.DataType}} to be able to call {{com.datastax.driver.core.UserType.newValue()}}.
> From a quick look into the related code in {{JavaUDF}}, {{DataType}} and {{UserType}} classes it looks fine to expose information about return and argument types via {{JavaUDF}}.
> Have to find some solution for script UDFs - but feels doable, too.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)