查询的时候报错:Temporal data comparison should have the same data type.

我用如下代码创建了一个表:

login("admin", "123456")

if(existsDatabase("dfs://compoDB")){
    dropDatabase("dfs://compoDB")
}

n = 1000000
ID = rand(100, n)
dates = 2017.08.07T00:00:00.000..2017.08.08T00:00:00.000
date = rand(dates, n)
x = rand(10.0, n)
t = table(ID, date, x)

dbDate = database(, VALUE, 2017.08.07..2017.08.11)
dbID=database(, RANGE, 0 50 100)
db = database("dfs://compoDB", COMPO, [dbDate, dbID])

pt = db.createPartitionedTable(t, `pt, `date`ID)
pt.append!(t)

执行下面的查询语句:

select * from loadTable("dfs://compoDB""pt") where date between 2017.08.07:2017.08.08

报如下错误:

select * from loadTable("dfs://compoDB""pt") where date between 2017.08.07 : 2017.08.08 => Temporal data comparison should have the same data type.

请问哪里出了问题?

请先 登录 后评论

1 个回答

Jax Wu

应该与查询字段date的时间类型匹配,查询语句应该这样写:

select * from loadTable("dfs://compoDB", "pt") where date between 2017.08.07T00:00:00.000:2017.08.08T23:59:59.999

请先 登录 后评论