cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Stupp (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CASSANDRA-10741) Unable to create a function with argument of type Inet
Date Fri, 20 Nov 2015 08:55:10 GMT

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

Robert Stupp edited comment on CASSANDRA-10741 at 11/20/15 8:54 AM:
--------------------------------------------------------------------

Use of {{INET}} type was forbidden by UDF sandbox. Unfortunately {{java.net.InetAddress}}
pulls in {{java.net.NetworkInterface}}. "Dangerous" uses of methods in both classes are forbidden
by the Java-UDF byte code verifier. But it's not possible to forbid uses of all methods of
these classes for script UDFs (if script UDFs are enabled).

EDIT: Patch allows use of {{INET}} - also added a bunch of new tests.

Git branches:
* 2.2: https://github.com/snazy/cassandra/tree/10741-udf-inet-2.2
* 3.0: https://github.com/snazy/cassandra/tree/10741-udf-inet-3.0
* trunk: (just a merge) https://github.com/snazy/cassandra/tree/10741-udf-inet-trunk

Cassci: http://cassci.datastax.com/view/Dev/view/snazy/search/?q=snazy-10741-
* testall triggered for 2.2, 3.0, trunk
* dtest triggered for 3.0, trunk


was (Author: snazy):
Use of {{INET}} type was forbidden by UDF sandbox. Unfortunately {{java.net.InetAddress}}
pulls in {{java.net.NetworkInterface}}. "Dangerous" uses of methods in both classes are forbidden
by the Java-UDF byte code verifier. But it's not possible to forbid uses of all methods of
these classes for script UDFs (if script UDFs are enabled).

Git branches:
* 2.2: https://github.com/snazy/cassandra/tree/10741-udf-inet-2.2
* 3.0: https://github.com/snazy/cassandra/tree/10741-udf-inet-3.0
* trunk: (just a merge) https://github.com/snazy/cassandra/tree/10741-udf-inet-trunk

Cassci: http://cassci.datastax.com/view/Dev/view/snazy/search/?q=snazy-10741-
* testall triggered for 2.2, 3.0, trunk
* dtest triggered for 3.0, trunk

> Unable to create a function with argument of type Inet
> ------------------------------------------------------
>
>                 Key: CASSANDRA-10741
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10741
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL
>            Reporter: dan jatnieks
>            Assignee: Robert Stupp
>             Fix For: 3.0.1, 3.1
>
>
> We are unable to create a function with an argument of type {{inet}} using 3.0.
> This works in 2.2, but fails in 3.0
> {noformat}
> CREATE OR REPLACE FUNCTION test.f2 (p1 inet)
> CALLED ON NULL INPUT RETURNS int LANGUAGE java AS 'return 2;';
> {noformat}
> From cqlsh:
> {noformat}
> 05:14 PM:~/projects/cassandra-3.0$ ./bin/cqlsh
> Connected to Test Cluster at 127.0.0.1:9042.
> [cqlsh 5.0.1 | Cassandra 3.0.0-SNAPSHOT | CQL spec 3.3.1 | Native protocol v4]
> Use HELP for help.
> cqlsh> CREATE OR REPLACE FUNCTION test.f2 (p1 inet)
>    ... CALLED ON NULL INPUT RETURNS int LANGUAGE java AS 'return 2;';
> InvalidRequest: code=2200 [Invalid query] message="Could not compile function 'test.f2'
from Java source: org.apache.cassandra.exceptions.InvalidRequestException: Java source compilation
failed:
> GENERATED SOURCE ERROR: line 20 (in generated source): java.net.InetAddress cannot be
resolved to a type
> GENERATED SOURCE ERROR: line 25 (in generated source): java.net.InetAddress cannot be
resolved to a type
>  generated source:
> package org.apache.cassandra.cql3.udf.gen.ptest2ef2_4746343_7;
> import java.nio.ByteBuffer;
> import java.util.List;
> import org.apache.cassandra.cql3.functions.JavaUDF;
> import com.datastax.driver.core.DataType;
> public final class Ctest2ef2_12216880_8 extends JavaUDF
> {
>     public Ctest2ef2_12216880_8(DataType returnDataType, DataType[] argDataTypes)
>     {
>         super(returnDataType, argDataTypes);
>     }
>     protected ByteBuffer executeImpl(int protocolVersion, List<ByteBuffer> params)
>     {
>         Integer result = xtest2ef2_16165915_9(
>             (java.net.InetAddress) super.compose(protocolVersion, 0, params.get(0))
>         );
>         return super.decompose(protocolVersion, result);
>     }
>     private Integer xtest2ef2_16165915_9(java.net.InetAddress p1)
>     {
> return 2;
>     }
> }
> "
> {noformat}



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

Mime
View raw message