本文介绍了HDFql使用表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对HDFql的可用性有疑问:

I have some question on the usability of HDFql:

  1. HDFql是否支持创建行类型不同的表?
  2. 如何将数据追加到表中?
  3. 如何遍历表格的行?

我要创建的表将具有1到2 ^ n行的任何内容,并且无法事先确定.

The table I want to create will have any thing 1 to 2^n rows and cannot be determine before hand.

推荐答案

以下是有关您有关 HDFql 的问题的一些信息a>:

Here goes some info concerning your questions about HDFql:

  1. 如果通过"对行具有不同类型的表创建HDFql支持",则表示HDFql支持复合数据类型,但答案尚无. (因为现在支持HDFql 2.2.0版复合数据类型)

  1. If by "HDFql support created of a table where the row are of different type" you mean HDFql supports compound data type, the answer is not yet. ( since HDFql version 2.2.0 compound data types are now supported)

要将数据追加到数据集(无法预先确定大小)中,您必须经过几个步骤(我假设您使用的是C编程语言):

To append data into a dataset (where its size cannot be determined before hand), you have to go through several steps (I will assume that you are using the C programming language):

2.1.数据集必须是可扩展的.例如,您可以按如下方式在HDFql中创建一个可扩展的数据集(这将创建一个名为dset的数据集,该数据集的大小不受限制):

2.1. The dataset must be extendible. As an example, you can create an extendible dataset in HDFql as follows (this creates a dataset named dset of integer data type with an unlimited size):

    hdfql_execute("CREATE CHUNKED DATASET dset AS INT(UNLIMITED)");

2.2.如下所述,使用超级平板在数据集dset的最后一行中写入一个值(将my_value替换为您要写入数据集的整数):

2.2. Write a value in the last row of dataset dset using a hyperslab as follows (replace my_value with an integer that you would like to write into the dataset):

    hdfql_execute("INSERT INTO dset(-1:1:1:1) VALUES(my_value)");

2.3.将值写入数据集dset后,如果要写入的值更多,请首先按如下所示增加(即更改)一个维度,然后重复步骤2.2.

2.3. After writing a value to dataset dset and if there are more values to write, first increase (i.e. alter) the dimension one unit like the following and then repeat step 2.2.:

    hdfql_execute("ALTER DIMENSION dset TO +1");
  1. 要遍历数据集dset的行,必须首先阅读它,然后按如下方式使用函数hdfql_cursor_get_int():
  1. To iterate through the rows of dataset dset, you must first read it and then use function hdfql_cursor_get_int() as follows:
    hdfql_execute("SELECT FROM dset");
    while(hdfql_cursor_next(NULL) == HDFQL_SUCCESS)
    {
        printf("Value: %d\n", *hdfql_cursor_get_int(NULL));
    }

这篇关于HDFql使用表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!