Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

getRange操作支持 time_range 吗? #22

Open
yi opened this issue Jun 8, 2017 · 5 comments
Open

getRange操作支持 time_range 吗? #22

yi opened this issue Jun 8, 2017 · 5 comments

Comments

@yi
Copy link

yi commented Jun 8, 2017

getRange操作支持 time_range 吗?

如果支持的话,请问传入参数的结构应该如何表达?

谢谢

@JacksonTian
Copy link
Contributor

// 范围读
var start = {
  uid: ots.InfMin
};

var end = {
  uid: ots.InfMax
};

var request = {
  table_name: 'metrics',
  direction: ots.Direction.FORWARD,
  columns_to_get: ['test'],
  limit: 4,
  inclusive_start_primary_key: start,
  exclusive_end_primary_key: end
};
var response = yield client.getRange(request);

column 的数据类型就那么几种,你可以将时间转换为 整型 或者 字符串。只要设定起止值就可以了。

@yi
Copy link
Author

yi commented Jun 9, 2017

我面临的需求,是获取一个时间段中特定类型的OTS记录。 从 OTS 文档来看, getRange by time_range 貌似特别合适满足我所面临的需求。

但是,文档上没有说明 time_range 的数据依据是哪里来?是需要我们手动在OTS记录里面添加 timestamp吗? 2. 从这个 repo 的代码来看,好像没有对 time_range 的实现,目前 time_range 可以用吗?

@yi
Copy link
Author

yi commented Jun 9, 2017

我开工单问清楚了这个问题,OTS是支持记录时间戳的,在 createTable 的 option 里面支持。

文档在 https://help.aliyun.com/document_detail/43012.html?spm=5176.doc27309.6.699.LEMxf9 的 TableOptions 模块

我想问一下,现在OTS 的 protocol buffer 里面有对 createTable 的 这3个 options 提供支持吗?

@JacksonTian
Copy link
Contributor

你指的时间戳是表的元数据吧。

当前版本的SDK还没支持到这个。待后续更新

@yi
Copy link
Author

yi commented Jun 9, 2017

不是 TableMeta 是 TableOptions, 在 官方的 protocol buffer 有找到 https://help.aliyun.com/document_detail/27345.html?spm=5176.doc27304.6.644.Gs8Z6r

咱们改一下 createTable 的接口把,TableOptions貌似挺有用的

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants