codefollower / h2-research Goto Github PK
View Code? Open in Web Editor NEWH2数据库源代码学习研究(包括代码注释、文档、用于代码分析的测试用例)
License: Other
H2数据库源代码学习研究(包括代码注释、文档、用于代码分析的测试用例)
License: Other
1.在连接执行时,使用的嵌套循环,内部表 和外部表的选择是怎样的呢?一般是小表是外部表,代码中好像没有看到计算表的大小
2.两表连接时,每一次连接都要建立索引,关于COST的3种计算都是基于B树索引?没有HASH索引的执行吗?
3. join中有用到HASH的地方吗?TableFilter中好像没读到
4.题外问题,用您给的代码调试,有很多错误,是因为jdk版本的问题吗?
谢谢!
建表语句报错了:
CREATE TABLE IF NOT EXISTS mytable
(
f2 IDENTITY(1, 10)
CONSTRAINT pk PRIMARY KEY HASH AUTO_INCREMENT,
f5 int NOT NULL UNIQUE NOT NULL,
f6 int NULL CHECK f6 > 10,
f7 int
CONSTRAINT c8 NOT NULL REFERENCES mytable (f2) ON DELETE CASCADE,
f99 int
)
报错信息:
Exception in thread "main" org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "CREATE TABLE IF NOT EXISTS MYTABLE (F2 IDENTITY(1, 10) CONSTRAINT PK PRIMARY KEY HASH AUTO_INCREMENT[*], F5 INT NOT NULL UNIQUE NOT NULL, F6 INT NULL CHECK F6>10, F7 INT CONSTRAINT C8 NOT NULL REFERENCES MYTABLE(F2) ON DELETE CASCADE, F99 INT)"; expected "CONSTRAINT, COMMENT, UNIQUE, NOT, NULL, CHECK, REFERENCES, ., )"; SQL statement:
CREATE TABLE IF NOT EXISTS mytable (f2 IDENTITY(1, 10) CONSTRAINT pk PRIMARY KEY HASH AUTO_INCREMENT, f5 int NOT NULL UNIQUE NOT NULL, f6 int NULL CHECK f6>10, f7 int CONSTRAINT c8 NOT NULL REFERENCES mytable(f2) ON DELETE CASCADE, f99 int) [42001-201]
解析完 AUTO_INCREMENT 之后就报错了,根据 debug 发现第 11668 行后
if (column.getIdentityOptions() != null || !parseCompatibilityIdentity(column, mode)) {
return;
}
由于 column.getIdentityOptions() != null 为真,导致 parseCompatibilityIdentity(column, mode) 没有执行,从而没有解析下一个 token ‘,’ ,等到处理下一次循环,读取更多的时候
private boolean readIfMore() {
if (readIf(COMMA)) {
return true;
}
read(CLOSE_PAREN);
return false;
}
尝试读取 逗号 失败,下次读取比括号的时候就报错了。好像是 h2 的一个 bug 。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.