Bug #87658 "ndb_restore --print-data" can't converts enum data.
Submitted: 4 Sep 2017 14:12 Modified: 4 Apr 2019 6:04
Reporter: Yoshiaki Yamasaki Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S4 (Feature request)
Version:7.5.7 OS:Any
Assigned to: CPU Architecture:Any
Tags: MySQL Cluster, ndb_restore

[4 Sep 2017 14:12] Yoshiaki Yamasaki
Description:
"ndb_restore --print-data" can't converts enum data. The output has only number such as "0x01".

 Ex) Output of world.countrylanguate table

  ABW     Spanish 0x02    7.400000
  AFG     Turkmenian      0x02    1.900000
  AFG     Uzbek   0x02    8.800000

 [Table data]
  mysql> select * from world.countrylanguage where CountryCode='ABW' and Language='Spanish';
  +-------------+----------+------------+------------+
  | CountryCode | Language | IsOfficial | Percentage |
  +-------------+----------+------------+------------+
  | ABW         | Spanish  | F          |        7.4 |
  +-------------+----------+------------+------------+
  1 row in set (0.00 sec)

How to repeat:
1.Create world database.

2.Get online backup via "ndb_mgm -e "START BACKUP"

3.Execute ndb_restore with --print-data option.
Ex) ndb_restore -c localhost:1186 -n 2 -b 1 --print-data --tab=./csvdata --append ./data/data1/BACKUP/BACKUP-1

4.Check following column data
 - Continent column of country table.
 - IsOfficial column of countrylanguage table.

Suggested fix:
"ndb_restore --print-data" converts enum data. It is convenient for restore backup data to InnoDB.
[4 Sep 2017 16:36] Yoshiaki Yamasaki
[Note]
When we copy data from MySQL Cluster to MySQL(InnoDB), we need to convert enum data as follows. It is inconvenient.

LOAD DATA INFILE '/home/mysql/mysqlc/csvdata/countrylanguage.txt' INTO TABLE world.countrylanguage(CountryCode, Language, @var3, Percentage)
 SET IsOfficial = (CASE @var3
 WHEN '0x01' THEN 'T'
 WHEN '0x02' THEN 'F'
 ELSE 'ERROR'
 END)
;
[5 Sep 2017 1:03] Yoshiaki Yamasaki
I have another Suggested fix.

I think previous Suggested fix is better than this plan. However, this plan can achieve the purpose. I mean "the purpose" is transfer data from MySQL Cluster to InnoDB easily.

[Another Suggested fix]
LOAD DATA INFILE can use numeric values for ENUM.
[4 Apr 2019 6:04] MySQL Verification Team
Hello Yamasaki-San,

Thank you for the feature request!

regards,
Umesh