Use objects
This guide will show you how to work with objects in your query strings.
When performing complex analyses, objects are an invaluable tool. Objects can contain related data and provide an easy way to access data from one source to make your program more logical or streamlined.
The Deephaven Query Language natively supports objects in Python and Groovy, allowing users to pass in objects, object's fields, and object's methods into query strings.
Power of objects in code
Objects are designed to hold information or values. In the following example, operators are used with objects to assign values.
Here, we have two objects and each object holds two values and a custom method. When we call that object, those specific values and methods are utilized without having to pass extra parameters.
Poorly written code
If we didn't use objects, our code could get confusing and cumbersome.
In the following example, we do a similar operation as above, but without the power of objects. Notice that the compute methods require us to track the parameters, and pass them in every time we need to perform these operations.
Use the power of objects in the Deephaven Query Language to make your queries more powerful and concise.