Other Deephaven Types

A variety of other types that appear in the system.

Types used for expressing Deephaven data types

class ElementType

Represents the element type of the column source. This data structure is able to represent any of the simple types, as well as lists and nested lists of the simple types. If ‘list_depth_’ == 0, this object represents a scalar element of type ‘element_type_id_’. If ‘list_depth_’ == 1, then this object represents a list of elements of type ‘element_type_id_’. If ‘list_depth_’ == 2, then this object represents a list of lists of elements of type ‘element_type_id_’, and so on. Note that even though this object can represent multidimensional lists, the rest of the system currently only supports scalars and one-dimensional lists.

Public Functions

ElementType() = default

Default Constructor.

inline ElementType(uint32_t list_depth, ElementTypeId::Enum element_type_id)

Constructs an ElementType with the given list_depth and scalar type. See class documentation for the interpretation of list_depth.

inline uint32_t ListDepth() const

The list depth of this ElementType. Scalar types have a list depth of 0. One-dimensional list types (e.g. list<int>) have a list depth of 1. Higher-dimensional list types (e.g. list<list<int>>) have a list depth greater than 1.

Returns:

The list depth.

inline ElementTypeId::Enum Id() const

If this object represents a scalar, returns the scalar’s type. Otherwise, if this object represents a list (of any dimension), returns the element type of the innermost list.

Returns:

The enumeration representing this scalar or the elemenet type of the innermost list.

inline ElementType WrapList() const

Assuming this object represents the type T, returns a new object representing the type list<T>

Returns:

The wrapped type.

ElementType UnwrapList() const

If this object represents the type list<T>, returns a new object representing the type T. If this object is not a list type, throws an exception.

Returns:

The unwrapped type.

inline std::string ToString() const

Makes a string representation of this type object. For example “list<int32_t>”

Returns:

This object’s string representation.

Public Static Functions

static inline ElementType Of(ElementTypeId::Enum element_type_id)

Create an ElementType representing the specified scalar type.

class ElementTypeId

A static class (not instantiable) used to create a scope for the ElementTypeId::Enum

Public Types

enum Enum

The Deephaven server types that are known to the C++ client.

Values:

enumerator kChar
enumerator kInt8
enumerator kInt16
enumerator kInt32
enumerator kInt64
enumerator kFloat
enumerator kDouble
enumerator kBool
enumerator kString
enumerator kTimestamp
enumerator kLocalDate
enumerator kLocalTime

Types used for sorting tables

class SortPair

A tuple (not a “pair”, despite the name) representing a column to sort, the SortDirection, and whether the Sort should consider the value’s regular or absolute value when doing comparisons.

Public Functions

inline SortPair(std::string column, SortDirection direction, bool abs = false)

Constructor.

inline SortPair(std::string column, bool abs = false)

Constructor.

inline std::string &Column()

Get the column name

Returns:

The column name

inline const std::string &Column() const

Get the column name

Returns:

The column name

inline SortDirection Direction() const

Get the SortDirection

Returns:

The SortDirection

inline bool Abs() const

Get the “Sort by absolute value” flag

Returns:

Public Static Functions

static inline SortPair Ascending(std::string column, bool abs = false)

Create a SortPair with direction set to ascending.

Parameters:
  • column – The name of the column to sort.

  • abs – If true, the data should be sorted by absolute value.

Returns:

The SortPair tuple.

static inline SortPair Descending(std::string column, bool abs = false)

Create a SortPair with direction set to descending.

Parameters:
  • column – The name of the column to sort.

  • abs – If true, the data should be sorted by absolute value.

Returns:

The SortPair tuple.

enum class deephaven::client::SortDirection

Describes a sort direction

Values:

enumerator kAscending
enumerator kDescending

Types used for manipulating dates/times

class DateTime

The Deephaven DateTime type. Records nanoseconds relative to the epoch (January 1, 1970) UTC. Times before the epoch can be represented with negative nanosecond values.

Public Types

using rep_t = int64_t

Convenience using.

Public Functions

DateTime() = default

Default constructor. Sets the DateTime equal to the epoch.

inline explicit DateTime(int64_t nanos)

Sets the DateTime to the specified number of nanoseconds relative to the epoch.

Parameters:

nanos – Nanoseconds since the epoch (January 1, 1970 UTC).

DateTime(int year, int month, int day)

Sets the DateTime to the specified date, with a time component of zero.

Parameters:
  • year – Year.

  • month – Month.

  • day – Day.

DateTime(int year, int month, int day, int hour, int minute, int second)

Sets the DateTime to the specified date and time, with a fractional second component of zero.

Parameters:
  • year – Year.

  • month – Month.

  • day – Day.

  • hour – Hour.

  • minute – Minute.

  • second – Second.

DateTime(int year, int month, int day, int hour, int minute, int second, int64_t nanos)

Sets the DateTime to the specified date and time, including fractional seconds expressed in nanos.

Parameters:
  • year – Year.

  • month – Month.

  • day – Day.

  • hour – Hour.

  • minute – Minute.

  • second – Second.

  • nanos – Nanoseconds.

inline int64_t Nanos() const

The DateTime as expressed in nanoseconds since the epoch. Can be negative.

Public Static Functions

static inline constexpr bool IsBlittableToInt64()

This method exists to document and enforce an assumption in Cython, namely that this class has the same representation as an int64_t. This constexpr method always returns true (or fails to compile).

static inline DateTime FromNanos(int64_t nanos)

Converts nanoseconds-since-UTC-epoch to DateTime. The Deephaven null value sentinel is turned into DateTime(0).

Parameters:

nanos – Nanoseconds since the epoch (January 1, 1970 UTC).

Returns:

The corresponding DateTime.

static DateTime Parse(std::string_view iso_8601_timestamp)

Parses a string in ISO 8601 format into a DateTime.

Parameters:

iso_8601_timestamp – The timestamp, in ISO 8601 format.

Returns:

The corresponding DateTime.

class LocalDate

The Deephaven LocalDate type which corresponds to java.time.LocalDate. For consistency with the Arrow type we use, stores its value in units of milliseconds. However we do not allow fractional days, so only millisecond values that are an even number of days are permitted.

Public Types

using rep_t = int64_t

Convenience using.

Public Functions

LocalDate() = default

Default constructor. Sets the LocalDate equal to the null value.

explicit LocalDate(int64_t millis)

Sets the DateTime to the specified number of milliseconds relative to the epoch. Currently we will throw an exception if millis is not an even number of days.

Parameters:

millis – Milliseconds since the epoch (January 1, 1970 UTC).

inline int64_t Millis() const

The LocalDate as expressed in milliseconds since the epoch. Can be negative.

Public Static Functions

static inline constexpr bool IsBlittableToInt64()

This method exists to document and enforce an assumption in Cython, namely that this class has the same representation as an int64_t. This constexpr method always returns true (or fails to compile).

static LocalDate Of(int32_t year, int32_t month, int32_t day_of_month)

Creates an instance of LocalDate from the specified year, month, and day.

static inline LocalDate FromMillis(int64_t millis)

Creates an instance of LocalDate from milliseconds-since-UTC-epoch. The Deephaven null value sentinel is turned into LocalDate(0).

Parameters:

millis – Milliseconds since the epoch (January 1, 1970 UTC). An exception is thrown if millis is not an even number of days.

Returns:

The corresponding LocalDate

class LocalTime

The Deephaven LocalTime type which corresponds to java.time.LocalTime. Records nanoseconds since midnight (of some unspecified reference day).

Public Types

using rep_t = int64_t

Convenience using.

Public Functions

LocalTime() = default

Default constructor. Sets the DateTime equal to the epoch.

explicit LocalTime(int64_t nanos)

Sets the LocalTime to the specified number of nanoseconds relative to the start of the day.

Parameters:

nanos – Nanoseconds since the start of the day.

Public Static Functions

static inline constexpr bool IsBlittableToInt64()

This method exists to document and enforce an assumption in Cython, namely that this class has the same representation as an int64_t. This constexpr method always returns true (or fails to compile).

static LocalTime Of(int32_t hour, int32_t minute, int32_t second)

Creates an instance of LocalTime from the specified hour, minute, and second.

static inline LocalTime FromNanos(int64_t nanos)

Converts nanoseconds-since-start-of-day to LocalTime. The Deephaven null value sentinel is turned into LocalTime(0).

Parameters:

nanos – Nanoseconds since the start of the day.

Returns:

The corresponding LocalTime.