[MCOL-2234] VARBINARY in InnoDB is truncated on 0x00 byte when joining with ColumnStore Created: 2019-03-12  Updated: 2023-03-06  Resolved: 2023-03-06

Status: Closed
Project: MariaDB ColumnStore
Component/s: N/A
Affects Version/s: 1.2.2
Fix Version/s: Icebox

Type: Bug Priority: Major
Reporter: Michal Chomo Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: beginner-friendly
Environment:

Ubuntu 18.04 64-bit



 Description   

Server version: 10.3.11-MariaDB-log Columnstore 1.2.2-1

Steps to replicate:

CREATE TABLE ip_addresses
(
  id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
  ip_addr VARBINARY(16),
  UNIQUE KEY (ip_addr)
) ENGINE = InnoDB;
 
CREATE TABLE join_inno
(
  id INT PRIMARY KEY,
  ip_addr_id BIGINT UNSIGNED,
  KEY (ip_addr_id)
) ENGINE = InnoDB;
 
CREATE TABLE join_columnstore
(
  id INT,
  ip_addr_id BIGINT UNSIGNED
) ENGINE = Columnstore;
 
INSERT INTO ip_addresses VALUES (0, inet6_aton('32.209.0.71'));
INSERT INTO join_inno VALUES (0, 1);
INSERT INTO join_columnstore VALUES (0, 1);

SELECT ip_addr, inet6_ntoa(ip.ip_addr)
  FROM join_inno AS inno
       JOIN ip_addresses AS ip
            ON inno.ip_addr_id = ip.id;

ip_addr inet6_ntoa(ip.ip_addr)
0x20D10047 32.209.0.71

SELECT ip_addr, inet6_ntoa(ip.ip_addr)
  FROM join_columnstore AS cs
       JOIN ip_addresses AS ip
            ON cs.ip_addr_id = ip.id;

ip_addr inet6_ntoa(ip.ip_addr)
0x20D1 <null>

MariaDB [tor]> show warnings;
+---------+------+----------------------------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                                                    |
+---------+------+----------------------------------------------------------------------------------------------------------------------------+
| Note    | 1051 | Unknown table 'infinidb_vtable.$vtable_348'                                                                                |
| Warning | 9999 | Columnstore Query Stats - fatal error running mysql_use_result() or empty result set in libmysql_client lib (-1) (unknown) |
+---------+------+----------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.000 sec)



 Comments   
Comment by Roman [ 2019-03-13 ]

Greetings,
This looks very interesting b/c CS shouldn't do anything with both ip_addr and inet6_ntoa(ip.ip_addr). I will recheck this and return to you.

Comment by Roman [ 2019-03-13 ]

The external ip_address.ip_addr internal representation is a string and it is 0x4700d120 When CrossEngineStep::setField() get into Row::setStringField() CS incorrectly detects a length of std::string taking the null byte as a end of the string.

Comment by Michal Chomo [ 2019-03-13 ]

Hi Roman, thank you very much for such a quick response. Regarding your second comment, inet6_ntoa() actually works fine even in join with CS if the address doesn't contain null bytes. Example with the same tables as in the description:

INSERT INTO ip_addresses VALUES (0, inet6_aton('32.209.1.71'));
INSERT INTO join_columnstore VALUES (1, 2);
 
SELECT ip.ip_addr, inet6_ntoa(ip.ip_addr)
  FROM join_columnstore AS cs
       JOIN ip_addresses AS ip
            ON cs.ip_addr_id = ip.id;

ip_addr inet6_ntoa(ip.ip_addr)
0x20D1 <null>
0x20D10147 32.209.1.71
Comment by Roman [ 2019-03-14 ]

GTK. Many thanks for this important detail. We will look into this bug

Comment by Todd Stoffel (Inactive) [ 2023-03-06 ]

This ticket was opened prior to convergence with the server. It may have been rendered obsolete. If this issue still exists in a modern version, please open a new request.

Generated at Thu Feb 08 02:34:44 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.