Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Set data type #23

Open
bigboss2063 opened this issue Jul 14, 2023 · 7 comments
Open

Implement Set data type #23

bigboss2063 opened this issue Jul 14, 2023 · 7 comments
Labels
good first issue Good for newcomers

Comments

@bigboss2063
Copy link
Collaborator

bigboss2063 commented Jul 14, 2023

Implement the Set data type at the storage engine level.

First, you need to enable the storage engine to support the Set data type.The tasks include designing and adding index for the Set data type, creating Set indexes upon database startup, updating Set indexes after transaction commits, and so on. For the specific implementation, you can refer to the Hash type(This task is already assigned to @yoshihiro-shu, so the next phase of the task may have to wait for him to complete).

Afterward, there are some apis to implement. The specific apis to be implemented are listed in the table below.Please also api test cases for each instruction.

API Explanation assigned done
SADD key member [member ...] Add one or more members to a set. @yoshihiro-shu
SCARD key Get the number of members in a set. @yoshihiro-shu
SMEMBERS key Get all the members in a set. @yoshihiro-shu
SREM key member [member ...] Remove one or more members from a set. @yoshihiro-shu
SRANDMEMBER key [count] Get one or more random members from a set.
SPOP key [count] Remove and return one or more random members from a set.
SMOVE source destination member Move a member from one set to another.
SDIFF key [key ...] Get the difference between sets.
SINTER key [key ...] Get the intersection of sets.
SUNION key [key ...] Get the union of sets.
SUNIONSTORE destination key [key ...] Store the union of sets into a new set.

首先,你需要让存储引擎支持Set数据类型。任务包括为Set数据类型设计和添加索引,在数据库启动时创建Set索引,在事务提交后更新Set索引等。对于具体的实现,你可以参考Hash类型(此任务已经分配给yoshihiro shu,所以下一阶段的任务可能要等他完成)。

然后,接下来还有一些指令需要实现。具体需要实现的指令见下表。每个指令也请完成测试用例的实现。

接口 命令解释 承接人 是否完成
SADD key member [member ...] 向集合中添加一个或多个成员。 @yoshihiro-shu
SCARD key 获取集合中的成员数量。 @yoshihiro-shu
SMEMBERS key 获取集合中的所有成员。 @yoshihiro-shu
SISMEMBER key member 检查成员是否存在于集合中。 @yoshihiro-shu
SREM key member [member ...] 从集合中移除一个或多个成员。
SRANDMEMBER key [count] 从集合中随机获取一个或多个成员。
SPOP key [count] 随机移除并返回集合中的一个或多个成员。
SMOVE source destination member 将成员从一个集合移动到另一个集合。
SDIFF key [key ...] 返回给定集合之间的差集。
SINTER key [key ...] 返回给定集合的交集。
SUNION key [key ...] 返回给定集合的并集。
SUNIONSTORE destination key [key ...] 将给定集合的并集存储到一个新的集合中。
@bigboss2063 bigboss2063 added help wanted Extra attention is needed good first issue Good for newcomers labels Jul 14, 2023
@bigboss2063 bigboss2063 changed the title implement Set data structure Implement Set data structure Jul 15, 2023
@bigboss2063 bigboss2063 removed the help wanted Extra attention is needed label Jul 18, 2023
@yoshihiro-shu
Copy link
Contributor

HI I’m Yoshi!
I’m in charge of this issue.

@bigboss2063 bigboss2063 changed the title Implement Set data structure Implement Set data type Jul 22, 2023
@bigboss2063
Copy link
Collaborator Author

@yoshihiro-shu Please go through the list and claim the specific commands you intend to implement.

@yoshihiro-shu
Copy link
Contributor

I intend to implement these command list.

  • SADD key member [member ...]
  • SCARD key
  • SMEMBERS key
  • SREM key member [member ...]

@bigboss2063
Copy link
Collaborator Author

Okay, I have assigned these to you.😄

@yoshihiro-shu
Copy link
Contributor

Can I get permission to Make a Pull request?
I think I will finish implement until this weekend.

@bigboss2063
Copy link
Collaborator Author

Can I get permission to Make a Pull request? I think I will finish implement until this weekend.

Of course. You can open pr at any time. I'll help you review.

@bigboss2063
Copy link
Collaborator Author

You should fork your own repository on github, and then open pr in that repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants