Skip to content

Commit

Permalink
Improve the documentation and optimize test cases for project 5 (tale…
Browse files Browse the repository at this point in the history
  • Loading branch information
pupillord authored Jul 12, 2022
1 parent 2707cee commit 0757d7e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,9 @@ test-proj4-2:
go test -check.f TestSkylinePruning

test-proj5-1:
cd executor && \
go test -check.f TestJoin
go test ./executor -check.f "TestSelectExec" && \
cd expression && \
go test -timeout 60s

test-proj5-2: failpoint-enable
go test -timeout 600s ./executor -check.f "testSuiteJoin1|testSuiteJoin2|testSuiteJoin3"
Expand All @@ -301,7 +302,6 @@ test-proj5-3: failpoint-enable
@$(FAILPOINT_DISABLE)



proj6: failpoint-enable
go test -timeout 600s ./store/tikv -mockStore=false
@$(FAILPOINT_DISABLE)
7 changes: 4 additions & 3 deletions courses/proj5-part1-README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@

## 作业描述

- 实现向量化表达式 [vecEvalInt](https://github.com/tidb-incubator/tinysql/blob/course/expression/builtin_string_vec.go#L89),并将 [vectorized](https://github.com/tidb-incubator/tinysql/blob/course/expression/builtin_string_vec.go#L84) 的返回值改为 `true`
- 实现向量化表达式 [vecEvalInt](https://github.com/tidb-incubator/tinysql/blob/course/expression/builtin_string_vec.go#L89) ,并将 [vectorized](https://github.com/tidb-incubator/tinysql/blob/course/expression/builtin_string_vec.go#L84) 的返回值改为 `true`
- 实现向量化 selection 的 [Next](https://github.com/tidb-incubator/tinysql/blob/course/executor/executor.go#L380) 函数。

## 测试

通过 `expression` 下所有测试和 `executor` 下面的 `TestJoin` 以及 `TestMergeJoin`
- 通过 `expression` 下的所有测试
- 通过 `executor/executor_test.go``TestSelectExec`

你可以通过 `go test package_path -check.f func_name` 来跑一个具体的函数。以 `TestJoin` 为例,你可以使用 `go test github.com/pingcap/pingcap-incubator/tinysql/executor -check.f TestJoin` 来跑这个具体的函数。同时可以将输出文件重定向至文件中来后续 debug
你可以直接通过 `make test-proj5-1` 来运行测试,也可以通过 `go test package_path -check.f func_name` 来跑一个具体的函数。以 `TestSelectExec` 为例,你可以使用 `go test ./executor -check.f "TestSelectExec"` 来跑这个具体的函数。

## 评分

Expand Down
8 changes: 5 additions & 3 deletions courses/proj5-part2-README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,15 @@ Outer Fetcher 是一个后台 goroutine,他的主要计算逻辑在 fetchOuter

## 作业

实现 [runJoinWorker](https://github.com/tidb-incubator/tinysql/blob/course/executor/join.go#L243) 以及 [fetchAndBuildHashTable](https://github.com/tidb-incubator/tinysql/blob/course/executor/join.go#L148)
实现 [runJoinWorker](https://github.com/tidb-incubator/tinysql/blob/course/executor/join.go#L243) 以及 [fetchAndBuildHashTable](https://github.com/tidb-incubator/tinysql/blob/course/executor/join.go#L148)

## 测试

通过 `join_test.go` 下的所有测试
- 通过 `join_test.go` 下除 `TestJoin` 以外的所有测试用例。
- `TestJoin` 测试用例涉及到 project5-3 中 `aggregate` 相关方法,可以在完成整个 project5 后再测试,该测试不会计算到分数之中。

你可以通过 `make test-proj5-2` 来运行测试。

## 评分

全部通过可得 100 分。若有测试未通过按比例扣分。

10 changes: 7 additions & 3 deletions courses/proj5-part3-README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,14 @@ Hash Aggregation 的执行阶段可分为如下图所示的 5 步:

## 作业描述

补充完整 `aggregate.go` 中的 TODO 代码
- 补充完整 `aggregate.go` 中的 TODO 代码,包括 `consumeIntermData``shuffleIntermData` 两个方法。

## 评分
## 测试

- 完成 `aggregate_test.go` 中的所有测试

完成 `aggregate_test.go` 中的测试
你可以通过 `make test-proj5-3` 来运行测试

## 评分

全部通过可得 100 分。若有测试未通过按比例扣分。
11 changes: 11 additions & 0 deletions executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ func (s *testSuiteP1) TestChange(c *C) {
c.Assert(tk.ExecToErr("alter table t change c d varchar(100)"), NotNil)
}

func (s *testSuiteP1) TestSelectExec(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec(`use test;`)
tk.MustExec(`drop table if exists t;`)
tk.MustExec(`create table t(a bigint, b bigint);`)
tk.MustExec(`insert into t values(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6);`)

r := tk.MustQuery("select a from (select * from t limit 3) k where a != 1;")
r.Check(testkit.Rows("2", "3"))
}

func (s *baseTestSuite) fillData(tk *testkit.TestKit, table string) {
tk.MustExec("use test")
tk.MustExec(fmt.Sprintf("create table %s(id int not null default 1, name varchar(255), PRIMARY KEY(id));", table))
Expand Down

0 comments on commit 0757d7e

Please sign in to comment.