Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

您好,请问一下我操作java API获取表字段类型的时候有问题? (How to get series data type using Java API) #1461

Closed
liubofeng opened this issue Jul 6, 2020 · 6 comments

Comments

@liubofeng
Copy link

liubofeng commented Jul 6, 2020

// 当 columnPattern 为"root.*"的时候,可以获得所有的列名
// 当columnPattern为某一列(如"root.sgcc.wf03.wt01.temperature")的时候,可以获得
该列的数据类型
public ResultSet getColumns(String catalog, String schemaPattern, String
columnPattern, String deltaObjectPattern)
请问一下咱们这个版本还有维护这个API吗?我这边获取的resultset为null,能帮忙看看吗,谢谢了

@qiaojialin
Copy link
Member

@liubofeng
Copy link
Author

收到,感谢您的回复,我现在的需求是要提前获取列的类型,然后再插入数据的时候用preparedStatement指定类型,请问有这块的指导资料吗?

@jixuan1989 jixuan1989 changed the title 您好,请问一下我操作java API获取表字段类型的时候有问题? 您好,请问一下我操作java API获取表字段类型的时候有问题? (How to get series data type using Java API) Jul 6, 2020
@jixuan1989
Copy link
Member

Not maintained?? don't we have UT to cover it?

我们这个接口没有再维护了?JDBC的接口还是应该维护吧。。

这个应该没维护了

现在获取结果集列名的方法,JDBC 和 Session 不太一样,可以参考

https://raw.githubusercontent.com/apache/incubator-iotdb/master/example/jdbc/src/main/java/org/apache/iotdb/JDBCExample.java

https://github.com/apache/incubator-iotdb/blob/master/example/session/src/main/java/org/apache/iotdb/SessionExample.java

推荐使用 Session 的

我现在的需求是要提前获取列的类型,然后再插入数据的时候用preparedStatement指定类型,请问有这块的指导资料吗?

看下这个文档的show timeseries语法:

https://iotdb.apache.org/UserGuide/Master/Operation%20Manual/SQL%20Reference.html

此外session有个API是fetchMetadata 应该也可以。

@qiaojialin
Copy link
Member

preparedStatement 最近没维护,不确定能不能正常工作。。如果每次写入都要查一下元数据会比较慢,可以用 Session 的 insertRecords 接口。String values 这个接口会在服务器端自动推断类型,只要提前注册好序列就可以了。

如果想写入的时候指定类型,可以查出来类型在客户端缓存,这个查询可以用 show timeseries

@liubofeng
Copy link
Author

收到, @jixuan1989 @qiaojialin 感谢回复!感觉咱们现在主要维护session这块了,我看一下,能提供一下交流群吗,这样方便交流

@qiaojialin
Copy link
Member

qiaojialin commented Jul 6, 2020

Not maintained?? don't we have UT to cover it?

我们这个接口没有再维护了?JDBC的接口还是应该维护吧。。

ResultSetMetaData metaData = resultSet.getMetaData();
metaData.getColumnLabel();
这个是有的,那个 catalog 什么的没了

@HTHou HTHou closed this as completed May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants