Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Iotdb
提交
c8151668
I
Iotdb
项目概览
apache
/
Iotdb
10 个月 前同步成功
通知
25
Star
3344
Fork
916
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
Iotdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
c8151668
编写于
11月 22, 2020
作者:
B
Benedict Jin
提交者:
GitHub
11月 22, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use min or max method of Math to improve readability (#2103)
上级
93b367df
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
15 addition
and
15 deletion
+15
-15
server/src/main/java/org/apache/iotdb/db/engine/merge/selector/MaxFileMergeFileSelector.java
...db/db/engine/merge/selector/MaxFileMergeFileSelector.java
+2
-2
server/src/main/java/org/apache/iotdb/db/engine/merge/task/MergeFileTask.java
.../org/apache/iotdb/db/engine/merge/task/MergeFileTask.java
+1
-1
server/src/main/java/org/apache/iotdb/db/utils/datastructure/BinaryTVList.java
...org/apache/iotdb/db/utils/datastructure/BinaryTVList.java
+1
-1
server/src/main/java/org/apache/iotdb/db/utils/datastructure/BooleanTVList.java
...rg/apache/iotdb/db/utils/datastructure/BooleanTVList.java
+1
-1
server/src/main/java/org/apache/iotdb/db/utils/datastructure/DoubleTVList.java
...org/apache/iotdb/db/utils/datastructure/DoubleTVList.java
+1
-1
server/src/main/java/org/apache/iotdb/db/utils/datastructure/FloatTVList.java
.../org/apache/iotdb/db/utils/datastructure/FloatTVList.java
+1
-1
server/src/main/java/org/apache/iotdb/db/utils/datastructure/IntTVList.java
...va/org/apache/iotdb/db/utils/datastructure/IntTVList.java
+1
-1
server/src/main/java/org/apache/iotdb/db/utils/datastructure/LongTVList.java
...a/org/apache/iotdb/db/utils/datastructure/LongTVList.java
+1
-1
server/src/main/java/org/apache/iotdb/db/utils/datastructure/TVList.java
.../java/org/apache/iotdb/db/utils/datastructure/TVList.java
+4
-4
tsfile/src/main/java/org/apache/iotdb/tsfile/utils/ReadWriteForEncodingUtils.java
.../apache/iotdb/tsfile/utils/ReadWriteForEncodingUtils.java
+2
-2
未找到文件。
server/src/main/java/org/apache/iotdb/db/engine/merge/selector/MaxFileMergeFileSelector.java
浏览文件 @
c8151668
...
...
@@ -316,7 +316,7 @@ public class MaxFileMergeFileSelector implements IMergeFileSelector {
long
singleSeriesCost
=
calculateTightFileMemoryCost
(
seqFile
,
this
::
calculateMetadataSize
);
long
multiSeriesCost
=
concurrentMergeNum
*
singleSeriesCost
;
long
maxCost
=
calculateMetadataSize
(
seqFile
);
return
multiSeriesCost
>
maxCost
?
maxCost
:
multiSeriesCost
;
return
Math
.
min
(
multiSeriesCost
,
maxCost
)
;
}
// this method traverses all ChunkMetadata to find out which series has the most chunks and uses
...
...
@@ -325,7 +325,7 @@ public class MaxFileMergeFileSelector implements IMergeFileSelector {
long
singleSeriesCost
=
calculateTightFileMemoryCost
(
unseqFile
,
TsFileResource:
:
getTsFileSize
);
long
multiSeriesCost
=
concurrentMergeNum
*
singleSeriesCost
;
long
maxCost
=
unseqFile
.
getTsFileSize
();
return
multiSeriesCost
>
maxCost
?
maxCost
:
multiSeriesCost
;
return
Math
.
min
(
multiSeriesCost
,
maxCost
)
;
}
@Override
...
...
server/src/main/java/org/apache/iotdb/db/engine/merge/task/MergeFileTask.java
浏览文件 @
c8151668
...
...
@@ -223,7 +223,7 @@ class MergeFileTask {
if
(
metaData
.
getStartTime
()
==
startTime
)
{
Chunk
chunk
=
reader
.
readMemChunk
(
metaData
);
fileWriter
.
writeChunk
(
chunk
,
metaData
);
maxVersion
=
metaData
.
getVersion
()
>
maxVersion
?
metaData
.
getVersion
()
:
maxVersion
;
maxVersion
=
Math
.
max
(
metaData
.
getVersion
(),
maxVersion
)
;
context
.
incTotalPointWritten
(
metaData
.
getNumOfPoints
());
break
;
}
...
...
server/src/main/java/org/apache/iotdb/db/utils/datastructure/BinaryTVList.java
浏览文件 @
c8151668
...
...
@@ -47,7 +47,7 @@ public class BinaryTVList extends TVList {
checkExpansion
();
int
arrayIndex
=
size
/
ARRAY_SIZE
;
int
elementIndex
=
size
%
ARRAY_SIZE
;
minTime
=
minTime
<=
timestamp
?
minTime
:
timestamp
;
minTime
=
Math
.
min
(
minTime
,
timestamp
)
;
timestamps
.
get
(
arrayIndex
)[
elementIndex
]
=
timestamp
;
values
.
get
(
arrayIndex
)[
elementIndex
]
=
value
;
size
++;
...
...
server/src/main/java/org/apache/iotdb/db/utils/datastructure/BooleanTVList.java
浏览文件 @
c8151668
...
...
@@ -46,7 +46,7 @@ public class BooleanTVList extends TVList {
checkExpansion
();
int
arrayIndex
=
size
/
ARRAY_SIZE
;
int
elementIndex
=
size
%
ARRAY_SIZE
;
minTime
=
minTime
<=
timestamp
?
minTime
:
timestamp
;
minTime
=
Math
.
min
(
minTime
,
timestamp
)
;
timestamps
.
get
(
arrayIndex
)[
elementIndex
]
=
timestamp
;
values
.
get
(
arrayIndex
)[
elementIndex
]
=
value
;
size
++;
...
...
server/src/main/java/org/apache/iotdb/db/utils/datastructure/DoubleTVList.java
浏览文件 @
c8151668
...
...
@@ -47,7 +47,7 @@ public class DoubleTVList extends TVList {
checkExpansion
();
int
arrayIndex
=
size
/
ARRAY_SIZE
;
int
elementIndex
=
size
%
ARRAY_SIZE
;
minTime
=
minTime
<=
timestamp
?
minTime
:
timestamp
;
minTime
=
Math
.
min
(
minTime
,
timestamp
)
;
timestamps
.
get
(
arrayIndex
)[
elementIndex
]
=
timestamp
;
values
.
get
(
arrayIndex
)[
elementIndex
]
=
value
;
size
++;
...
...
server/src/main/java/org/apache/iotdb/db/utils/datastructure/FloatTVList.java
浏览文件 @
c8151668
...
...
@@ -48,7 +48,7 @@ public class FloatTVList extends TVList {
checkExpansion
();
int
arrayIndex
=
size
/
ARRAY_SIZE
;
int
elementIndex
=
size
%
ARRAY_SIZE
;
minTime
=
minTime
<=
timestamp
?
minTime
:
timestamp
;
minTime
=
Math
.
min
(
minTime
,
timestamp
)
;
timestamps
.
get
(
arrayIndex
)[
elementIndex
]
=
timestamp
;
values
.
get
(
arrayIndex
)[
elementIndex
]
=
value
;
size
++;
...
...
server/src/main/java/org/apache/iotdb/db/utils/datastructure/IntTVList.java
浏览文件 @
c8151668
...
...
@@ -46,7 +46,7 @@ public class IntTVList extends TVList {
checkExpansion
();
int
arrayIndex
=
size
/
ARRAY_SIZE
;
int
elementIndex
=
size
%
ARRAY_SIZE
;
minTime
=
minTime
<=
timestamp
?
minTime
:
timestamp
;
minTime
=
Math
.
min
(
minTime
,
timestamp
)
;
timestamps
.
get
(
arrayIndex
)[
elementIndex
]
=
timestamp
;
values
.
get
(
arrayIndex
)[
elementIndex
]
=
value
;
size
++;
...
...
server/src/main/java/org/apache/iotdb/db/utils/datastructure/LongTVList.java
浏览文件 @
c8151668
...
...
@@ -46,7 +46,7 @@ public class LongTVList extends TVList {
checkExpansion
();
int
arrayIndex
=
size
/
ARRAY_SIZE
;
int
elementIndex
=
size
%
ARRAY_SIZE
;
minTime
=
minTime
<=
timestamp
?
minTime
:
timestamp
;
minTime
=
Math
.
min
(
minTime
,
timestamp
)
;
timestamps
.
get
(
arrayIndex
)[
elementIndex
]
=
timestamp
;
values
.
get
(
arrayIndex
)[
elementIndex
]
=
value
;
size
++;
...
...
server/src/main/java/org/apache/iotdb/db/utils/datastructure/TVList.java
浏览文件 @
c8151668
...
...
@@ -187,7 +187,7 @@ public abstract class TVList {
long
time
=
getTime
(
i
);
if
(
time
<
lowerBound
||
time
>
upperBound
)
{
set
(
i
,
newSize
++);
minTime
=
time
<
minTime
?
time
:
minTime
;
minTime
=
Math
.
min
(
time
,
minTime
)
;
}
}
int
deletedNumber
=
size
-
newSize
;
...
...
@@ -245,7 +245,7 @@ public abstract class TVList {
abstract
void
clearValue
();
/**
* The arrays for sorting are not including in write memory now,
* The arrays for sorting are not including in write memory now,
* the memory usage is considered as temporary memory.
*/
abstract
void
clearSortedValue
();
...
...
@@ -452,12 +452,12 @@ public abstract class TVList {
long
inPutMinTime
=
Long
.
MAX_VALUE
;
boolean
inputSorted
=
true
;
for
(
int
i
=
start
;
i
<
end
;
i
++)
{
inPutMinTime
=
inPutMinTime
<=
time
[
i
]
?
inPutMinTime
:
time
[
i
]
;
inPutMinTime
=
Math
.
min
(
inPutMinTime
,
time
[
i
])
;
if
(
inputSorted
&&
i
<
length
-
1
&&
time
[
i
]
>
time
[
i
+
1
])
{
inputSorted
=
false
;
}
}
minTime
=
inPutMinTime
<
minTime
?
inPutMinTime
:
minTime
;
minTime
=
Math
.
min
(
inPutMinTime
,
minTime
)
;
sorted
=
sorted
&&
inputSorted
&&
(
size
==
0
||
inPutMinTime
>=
getTime
(
size
-
1
));
}
...
...
tsfile/src/main/java/org/apache/iotdb/tsfile/utils/ReadWriteForEncodingUtils.java
浏览文件 @
c8151668
...
...
@@ -44,7 +44,7 @@ public class ReadWriteForEncodingUtils {
int
max
=
1
;
for
(
int
num
:
list
)
{
int
bitWidth
=
32
-
Integer
.
numberOfLeadingZeros
(
num
);
max
=
bitWidth
>
max
?
bitWidth
:
max
;
max
=
Math
.
max
(
bitWidth
,
max
)
;
}
return
max
;
}
...
...
@@ -59,7 +59,7 @@ public class ReadWriteForEncodingUtils {
int
max
=
1
;
for
(
long
num
:
list
)
{
int
bitWidth
=
64
-
Long
.
numberOfLeadingZeros
(
num
);
max
=
bitWidth
>
max
?
bitWidth
:
max
;
max
=
Math
.
max
(
bitWidth
,
max
)
;
}
return
max
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录