Package net.quasardb.qdb.ts
Class Table
java.lang.Object
net.quasardb.qdb.ts.Table
- All Implemented Interfaces:
Serializable
Represents a timeseries Table. Upon construction, actively resolves metadata
such as the associated Columns.
Can also be used to construct new QuasarDB timeseries tables.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Attaches a tag to an existing table.static void
Attaches a tag to an existing table.static void
attachTags
(Session session, String tableName, List<String> tags) Attaches tags to an existing table.static void
attachTags
(Session session, Table table, List<String> tags) Attaches tags to an existing table.int
Utility function that looks up a column's index by its id.static Table
Create new timeseries table with a default shard size.static Table
Create new timeseries table.static Table
Create new timeseries table by copying a 'skeleton' table's schema and using the default shard size.static Table
Create new timeseries table by copying a 'skeleton' table's schema.getColumnByName
(String name) Returns reference to Column object for column with a certain name.Column[]
Returns column representation of this table.static Column[]
getColumns
(Session session, String name) Returns column layout of table.Returns the types of each of the columns.Returns the types of the values that are used to represent data for each column.getName()
Returns the table name.long
Returns this table's shard size (in seconds)static long
getShardSize
(Session session, String tableName) Returns the shard size (in milliseconds) of the table.static long
getShardSize
(Session session, Table table) Returns the shard size (in seconds) of the table.long
Returns this table's shard size (in milliseconds)static long
getShardSizeMillis
(Session session, Table table) Returns the shard size (in milliseconds) of the table.boolean
hasColumnWithName
(String name) Returns `true` if table has a column with the name.static Table
Creates a new table object with the exact same structure and shard size as another table.static Reader
Initializes new reader for a timeseries table.static Reader
Initializes new reader for a timeseries table that filters for a time range.static Reader
Initializes new reader for a timeseries table,static Reader
Initializes new reader for a timeseries table that filters for a time range.static void
Remove existing timeseries table.static void
Remove existing timeseries table.toString()
-
Field Details
-
name
-
shardSizeMillis
protected long shardSizeMillis -
shardSizeSecs
protected long shardSizeSecs -
columns
-
-
Constructor Details
-
Table
Initialize a new timeseries table.- Parameters:
session
- Active connection with the QdbClustername
- Timeseries name. Must already exist.
-
Table
Initialize a new timeseries table.- Parameters:
columns
- Table columnsname
- Timeseries name. Must already exist.
-
-
Method Details
-
likeOther
Creates a new table object with the exact same structure and shard size as another table. This is an efficient way to initialize large sets of tables that all share a common shard size / schema, as no lookups with the QuasarDB cluster are performed.- Parameters:
other
- Table to use the schema and shard size ofname
- Name of the new table to be initialized.
-
create
Create new timeseries table by copying a 'skeleton' table's schema and using the default shard size.- Parameters:
session
- Active session with the QuasarDB cluster.name
- Unique identifier for this timeseries table.skeleton
- Skeleton table's schema to be copied.- Returns:
- Reference to the newly created timeseries table.
-
create
Create new timeseries table by copying a 'skeleton' table's schema.- Parameters:
session
- Active session with the QuasarDB cluster.name
- Unique identifier for this timeseries table.skeleton
- Skeleton table's schema to be copied.shardSize
- The size of the shards in ms.- Returns:
- Reference to the newly created timeseries table.
-
create
Create new timeseries table with a default shard size.- Parameters:
session
- Active session with the QuasarDB cluster.name
- Unique identifier for this timeseries table.columns
- Column definitions of this table. The ordering of the array will persist through the table definition and cannot be changed after creation.- Returns:
- Reference to the newly created timeseries table.
-
create
Create new timeseries table.- Parameters:
session
- Active session with the QuasarDB cluster.name
- Unique identifier for this timeseries table.columns
- Column definitions of this table. The ordering of the array will persist through the table definition and cannot be changed after creation.shardSize
- The size of the shards in ms.- Returns:
- Reference to the newly created timeseries table.
-
remove
Remove existing timeseries table.- Parameters:
session
- Active session with the QuasarDB clustername
- Unique identifier for this timeseries table.
-
remove
Remove existing timeseries table.- Parameters:
session
- Active session with the QuasarDB clustertable
- Table to remove
-
reader
Initializes new reader for a timeseries table that filters for a time range.- Parameters:
session
- Active session with the QuasarDB cluster.name
- Timeseries table name. Must already exist.ranges
- Time ranges to look for.
-
reader
Initializes new reader for a timeseries table.- Parameters:
session
- Active session with the QuasarDB cluster.name
- Timeseries table name. Must already exist.
-
reader
Initializes new reader for a timeseries table that filters for a time range.- Parameters:
session
- Active session with the QuasarDB cluster.table
- Timeseries table.ranges
- Time time ranges to look for.
-
reader
Initializes new reader for a timeseries table,- Parameters:
session
- Active session with the QuasarDB cluster.table
- Timeseries table.
-
attachTag
Attaches a tag to an existing table.- Parameters:
session
- Active session with the QuasarDB clustertable
- Timeseries tabletag
- Tag to attach
-
attachTag
Attaches a tag to an existing table.- Parameters:
session
- Active session with the QuasarDB clustertableName
- Name of the timeseries tabletag
- Tag to attach
-
attachTags
Attaches tags to an existing table.- Parameters:
session
- Active session with the QuasarDB clustertable
- Timeseries tabletags
- Tags to attach
-
attachTags
Attaches tags to an existing table.- Parameters:
session
- Active session with the QuasarDB clustertableName
- Name of the timeseries tabletags
- Tags to attach
-
getName
Returns the table name. -
getShardSizeMillis
public long getShardSizeMillis()Returns this table's shard size (in milliseconds) -
getShardSize
public long getShardSize()Returns this table's shard size (in seconds) -
getShardSizeMillis
Returns the shard size (in milliseconds) of the table. -
getShardSize
Returns the shard size (in seconds) of the table. -
getShardSize
Returns the shard size (in milliseconds) of the table. -
getColumns
Returns column layout of table.- Parameters:
session
- Active session with the QuasarDB cluster.name
- Unique identifier for this timeseries table.
-
getColumns
Returns column representation of this table. -
getColumnByName
Returns reference to Column object for column with a certain name.- Parameters:
name
- The name to search for.
-
hasColumnWithName
Returns `true` if table has a column with the name.- Parameters:
name
- The name to search for.
-
getColumnTypes
Returns the types of each of the columns. -
getColumnTypesAsValueTypes
Returns the types of the values that are used to represent data for each column. -
columnIndexById
Utility function that looks up a column's index by its id. The first column starts with 0.- Parameters:
id
- String identifier of the column.- Returns:
- The index of the column inside the timeseries table definition.
-
toString
-