talent-plan / tinysql Goto Github PK
View Code? Open in Web Editor NEWA course to build the SQL layer of a distributed database.
License: Apache License 2.0
A course to build the SQL layer of a distributed database.
License: Apache License 2.0
This issue aims to address the lack of course documentation and code comments for TinySQL
. We will start from this step to improve the user experience.
## Project
### Introduction
### Topic
#### Knowledge topic
#### Related code
### Exercises
### References
Chinese version
## Project
### 简介
### XX主题
#### 相关知识
#### 相关代码
### 练习
### 引用
/* Project 1: Your Code Here */
to identify where the user needs to fill in.func MyFunc(a int, b int) (int, error) {
/* What does `MyFunc` need to do?
* explain parameters:
* a int: ....;
* b int: ....;
* explain return value:
* int: ....;
* error: ....;
* `MyFunc` may need to follow the steps:
* 1. xxxx;
* 2. xxxx;
* .....
* Some hints that might be useful:
* - you may need some structs
* - you may need to add some members for struct A
* - you need to implement 'FuncA' first
* - Be aware of concurrency issues
* .....
*/
}
Hi!
While struggling with TestCMSketch
, I found an interesting fact that values generated with lower zipfFactor
are more dispersive (thus lead to more collision) but with lower expected avgErr
. This can be inferred by the definition of Zipf distribution.
I have passed case 2 (zipfFactor = 2) and case 3 (zipfFactor = 3), and the avgErrs are all 0. I am sure that hashing results for different rows are independent and I have tried many groups. However, these different groups of hasher all failed in case 1 (zipfFactor = 1.1) with avgErr 10, which really upsets me :)
The numbers of distinct values generated in terms of different zipfFactor
are as follows:
zipfFactor: 1.1 len(lMap): 23965
zipfFactor: 2 len(lMap): 420
zipfFactor: 3 len(lMap): 58
It seems that lower zipfFactor
should be coupled with higher avgErr
. And the incorrect arrErr
10 I got in case 1 looks reasonable giving width = 2048. Is that wrong? I really need some advice.
Thanks!
Current GitHub workflow is broken while we can hardly fix it during @rebelice preparing Talent Plan 3.0.
Will first remove the workflow as it is totally broken and this issue tracks for adding back proper GitHub workflow.
"github.com/pingcap/tidb/parser/mysql"这个在proj1和proj2中都有出现,但是tidb下面没有parser目录。
在学习tinysql课程时,我发现课程资料这里的链接失效,请问是否有该两个资料的备份网址?
Please make a translation of the project readmes to english
exec "alter table t add index idx(a, b, c)" times out in executor/aggregate_test.go: 56 (in TestAggPushDown
). The test will pass after deleting this line. I didn't change codes about DDL for index.
another issue is the images lost:
take https://github.com/pingcap/talent-plan/pull/329/files as an example.
In lock_test.go
, settings of lock TTL are shrunk together to speed up tests:
func init() {
// Speed up tests.
defaultLockTTL = 3
maxLockTTL = 120
ttlFactor = 6
oracleUpdateInterval = 2
}
However, the remaining code still applies millisecond
while computing elapsed time (ex.2pc.go/txnLockTTL
), which will add a relatively large bias on the basic formula ttl = ttlFactor * sqrt(sizeInMiB)
.
In addition, ttlEquals
ignores case that x < y
, where float(x - y)
will result in a wrong answer given x and y of uint
type.
the links in proj3-README-zh_CN.md link to 404, please update them.
#36 LGTM, please check.
I noticed reading material in https://github.com/tidb-incubator/tinysql/blob/course/courses/material.md which included links to
https://pingcap.com/zh/blog/ , for example https://pingcap.com/zh/blog/tidb-source-code-reading-5 . I was wondering if the same blog is present in English too. For now I'm planning to use Google Translate though
code here is a little strange, why mysql.TypeDatetime
, mysql.TypeDuration
, mysql.TypeTimestamp
need to check precision?
Perhaps this is for case mysql.TypeNewDecimal
, mysql.TypeDouble
, mysql.TypeFloat
Can not find out the code file listed in https://github.com/pingcap-incubator/tinysql/blob/course/courses/proj4-part1-README-zh_CN.md,
can you specify more clearly about the specific folder?
用途
In TinySQL, we hope everyone can focus on the design and implementation of the SQL layer. The content of the MySQL protocol layer is complex and messy, and it is not our focus. So we will provide a simple implementation at the beginning.
It works fine whe I try run make test-proj1
locally, but when I submit the code the autograding workflow reports error as below:
Makefile:7: *** Please set the environment variable GOPATH before running `make`. Stop.
❌ proj1
::error::Error: Exit with code: 2 and signal: null
Am I missing some configs? How can I make the autograding work?
proj1-part1-README-zh_CN.md
原句:
还可以制定指输出需要的列,例如:
“指” - > "只"
In parser/model/ddl.go
, line 273:
// String implements fmt.Stringer interface.
func (job *Job) String() string {
rowCount := job.GetRowCount()
return fmt.Sprintf("ID:%d, Type:%s, State:%s, SchemaState:%s, SchemaID:%d, TableID:%d, RowCount:%d, ArgLen:%d, start time: %v, Err:%v, ErrCount:%d, SnapshotVersion:%v",
job.ID, job.Type, job.State, job.SchemaState, job.SchemaID, job.TableID, rowCount, len(job.Args), TSConvert2Time(job.StartTS), job.Error, job.ErrorCount, job.SnapshotVer)
}
job.Error
may be nil, which will cause nil error when fmt
package call Error()
define in parse/terror.go
line 217 and stop the debugger.
So i think it's needed to check whether job.Error
is nil in func job.String
, or check whether e
is nil in func Error.Error
The current MySQL protocol layer is a simplified version of TiDB implementation. I just deleted unnecessary parts. It works, but I think it might not be good.
config
module and delete unnecessary configurationsWhy not take the length of idxID
into account when allocating the capacity of key
in the EncodeIndexSeekKey
function, like the following:
key := make([]byte, 0, prefixLen+idLen+len(encodedValue))
In tableCodec.go
, line 146, the comment is suggesting to use errInvalidRecordKey.GenWithStack
whereas the function is decoding index prefix key. Might be better to consider changing this into using errInvalidIndexKey.GenWithStack
.
func DecodeIndexKeyPrefix(key kv.Key) (tableID int64, indexID int64, indexValues []byte, err error) {
...
* 3. errInvalidRecordKey.GenWithStack is a useful function to generate invalid record key errors.
...
}
To
func DecodeIndexKeyPrefix(key kv.Key) (tableID int64, indexID int64, indexValues []byte, err error) {
...
* 3. errInvalidIndexKey.GenWithStack is a useful function to generate invalid record key errors.
...
}
Comment in lock_resolver.go#L334 is broken.
go test
in ddl folder
Assert fauilre
or Success
# github.com/pingcap/tidb/planner/core [github.com/pingcap/tidb/ddl.test]
../planner/core/rule_join_reorder_dp.go:17:2: imported and not used: "math/bits"
FAIL github.com/pingcap/tidb/ddl [build failed]
In classroom.md
file, the link is invalid.
now the default branch is "course" , and "master" branch is missing,
project created by 作业模版 also missing master,so local work following https://github.com/pingcap-incubator/tinysql/blob/course/tutorial.md can't work well, maybe describition in tutorial.md should be edited ?
When I start proj2, parser_test directly success without any changing.
roger@192 tinysql-course % make test-proj4-1
pwd
/Users/roger/Downloads/pichunying/tinysql-course
cd planner/core &&
go test -check.f TestPredicatePushDown && \
/bin/sh: -c: line 1: syntax error: unexpected end of file
make: *** [test-proj4-1] Error 2
Env setup
Go: 1.16
Current progress: proj3 in progress, proj1&2 fin
When I test my code for as the the last section in this page:
https://github.com/tidb-incubator/tinysql/blob/course/courses/proj3-README-zh_CN.md
I hit this line sometimes:
https://github.com/tidb-incubator/tinysql/blob/1bdb9a3bc6ba158424a7da352d14d2b72d39ebaf/store/tikv/snapshot.go#L150
After I commented it out, those tests are able to pass.
Can someone please check if that's a real issue or a bug introduced by my change?
关系代数是 relational algebra
,不是 relation algebra
https://github.com/tidb-incubator/tinysql/blob/course/courses/material.md
It is corresponding to the effort towards Talent Plan v3.0.
According to user feedback and my investigation, I found that TinySQL has serious issues. They make it a departure from the learning-friendly mini distributed relational database:
In order to solve the above problems, I will redesign and implement TinySQL. The main improvements in the plan are as follows:
## Stage
### Introduction
#### Objectives
#### Materials
### Topic 1
#### Knowledge topic
#### Related code
### Exercises
### References
The following is stage design:
This test seems to validate the new value of key b
while only key a
is committed (see 2pc_test.go#L165) .Maybe some comments could be added to explain this counterintuitive design.
Maintaining such a complicated learner-oriented project is hard. I hope I can help although still struggling with the code.
Really appreciate your work :)
Environment Details:
System: Manjaro Linux x86_64
Kernel: 5.10.7-1-MANJARO
Go Version: 1.15.6
find a bug in tinysql/parser/lexer_test.go
if run go test
under directory tinysql/parser
, go build
would fail with
# github.com/pingcap/tidb/parser
./lexer_test.go:199:12: conversion from untyped int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
FAIL github.com/pingcap/tidb/parser [build failed]
by changing line 199 solve the problem
// {`'\Z'`, string(26)},
{`'\z'`, string(rune(26))},
this error may be caused by higher Go version.
windows 10
1.15.7
1. cd parser
2. go test .
test build successful
# github.com/pingcap/tidb/parser
.\lexer_test.go:199:12: conversion from untyped int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
FAIL github.com/pingcap/tidb/parser [build failed]
FAIL
If you are working on project 2(implement&test JoinTable for SQL parser), you maybe would get an error as below:
./lexer_test.go:199:12: conversion from untyped int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
that code block looked like:
191 func (s *testLexerSuite) TestscanString(c *C) {
192 table := []struct {
193 raw string
194 expect string
195 }{
196 {`' \n\tTest String'`, " \n\tTest String"},
197 {`'\x\B'`, "xB"},
198 {`'\0\'\"\b\n\r\t\\'`, "\000'\"\b\n\r\t\\"},
199 {`'\Z'`, string(26)},// Error
It broke tests but not a user cause
use hardcoded string
Repeat "make clean" should not show error
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.