Commit 633ee9b0 authored by unknown's avatar unknown
Browse files

ndb - wl-1442 fix Date ordering


mysql-test/r/ndb_index_ordered.result:
  wl-1442 fix Date.  reuses old unused Timespec type id
mysql-test/t/ndb_index_ordered.test:
  wl-1442 fix Date.  reuses old unused Timespec type id
ndb/include/kernel/signaldata/DictTabInfo.hpp:
  wl-1442 fix Date.  reuses old unused Timespec type id
ndb/include/ndbapi/NdbDictionary.hpp:
  wl-1442 fix Date.  reuses old unused Timespec type id
ndb/include/util/NdbSqlUtil.hpp:
  wl-1442 fix Date.  reuses old unused Timespec type id
ndb/src/common/util/NdbSqlUtil.cpp:
  wl-1442 fix Date.  reuses old unused Timespec type id
ndb/src/ndbapi/NdbDictionary.cpp:
  wl-1442 fix Date.  reuses old unused Timespec type id
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  wl-1442 fix Date.  reuses old unused Timespec type id
ndb/test/include/NdbSchemaOp.hpp:
  wl-1442 fix Date.  reuses old unused Timespec type id
ndb/tools/restore/consumer.cpp:
  wl-1442 fix Date.  reuses old unused Timespec type id
sql/ha_ndbcluster.cc:
  wl-1442 fix Date.  reuses old unused Timespec type id
parent 2a3f285e
Loading
Loading
Loading
Loading
+50 −16
Original line number Diff line number Diff line
@@ -325,19 +325,53 @@ index(ts)
) engine=ndb;
insert into t1 (pk,dt,da,ye,ti) values
(1, '1901-05-05 23:00:59', '1901-05-05', '1901', '23:00:59'),
(2, '1955-12-31 00:00:00', '1955-12-31', '1955', '00:00:00'),
(3, '1999-06-06 06:06:06', '1999-06-06', '1999', '06:06:06'),
(4, '2001-01-01 10:11:11', '2001-01-01', '2001', '10:11:11'),
(5, '2005-01-31 23:59:59', '2005-01-31', '2005', '23:59:59');
select count(*) from t1 use index (dt) where dt > '1900-01-01 00:00:00';
count(*)
5
select count(*) from t1 use index (dt) where dt > '1955-12-31 00:00:00';
count(*)
3
select count(*) from t1 use index (dt) where dt < '2001-01-01 10:11:11';
count(*)
3
select count(*) from t1 use index (dt) where dt < '2001-01-01 10:11:12';
count(*)
4
(2, '1912-09-05 13:00:59', '1912-09-05', '1912', '13:00:59'),
(3, '1945-12-31 00:00:00', '1945-12-31', '1945', '00:00:00'),
(4, '1955-12-31 00:00:00', '1955-12-31', '1955', '00:00:00'),
(5, '1963-06-06 06:06:06', '1963-06-06', '1963', '06:06:06'),
(6, '1993-06-06 06:06:06', '1993-06-06', '1993', '06:06:06'),
(7, '2001-01-01 10:11:10', '2001-01-01', '2001', '10:11:10'),
(8, '2001-01-01 10:11:11', '2001-01-01', '2001', '10:11:11'),
(9, '2005-01-31 23:59:59', '2005-01-31', '2005', '23:59:59');
select count(*)-9 from t1 use index (dt) where dt >  '1900-01-01 00:00:00';
count(*)-9
0
select count(*)-6 from t1 use index (dt) where dt >= '1955-12-31 00:00:00';
count(*)-6
0
select count(*)-5 from t1 use index (dt) where dt >  '1955-12-31 00:00:00';
count(*)-5
0
select count(*)-5 from t1 use index (dt) where dt <  '1970-03-03 22:22:22';
count(*)-5
0
select count(*)-7 from t1 use index (dt) where dt <  '2001-01-01 10:11:11';
count(*)-7
0
select count(*)-8 from t1 use index (dt) where dt <= '2001-01-01 10:11:11';
count(*)-8
0
select count(*)-9 from t1 use index (dt) where dt <= '2055-01-01 00:00:00';
count(*)-9
0
select count(*)-9 from t1 use index (da) where da >  '1900-01-01';
count(*)-9
0
select count(*)-6 from t1 use index (da) where da >= '1955-12-31';
count(*)-6
0
select count(*)-5 from t1 use index (da) where da >  '1955-12-31';
count(*)-5
0
select count(*)-5 from t1 use index (da) where da <  '1970-03-03';
count(*)-5
0
select count(*)-6 from t1 use index (da) where da <  '2001-01-01';
count(*)-6
0
select count(*)-8 from t1 use index (da) where da <= '2001-01-02';
count(*)-8
0
select count(*)-9 from t1 use index (da) where da <= '2055-01-01';
count(*)-9
0
+24 −8
Original line number Diff line number Diff line
@@ -191,13 +191,29 @@ create table t1 (

insert into t1 (pk,dt,da,ye,ti) values
  (1, '1901-05-05 23:00:59', '1901-05-05', '1901', '23:00:59'),
  (2, '1955-12-31 00:00:00', '1955-12-31', '1955', '00:00:00'),
  (3, '1999-06-06 06:06:06', '1999-06-06', '1999', '06:06:06'),
  (4, '2001-01-01 10:11:11', '2001-01-01', '2001', '10:11:11'),
  (5, '2005-01-31 23:59:59', '2005-01-31', '2005', '23:59:59');
  (2, '1912-09-05 13:00:59', '1912-09-05', '1912', '13:00:59'),
  (3, '1945-12-31 00:00:00', '1945-12-31', '1945', '00:00:00'),
  (4, '1955-12-31 00:00:00', '1955-12-31', '1955', '00:00:00'),
  (5, '1963-06-06 06:06:06', '1963-06-06', '1963', '06:06:06'),
  (6, '1993-06-06 06:06:06', '1993-06-06', '1993', '06:06:06'),
  (7, '2001-01-01 10:11:10', '2001-01-01', '2001', '10:11:10'),
  (8, '2001-01-01 10:11:11', '2001-01-01', '2001', '10:11:11'),
  (9, '2005-01-31 23:59:59', '2005-01-31', '2005', '23:59:59');

# datetime
select count(*) from t1 use index (dt) where dt > '1900-01-01 00:00:00';
select count(*) from t1 use index (dt) where dt > '1955-12-31 00:00:00';
select count(*) from t1 use index (dt) where dt < '2001-01-01 10:11:11';
select count(*) from t1 use index (dt) where dt < '2001-01-01 10:11:12';
select count(*)-9 from t1 use index (dt) where dt >  '1900-01-01 00:00:00';
select count(*)-6 from t1 use index (dt) where dt >= '1955-12-31 00:00:00';
select count(*)-5 from t1 use index (dt) where dt >  '1955-12-31 00:00:00';
select count(*)-5 from t1 use index (dt) where dt <  '1970-03-03 22:22:22';
select count(*)-7 from t1 use index (dt) where dt <  '2001-01-01 10:11:11';
select count(*)-8 from t1 use index (dt) where dt <= '2001-01-01 10:11:11';
select count(*)-9 from t1 use index (dt) where dt <= '2055-01-01 00:00:00';

# date
select count(*)-9 from t1 use index (da) where da >  '1900-01-01';
select count(*)-6 from t1 use index (da) where da >= '1955-12-31';
select count(*)-5 from t1 use index (da) where da >  '1955-12-31';
select count(*)-5 from t1 use index (da) where da <  '1970-03-03';
select count(*)-6 from t1 use index (da) where da <  '2001-01-01';
select count(*)-8 from t1 use index (da) where da <= '2001-01-02';
select count(*)-9 from t1 use index (da) where da <= '2055-01-01';
+3 −3
Original line number Diff line number Diff line
@@ -308,7 +308,7 @@ public:
    ExtBinary = NdbSqlUtil::Type::Binary,
    ExtVarbinary = NdbSqlUtil::Type::Varbinary,
    ExtDatetime = NdbSqlUtil::Type::Datetime,
    ExtTimespec = NdbSqlUtil::Type::Timespec,
    ExtDate = NdbSqlUtil::Type::Date,
    ExtBlob = NdbSqlUtil::Type::Blob,
    ExtText = NdbSqlUtil::Type::Text
  };
@@ -428,10 +428,10 @@ public:
        AttributeSize = DictTabInfo::an8Bit;
        AttributeArraySize = 8 * AttributeExtLength;
        return true;
      case DictTabInfo::ExtTimespec:
      case DictTabInfo::ExtDate:
        AttributeType = DictTabInfo::StringType;
        AttributeSize = DictTabInfo::an8Bit;
        AttributeArraySize = 12 * AttributeExtLength;
        AttributeArraySize = 3 * AttributeExtLength;
        return true;
      case DictTabInfo::ExtBlob:
      case DictTabInfo::ExtText:
+1 −1
Original line number Diff line number Diff line
@@ -185,7 +185,7 @@ public:
      Binary,        ///< Len
      Varbinary,     ///< Max len
      Datetime,    ///< Precision down to 1 sec (sizeof(Datetime) == 8 bytes )
      Timespec,    ///< Precision down to 1 nsec(sizeof(Datetime) == 12 bytes )
      Date,        ///< Precision down to 1 day(sizeof(Date) == 4 bytes )
      Blob,        ///< Binary large object (see NdbBlob)
      Text         ///< Text blob
    };
+2 −2
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ public:
      Binary,           // Len
      Varbinary,        // Max len
      Datetime,         // Precision down to 1 sec  (size 8 bytes)
      Timespec,         // Precision down to 1 nsec (size 12 bytes)
      Date,             // Precision down to 1 day (size 4 bytes)
      Blob,             // Blob
      Text              // Text blob
    };
@@ -132,7 +132,7 @@ private:
  static Cmp cmpBinary;
  static Cmp cmpVarbinary;
  static Cmp cmpDatetime;
  static Cmp cmpTimespec;
  static Cmp cmpDate;
  static Cmp cmpBlob;
  static Cmp cmpText;
};
Loading