talent-plan / tinysql

A course to build the SQL layer of a distributed database.
Apache License 2.0
1.7k stars 519 forks source link

Typo in proj1-2 code comments #138

Open ccjeff opened 2 years ago

ccjeff commented 2 years ago

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.
     ...
}