We explore the CQL and Java integration by walking through several scenarios. Let's start with a simple scenario, where we want to get a sub-string from the symbol
event property, whose type is the CHAR
native type. This is illustrated in the following example:
SELECT symbol.substring(0,2) FROM marketFeed
First, CQL performs an implicit conversion between the CQL native CHAR
data type and the Java String
class. Next, you can invoke an instance method of a Java class instance in CQL by using the .
(dot) operator, very much like you would do normally in Java. In other words, the expression symbol.substring(…)
invokes the method String java.lang.String.substring(intbeginIndex, intendIndex)
in the object represented by the property symbol. You can even go further, and nest invocations as in the following example:
SELECT symbol.substring(0,2).toUpperCase() FROM marketFeed
In this case, you first invoke the substring()
method, and then invoke the toUpperCase()
method in the returning...