[ https://issues.apache.org/jira/browse/CASSANDRA-14737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16932719#comment-16932719 ]
Olivier Michallat commented on CASSANDRA-14737: ----------------------------------------------- (non-binding) +1 to remove the dependency to the driver. One indirect consequence of the current situation is that driver types are leaked into UDF implementations. For example, given the following declaration: {code} CREATE FUNCTION test.first (t tuple<int,int>) RETURNS NULL ON NULL INPUT RETURNS int LANGUAGE java AS 'return t.getInt(0);'; {code} The variable {{t}} in the method body is a {{TupleValue}}, a driver type. Same for UDTs. This is fine as long as Cassandra remains on version 3.x of the driver, but if it upgrades to the latest (4.x), there are a few breaking changes to the API. For example, the getters for temporal types now return {{java.time}} types instead of {{java.util.Date}}. So upgrading the driver would break existing UDF implementations. Copying the code gives Cassandra full control over the API. > Limit the dependencies used by UDFs/UDAs > ---------------------------------------- > > Key: CASSANDRA-14737 > URL: https://issues.apache.org/jira/browse/CASSANDRA-14737 > Project: Cassandra > Issue Type: Improvement > Components: Legacy/CQL > Reporter: Robert Stupp > Assignee: Robert Stupp > Priority: Low > Labels: UDF > Fix For: 4.0 > > > In an effort to clean up our hygiene and limit the dependencies used by > UDFs/UDAs, I think we should refactor the UDF code parts and remove the > dependency to the Java Driver in that area without breaking existing > UDFs/UDAs. > > The patch is in [this > branch|https://github.com/snazy/cassandra/tree/feature/remove-udf-driver-dep-trunk]. > The changes are rather trivial and provide 100% backwards compatibility for > existing UDFs. > > The prototype copies the necessary parts from the Java Driver into the C* > source tree to {{org.apache.cassandra.cql3.functions.types}} and adopts its > usages - i.e. UDF/UDA code plus {{CQLSSTableWriter}} + > {{StressCQLSSTableWriter}}. The latter two classes have a reference to UDF's > {{UDHelper}} and had to be changed as well. > > Some functionality, like type parsing & handling, is duplicated in the code > base with this prototype - once in the "current" source tree and once for > UDFs. However, unifying the code paths is not trivial, since the UDF sandbox > prohibits the use of internal classes (direct and likely indirect > dependencies). > > /cc [~jbellis] > -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org