Hi!
(First of all, this has *nothing* to do with NDB API--the
NDB API is a C/C++ API, and this is all SQL.)
You should not have a problem with the statements you've provided, and they work just fine for me using a 7.4 built from the git tree (I only changed the name of the table--already had one with that name in the test DB):
mysql> use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
mysql> select version();
+------------------+
| version() |
+------------------+
| 5.6.26-ndb-7.4.8 |
+------------------+
1 row in set (0.00 sec)
mysql> CREATE TABLE t(
-> ID VARCHAR(100) NOT NULL,
-> NUM VARCHAR(20) NOT NULL,
-> CALLED_NUM VARCHAR(20) NOT NULL,
-> PRIMARY KEY (ID, NUM)
-> )ENGINE NDB PARTITION BY key(NUM);
Query OK, 0 rows affected (1.21 sec)
mysql> show create table t\G
*************************** 1. row ***************************
Table: t
Create Table: CREATE TABLE `t` (
`ID` varchar(100) NOT NULL,
`NUM` varchar(20) NOT NULL,
`CALLED_NUM` varchar(20) NOT NULL,
PRIMARY KEY (`ID`,`NUM`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (NUM) */
1 row in set (0.01 sec)
mysql> CREATE INDEX IDX_CALLED_NUM ON t(CALLED_NUM);
Query OK, 0 rows affected (0.74 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> show create table t\G
*************************** 1. row ***************************
Table: t
Create Table: CREATE TABLE `t` (
`ID` varchar(100) NOT NULL,
`NUM` varchar(20) NOT NULL,
`CALLED_NUM` varchar(20) NOT NULL,
PRIMARY KEY (`ID`,`NUM`),
KEY `IDX_CALLED_NUM` (`CALLED_NUM`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (NUM) */
1 row in set (0.01 sec)
mysql> describe t;
+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| ID | varchar(100) | NO | PRI | NULL | |
| NUM | varchar(20) | NO | PRI | NULL | |
| CALLED_NUM | varchar(20) | NO | MUL | NULL | |
+------------+--------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
Please try to repeat your issue using the latest 7.3 or 7.4 release. If you can produce this error in one of those, then please
file a bug report.
Thanks for using MySQL Cluster!
Jon Stephens
MySQL Documentation Team @ Oracle
MySQL Dev Zone
MySQL Server Documentation
Oracle