HDFql Reference Manual v2.6.0

6.7.27SHOW SIZE

Syntax

SHOW SIZE [DATASET | ATTRIBUTE] [file_name] object_name [, [file_name] object_name]*

[post_processing_option]

[output_redirecting_option]

Description

Show (i.e. get) the size (in bytes) of an HDF5 dataset or attribute named object_name. Multiple objects’ sizes can be obtained at once by separating their names with a comma (,). If object_name was not found or its size could not be obtained (due to unknown/unexpected reasons), no subsequent objects are checked, and an error is raised. In case a dataset and an attribute with identical names (object_name) are stored in the same location (i.e. group) and neither the keyword DATASET nor ATTRIBUTE is specified, the size returned belongs to the dataset. To explicitly get the size of object_name according to its type, the keyword DATASET or ATTRIBUTE must be specified.

Parameter(s)

file_name – optional string that specifies the name of the HDF5 file storing the dataset or attribute whose size (in bytes) is to be obtained. If file_name is specified, the file is opened on the fly, the size of the dataset or attribute is obtained, and the file is subsequently closed. If not specified, the file currently in use is used instead.

object_name – mandatory string that specifies the name of the HDF5 dataset or attribute whose size (in bytes) is to be obtained.

post_processing_option – optional option that transforms the result set according to the programmer’s needs, such as ordering or truncating (please refer to the section PROCESSING for additional information).

output_redirecting_option – optional option that specifies the cursor in use, an HDF5 object (i.e. dataset or attribute), a (text, binary, or Excel) file, or memory (i.e. user-defined variable) to write the result set into (please refer to the subsection INTO for additional information). If not specified, the cursor in use is populated with the result set instead (please refer to the chapter CURSOR for additional information).

Return

The size (in bytes) of an HDF5 dataset or attribute as an HDFQL_BIGINT.

Example(s)

# create an HDF5 dataset named "my_dataset0" of data type float 
CREATE DATASET my_dataset0 AS FLOAT

# show (i.e. get) size (in bytes) of dataset "my_dataset0" (should return 4) 
SHOW SIZE my_dataset0

# create an HDF5 dataset named "my_dataset1" of data type long long of one dimension (size 3)
CREATE DATASET my_dataset1 AS BIGINT(3)

# show (i.e. get) size (in bytes) of dataset "my_dataset1" (should return 24 (i.e. 8x3)) 
SHOW SIZE my_dataset1

# create an HDF5 dataset named "my_dataset2" of data type variable-length short with initial values of 10, 20, and 30
CREATE DATASET my_dataset2 AS VARSMALLINT VALUES(10, 20, 30)

# show (i.e. get) size (in bytes) of dataset "my_dataset2" (should return 16 (i.e. the size of an HDF5 hvl_t structure))
SHOW SIZE my_dataset2

# create an HDF5 dataset named "my_common" of data type int 
CREATE DATASET my_common AS INT

# create an HDF5 attribute named "my_common" of data type double of two dimensions (size 2x3)
CREATE ATTRIBUTE my_common AS DOUBLE(2, 3)

# show (i.e. get) size (in bytes) of dataset "my_common" (should return 4) 
SHOW SIZE my_common

# show (i.e. get) size (in bytes) of dataset "my_common" (should return 12 (i.e. 2x6)) 
SHOW SIZE DATASET my_common

# show (i.e. get) size (in bytes) of attribute "my_common" (should return 48 (i.e. 8x2x3)) 
SHOW SIZE ATTRIBUTE my_common