提交 6e0c5153 authored 作者: Thomas Mueller's avatar Thomas Mueller

The optimizer had problems with function tables (for example CSVREAD and FTL_SEARCH).

上级 3cc5f839
......@@ -18,7 +18,10 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>The function SUM could overflow when using large values. It returns now a data type that is safe.
<ul><li>The optimizer had problems with function tables (for example CSVREAD and FTL_SEARCH).
A new system property h2.estimatedFunctionTableRows (default 1000) defines how many rows
can be expected in the table.
</li><li>The function SUM could overflow when using large values. It returns now a data type that is safe.
</li><li>The function AVG could overflow when using large values. Fixed.
</li><li>The emergency reserve file has been removed. It didn't provide an appropriate
solution for the problem. It is still possible for an application to detect and deal with
......
......@@ -215,6 +215,13 @@ public class SysProperties {
*/
public static final boolean DOLLAR_QUOTING = getBooleanSetting("h2.dollarQuoting", true);
/**
* System property <code>h2.estimatedFunctionTableRows</code> (default: 1000).<br />
* The estimated number of rows in a function table (for example, CSVREAD or FTL_SEARCH).
* This value is used by the optimizer.
*/
public static final int ESTIMATED_FUNCTION_TABLE_ROWS = getIntSetting("h2.estimatedFunctionTableRows", 1000);
/**
* System property <code>h2.largeResultBufferSize</code> (default: 4096).<br />
* Buffer size for large result sets. Set this value to 0 to disable the buffer.
......@@ -418,7 +425,7 @@ public class SysProperties {
* added so an index on A can be used.
*/
public static final boolean OPTIMIZE_TWO_EQUALS = getBooleanSetting("h2.optimizeTwoEquals", true);
/**
* System property <code>h2.overflowExceptions</code> (default: true).<br />
* Throw an exception on integer overflows.
......
......@@ -8,6 +8,7 @@ package org.h2.index;
import java.sql.SQLException;
import org.h2.constant.SysProperties;
import org.h2.engine.Session;
import org.h2.message.Message;
import org.h2.result.LocalResult;
......@@ -53,7 +54,13 @@ public class FunctionIndex extends BaseIndex {
if (masks != null) {
throw Message.getUnsupportedException();
}
return functionTable.getRowCount(session) * 10;
long expectedRows;
if (functionTable.canGetRowCount()) {
expectedRows = functionTable.getRowCount(session);
} else {
expectedRows = SysProperties.ESTIMATED_FUNCTION_TABLE_ROWS;
}
return expectedRows * 10;
}
public void remove(Session session) throws SQLException {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论