Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
f3ac8c41
提交
f3ac8c41
authored
2月 08, 2018
作者:
thomasmueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Javadocs
上级
145b71b5
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
73 行增加
和
45 行删除
+73
-45
changelog.html
h2/src/docsrc/html/changelog.html
+29
-29
Aggregate.java
h2/src/main/org/h2/expression/Aggregate.java
+1
-1
AggregateDataMedian.java
h2/src/main/org/h2/expression/AggregateDataMedian.java
+21
-11
ConditionInParameter.java
h2/src/main/org/h2/expression/ConditionInParameter.java
+1
-1
AbstractBaseForCommonTableExpressions.java
...org/h2/test/db/AbstractBaseForCommonTableExpressions.java
+14
-1
TestDateTimeUtils.java
h2/src/test/org/h2/test/unit/TestDateTimeUtils.java
+4
-2
dictionary.txt
h2/src/tools/org/h2/build/doc/dictionary.txt
+3
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
f3ac8c41
...
...
@@ -35,55 +35,55 @@ Change Log
</li>
<li>
PR #798: Add partial support of DATE, TIME, and TIMESTAMP data types to PgServer
</li>
<li>
PR #799: Use result of ArrayList.remove()
<li>
PR #799: Use result of ArrayList.remove()
</li>
<li>
PR #797: Add ceilingKey() and floorKey() to TransactionMap (version 2)
<li>
PR #797: Add ceilingKey() and floorKey() to TransactionMap (version 2)
</li>
<li>
PR #796: Add MDY to DateStyle in PgServerThread
<li>
PR #796: Add MDY to DateStyle in PgServerThread
</li>
<li>
PR #794: Sort files in generated jars
<li>
PR #794: Sort files in generated jars
</li>
<li>
PR #793: Change return type of Value.getBoolean() to boolean (unwrapped)
<li>
PR #793: Change return type of Value.getBoolean() to boolean (unwrapped)
</li>
<li>
PR #792: Inherit classpath from parent process
<li>
PR #792: Inherit classpath from parent process
</li>
<li>
PR #791: Switch to JaCoCo code coverage
<li>
PR #791: Switch to JaCoCo code coverage
</li>
<li>
PR #788: Update lists of keywords
<li>
PR #788: Update lists of keywords
</li>
<li>
PR #789: Map DATE in Oracle mode to ValueTimestamp
<li>
PR #789: Map DATE in Oracle mode to ValueTimestamp
</li>
<li>
PR #787: Assorted changes
<li>
PR #787: Assorted changes
</li>
<li>
PR #785: Optimize NULL handling in MVSecondaryIndex.add()
<li>
PR #785: Optimize NULL handling in MVSecondaryIndex.add()
</li>
<li>
PR #783: Add Bits implementation for Java 9 and later versions
<li>
PR #783: Add Bits implementation for Java 9 and later versions
</li>
<li>
PR #784: Hardcoded port numbers should not be used in unit tests
<li>
PR #784: Hardcoded port numbers should not be used in unit tests
</li>
<li>
PR #780: Close JavaFileManager after use.
<li>
PR #780: Close JavaFileManager after use.
</li>
<li>
PR #782: Leftover shared lock after release
<li>
PR #782: Leftover shared lock after release
</li>
<li>
PR #781: Locks left behind after commit
<li>
PR #781: Locks left behind after commit
</li>
<li>
PR #778: Reduce code duplication
<li>
PR #778: Reduce code duplication
</li>
<li>
PR #775: Fix building of documentation and zip
<li>
PR #775: Fix building of documentation and zip
</li>
<li>
PR #774: Assorted changes
<li>
PR #774: Assorted changes
</li>
<li>
PR #773: Better checks for arguments of partial LOB reading methods
<li>
PR #773: Better checks for arguments of partial LOB reading methods
</li>
<li>
PR #772: getBinaryStream() and getCharacterStream() with pos and length
</li>
<li>
Issue #754: Make NUMERIC type read as NUMERIC
</li>
<li>
PR #768: Add DataUtils.parseChecksummedMap()
<li>
PR #768: Add DataUtils.parseChecksummedMap()
</li>
<li>
PR #769: Do not copy result of DataUtils.parseMap() to a new maps
<li>
PR #769: Do not copy result of DataUtils.parseMap() to a new maps
</li>
<li>
PR #766: Minor clean up of DateTimeUtils
<li>
PR #766: Minor clean up of DateTimeUtils
</li>
<li>
PR #764: Make use of try-with-resources statement
</li>
...
...
@@ -109,7 +109,7 @@ Change Log
</li>
<li>
PR #750: Use AtomicIntegerArray and StandardCharsets
</li>
<li>
PR #749: Fix some build checks in sources
<li>
PR #749: Fix some build checks in sources
</li>
<li>
Issue #740: TestWeb hangups if webSSL=true specified in configuration
</li>
...
...
@@ -125,7 +125,7 @@ Change Log
</li>
<li>
PR #738: Copy javadoc to *BackwardsCompat to fix building of documentation
</li>
<li>
PR #735: Add support of java.time.Instant V2
<li>
PR #735: Add support of java.time.Instant V2
</li>
<li>
PR #733: Remove JPA/ORM configuration txt files as they're already integrated
</li>
...
...
@@ -139,15 +139,15 @@ Change Log
</li>
<li>
PR #726: Fixes in tests
</li>
<li>
Issue #725: FilePathMem.tryLock() fails since Java 9
<li>
Issue #725: FilePathMem.tryLock() fails since Java 9
</li>
<li>
PR #723: Clean up LocalDateTimeUtils
<li>
PR #723: Clean up LocalDateTimeUtils
</li>
<li>
PR #724: Use StringBuilder instead of StringBuffer
<li>
PR #724: Use StringBuilder instead of StringBuffer
</li>
<li>
PR #720: DROP TABLE RESTRICT shouldn't drop foreign keys in other tables
</li>
<li>
PR #722: Assorted minor changes
<li>
PR #722: Assorted minor changes
</li>
<li>
Issue #638: Oracle mode: incompatible regexp back-reference syntax
</li>
...
...
h2/src/main/org/h2/expression/Aggregate.java
浏览文件 @
f3ac8c41
...
...
@@ -311,7 +311,7 @@ public class Aggregate extends Expression {
return
v
;
}
case
MEDIAN:
{
return
AggregateDataMedian
.
getFromIndex
(
session
,
on
,
dataType
);
return
AggregateDataMedian
.
get
Result
FromIndex
(
session
,
on
,
dataType
);
}
default
:
DbException
.
throwInternalError
(
"type="
+
type
);
...
...
h2/src/main/org/h2/expression/AggregateDataMedian.java
浏览文件 @
f3ac8c41
...
...
@@ -49,6 +49,12 @@ class AggregateDataMedian extends AggregateData {
||
(
sortType
&
SortOrder
.
DESCENDING
)
!=
0
&&
(
sortType
&
SortOrder
.
NULLS_FIRST
)
==
0
;
}
/**
* Get the index (if any) for the column specified in the median aggregate.
*
* @param on the expression (usually a column expression)
* @return the index, or null
*/
static
Index
getMedianColumnIndex
(
Expression
on
)
{
if
(
on
instanceof
ExpressionColumn
)
{
ExpressionColumn
col
=
(
ExpressionColumn
)
on
;
...
...
@@ -68,8 +74,8 @@ class AggregateDataMedian extends AggregateData {
if
(!
index
.
isFirstColumn
(
column
))
{
continue
;
}
if
(
result
==
null
||
result
.
getColumns
().
length
>
index
.
getColumns
().
length
// Prefer index without nulls last for nullable columns
if
(
result
==
null
||
result
.
getColumns
().
length
>
index
.
getColumns
().
length
||
nullable
&&
isNullsLast
(
result
)
&&
!
isNullsLast
(
index
))
{
result
=
index
;
}
...
...
@@ -81,7 +87,15 @@ class AggregateDataMedian extends AggregateData {
return
null
;
}
static
Value
getFromIndex
(
Session
session
,
Expression
on
,
int
dataType
)
{
/**
* Get the result from the index.
*
* @param session the session
* @param on the expression
* @param dataType the data type
* @return the result
*/
static
Value
getResultFromIndex
(
Session
session
,
Expression
on
,
int
dataType
)
{
Index
index
=
getMedianColumnIndex
(
on
);
long
count
=
index
.
getRowCount
(
session
);
if
(
count
==
0
)
{
...
...
@@ -94,10 +108,8 @@ class AggregateDataMedian extends AggregateData {
if
(
expr
.
getColumn
().
isNullable
())
{
boolean
hasNulls
=
false
;
SearchRow
row
;
/*
* Try to skip nulls from the start first with the same cursor that will be used
* to read values.
*/
// Try to skip nulls from the start first with the same cursor that
// will be used to read values.
while
(
count
>
0
)
{
row
=
cursor
.
getSearchRow
();
if
(
row
==
null
)
{
...
...
@@ -113,10 +125,8 @@ class AggregateDataMedian extends AggregateData {
if
(
count
==
0
)
{
return
ValueNull
.
INSTANCE
;
}
/*
* If no nulls found and if index orders nulls last create a second cursor to
* count nulls at the end.
*/
// If no nulls found and if index orders nulls last create a second
// cursor to count nulls at the end.
if
(!
hasNulls
&&
isNullsLast
(
index
))
{
TableFilter
tableFilter
=
expr
.
getTableFilter
();
SearchRow
check
=
tableFilter
.
getTable
().
getTemplateSimpleRow
(
true
);
...
...
@@ -196,7 +206,7 @@ class AggregateDataMedian extends AggregateData {
return
getMedian
(
a
[
idx
-
1
],
v1
,
dataType
,
mode
);
}
static
Value
getMedian
(
Value
v0
,
Value
v1
,
int
dataType
,
CompareMode
mode
)
{
private
static
Value
getMedian
(
Value
v0
,
Value
v1
,
int
dataType
,
CompareMode
mode
)
{
if
(
v0
.
compareTo
(
v1
,
mode
)
==
0
)
{
return
v0
.
convertTo
(
dataType
);
}
...
...
h2/src/main/org/h2/expression/ConditionInParameter.java
浏览文件 @
f3ac8c41
...
...
@@ -57,7 +57,7 @@ public class ConditionInParameter extends Condition {
private
Expression
left
;
final
Parameter
parameter
;
private
final
Parameter
parameter
;
/**
* Create a new {@code = ANY(?)} condition.
...
...
h2/src/test/org/h2/test/db/AbstractBaseForCommonTableExpressions.java
浏览文件 @
f3ac8c41
...
...
@@ -17,7 +17,20 @@ import org.h2.test.TestBase;
*/
public
abstract
class
AbstractBaseForCommonTableExpressions
extends
TestBase
{
protected
void
testRepeatedQueryWithSetup
(
int
maxRetries
,
String
[]
expectedRowData
,
String
[]
expectedColumnNames
,
/**
* Test a query.
*
* @param maxRetries the number of times the query is run
* @param expectedRowData the expected result data
* @param expectedColumnNames the expected columns of the result
* @param expectedNumberOfRows the expected number of rows
* @param setupSQL the SQL statement used for setup
* @param withQuery the query
* @param closeAndReopenDatabaseConnectionOnIteration whether the connection
* should be re-opened each time
* @param expectedColumnTypes the expected datatypes of the result
*/
void
testRepeatedQueryWithSetup
(
int
maxRetries
,
String
[]
expectedRowData
,
String
[]
expectedColumnNames
,
int
expectedNumberOfRows
,
String
setupSQL
,
String
withQuery
,
int
closeAndReopenDatabaseConnectionOnIteration
,
String
[]
expectedColumnTypes
)
throws
SQLException
{
...
...
h2/src/test/org/h2/test/unit/TestDateTimeUtils.java
浏览文件 @
f3ac8c41
...
...
@@ -63,7 +63,8 @@ public class TestDateTimeUtils extends TestBase {
int
isoDow
=
(
dow
+
5
)
%
7
+
1
;
assertEquals
(
isoDow
,
DateTimeUtils
.
getIsoDayOfWeek
(
dateValue
));
assertEquals
(
gc
.
get
(
Calendar
.
WEEK_OF_YEAR
),
DateTimeUtils
.
getWeekOfYear
(
dateValue
,
gc
.
getFirstDayOfWeek
()
-
1
,
gc
.
getMinimalDaysInFirstWeek
()));
DateTimeUtils
.
getWeekOfYear
(
dateValue
,
gc
.
getFirstDayOfWeek
()
-
1
,
gc
.
getMinimalDaysInFirstWeek
()));
}
}
...
...
@@ -83,7 +84,8 @@ public class TestDateTimeUtils extends TestBase {
gc
.
clear
();
gc
.
setTimeInMillis
(
i
*
86400000L
);
assertEquals
(
gc
.
get
(
Calendar
.
DAY_OF_YEAR
),
DateTimeUtils
.
getDayOfYear
(
dateValue
));
assertEquals
(
gc
.
get
(
Calendar
.
WEEK_OF_YEAR
),
DateTimeUtils
.
getWeekOfYear
(
dateValue
,
firstDay
-
1
,
minimalDays
));
assertEquals
(
gc
.
get
(
Calendar
.
WEEK_OF_YEAR
),
DateTimeUtils
.
getWeekOfYear
(
dateValue
,
firstDay
-
1
,
minimalDays
));
assertEquals
(
gc
.
getWeekYear
(),
DateTimeUtils
.
getWeekYear
(
dateValue
,
firstDay
-
1
,
minimalDays
));
}
}
...
...
h2/src/tools/org/h2/build/doc/dictionary.txt
浏览文件 @
f3ac8c41
...
...
@@ -763,3 +763,6 @@ assorted reimplemented hangups confirmation predefined
mdy destfile hclf forbids spellchecking selfdestruct expects accident jacocoagent cli historic mitigate
jacoco xdata invokes sourcefiles classfiles duplication crypto stacktraces prt directions handled overly asm hardcoded
interpolated thead
die weekdiff osx subprocess dow proleptic
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论