我在Windows10 x64位操作系统上使用MonetDB v11.29.7“ Mar2018-SP1”。当我在长度大于0(type_digits> 0)的相应varchar列上对两个表执行完全外部联接时,目标列中的结果列将产生type_digits = 0的varchar列,尽管列数据似乎显示正确,非空的varchar记录。
我不确定如何解释type = varchar和type_digits = 0的列信息。这种状态会导致随后通过Python接口(UDF)处理/提取数据的问题,因为此列数据的预期Python dtype对于Python numpy转换是模棱两可的。
我提供了一个简单的示例,其中我创建了两个分别包含两列的小表(dummy4和dummy5),然后使用完整的外部联接命令创建了第三个表(dummy6)。
对于表dummy6和列“ key”,我期望type_digits = 32(根据两个源表dummy4和dummy5中的“ key”列)。另外,我应该如何解释type = varchar和type_digits = 0状态?在这种情况下,访问/分配Python / numpy数组以提取表“ dummy6”的“键”列(通过Python UDF)时,应该采取什么适当的处理/期望?
create table dummy4(key varchar(32), val int);
insert into dummy4 values('AAAAAAAA',1);
insert into dummy4 values('BBBBBBBBB',2);
select * from dummy4;
+ --------------- + ------ + |关键val | + =========== + ====== + | AAAAAAAA | 1 | | BBBBBBBBB | 2 | + ----------- + ------ +
create table dummy5(key varchar(32), val int);
insert into dummy5 values('CCCCCCCC',3);
insert into dummy5 values('DDDDDDDD',4);
select * from dummy5;
+ ---------- + ------ + |关键val | + ========== + ====== + | CCCCCCCC | 3 | | DDDDDDDD | 4 | + ---------- + ------ +
create table dummy6 as select key, dummy4.val as "val4", dummy5.val as "val5" from dummy4 full outer join dummy5 using (key);
select * from dummy6;
+ --------------- + ------ + ------ + |关键val4 | val5 | + =========== + ====== + ===== + | AAAAAAAA | 1 |空| | BBBBBBBBB | 2 |空| | CCCCCCCC |空| 3 | | DDDDDDDD |空| 4 | + ----------- + ------ + ------ +
select t.name as "table_name", t.id as "table_id", c.id as "column_id", c.name as "column_name", c.type, c.type_digits from sys.tables t JOIN sys.columns c ON c.table_id = t.id where t.name = 'dummy4';
+ ------------ + ---------- + ----------- + ---------- --- + --------- ++ ----------- + | table_name | table_id | column_id | column_name |类型type_digits | + ==================================== + ============ + ========= + ============ + |虚拟4 | 78445 | 78443 |关键varchar | 32 | |虚拟4 | 78445 | 78444 | val | int | 32 | + ------------ + ---------- + ----------- + ------------- + --------- + ------------- +
select t.name as "table_name", t.id as "table_id", c.id as "column_id", c.name as "column_name", c.type, c.type_digits from sys.tables t JOIN sys.columns c ON c.table_id = t.id where t.name = 'dummy5';
+ ------------ + ---------- + ----------- + ---------- --- + --------- ++ ----------- + | table_name | table_id | column_id | column_name |类型type_digits | + ==================================== + ============ + ========= + ============ + |虚拟5 | 78449 | 78447 |关键varchar | 32 | |虚拟5 | 78449 | 78448 | val | int | 32 | + ------------ + ---------- + ----------- + ------------- + --------- + ------------- +
select t.name as "table_name", t.id as "table_id", c.id as "column_id", c.name as "column_name", c.type, c.type_digits from sys.tables t JOIN sys.columns c ON c.table_id = t.id where t.name = 'dummy6';
+ ------------ + ---------- + ----------- + ---------- --- + --------- ++ ----------- + | table_name | table_id | column_id | column_name |类型type_digits | + ==================================== + ============ + ========= + ============ + |虚拟6 | 78457 | 78454 |关键varchar | 0 | |虚拟6 | 78457 | 78455 | val4 | int | 32 | |虚拟6 | 78457 | 78456 | val5 | int | 32 | + ------------ + ---------- + ----------- + ------------- + --------- + ------------- +
答案 0 :(得分:0)
实际上,这是MonetDB的错误,并已在今天修复。该修复程序将在即将发布的Nov2019版本中进行介绍。