提交 3dba1b44 authored 作者: Noel Grandin's avatar Noel Grandin

add some javadoc

上级 78c40095
...@@ -47,7 +47,7 @@ class Optimizer { ...@@ -47,7 +47,7 @@ class Optimizer {
private TableFilter topFilter; private TableFilter topFilter;
private double cost; private double cost;
private Random random; private Random random;
final AllColumnsForPlan allColumnsSet; private final AllColumnsForPlan allColumnsSet;
Optimizer(TableFilter[] filters, Expression condition, Session session) { Optimizer(TableFilter[] filters, Expression condition, Session session) {
this.filters = filters; this.filters = filters;
......
...@@ -105,6 +105,9 @@ public class Select extends Query { ...@@ -105,6 +105,9 @@ public class Select extends Query {
*/ */
boolean[] groupByExpression; boolean[] groupByExpression;
/**
* Grouped data for aggregates.
*/
SelectGroups groupData; SelectGroups groupData;
private int havingIndex; private int havingIndex;
...@@ -161,6 +164,9 @@ public class Select extends Query { ...@@ -161,6 +164,9 @@ public class Select extends Query {
this.expressions = expressions; this.expressions = expressions;
} }
/**
* Sets a wildcard expression as in "SELECT * FROM TEST".
*/
public void setWildcard() { public void setWildcard() {
expressions = new ArrayList<>(1); expressions = new ArrayList<>(1);
expressions.add(new Wildcard(null, null)); expressions.add(new Wildcard(null, null));
...@@ -201,7 +207,9 @@ public class Select extends Query { ...@@ -201,7 +207,9 @@ public class Select extends Query {
} }
/** /**
* Set the distinct expressions. * Set the DISTINCT ON expressions.
*
* @param distinctExpressions array of expressions
*/ */
public void setDistinct(Expression[] distinctExpressions) { public void setDistinct(Expression[] distinctExpressions) {
if (distinct) { if (distinct) {
......
...@@ -471,6 +471,9 @@ public class ConstraintReferential extends Constraint { ...@@ -471,6 +471,9 @@ public class ConstraintReferential extends Constraint {
buildDeleteSQL(); buildDeleteSQL();
} }
/**
* Update the constraint SQL when a referenced column is renamed.
*/
public void updateOnTableColumnRename() { public void updateOnTableColumnRename() {
if (deleteAction != null) { if (deleteAction != null) {
deleteSQL = null; deleteSQL = null;
......
...@@ -1149,6 +1149,10 @@ public class Database implements DataHandler { ...@@ -1149,6 +1149,10 @@ public class Database implements DataHandler {
} }
} }
/**
* Mark some database ids as unused.
* @param idsToRelease the ids to release
*/
void releaseDatabaseObjectIds(BitSet idsToRelease) { void releaseDatabaseObjectIds(BitSet idsToRelease) {
synchronized (objectIds) { synchronized (objectIds) {
objectIds.andNot(idsToRelease); objectIds.andNot(idsToRelease);
......
...@@ -155,6 +155,11 @@ public class ExpressionColumn extends Expression { ...@@ -155,6 +155,11 @@ public class ExpressionColumn extends Expression {
return columnResolver.optimize(this, column); return columnResolver.optimize(this, column);
} }
/**
* Get exception to throw, with column and table info added
* @param code SQL error code
* @return DbException
*/
public DbException getColumnException(int code) { public DbException getColumnException(int code) {
String name = columnName; String name = columnName;
if (tableAlias != null) { if (tableAlias != null) {
......
...@@ -1141,6 +1141,16 @@ public class Function extends Expression implements FunctionCall { ...@@ -1141,6 +1141,16 @@ public class Function extends Expression implements FunctionCall {
return new Parser(session).parseTableName(tableName.getString()); return new Parser(session).parseTableName(tableName.getString());
} }
/**
* Get value transformed by expression, or null if i is out of range or
* the input value is null.
*
* @param session database session
* @param args expressions
* @param values array of input values
* @param i index of value of transform
* @return value or null
*/
protected static Value getNullOrValue(Session session, Expression[] args, protected static Value getNullOrValue(Session session, Expression[] args,
Value[] values, int i) { Value[] values, int i) {
if (i >= args.length) { if (i >= args.length) {
...@@ -1157,7 +1167,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -1157,7 +1167,7 @@ public class Function extends Expression implements FunctionCall {
return v; return v;
} }
protected Value getValueWithArgs(Session session, Expression[] args) { private Value getValueWithArgs(Session session, Expression[] args) {
Value[] values = new Value[args.length]; Value[] values = new Value[args.length];
if (info.nullIfParameterIsNull) { if (info.nullIfParameterIsNull) {
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
......
...@@ -64,6 +64,10 @@ public class Transaction { ...@@ -64,6 +64,10 @@ public class Transaction {
private static final String[] STATUS_NAMES = { private static final String[] STATUS_NAMES = {
"CLOSED", "OPEN", "PREPARED", "COMMITTED", "ROLLING_BACK", "ROLLED_BACK" "CLOSED", "OPEN", "PREPARED", "COMMITTED", "ROLLING_BACK", "ROLLED_BACK"
}; };
/**
* How many bits of the "operation id" we store in the transaction belong to the
* log id (the rest belong to the transaction id).
*/
static final int LOG_ID_BITS = 40; static final int LOG_ID_BITS = 40;
private static final int LOG_ID_BITS1 = LOG_ID_BITS + 1; private static final int LOG_ID_BITS1 = LOG_ID_BITS + 1;
private static final long LOG_ID_LIMIT = 1L << LOG_ID_BITS; private static final long LOG_ID_LIMIT = 1L << LOG_ID_BITS;
......
...@@ -328,7 +328,7 @@ public class IntervalUtils { ...@@ -328,7 +328,7 @@ public class IntervalUtils {
return ValueInterval.from(qualifier, negative, leading, remaining); return ValueInterval.from(qualifier, negative, leading, remaining);
} }
static ValueInterval parseInterval2(IntervalQualifier qualifier, String s, char ch, int max, boolean negative) { private static ValueInterval parseInterval2(IntervalQualifier qualifier, String s, char ch, int max, boolean negative) {
long leading; long leading;
long remaining; long remaining;
int dash = s.indexOf(ch, 1); int dash = s.indexOf(ch, 1);
......
...@@ -167,7 +167,7 @@ public final class GeometryUtils { ...@@ -167,7 +167,7 @@ public final class GeometryUtils {
*/ */
private boolean set; private boolean set;
double minX, maxX, minY, maxY; private double minX, maxX, minY, maxY;
/** /**
* Creates a new envelope calculation target. * Creates a new envelope calculation target.
...@@ -295,7 +295,7 @@ public final class GeometryUtils { ...@@ -295,7 +295,7 @@ public final class GeometryUtils {
*/ */
private boolean set; private boolean set;
double minX, maxX, minY, maxY; private double minX, maxX, minY, maxY;
private boolean hasZ; private boolean hasZ;
...@@ -567,6 +567,11 @@ public final class GeometryUtils { ...@@ -567,6 +567,11 @@ public final class GeometryUtils {
return Double.isNaN(d) ? Double.NaN : d == 0d ? 0d : d; return Double.isNaN(d) ? Double.NaN : d == 0d ? 0d : d;
} }
/**
* Throw exception if param is not finite value (ie. NaN/inf/etc)
* @param d double value
* @return same double value
*/
static double checkFinite(double d) { static double checkFinite(double d) {
// Do not push this negation down, it will break NaN rejection // Do not push this negation down, it will break NaN rejection
if (!(Math.abs(d) <= Double.MAX_VALUE)) { if (!(Math.abs(d) <= Double.MAX_VALUE)) {
......
...@@ -56,6 +56,9 @@ public final class JTSUtils { ...@@ -56,6 +56,9 @@ public final class JTSUtils {
*/ */
public static final boolean M_IS_SUPPORTED; public static final boolean M_IS_SUPPORTED;
/**
* create(int,int,int) method from CoordinateSequenceFactory, if it exists
*/
static final Method CREATE; static final Method CREATE;
private static final Method GET_MEASURES; private static final Method GET_MEASURES;
......
...@@ -134,6 +134,8 @@ public final class ExtTypeInfoEnum extends ExtTypeInfo { ...@@ -134,6 +134,8 @@ public final class ExtTypeInfoEnum extends ExtTypeInfo {
/** /**
* Get ValueEnum instance for an ordinal. * Get ValueEnum instance for an ordinal.
* @param ordinal ordinal value of an enum
* @return ValueEnum instance
*/ */
public ValueEnum getValue(int ordinal) { public ValueEnum getValue(int ordinal) {
if (ordinal < 0 || ordinal >= enumerators.length) { if (ordinal < 0 || ordinal >= enumerators.length) {
...@@ -145,6 +147,8 @@ public final class ExtTypeInfoEnum extends ExtTypeInfo { ...@@ -145,6 +147,8 @@ public final class ExtTypeInfoEnum extends ExtTypeInfo {
/** /**
* Get ValueEnum instance for a label string. * Get ValueEnum instance for a label string.
* @param label label string
* @return ValueEnum instance
*/ */
public ValueEnum getValue(String label) { public ValueEnum getValue(String label) {
ValueEnum value = getValueOrNull(label); ValueEnum value = getValueOrNull(label);
......
...@@ -12,7 +12,7 @@ import java.sql.ResultSet; ...@@ -12,7 +12,7 @@ import java.sql.ResultSet;
import java.sql.Statement; import java.sql.Statement;
public class TestAnalyzeTableTx extends TestDb { public class TestAnalyzeTableTx extends TestDb {
static final int C = 10_000; private static final int C = 10_000;
/** /**
* Run just this test. * Run just this test.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论