Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
Questdb
提交
759158df
Q
Questdb
项目概览
jobily
/
Questdb
11 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
Questdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
759158df
编写于
10月 27, 2019
作者:
V
Vlad Ilyushchenko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MISC: removed unused "id" field from TimezoneRule
GRIFFIN: timestamp_sequence() increment argument can be a function.
上级
82bc4287
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
21 addition
and
69 deletion
+21
-69
core/src/main/java/io/questdb/griffin/engine/functions/date/TimestampSequenceFunctionFactory.java
...gine/functions/date/TimestampSequenceFunctionFactory.java
+7
-13
core/src/main/java/io/questdb/std/microtime/FixedTimeZoneRule.java
...main/java/io/questdb/std/microtime/FixedTimeZoneRule.java
+1
-8
core/src/main/java/io/questdb/std/microtime/TimeZoneRuleFactory.java
...in/java/io/questdb/std/microtime/TimeZoneRuleFactory.java
+2
-2
core/src/main/java/io/questdb/std/microtime/TimeZoneRules.java
...src/main/java/io/questdb/std/microtime/TimeZoneRules.java
+0
-2
core/src/main/java/io/questdb/std/microtime/TimeZoneRulesImpl.java
...main/java/io/questdb/std/microtime/TimeZoneRulesImpl.java
+1
-8
core/src/main/java/io/questdb/std/time/FixedTimeZoneRule.java
.../src/main/java/io/questdb/std/time/FixedTimeZoneRule.java
+1
-8
core/src/main/java/io/questdb/std/time/TimeZoneRuleFactory.java
...rc/main/java/io/questdb/std/time/TimeZoneRuleFactory.java
+2
-2
core/src/main/java/io/questdb/std/time/TimeZoneRules.java
core/src/main/java/io/questdb/std/time/TimeZoneRules.java
+0
-2
core/src/main/java/io/questdb/std/time/TimeZoneRulesImpl.java
.../src/main/java/io/questdb/std/time/TimeZoneRulesImpl.java
+1
-8
core/src/test/java/io/questdb/griffin/engine/functions/date/TimestampSequenceFunctionFactoryTest.java
.../functions/date/TimestampSequenceFunctionFactoryTest.java
+0
-10
core/src/test/java/io/questdb/std/microtime/TimeZoneRulesImplTest.java
.../java/io/questdb/std/microtime/TimeZoneRulesImplTest.java
+3
-3
core/src/test/java/io/questdb/std/time/TimeZoneRulesImplTest.java
.../test/java/io/questdb/std/time/TimeZoneRulesImplTest.java
+3
-3
未找到文件。
core/src/main/java/io/questdb/griffin/engine/functions/date/TimestampSequenceFunctionFactory.java
浏览文件 @
759158df
...
...
@@ -38,34 +38,28 @@ import io.questdb.std.ObjList;
public
class
TimestampSequenceFunctionFactory
implements
FunctionFactory
{
@Override
public
String
getSignature
()
{
return
"timestamp_sequence(n
l
)"
;
return
"timestamp_sequence(n
L
)"
;
}
@Override
public
Function
newInstance
(
ObjList
<
Function
>
args
,
int
position
,
CairoConfiguration
configuration
)
throws
SqlException
{
final
long
start
=
args
.
getQuick
(
0
).
getTimestamp
(
null
);
final
long
increment
=
args
.
getQuick
(
1
).
getLong
(
null
);
if
(
increment
<
0
)
{
throw
SqlException
.
$
(
args
.
getQuick
(
1
).
getPosition
(),
"positive increment expected"
);
}
if
(
start
==
Numbers
.
LONG_NaN
)
{
return
new
TimestampConstant
(
args
.
getQuick
(
0
).
getPosition
(),
Numbers
.
LONG_NaN
);
}
return
new
Func
(
position
,
start
,
increment
);
return
new
TimestampSequenceFunction
(
position
,
start
,
args
.
getQuick
(
1
));
}
private
static
final
class
Func
extends
TimestampFunction
{
private
final
long
i
ncrement
;
private
static
final
class
TimestampSequenceFunction
extends
TimestampFunction
{
private
final
Function
longI
ncrement
;
private
final
long
start
;
private
long
next
;
public
Func
(
int
position
,
long
start
,
long
i
ncrement
)
{
public
TimestampSequenceFunction
(
int
position
,
long
start
,
Function
longI
ncrement
)
{
super
(
position
);
this
.
start
=
start
;
this
.
next
=
start
;
this
.
increment
=
i
ncrement
;
this
.
longIncrement
=
longI
ncrement
;
}
@Override
...
...
@@ -75,7 +69,7 @@ public class TimestampSequenceFunctionFactory implements FunctionFactory {
@Override
public
long
getTimestamp
(
Record
rec
)
{
final
long
result
=
next
;
next
+=
increment
;
next
+=
longIncrement
.
getLong
(
rec
)
;
return
result
;
}
...
...
core/src/main/java/io/questdb/std/microtime/FixedTimeZoneRule.java
浏览文件 @
759158df
...
...
@@ -25,18 +25,11 @@ package io.questdb.std.microtime;
public
class
FixedTimeZoneRule
implements
TimeZoneRules
{
private
final
long
offset
;
private
final
String
id
;
public
FixedTimeZoneRule
(
String
id
,
long
offset
)
{
this
.
id
=
id
;
public
FixedTimeZoneRule
(
long
offset
)
{
this
.
offset
=
offset
;
}
@Override
public
String
getId
()
{
return
id
;
}
@Override
public
long
getOffset
(
long
millis
,
int
year
,
boolean
leap
)
{
return
offset
;
...
...
core/src/main/java/io/questdb/std/microtime/TimeZoneRuleFactory.java
浏览文件 @
759158df
...
...
@@ -40,7 +40,7 @@ public class TimeZoneRuleFactory {
public
TimeZoneRuleFactory
()
{
int
index
=
0
;
for
(
String
z
:
ZoneId
.
getAvailableZoneIds
())
{
ruleList
.
add
(
new
TimeZoneRulesImpl
(
z
,
ZoneId
.
of
(
z
).
getRules
()));
ruleList
.
add
(
new
TimeZoneRulesImpl
(
ZoneId
.
of
(
z
).
getRules
()));
ruleMap
.
put
(
z
,
index
++);
}
...
...
@@ -57,7 +57,7 @@ public class TimeZoneRuleFactory {
// this could be fixed offset, try parsing value as one
long
offset
=
Timestamps
.
parseOffset
(
alias
,
0
,
alias
.
length
());
if
(
offset
!=
Long
.
MIN_VALUE
)
{
ruleList
.
add
(
new
FixedTimeZoneRule
(
alias
,
Numbers
.
decodeLowInt
(
offset
)
*
Timestamps
.
MILLI_MICROS
));
ruleList
.
add
(
new
FixedTimeZoneRule
(
Numbers
.
decodeLowInt
(
offset
)
*
Timestamps
.
MILLI_MICROS
));
ruleMap
.
put
(
key
,
index
++);
}
}
else
{
...
...
core/src/main/java/io/questdb/std/microtime/TimeZoneRules.java
浏览文件 @
759158df
...
...
@@ -24,8 +24,6 @@
package
io.questdb.std.microtime
;
public
interface
TimeZoneRules
{
String
getId
();
long
getOffset
(
long
millis
,
int
year
,
boolean
leap
);
long
getOffset
(
long
millis
);
...
...
core/src/main/java/io/questdb/std/microtime/TimeZoneRulesImpl.java
浏览文件 @
759158df
...
...
@@ -46,11 +46,9 @@ public class TimeZoneRulesImpl implements TimeZoneRules {
private
final
long
firstWall
;
private
final
long
lastWall
;
private
final
int
historyOverlapCheckCutoff
;
private
final
String
id
;
private
final
long
standardOffset
;
public
TimeZoneRulesImpl
(
String
id
,
ZoneRules
rules
)
{
this
.
id
=
id
;
public
TimeZoneRulesImpl
(
ZoneRules
rules
)
{
final
long
[]
savingsInstantTransition
=
(
long
[])
Unsafe
.
getUnsafe
().
getObject
(
rules
,
SAVING_INSTANT_TRANSITION
);
if
(
savingsInstantTransition
.
length
==
0
)
{
...
...
@@ -111,11 +109,6 @@ public class TimeZoneRulesImpl implements TimeZoneRules {
this
.
lastWall
=
this
.
wallOffsets
[
wallOffsets
.
length
-
1
]
*
Timestamps
.
SECOND_MICROS
;
}
@Override
public
String
getId
()
{
return
id
;
}
@Override
public
long
getOffset
(
long
micros
,
int
year
,
boolean
leap
)
{
if
(
standardOffset
!=
Long
.
MIN_VALUE
)
{
...
...
core/src/main/java/io/questdb/std/time/FixedTimeZoneRule.java
浏览文件 @
759158df
...
...
@@ -25,18 +25,11 @@ package io.questdb.std.time;
public
class
FixedTimeZoneRule
implements
TimeZoneRules
{
private
final
long
offset
;
private
final
String
id
;
public
FixedTimeZoneRule
(
String
id
,
long
offset
)
{
this
.
id
=
id
;
public
FixedTimeZoneRule
(
long
offset
)
{
this
.
offset
=
offset
;
}
@Override
public
String
getId
()
{
return
id
;
}
@Override
public
long
getOffset
(
long
millis
,
int
year
,
boolean
leap
)
{
return
offset
;
...
...
core/src/main/java/io/questdb/std/time/TimeZoneRuleFactory.java
浏览文件 @
759158df
...
...
@@ -40,7 +40,7 @@ public class TimeZoneRuleFactory {
public
TimeZoneRuleFactory
()
{
int
index
=
0
;
for
(
String
z
:
ZoneId
.
getAvailableZoneIds
())
{
ruleList
.
add
(
new
TimeZoneRulesImpl
(
z
,
ZoneId
.
of
(
z
).
getRules
()));
ruleList
.
add
(
new
TimeZoneRulesImpl
(
ZoneId
.
of
(
z
).
getRules
()));
ruleMap
.
put
(
z
,
index
++);
}
...
...
@@ -57,7 +57,7 @@ public class TimeZoneRuleFactory {
// this could be fixed offset, try parsing value as one
long
offset
=
Dates
.
parseOffset
(
alias
,
0
,
alias
.
length
());
if
(
offset
!=
Long
.
MIN_VALUE
)
{
ruleList
.
add
(
new
FixedTimeZoneRule
(
alias
,
Numbers
.
decodeLowInt
(
offset
)
*
Dates
.
MINUTE_MILLIS
));
ruleList
.
add
(
new
FixedTimeZoneRule
(
Numbers
.
decodeLowInt
(
offset
)
*
Dates
.
MINUTE_MILLIS
));
ruleMap
.
put
(
key
,
index
++);
}
}
else
{
...
...
core/src/main/java/io/questdb/std/time/TimeZoneRules.java
浏览文件 @
759158df
...
...
@@ -24,8 +24,6 @@
package
io.questdb.std.time
;
public
interface
TimeZoneRules
{
String
getId
();
long
getOffset
(
long
millis
,
int
year
,
boolean
leap
);
long
getOffset
(
long
millis
);
...
...
core/src/main/java/io/questdb/std/time/TimeZoneRulesImpl.java
浏览文件 @
759158df
...
...
@@ -46,11 +46,9 @@ public class TimeZoneRulesImpl implements TimeZoneRules {
private
final
long
firstWall
;
private
final
long
lastWall
;
private
final
int
historyOverlapCheckCutoff
;
private
final
String
id
;
private
final
long
standardOffset
;
public
TimeZoneRulesImpl
(
String
id
,
ZoneRules
rules
)
{
this
.
id
=
id
;
public
TimeZoneRulesImpl
(
ZoneRules
rules
)
{
final
long
[]
savingsInstantTransition
=
(
long
[])
Unsafe
.
getUnsafe
().
getObject
(
rules
,
SAVING_INSTANT_TRANSITION
);
if
(
savingsInstantTransition
.
length
==
0
)
{
...
...
@@ -111,11 +109,6 @@ public class TimeZoneRulesImpl implements TimeZoneRules {
this
.
lastWall
=
this
.
wallOffsets
[
wallOffsets
.
length
-
1
]
*
Dates
.
SECOND_MILLIS
;
}
@Override
public
String
getId
()
{
return
id
;
}
@Override
public
long
getOffset
(
long
millis
,
int
year
,
boolean
leap
)
{
if
(
standardOffset
!=
Long
.
MIN_VALUE
)
{
...
...
core/src/test/java/io/questdb/griffin/engine/functions/date/TimestampSequenceFunctionFactoryTest.java
浏览文件 @
759158df
...
...
@@ -34,11 +34,6 @@ import org.junit.Test;
public
class
TimestampSequenceFunctionFactoryTest
extends
AbstractFunctionFactoryTest
{
@Test
public
void
testIncrement1
()
throws
SqlException
{
assertFunction
(
call
(
0L
,
1000L
).
getFunction1
());
}
@Test
public
void
testIncrement2
()
throws
SqlException
{
assertFunction
(
call
(
0L
,
1000L
).
getFunction2
());
...
...
@@ -49,11 +44,6 @@ public class TimestampSequenceFunctionFactoryTest extends AbstractFunctionFactor
call
(
Numbers
.
LONG_NaN
,
1000L
).
andAssertTimestamp
(
Numbers
.
LONG_NaN
);
}
@Test
public
void
testNegativeIncrement
()
{
assertFailure
(
35
,
"positive increment expected"
,
0L
,
-
100L
);
}
@Override
protected
void
addExtraFunctions
()
{
functions
.
add
(
new
NegIntFunctionFactory
());
...
...
core/src/test/java/io/questdb/std/microtime/TimeZoneRulesImplTest.java
浏览文件 @
759158df
...
...
@@ -47,7 +47,7 @@ public class TimeZoneRulesImplTest {
for
(
String
z
:
zoneList
)
{
ZoneId
zone
=
ZoneId
.
of
(
z
);
zones
.
add
(
zone
);
zoneRules
.
add
(
new
TimeZoneRulesImpl
(
z
,
z
one
.
getRules
()));
zoneRules
.
add
(
new
TimeZoneRulesImpl
(
zone
.
getRules
()));
}
long
micros
=
Timestamps
.
toMicros
(
1900
,
1
,
1
,
0
,
0
);
...
...
@@ -100,7 +100,7 @@ public class TimeZoneRulesImplTest {
for
(
String
z
:
zoneList
)
{
ZoneId
zone
=
ZoneId
.
of
(
z
);
zones
.
add
(
zone
);
zoneRules
.
add
(
new
TimeZoneRulesImpl
(
z
,
z
one
.
getRules
()));
zoneRules
.
add
(
new
TimeZoneRulesImpl
(
zone
.
getRules
()));
}
long
millis
=
Timestamps
.
toMicros
(
1900
,
1
,
1
,
0
,
0
);
...
...
@@ -117,7 +117,7 @@ public class TimeZoneRulesImplTest {
@Test
public
void
testSingle
()
{
ZoneId
zone
=
ZoneId
.
of
(
"GMT"
);
TimeZoneRulesImpl
rules
=
new
TimeZoneRulesImpl
(
"GMT"
,
zone
.
getRules
());
TimeZoneRulesImpl
rules
=
new
TimeZoneRulesImpl
(
zone
.
getRules
());
int
y
=
2017
;
int
m
=
3
;
...
...
core/src/test/java/io/questdb/std/time/TimeZoneRulesImplTest.java
浏览文件 @
759158df
...
...
@@ -47,7 +47,7 @@ public class TimeZoneRulesImplTest {
for
(
String
z
:
zoneList
)
{
ZoneId
zone
=
ZoneId
.
of
(
z
);
zones
.
add
(
zone
);
zoneRules
.
add
(
new
TimeZoneRulesImpl
(
z
,
z
one
.
getRules
()));
zoneRules
.
add
(
new
TimeZoneRulesImpl
(
zone
.
getRules
()));
}
long
micros
=
Dates
.
toMillis
(
1900
,
1
,
1
,
0
,
0
);
...
...
@@ -100,7 +100,7 @@ public class TimeZoneRulesImplTest {
for
(
String
z
:
zoneList
)
{
ZoneId
zone
=
ZoneId
.
of
(
z
);
zones
.
add
(
zone
);
zoneRules
.
add
(
new
TimeZoneRulesImpl
(
z
,
z
one
.
getRules
()));
zoneRules
.
add
(
new
TimeZoneRulesImpl
(
zone
.
getRules
()));
}
long
millis
=
Dates
.
toMillis
(
1900
,
1
,
1
,
0
,
0
);
...
...
@@ -117,7 +117,7 @@ public class TimeZoneRulesImplTest {
@Test
public
void
testSingle
()
{
ZoneId
zone
=
ZoneId
.
of
(
"GMT"
);
TimeZoneRulesImpl
rules
=
new
TimeZoneRulesImpl
(
"GMT"
,
zone
.
getRules
());
TimeZoneRulesImpl
rules
=
new
TimeZoneRulesImpl
(
zone
.
getRules
());
int
y
=
2017
;
int
m
=
3
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录