【miniob】JOIN TABLE DEBUG

pro1

INSERT INTO join_table_1 VALUES (4, '16a'); Select * from join_table_1 inner join join_table_2 on join_table_1.name<join_table_2.age and join_table_1.id=join_table_2.id; + failed to receive response from observer. reason=Failed to receive from server. poll return POLLHUP=16 or POLLERR=str(event & select.POLLERR) failed to receive response from observer. reason=Failed to receive from server. poll return POLLHUP=16 or POLLERR=str(event & select.POLLERR)

就是对于表达式当中的比较类型,如果不一致的话,一开始是没考虑,后面是直接返回类型不一致的报错,但是没过,看别人的思路,应该就是要进行强转比较

——————
 

就是当类型不可比的时候,如何处理?

char为什么能转换成double?是否能转为Int或其它类型? 

subpro1

这个就是在.h文件中,就不用再声明类名前缀了

将Value::去掉即可

subpro2

就是运行以下make clean,清理一下缓存

subpro3

这个很抽象的一点是代码内部自己定义了一个string,和std::string不一样(?

但确实不太理解之间的区别

用.c_str()就能正常打印和输出了

test

大数据

select * from join_table_large_1
inner join join_table_large_2 on join_table_large_1.id=join_table_large_2.id
inner join join_table_large_3 on join_table_large_1.id=join_table_large_3.id
inner join join_table_large_4 on join_table_large_3.id=join_table_large_4.id
inner join join_table_large_5 on 1=1
inner join join_table_large_6 on join_table_large_5.id=join_table_large_6.id
where
join_table_large_3.num3 <10
and
join_table_large_5.num5>90;

select * from join_table_large_1 inner join join_table_large_2 on join_table_large_1.id=join_table_large_2.id inner join join_table_large_3 on join_table_large_1.id=join_table_large_3.id inner join join_table_large_4 on join_table_large_3.id=join_table_large_4.id inner join join_table_large_5 on 1=1 inner join join_table_large_6 on join_table_large_5.id=join_table_large_6.id where join_table_large_3.num3 <10 and join_table_large_5.num5>90;
 

select * from join_table_1 inner join join_table_2 on 1=1

select * from join_table_large_5

CREATE TABLE join_table_1(id int, name char);

INSERT INTO join_table_1 VALUES (1, 'a');

INSERT INTO join_table_1 VALUES (2, 'b');

CREATE TABLE join_table_2(id int, num int);

INSERT INTO join_table_2 VALUES (1, 2);
INSERT INTO join_table_2 VALUES (2, 15);

create table join_table_large_1(id int, num1 int);
create table join_table_large_2(id int, num2 int);
create table join_table_large_3(id int, num3 int);
create table join_table_large_4(id int, num4 int);
create table join_table_large_5(id int, num5 int);
create table join_table_large_6(id int, num6 int);

insert into join_table_large_1 values(1, 1);
insert into join_table_large_1 values(2, 2);
insert into join_table_large_1 values(3, 3);
insert into join_table_large_1 values(4, 4);
insert into join_table_large_1 values(5, 5);
insert into join_table_large_1 values(6, 6);
insert into join_table_large_1 values(7, 7);
insert into join_table_large_1 values(8, 8);
insert into join_table_large_1 values(9, 9);
insert into join_table_large_1 values(10, 10);
insert into join_table_large_1 values(11, 11);
insert into join_table_large_1 values(12, 12);

insert into join_table_large_2 values(1, 1);
insert into join_table_large_2 values(2, 2);
insert into join_table_large_2 values(3, 3);
insert into join_table_large_2 values(4, 4);
insert into join_table_large_2 values(5, 5);
insert into join_table_large_2 values(6, 6);
insert into join_table_large_2 values(7, 7);
insert into join_table_large_2 values(8, 8);
insert into join_table_large_2 values(9, 9);
insert into join_table_large_2 values(10, 10);
insert into join_table_large_2 values(11, 11);
insert into join_table_large_2 values(12, 12);

insert into join_table_large_3 values(1, 1);
insert into join_table_large_3 values(2, 2);
insert into join_table_large_3 values(3, 3);
insert into join_table_large_3 values(4, 4);
insert into join_table_large_3 values(5, 5);
insert into join_table_large_3 values(6, 6);
insert into join_table_large_3 values(7, 7);
insert into join_table_large_3 values(8, 8);
insert into join_table_large_3 values(9, 9);
insert into join_table_large_3 values(10, 10);
insert into join_table_large_3 values(11, 11);
insert into join_table_large_3 values(12, 12);

insert into join_table_large_4 values(1, 1);
insert into join_table_large_4 values(2, 2);
insert into join_table_large_4 values(3, 3);
insert into join_table_large_4 values(4, 4);
insert into join_table_large_4 values(5, 5);
insert into join_table_large_4 values(6, 6);
insert into join_table_large_4 values(7, 7);
insert into join_table_large_4 values(8, 8);
insert into join_table_large_4 values(9, 9);
insert into join_table_large_4 values(10, 10);
insert into join_table_large_4 values(11, 11);
insert into join_table_large_4 values(12, 12);

insert into join_table_large_5 values(87, 87);
insert into join_table_large_5 values(88, 88);
insert into join_table_large_5 values(89, 89);
insert into join_table_large_5 values(90, 90);
insert into join_table_large_5 values(91, 91);
insert into join_table_large_5 values(92, 92);
insert into join_table_large_5 values(93, 93);
insert into join_table_large_5 values(94, 94);
insert into join_table_large_5 values(95, 95);
insert into join_table_large_5 values(96, 96);
insert into join_table_large_5 values(97, 97);
insert into join_table_large_5 values(98, 98);
insert into join_table_large_5 values(99, 99);
insert into join_table_large_5 values(100, 100);

insert into join_table_large_6 values(86, 86);
insert into join_table_large_6 values(87, 87);
insert into join_table_large_6 values(88, 88);
insert into join_table_large_6 values(89, 89);
insert into join_table_large_6 values(90, 90);
insert into join_table_large_6 values(91, 91);
insert into join_table_large_6 values(92, 92);
insert into join_table_large_6 values(93, 93);
insert into join_table_large_6 values(94, 94);
insert into join_table_large_6 values(95, 95);
insert into join_table_large_6 values(96, 96);
insert into join_table_large_6 values(97, 97);
insert into join_table_large_6 values(98, 98);
insert into join_table_large_6 values(99, 99);
insert into join_table_large_6 values(100, 100);

大数据下没问题,就是数据要求可判断的

miniob > select * from join_table_large_1 inner join join_table_large_2 on join_table_large_1.id=join_table_large_2.id inner join join_table_large_3 on join_table_large_1.id=join_table_large_3.id inner join join_table_large_4 on join_table_large_3.id=join_table_large_4.id inner join join_table_large_5 on 1=1 inner join join_table_large_6 on join_table_large_5.id=join_table_large_6.id where join_table_large_3.num3 <10 and join_table_large_5.num5>90;
id | num1 | id | num6 | id | num5 | id | num4 | id | num3 | id | num2
1 | 1 | 91 | 91 | 91 | 91 | 1 | 1 | 1 | 1 | 1 | 1
1 | 1 | 92 | 92 | 92 | 92 | 1 | 1 | 1 | 1 | 1 | 1
1 | 1 | 93 | 93 | 93 | 93 | 1 | 1 | 1 | 1 | 1 | 1
1 | 1 | 94 | 94 | 94 | 94 | 1 | 1 | 1 | 1 | 1 | 1
1 | 1 | 95 | 95 | 95 | 95 | 1 | 1 | 1 | 1 | 1 | 1
1 | 1 | 96 | 96 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8 | 93 | 93 | 93 | 93 | 8 | 8 | 8 | 8 | 8 | 8
8 | 8 | 94 | 94 | 94 | 94 | 8 | 8 | 8 | 8 | 8 | 8
8 | 8 | 95 | 95 | 95 | 95 | 8 | 8 | 8 | 8 | 8 | 8
8 | 8 | 96 | 96 | 96 | 96 | 8 | 8 | 8 | 8 | 8 | 8
8 | 8 | 97 | 97 | 97 | 97 | 8 | 8 | 8 | 8 | 8 | 8
8 | 8 | 98 | 98 | 98 | 98 | 8 | 8 | 8 | 8 | 8 | 8
8 | 8 | 99 | 99 | 99 | 99 | 8 | 8 | 8 | 8 | 8 | 8
8 | 8 | 100 | 100 | 100 | 100 | 8 | 8 | 8 | 8 | 8 | 8
9 | 9 | 91 | 91 | 91 | 91 | 9 | 9 | 9 | 9 | 9 | 9
9 | 9 | 92 | 92 | 92 | 92 | 9 | 9 | 9 | 9 | 9 | 9
9 | 9 | 93 | 93 | 93 | 93 | 9 | 9 | 9 | 9 | 9 | 9
9 | 9 | 94 | 94 | 94 | 94 | 9 | 9 | 9 | 9 | 9 | 9
9 | 9 | 95 | 95 | 95 | 95 | 9 | 9 | 9 | 9 | 9 | 9
9 | 9 | 96 | 96 | 96 | 96 | 9 | 9 | 9 | 9 | 9 | 9
9 | 9 | 97 | 97 | 97 | 97 | 9 | 9 | 9 | 9 | 9 | 9
9 | 9 | 98 | 98 | 98 | 98 | 9 | 9 | 9 | 9 | 9 | 9
9 | 9 | 99 | 99 | 99 | 99 | 9 | 9 | 9 | 9 | 9 | 9
9 | 9 | 100 | 100 | 100 | 100 | 9 | 9 | 9 | 9 | 9 | 9

类型检测

CREATE TABLE join_table_1(id int, name char);
CREATE TABLE join_table_2(id int, num int);

INSERT INTO join_table_1 VALUES (1, 'a');
INSERT INTO join_table_1 VALUES (2, 'b');
INSERT INTO join_table_1 VALUES (3, 'c');
INSERT INTO join_table_2 VALUES (1, 2);
INSERT INTO join_table_2 VALUES (2, 15);

select * from join_table_1 inner join join_table_2 on join_table_1.name<join_table_2.num and join_table_1.id=join_table_2.id

select * from join_table_1

select * from join_table_1 inner join join_table_2 on join_table_1.id=join_table_2.id

select * from join_table_1 inner join join_table_2 on join_table_1.id=join_table_2.id

select * from join_table_1 inner join join_table_2 on join_table_1.id=join_table_2.id

`@JoinTable` 注解用于定义两个实体类之间的多对多关系,并且指定用于关系维护的中间表的细节。 以下是 `@JoinTable` 注解的一些常用属性: - `name`:指定用于关系维护的中间表的名称。 - `joinColumns`:指定关系维护方的外键列的细节,包括列名、引用的列名等。 - `inverseJoinColumns`:指定关系被维护方的外键列的细节,包括列名、引用的列名等。 以下是一个使用 `@JoinTable` 注解的多对多关系的示例: ``` @Entity public class Student { @Id private Long id; @ManyToMany @JoinTable(name = "student_course", joinColumns = @JoinColumn(name = "student_id"), inverseJoinColumns = @JoinColumn(name = "course_id")) private Set<Course> courses = new HashSet<>(); // getters and setters } @Entity public class Course { @Id private Long id; @ManyToMany(mappedBy = "courses") private Set<Student> students = new HashSet<>(); // getters and setters } ``` 在这个示例中,我们创建了两个实体类 `Student` 和 `Course`,它们之间是多对多关系。我们使用 `@JoinTable` 注解来定义中间表,指定中间表的名称为 `student_course`,关系维护方的外键列为 `student_id`,关系被维护方的外键列为 `course_id`。 在 `Student` 实体类中,我们使用 `@ManyToMany` 和 `@JoinTable` 注解来定义多对多关系,并将多对多关系映射到 `courses` 属性中。 在 `Course` 实体类中,我们使用 `@ManyToMany(mappedBy = "courses")` 注解来定义多对多关系,并指定 `mappedBy = "courses"`,表示多对多关系的映射属性为 `courses`。 通过使用 `@JoinTable` 注解,我们可以方便地定义多对多关系,并指定用于关系维护的中间表的细节。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值