Unverified 提交 88a7bfaa authored 作者: Noel Grandin's avatar Noel Grandin 提交者: GitHub

Merge pull request #843 from katzyn/misc

Add MEDIAN to help.csv and fix building of documentation
...@@ -498,7 +498,7 @@ qualified class name. The class must implement the interface ...@@ -498,7 +498,7 @@ qualified class name. The class must implement the interface
Admin rights are required to execute this command. Admin rights are required to execute this command.
This command commits an open transaction in this connection. This command commits an open transaction in this connection.
"," ","
CREATE AGGREGATE MEDIAN FOR ""com.acme.db.Median"" CREATE AGGREGATE SIMPLE_MEDIAN FOR ""com.acme.db.Median""
" "
"Commands (DDL)","CREATE ALIAS"," "Commands (DDL)","CREATE ALIAS","
...@@ -821,7 +821,7 @@ Drops an existing user-defined aggregate function. ...@@ -821,7 +821,7 @@ Drops an existing user-defined aggregate function.
Admin rights are required to execute this command. Admin rights are required to execute this command.
This command commits an open transaction in this connection. This command commits an open transaction in this connection.
"," ","
DROP AGGREGATE MEDIAN DROP AGGREGATE SIMPLE_MEDIAN
" "
"Commands (DDL)","DROP ALIAS"," "Commands (DDL)","DROP ALIAS","
...@@ -2801,6 +2801,19 @@ Aggregates are only allowed in select statements. ...@@ -2801,6 +2801,19 @@ Aggregates are only allowed in select statements.
VAR_SAMP(X) VAR_SAMP(X)
" "
"Functions (Aggregate)","MEDIAN","
MEDIAN( [ DISTINCT ] value )
","
The value separating the higher half of a values from the lower half.
Returns the middle value or an interpolated value between two middle values if number of values is even.
Interpolation is only supported for numeric, date, and time data types.
NULL values are ignored in the calculation.
If no rows are selected, the result is NULL.
Aggregates are only allowed in select statements.
","
MEDIAN(X)
"
"Functions (Numeric)","ABS"," "Functions (Numeric)","ABS","
ABS ( { numeric } ) ABS ( { numeric } )
"," ","
......
...@@ -77,7 +77,7 @@ public class Select extends Query { ...@@ -77,7 +77,7 @@ public class Select extends Query {
boolean[] groupByExpression; boolean[] groupByExpression;
/** /**
* Thhe current group-by values. * The current group-by values.
*/ */
HashMap<Expression, Object> currentGroup; HashMap<Expression, Object> currentGroup;
......
...@@ -131,7 +131,7 @@ public class Aggregate extends Expression { ...@@ -131,7 +131,7 @@ public class Aggregate extends Expression {
MEDIAN MEDIAN
} }
private static final HashMap<String, AggregateType> AGGREGATES = new HashMap<>(24); private static final HashMap<String, AggregateType> AGGREGATES = new HashMap<>(25);
private final AggregateType type; private final AggregateType type;
private final Select select; private final Select select;
......
...@@ -27,38 +27,38 @@ public class Operation extends Expression { ...@@ -27,38 +27,38 @@ public class Operation extends Expression {
* This operation represents a string concatenation as in * This operation represents a string concatenation as in
* 'Hello' || 'World'. * 'Hello' || 'World'.
*/ */
CONCAT, CONCAT,
/** /**
* This operation represents an addition as in 1 + 2. * This operation represents an addition as in 1 + 2.
*/ */
PLUS, PLUS,
/** /**
* This operation represents a subtraction as in 2 - 1. * This operation represents a subtraction as in 2 - 1.
*/ */
MINUS, MINUS,
/** /**
* This operation represents a multiplication as in 2 * 3. * This operation represents a multiplication as in 2 * 3.
*/ */
MULTIPLY, MULTIPLY,
/** /**
* This operation represents a division as in 4 * 2. * This operation represents a division as in 4 * 2.
*/ */
DIVIDE, DIVIDE,
/** /**
* This operation represents a negation as in - ID. * This operation represents a negation as in - ID.
*/ */
NEGATE, NEGATE,
/** /**
* This operation represents a modulus as in 5 % 2. * This operation represents a modulus as in 5 % 2.
*/ */
MODULUS MODULUS
}; }
private OpType opType; private OpType opType;
private Expression left, right; private Expression left, right;
......
...@@ -262,7 +262,8 @@ public class TestIndex extends TestBase { ...@@ -262,7 +262,8 @@ public class TestIndex extends TestBase {
c.close(); c.close();
} }
private void testConcurrentUpdateRun(ConcurrentUpdateThread[] threads, PreparedStatement check) throws SQLException { private void testConcurrentUpdateRun(ConcurrentUpdateThread[] threads, PreparedStatement check)
throws SQLException {
for (ConcurrentUpdateThread t : threads) { for (ConcurrentUpdateThread t : threads) {
t.start(); t.start();
} }
......
...@@ -307,10 +307,10 @@ public class TestValue extends TestBase { ...@@ -307,10 +307,10 @@ public class TestValue extends TestBase {
} }
private void testTimestamp() { private void testTimestamp() {
ValueTimestamp vts = ValueTimestamp.parse("2000-01-15 10:20:30.333222111"); ValueTimestamp valueTs = ValueTimestamp.parse("2000-01-15 10:20:30.333222111");
Timestamp ts = Timestamp.valueOf("2000-01-15 10:20:30.333222111"); Timestamp ts = Timestamp.valueOf("2000-01-15 10:20:30.333222111");
assertEquals(ts.toString(), vts.getString()); assertEquals(ts.toString(), valueTs.getString());
assertEquals(ts, vts.getTimestamp()); assertEquals(ts, valueTs.getTimestamp());
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("Europe/Berlin")); Calendar c = Calendar.getInstance(TimeZone.getTimeZone("Europe/Berlin"));
c.set(2018, 02, 25, 1, 59, 00); c.set(2018, 02, 25, 1, 59, 00);
c.set(Calendar.MILLISECOND, 123); c.set(Calendar.MILLISECOND, 123);
......
...@@ -760,5 +760,6 @@ zzbbzz cldr booleans maria enquotes mtc cbuf checksummed nreturn despite bbzz re ...@@ -760,5 +760,6 @@ zzbbzz cldr booleans maria enquotes mtc cbuf checksummed nreturn despite bbzz re
unconditionally coco aren eecccc decimals charsets zzbb lsb msb usecount outdir endian misleading precompiled unconditionally coco aren eecccc decimals charsets zzbb lsb msb usecount outdir endian misleading precompiled
assorted reimplemented hangups confirmation predefined assorted reimplemented hangups confirmation predefined
mdy destfile hclf forbids spellchecking selfdestruct expects accident jacocoagent cli historic mitigate 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 jacoco xdata invokes sourcefiles classfiles duplication crypto stacktraces prt directions handled overly asm hardcoded
interpolated thead
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论