[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-11-26 Thread Tyler Hobbs (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14226557#comment-14226557
 ] 

Tyler Hobbs commented on CASSANDRA-7563:


There's one oddity around renaming a field in a UDT that's used by a UDFs.  The 
function will continue to work, even if it uses the old name for the renamed 
field.  For example:

{noformat}
cqlsh CREATE TYPE ks1.type1 (a int);
cqlsh CREATE FUNCTION ks1.func1 (a frozenks1.type1) RETURNS int LANGUAGE 
java AS $$ return Integer.valueOf(a.getInt(a)); $$;
cqlsh CREATE TABLE ks1.table1 (a int PRIMARY KEY, b frozenks1.type1);
cqlsh INSERT INTO ks1.table1 (a, b) VALUES (0, {a: 0});
cqlsh SELECT ks1.func1(b) FROM ks1.table1;

 ks1.func1(b)
--
0

(1 rows)
cqlsh ALTER TEYPE ks1.type1 RENAME a TO b;
cqlsh SELECT ks1.func1(b) FROM ks1.table1;

 ks1.func1(b)
--
0

(1 rows)
{noformat}

Note that the function gets field a, which was renamed to b.  I think I'm 
okay with this behavior, but I'd like to check with [~slebresne] as well.

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp
 Fix For: 3.0

 Attachments: 7563-7740.txt, 7563.txt, 7563v2.txt, 7563v3.txt, 
 7563v4.txt, 7563v5.txt, 7563v6.txt, 7563v7.txt, 7563v8-diff-diff.txt, 
 7563v8.txt


 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



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


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-11-25 Thread Tyler Hobbs (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14225200#comment-14225200
 ] 

Tyler Hobbs commented on CASSANDRA-7563:


Hmm, I'm still getting the failure to drop a type due to a function still 
referencing it (because a {{DROP FUNCTION}} didn't work, as described in my 
previous comment):
{noformat}
[junit] ERROR 20:54:34 Fatal exception in thread 
Thread[OptionalTasks:1,5,main]
[junit] java.lang.RuntimeException: java.lang.RuntimeException: Error 
setting schema for test (query was: DROP TYPE IF EXISTS 
cql_test_keyspace.type_4)
[junit] at 
org.apache.cassandra.cql3.CQLTester$1.run(CQLTester.java:188) ~[classes/:na]
[junit] at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
~[na:1.8.0_25]
[junit] at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
~[na:1.8.0_25]
[junit] at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
 ~[na:1.8.0_25]
[junit] at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
 ~[na:1.8.0_25]
[junit] at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
~[na:1.8.0_25]
[junit] at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
[na:1.8.0_25]
[junit] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_25]
[junit] Caused by: java.lang.RuntimeException: Error setting schema for 
test (query was: DROP TYPE IF EXISTS cql_test_keyspace.type_4)
[junit] at 
org.apache.cassandra.cql3.CQLTester.schemaChange(CQLTester.java:404) 
~[classes/:na]
[junit] at 
org.apache.cassandra.cql3.CQLTester.access$000(CQLTester.java:63) ~[classes/:na]
[junit] at 
org.apache.cassandra.cql3.CQLTester$1.run(CQLTester.java:167) ~[classes/:na]
[junit] ... 7 common frames omitted
[junit] Caused by: java.lang.RuntimeException: Error validating query DROP 
TYPE IF EXISTS cql_test_keyspace.type_4
[junit] at 
org.apache.cassandra.cql3.QueryProcessor.executeOnceInternal(QueryProcessor.java:374)
 ~[main/:na]
[junit] at 
org.apache.cassandra.cql3.CQLTester.schemaChange(CQLTester.java:400) 
~[classes/:na]
[junit] ... 9 common frames omitted
[junit] Caused by: org.apache.cassandra.exceptions.InvalidRequestException: 
Cannot drop user type cql_test_keyspace.type_4 as it is still used by function 
cql_test_keyspace.function_6
[junit] at 
org.apache.cassandra.cql3.statements.DropTypeStatement.validate(DropTypeStatement.java:83)
 ~[main/:na]
[junit] at 
org.apache.cassandra.cql3.QueryProcessor.executeOnceInternal(QueryProcessor.java:361)
 ~[main/:na]
[junit] ... 10 common frames omitted
{noformat}
Note that this doesn't cause the test to fail because it happens during cleanup.

DROP FUNCTION statements also seem to have a problem with UDTs in a different 
keyspace:
{noformat}
cqlsh create keyspace ks1 WITH replication = {'class': 'SimpleStrategy', 
'replication_factor': '1'};
cqlsh create keyspace ks2 WITH replication = {'class': 'SimpleStrategy', 
'replication_factor': '2'};
cqlsh create type ks1.foo (a int);
cqlsh create function ks2.myfunc (a frozenks1.foo) RETURNS frozenks1.foo 
LANGUAGE java AS $$return a;$$;
cqlsh drop function ks2.myfunc (frozenks1.foo);
code=2200 [Invalid query] message=Statement on keyspace ks2 cannot refer to a 
user type in keyspace ks1; user types can only be used in the keyspace they are 
defined in
{noformat}

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp
 Fix For: 3.0

 Attachments: 7563-7740.txt, 7563.txt, 7563v2.txt, 7563v3.txt, 
 7563v4.txt, 7563v5.txt, 7563v6.txt, 7563v7.txt


 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



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


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-11-25 Thread Robert Stupp (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14225504#comment-14225504
 ] 

Robert Stupp commented on CASSANDRA-7563:
-

Problem is the following sequence of statements:
{code}
CREATE TYPE foo ...
CREATE FUNCTION bar ( par foo ) RETURNS foo ...
ALTER TYPE foo ADD ...
{code}
or
{code}
ALTER TYPE foo ALTER ...
{code}
or
{code}
ALTER TYPE foo RENAME ...
{code}

Fix to use {{AbstractType.asCQL3Type().toString().equals()}} instead of 
{{AbstractType.equals()}} - this is (should be) what the user has typed. 
{{UserType.equals()}} also compares the embedded field names and types - so 
changes on the UDT effectively hides UDFs using that UDT (even no longer 
droppable -  that's what Tyler saw).

Breaking change: value of {{signuture}} column is now computed from 
{{AbstractType.asCQL3Type().toString()}} instead of {{AbstractType.toString()}} 
- so I'd recommend to {{rm -rf }} the {{schema_functions}} table for trunk 
installations ;)

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp
 Fix For: 3.0

 Attachments: 7563-7740.txt, 7563.txt, 7563v2.txt, 7563v3.txt, 
 7563v4.txt, 7563v5.txt, 7563v6.txt, 7563v7.txt


 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



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


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-11-21 Thread Tyler Hobbs (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14221331#comment-14221331
 ] 

Tyler Hobbs commented on CASSANDRA-7563:


When playing around with this, I discovered that you can trigger an assertion 
error when creating a function with a UDT without an explicit keyspace:

{noformat}
cqlsh use ks1;
cqlsh:ks1 create type mytype (a int);
cqlsh:ks1 create function bar (a mytype) RETURNS mytype LANGUAGE java AS 
$$return a;$$;
ErrorMessage code= [Server error] message=java.lang.AssertionError
{noformat}

{noformat}
java.lang.AssertionError: null
at org.apache.cassandra.config.Schema.getKSMetaData(Schema.java:222) 
~[main/:na]
at 
org.apache.cassandra.cql3.CQL3Type$Raw$RawUT.prepare(CQL3Type.java:510) 
~[main/:na]
at 
org.apache.cassandra.cql3.statements.CreateFunctionStatement.announceMigration(CreateFunctionStatement.java:115)
 ~[main/:na]
at 
org.apache.cassandra.cql3.statements.SchemaAlteringStatement.execute(SchemaAlteringStatement.java:80)
 ~[main/:na]
at 
org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:226)
 ~[main/:na]
at 
org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:248) 
~[main/:na]
at 
org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:118)
 ~[main/:na]
at 
org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:439)
 [main/:na]
at 
org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:335)
 [main/:na]
at 
io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
 [netty-all-4.0.23.Final.jar:4.0.23.Final]
at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
 [netty-all-4.0.23.Final.jar:4.0.23.Final]
at 
io.netty.channel.AbstractChannelHandlerContext.access$700(AbstractChannelHandlerContext.java:32)
 [netty-all-4.0.23.Final.jar:4.0.23.Final]
at 
io.netty.channel.AbstractChannelHandlerContext$8.run(AbstractChannelHandlerContext.java:324)
 [netty-all-4.0.23.Final.jar:4.0.23.Final]
at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
[na:1.8.0_25]
at 
org.apache.cassandra.concurrent.AbstractTracingAwareExecutorService$FutureTask.run(AbstractTracingAwareExecutorService.java:164)
 [main/:na]
at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:105) 
[main/:na]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_25]
{noformat}

A quick investigation shows that the keyspace being passed to {{prepare()}} is 
null.

Other than that, the post-test cleanup seems to have problems dropping some of 
the functions.  I believe it's due to a signature mismatch.  This doesn't show 
up as an error, since {{DROP IF EXISTS}} is used, but it causes {{DROP TYPE}} 
statements to fail later.  I'm not sure if this is due to the way the tests are 
working, or if it's an actual problem with dropping functions.  (I haven't 
narrowed it down to a particular set of functions, yet.)

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp
 Fix For: 3.0

 Attachments: 7563-7740.txt, 7563.txt, 7563v2.txt, 7563v3.txt, 
 7563v4.txt, 7563v5.txt, 7563v6.txt


 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



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


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-11-20 Thread Tyler Hobbs (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14220311#comment-14220311
 ] 

Tyler Hobbs commented on CASSANDRA-7563:


This is almost good to go, but it looks like there are some problems with 
Javascript in Java 7:

{noformat}
[junit] Testcase: 
testJavascriptTupleTypeCollection(org.apache.cassandra.cql3.UFTest):  
Caused an ERROR
[junit] Failed to compile function 'cql_test_keyspace_alt.function_75' for 
language javascript: javax.script.ScriptException: 
sun.org.mozilla.javascript.internal.EvaluatorException: missing name after . 
operator (Unknown Source#1)
[junit] org.apache.cassandra.exceptions.InvalidRequestException: Failed to 
compile function 'cql_test_keyspace_alt.function_75' for language javascript: 
javax.script.ScriptException: 
sun.org.mozilla.javascript.internal.EvaluatorException: missing name after . 
operator (Unknown Source#1)
[junit] at 
org.apache.cassandra.cql3.functions.ScriptBasedUDF.init(ScriptBasedUDF.java:86)
[junit] at 
org.apache.cassandra.cql3.functions.UDFunction.create(UDFunction.java:202)
[junit] at 
org.apache.cassandra.cql3.statements.CreateFunctionStatement.announceMigration(CreateFunctionStatement.java:132)
[junit] at 
org.apache.cassandra.cql3.statements.SchemaAlteringStatement.executeInternal(SchemaAlteringStatement.java:92)
[junit] at 
org.apache.cassandra.cql3.QueryProcessor.executeOnceInternal(QueryProcessor.java:349)
[junit] at 
org.apache.cassandra.cql3.CQLTester.execute(CQLTester.java:436)
[junit] at 
org.apache.cassandra.cql3.CQLTester.createFunctionOverload(CQLTester.java:298)
[junit] at 
org.apache.cassandra.cql3.CQLTester.createFunction(CQLTester.java:289)
[junit] at 
org.apache.cassandra.cql3.UFTest.testJavascriptTupleTypeCollection(UFTest.java:1138)
[junit] 
[junit] 
[junit] Testcase: 
testJavascriptUTCollections(org.apache.cassandra.cql3.UFTest):Caused an 
ERROR
[junit] Execution of user-defined function 'cql_test_keyspace.function_83' 
failed: javax.script.ScriptException: 
sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot call method 
getString of null (Unknown Source#1) in Unknown Source at line number 1
[junit] org.apache.cassandra.exceptions.InvalidRequestException: Execution 
of user-defined function 'cql_test_keyspace.function_83' failed: 
javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: 
TypeError: Cannot call method getString of null (Unknown Source#1) in 
Unknown Source at line number 1
[junit] at 
org.apache.cassandra.cql3.functions.ScriptBasedUDF.execute(ScriptBasedUDF.java:142)
[junit] at 
org.apache.cassandra.cql3.selection.ScalarFunctionSelector.getOutput(ScalarFunctionSelector.java:60)
[junit] at 
org.apache.cassandra.cql3.selection.Selection$SelectionWithProcessing$1.getOutputRow(Selection.java:397)
[junit] at 
org.apache.cassandra.cql3.selection.Selection$ResultSetBuilder.build(Selection.java:241)
[junit] at 
org.apache.cassandra.cql3.statements.SelectStatement.process(SelectStatement.java:1168)
[junit] at 
org.apache.cassandra.cql3.statements.SelectStatement.processResults(SelectStatement.java:304)
[junit] at 
org.apache.cassandra.cql3.statements.SelectStatement.executeInternal(SelectStatement.java:328)
[junit] at 
org.apache.cassandra.cql3.statements.SelectStatement.executeInternal(SelectStatement.java:65)
[junit] at 
org.apache.cassandra.cql3.QueryProcessor.executeOnceInternal(QueryProcessor.java:349)
[junit] at 
org.apache.cassandra.cql3.CQLTester.execute(CQLTester.java:436)
[junit] at 
org.apache.cassandra.cql3.UFTest.testJavascriptUTCollections(UFTest.java:1278)
[junit] 
{noformat}

I believe we are considering requiring Java 8 for Cassandra 3.0, so if there's 
not a straightforward fix for whatever the underlying problem is, we could 
potentially just advertise the limitation.

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp
 Fix For: 3.0

 Attachments: 7563-7740.txt, 7563.txt, 7563v2.txt, 7563v3.txt, 
 7563v4.txt, 7563v5.txt


 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



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


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-11-20 Thread Robert Stupp (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14220348#comment-14220348
 ] 

Robert Stupp commented on CASSANDRA-7563:
-

FYI - diff for the rhino fix : 
https://github.com/snazy/cassandra/commit/4268d2ac148bcda407fc407ae4f5f9d498ee81da

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp
 Fix For: 3.0

 Attachments: 7563-7740.txt, 7563.txt, 7563v2.txt, 7563v3.txt, 
 7563v4.txt, 7563v5.txt, 7563v6.txt


 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



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


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-11-19 Thread Tyler Hobbs (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14218503#comment-14218503
 ] 

Tyler Hobbs commented on CASSANDRA-7563:


bq. The protocol version stuff got a bit bigger than I expected. But the new 
tests in UFTest pass. These test execution using executeInternal and using 
protocol version 2 + 3 via the Java Driver.

Looks good!

bq. I tried to make the new tests a bit more readable - hope it looks better 
now.

Thanks, this is definitely easier to read.

bq. Calling a UDF with a null value in a collection does not work - the Java 
Driver does not support that. Added a test for that (but with @Ignore 
annotation.

Sorry, I meant testing where the entire collection is null/empty.  For example, 
something like {{SELECT myfunc(mycollection) FROM ...}} where {{mycollection}} 
may be null/empty.

Some more review comments:

JavaSourceUDFFactory:
* Can you add quick docs explaining argDataTypes, returnDataType vs 
javaParamTypes, javaReturnType
* The example generated function for generateExecuteMethod() needs to be 
updated for protocolVersion in a couple of places

ScriptBasedUDF:
* Directly return {{decompose()}} result at the end of {{execute()}}

UDFunction:
* Can you add basic javadocs on type-related methods plus {{compose()}} and 
{{decompose()}}

UFTest:
* You mentioned that you had test coverage for various changes to UDTs used by 
functions, but I only see one that covers adding a field.  Can you add coverage 
for the other cases?  With the existing test, what happens if the UDT is 
altered and the function isn't replaced?  Make sure to cover failure scenarios 
in the tests.

It's getting close! Thanks for your hard work :)

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp
 Fix For: 3.0

 Attachments: 7563-7740.txt, 7563.txt, 7563v2.txt, 7563v3.txt, 
 7563v4.txt


 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



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


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-11-19 Thread Robert Stupp (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14218614#comment-14218614
 ] 

Robert Stupp commented on CASSANDRA-7563:
-

Heh - it all started with a simple pure approach :)

Attached v5 with changes regarding the comments.
Just one enhancement: you can no longer drop a type that is used by a UDF's 
return or argument type (updated DropTypeStatement for that).

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp
 Fix For: 3.0

 Attachments: 7563-7740.txt, 7563.txt, 7563v2.txt, 7563v3.txt, 
 7563v4.txt, 7563v5.txt


 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



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


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-11-17 Thread Robert Stupp (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14214609#comment-14214609
 ] 

Robert Stupp commented on CASSANDRA-7563:
-

Attached v4 of the patch.

The protocol version stuff got a bit bigger than I expected. But the new tests 
in UFTest pass. These test execution using {{executeInternal}} and using 
protocol version 2 + 3 via the Java Driver.

Calling a UDF with a null value in a collection does not work - the Java Driver 
does not support that. Added a test for that (but with {{@Ignore}} annotation.

I tried to make the new tests a bit more readable - hope it looks better now.

Also added support in CQLTester to create UDFs (createFunction, 
createFunctionOverload).

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp
 Fix For: 3.0

 Attachments: 7563-7740.txt, 7563.txt, 7563v2.txt, 7563v3.txt, 
 7563v4.txt


 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



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


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-11-15 Thread Robert Stupp (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14213523#comment-14213523
 ] 

Robert Stupp commented on CASSANDRA-7563:
-

Ah - got it (hopefully all places).
Since we have the java driver in classpath now, we can use it for unit test - 
especially to test that protocol-version thing - maybe useful for json stuff, 
too ;)

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp
 Fix For: 3.0

 Attachments: 7563-7740.txt, 7563.txt, 7563v2.txt, 7563v3.txt


 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



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


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-11-15 Thread ch.prasad (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14213568#comment-14213568
 ] 

ch.prasad commented on CASSANDRA-7563:
--

SPARK-4427
please see my issue .please provide solution .
]my id :
ch.kmvpra...@gmail.com


 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp
 Fix For: 3.0

 Attachments: 7563-7740.txt, 7563.txt, 7563v2.txt, 7563v3.txt


 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



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


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-11-14 Thread Tyler Hobbs (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14212882#comment-14212882
 ] 

Tyler Hobbs commented on CASSANDRA-7563:


Sorry for the slow response, I have some time to review your patch now.

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp
 Fix For: 3.0

 Attachments: 7563-7740.txt, 7563.txt, 7563v2.txt


 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



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


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-11-14 Thread Tyler Hobbs (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14213046#comment-14213046
 ] 

Tyler Hobbs commented on CASSANDRA-7563:


Good work so far!  Here's my preliminary feedback:
* Using {{ProtocolVersion.NEWEST_SUPPORTED}} for serializing and deserializing 
is not correct.  (I noticed a similiar issue when working on json functions.)  
The protocol version used by the current connection needs to be passed into 
function executions for proper serialization and deserialization.
* Can you add test cases for calling a UDF on a collection type with a null 
value (empty cell)?  The code looks like it should handle this, but it's good 
to test.
* The new unit tests are really hard to parse.  Do you have any ideas for 
making them a little more readable?
*  Do you already have a C* ticket open for replacing the reflection calls 
after JAVA-502 is done?  If not, can you go ahead and make that?

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp
 Fix For: 3.0

 Attachments: 7563-7740.txt, 7563.txt, 7563v2.txt, 7563v3.txt


 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



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


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-11-14 Thread Robert Stupp (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14213070#comment-14213070
 ] 

Robert Stupp commented on CASSANDRA-7563:
-

I've created the ticket (and updated JAVA-502 for that).
Will try to improve readability of all tests in {{UFTest}} - some support in 
CQLTester would be nice - especially after CASSANDRA-7813.
Another unit test is no problem :)

Regarding that protocol version issue. Maybe I'm a bit too tired, but isn't 
that problem a bit more complex? UDFs can get parameters from CQL statements as 
'constants', from CQL bound variables (I think these depend on the protocol 
version) and from tables (guess these are always 
{{ProtocolVersion.NEWEST_SUPPORTED}}).

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp
 Fix For: 3.0

 Attachments: 7563-7740.txt, 7563.txt, 7563v2.txt, 7563v3.txt


 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



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


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-11-14 Thread Tyler Hobbs (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14213105#comment-14213105
 ] 

Tyler Hobbs commented on CASSANDRA-7563:


bq. Will try to improve readability of all tests in UFTest - some support in 
CQLTester would be nice - especially after CASSANDRA-7813.

Yes, feel free to add some utility functions, options, etc to CQLTester if 
those would make the tests clearer.

bq. isn't that problem a bit more complex? UDFs can get parameters from CQL 
statements as 'constants', from CQL bound variables (I think these depend on 
the protocol version) and from tables (guess these are always 
ProtocolVersion.NEWEST_SUPPORTED).

Literals/constants will end up as Lists.Value, Sets.Value, etc.  In the Value 
classes, {{getWithProtocolVersion()}} will use the current connection's 
protocol version to serialize the list as a ByteBuffer.  Somthing similar 
happens for bound variables.

When we fetch them from tables, they get serialized based on the current 
connection's protocol version _before_ functions are applied.  So the function 
needs to deserialize them using the same protocol version.

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp
 Fix For: 3.0

 Attachments: 7563-7740.txt, 7563.txt, 7563v2.txt, 7563v3.txt


 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



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


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-11-01 Thread Robert Stupp (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14193497#comment-14193497
 ] 

Robert Stupp commented on CASSANDRA-7563:
-

ping for review ;)

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp
 Fix For: 3.0

 Attachments: 7563-7740.txt, 7563.txt, 7563v2.txt


 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



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


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-10-13 Thread Sylvain Lebresne (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14169314#comment-14169314
 ] 

Sylvain Lebresne commented on CASSANDRA-7563:
-

I've only scanned this very quickly, but why bother with special casing UDT, 
Tupe and collections in {{JavaTypesHelper.driverType()}}? Using {{parseOne()}} 
should work with any type (at which point I'm not sure having a separate 
{{JavaTypesHelper}} is really justified (I've committed CASSANDRA-8063 so 
{{javaType}} goes away too I believe), this could all stay into UDFunction imo, 
but that's a detail).


 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp
 Fix For: 3.0

 Attachments: 7563-7740.txt, 7563.txt


 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



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


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-09-03 Thread Tyler Hobbs (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14119969#comment-14119969
 ] 

Tyler Hobbs commented on CASSANDRA-7563:


With CASSANDRA-7812 committed, dropping a function with bad types gives the 
following error:

{noformat}
cqlsh:ks1 DROP FUNCTION foo(afeawefawef);
ErrorMessage code= [Server error] message=java.lang.AssertionError
{noformat}

We should make sure that case is handled well in this ticket.

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp
 Fix For: 3.0

 Attachments: 7563-7740.txt


 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



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


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-09-03 Thread Robert Stupp (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14120024#comment-14120024
 ] 

Robert Stupp commented on CASSANDRA-7563:
-

I did not update the patches for this ticket (due to dependency CASSANDRA-7692).
It's about CASSANDRA-7791 to fix the assertion error (DropFunctionStatement:92 
: We have no proper keyspace to give, which means that this will break (NPE 
currently) for UDT: #7791 is open to fix this).

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp
 Fix For: 3.0

 Attachments: 7563-7740.txt


 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



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


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-08-11 Thread Sylvain Lebresne (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14092535#comment-14092535
 ] 

Sylvain Lebresne commented on CASSANDRA-7563:
-

There's no reason to. The driver 2.1 will definitively be GA by the time 3.0 is 
out so if we need it here, let's just add it.

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp

 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-08-09 Thread Robert Stupp (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14091869#comment-14091869
 ] 

Robert Stupp commented on CASSANDRA-7563:
-

Shall we delay this ticket until Java Driver 2.1.0 GA is out, used in C* 2.1.x 
and merged into trunk ?

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp
Assignee: Robert Stupp

 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (CASSANDRA-7563) UserType, TupleType and collections in UDFs

2014-08-04 Thread Sylvain Lebresne (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-7563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14084624#comment-14084624
 ] 

Sylvain Lebresne commented on CASSANDRA-7563:
-

I'm going to mark that a bug to emphasis that while I won't mind it too much 
if this is a separated commit of CASSANDRA-7395, I think we should *not* 
release CASSANDRA-7395 until we have this.

bq. is it possible to extract parts of the Java Driver for UDT/TT/coll support ?

We currently already include the java driver for hadoop and for stress so I 
wouldn't worry about that here. I'm happy to work on splitting the relevant 
part in the driver into a separate jar if this ever become a problem but It 
probably won't be one and is definitively not one today.

 UserType, TupleType and collections in UDFs
 ---

 Key: CASSANDRA-7563
 URL: https://issues.apache.org/jira/browse/CASSANDRA-7563
 Project: Cassandra
  Issue Type: Bug
Reporter: Robert Stupp

 * is Java Driver as a dependency required ?
 * is it possible to extract parts of the Java Driver for UDT/TT/coll support ?
 * CQL {{DROP TYPE}} must check UDFs
 * must check keyspace access permissions (if those exist)



--
This message was sent by Atlassian JIRA
(v6.2#6252)