Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
cf2d49c5
Unverified
提交
cf2d49c5
authored
12月 15, 2018
作者:
Evgenij Ryazanov
提交者:
GitHub
12月 15, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1598 from katzyn/misc
Minor changes in parser and documentation
上级
c5652260
9042e61e
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
47 行增加
和
30 行删除
+47
-30
help.csv
h2/src/docsrc/help/help.csv
+23
-22
build.html
h2/src/docsrc/html/build.html
+1
-1
tutorial.html
h2/src/docsrc/html/tutorial.html
+1
-1
Parser.java
h2/src/main/org/h2/command/Parser.java
+13
-5
DateTimeFunctions.java
...rc/main/org/h2/expression/function/DateTimeFunctions.java
+0
-1
sum.sql
h2/src/test/org/h2/test/scripts/functions/aggregate/sum.sql
+9
-0
没有找到文件。
h2/src/docsrc/help/help.csv
浏览文件 @
cf2d49c5
...
...
@@ -3418,7 +3418,7 @@ INTERVAL MINUTE TO SECOND
"
"Functions (Aggregate)","AVG","
AVG ( [ DISTINCT ] { numeric } )
AVG ( [ DISTINCT
|ALL
] { numeric } )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The average (mean) value.
...
...
@@ -3474,7 +3474,7 @@ ANY(NAME LIKE 'W%')
"
"Functions (Aggregate)","COUNT","
COUNT( { * | { [ DISTINCT ] expression } } )
COUNT( { * | { [ DISTINCT
|ALL
] expression } } )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The count of all row, or of the non-null values.
...
...
@@ -3486,7 +3486,7 @@ COUNT(*)
"
"Functions (Aggregate)","GROUP_CONCAT","
GROUP_CONCAT ( [ DISTINCT ] string
GROUP_CONCAT ( [ DISTINCT
|ALL
] string
[ ORDER BY { expression [ ASC | DESC ] } [,...] ]
[ SEPARATOR expression ] )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
...
...
@@ -3501,7 +3501,7 @@ GROUP_CONCAT(NAME ORDER BY ID SEPARATOR ', ')
"
"Functions (Aggregate)","ARRAY_AGG","
ARRAY_AGG ( [ DISTINCT ] string
ARRAY_AGG ( [ DISTINCT
|ALL
] string
[ ORDER BY { expression [ ASC | DESC ] } [,...] ] )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
...
...
@@ -3538,7 +3538,7 @@ MIN(NAME)
"
"Functions (Aggregate)","SUM","
SUM( [ DISTINCT ] { numeric } )
SUM( [ DISTINCT
|ALL
] { numeric } )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The sum of all values.
...
...
@@ -3564,7 +3564,7 @@ SELECT SELECTIVITY(FIRSTNAME), SELECTIVITY(NAME) FROM TEST WHERE ROWNUM()<20000
"
"Functions (Aggregate)","STDDEV_POP","
STDDEV_POP( [ DISTINCT ] numeric )
STDDEV_POP( [ DISTINCT
|ALL
] numeric )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The population standard deviation.
...
...
@@ -3576,7 +3576,7 @@ STDDEV_POP(X)
"
"Functions (Aggregate)","STDDEV_SAMP","
STDDEV_SAMP( [ DISTINCT ] numeric )
STDDEV_SAMP( [ DISTINCT
|ALL
] numeric )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The sample standard deviation.
...
...
@@ -3588,7 +3588,7 @@ STDDEV(X)
"
"Functions (Aggregate)","VAR_POP","
VAR_POP( [ DISTINCT ] numeric )
VAR_POP( [ DISTINCT
|ALL
] numeric )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The population variance (square of the population standard deviation).
...
...
@@ -3600,7 +3600,7 @@ VAR_POP(X)
"
"Functions (Aggregate)","VAR_SAMP","
VAR_SAMP( [ DISTINCT ] numeric )
VAR_SAMP( [ DISTINCT
|ALL
] numeric )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The sample variance (square of the sample standard deviation).
...
...
@@ -3612,7 +3612,7 @@ VAR_SAMP(X)
"
"Functions (Aggregate)","MEDIAN","
MEDIAN( [ DISTINCT ] value )
MEDIAN( [ DISTINCT
|ALL
] value )
[FILTER (WHERE expression)] [OVER windowNameOrSpecification]
","
The value separating the higher half of a values from the lower half.
...
...
@@ -3672,7 +3672,8 @@ ABS(-2147483648) should be 2147483648, but this value is not allowed for this da
It leads to an exception.
To avoid it cast argument of this function to a higher data type.
","
ABS(ID)
ABS(VALUE)
ABS(CAST(VALUE AS BIGINT))
"
"Functions (Numeric)","ACOS","
...
...
@@ -4599,7 +4600,7 @@ DAYNAME(CREATED)
"
"Functions (Time and Date)","DAY_OF_MONTH","
DAY_OF_MONTH(dateAndTime)
DAY_OF_MONTH(dateAndTime
|interval
)
","
Returns the day of the month (1-31).
","
...
...
@@ -4623,7 +4624,7 @@ ISO_DAY_OF_WEEK(CREATED)
"
"Functions (Time and Date)","DAY_OF_YEAR","
DAY_OF_YEAR(dateAndTime)
DAY_OF_YEAR(dateAndTime
|interval
)
","
Returns the day of the year (1-366).
","
...
...
@@ -4657,7 +4658,7 @@ CALL FORMATDATETIME(TIMESTAMP '2001-02-03 04:05:06',
"
"Functions (Time and Date)","HOUR","
HOUR(dateAndTime)
HOUR(dateAndTime
|interval
)
","
Returns the hour (0-23) from a date/time value.
","
...
...
@@ -4665,7 +4666,7 @@ HOUR(CREATED)
"
"Functions (Time and Date)","MINUTE","
MINUTE(dateAndTime)
MINUTE(dateAndTime
|interval
)
","
Returns the minute (0-59) from a date/time value.
","
...
...
@@ -4673,7 +4674,7 @@ MINUTE(CREATED)
"
"Functions (Time and Date)","MONTH","
MONTH(dateAndTime)
MONTH(dateAndTime
|interval
)
","
Returns the month (1-12) from a date/time value.
","
...
...
@@ -4714,7 +4715,7 @@ SECOND(dateAndTime)
","
Returns the second (0-59) from a date/time value.
","
SECOND(CREATED)
SECOND(CREATED
|interval
)
"
"Functions (Time and Date)","WEEK","
...
...
@@ -4738,7 +4739,7 @@ ISO_WEEK(CREATED)
"
"Functions (Time and Date)","YEAR","
YEAR(dateAndTime)
YEAR(dateAndTime
|interval
)
","
Returns the year from a date/time value.
","
...
...
@@ -4756,10 +4757,10 @@ ISO_YEAR(CREATED)
"Functions (System)","ARRAY_GET","
ARRAY_GET(arrayExpression, indexExpression)
","
Returns
one element of
an array.
Returns
element at the specified 1-based index from
an array.
Returns NULL if there is no such element or array is NULL.
","
CALL ARRAY_GET(
('Hello', 'World')
, 2)
CALL ARRAY_GET(
ARRAY['Hello', 'World']
, 2)
"
"Functions (System)","ARRAY_LENGTH","
...
...
@@ -4768,7 +4769,7 @@ ARRAY_LENGTH(arrayExpression)
Returns the length of an array.
Returns NULL if the specified array is NULL.
","
CALL ARRAY_LENGTH(
('Hello', 'World')
)
CALL ARRAY_LENGTH(
ARRAY['Hello', 'World']
)
"
"Functions (System)","ARRAY_CONTAINS","
...
...
@@ -4777,7 +4778,7 @@ ARRAY_CONTAINS(arrayExpression, value)
Returns a boolean TRUE if the array contains the value or FALSE if it does not contain it.
Returns NULL if the specified array is NULL.
","
CALL ARRAY_CONTAINS(
('Hello', 'World')
, 'Hello')
CALL ARRAY_CONTAINS(
ARRAY['Hello', 'World']
, 'Hello')
"
"Functions (System)","AUTOCOMMIT","
...
...
h2/src/docsrc/html/build.html
浏览文件 @
cf2d49c5
...
...
@@ -116,7 +116,7 @@ build jarClient
<h3>
Using Apache Lucene
</h3>
<p>
Apache Lucene 5.5.5 is used for testing.
Newer versions up to 7.
5
.0 can also be used.
Newer versions up to 7.
6
.0 can also be used.
</p>
<h2
id=
"maven2"
>
Using Maven 2
</h2>
...
...
h2/src/docsrc/html/tutorial.html
浏览文件 @
cf2d49c5
...
...
@@ -1234,7 +1234,7 @@ org.h2.fulltext.FullText.searchData(conn, text, limit, offset);
<h3>
Using the Apache Lucene Fulltext Search
</h3>
<p>
To use the Apache Lucene full text search, you need the Lucene library in the classpath.
Apache Lucene 5.5.5 or later version up to 7.
5
.0 is required.
Apache Lucene 5.5.5 or later version up to 7.
6
.0 is required.
Newer versions may also work, but were not tested.
How to do that depends on the application; if you use the H2 Console, you can add the Lucene
jar file to the environment variables
<code>
H2DRIVERS
</code>
or
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
cf2d49c5
...
...
@@ -2949,7 +2949,7 @@ public class Parser {
if
(
readIf
(
ASTERISK
))
{
r
=
new
Aggregate
(
AggregateType
.
COUNT_ALL
,
null
,
currentSelect
,
false
);
}
else
{
boolean
distinct
=
read
If
(
DISTINCT
);
boolean
distinct
=
read
DistinctAgg
(
);
Expression
on
=
readExpression
();
if
(
on
instanceof
Wildcard
&&
!
distinct
)
{
// PostgreSQL compatibility: count(t.*)
...
...
@@ -2960,7 +2960,7 @@ public class Parser {
}
break
;
case
GROUP_CONCAT:
{
boolean
distinct
=
read
If
(
DISTINCT
);
boolean
distinct
=
read
DistinctAgg
(
);
if
(
equalsToken
(
"GROUP_CONCAT"
,
aggregateName
))
{
r
=
new
Aggregate
(
AggregateType
.
GROUP_CONCAT
,
readExpression
(),
currentSelect
,
distinct
);
if
(
readIf
(
ORDER
))
{
...
...
@@ -2985,7 +2985,7 @@ public class Parser {
break
;
}
case
ARRAY_AGG:
{
boolean
distinct
=
read
If
(
DISTINCT
);
boolean
distinct
=
read
DistinctAgg
(
);
r
=
new
Aggregate
(
AggregateType
.
ARRAY_AGG
,
readExpression
(),
currentSelect
,
distinct
);
if
(
readIf
(
ORDER
))
{
read
(
"BY"
);
...
...
@@ -3020,7 +3020,7 @@ public class Parser {
break
;
}
default
:
boolean
distinct
=
read
If
(
DISTINCT
);
boolean
distinct
=
read
DistinctAgg
(
);
r
=
new
Aggregate
(
aggregateType
,
readExpression
(),
currentSelect
,
distinct
);
break
;
}
...
...
@@ -3078,7 +3078,7 @@ public class Parser {
}
private
JavaAggregate
readJavaAggregate
(
UserAggregate
aggregate
)
{
boolean
distinct
=
read
If
(
DISTINCT
);
boolean
distinct
=
read
DistinctAgg
(
);
ArrayList
<
Expression
>
params
=
Utils
.
newSmallArrayList
();
do
{
params
.
add
(
readExpression
());
...
...
@@ -3089,6 +3089,14 @@ public class Parser {
return
agg
;
}
private
boolean
readDistinctAgg
()
{
if
(
readIf
(
DISTINCT
))
{
return
true
;
}
readIf
(
ALL
);
return
false
;
}
private
void
readFilterAndOver
(
AbstractAggregate
aggregate
)
{
if
(
readIf
(
"FILTER"
))
{
read
(
OPEN_PAREN
);
...
...
h2/src/main/org/h2/expression/function/DateTimeFunctions.java
浏览文件 @
cf2d49c5
...
...
@@ -642,7 +642,6 @@ public final class DateTimeFunctions {
v
=
IntervalUtils
.
monthsFromInterval
(
qualifier
,
negative
,
leading
,
remaining
);
break
;
case
DAY_OF_MONTH:
case
DAY_OF_WEEK:
case
DAY_OF_YEAR:
v
=
IntervalUtils
.
daysFromInterval
(
qualifier
,
negative
,
leading
,
remaining
);
break
;
...
...
h2/src/test/org/h2/test/scripts/functions/aggregate/sum.sql
浏览文件 @
cf2d49c5
...
...
@@ -26,6 +26,15 @@ select sum(v), sum(v) filter (where v >= 4) from test where v <= 10;
>
55
49
>
rows
:
1
insert
into
test
values
(
1
),
(
2
),
(
8
);
>
update
count
:
3
select
sum
(
v
),
sum
(
all
v
),
sum
(
distinct
v
)
from
test
;
>
SUM
(
V
)
SUM
(
V
)
SUM
(
DISTINCT
V
)
>
------ ------ ---------------
>
89
89
78
>
rows
:
1
drop
table
test
;
>
ok
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论