summaryrefslogtreecommitdiff
path: root/storage/mroonga
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-11-06 09:40:39 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-11-06 09:40:39 +0200
commitdf563e0c037f9b2cdb22e145575f92a121b4b529 (patch)
tree31d39796cebcef916eb7e0888537c18f946170ff /storage/mroonga
parente058a251c10350f3727ca1df022dc5786933535b (diff)
parentbdfe2784d5b73a1fdcdacb3d9adcc9dc71af344b (diff)
downloadmariadb-git-df563e0c037f9b2cdb22e145575f92a121b4b529.tar.gz
Merge 10.2 into 10.3
main.derived_cond_pushdown: Move all 10.3 tests to the end, trim trailing white space, and add an "End of 10.3 tests" marker. Add --sorted_result to tests where the ordering is not deterministic. main.win_percentile: Add --sorted_result to tests where the ordering is no longer deterministic.
Diffstat (limited to 'storage/mroonga')
-rw-r--r--storage/mroonga/ha_mroonga.cpp9
-rw-r--r--storage/mroonga/ha_mroonga.hpp2
-rw-r--r--storage/mroonga/lib/mrn_multiple_column_key_codec.cpp4
3 files changed, 10 insertions, 5 deletions
diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp
index 43445495b6c..a80776fe5f5 100644
--- a/storage/mroonga/ha_mroonga.cpp
+++ b/storage/mroonga/ha_mroonga.cpp
@@ -11824,7 +11824,8 @@ int ha_mroonga::storage_encode_key_timestamp2(Field *field, const uchar *key,
#endif
#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2
-int ha_mroonga::storage_encode_key_datetime2(Field *field, const uchar *key,
+int ha_mroonga::storage_encode_key_datetime2(Field *field, bool is_null,
+ const uchar *key,
uchar *buf, uint *size)
{
MRN_DBUG_ENTER_METHOD();
@@ -11832,7 +11833,7 @@ int ha_mroonga::storage_encode_key_datetime2(Field *field, const uchar *key,
bool truncated = false;
Field_datetimef *datetime2_field = (Field_datetimef *)field;
- longlong packed_time =
+ longlong packed_time = is_null ? 0 :
my_datetime_packed_from_binary(key, datetime2_field->decimals());
MYSQL_TIME mysql_time;
TIME_from_longlong_datetime_packed(&mysql_time, packed_time);
@@ -11960,6 +11961,7 @@ int ha_mroonga::storage_encode_key(Field *field, const uchar *key,
MRN_DBUG_ENTER_METHOD();
int error;
bool truncated = false;
+ bool is_null = false;
const uchar *ptr = key;
error = mrn_change_encoding(ctx, field->charset());
@@ -11967,6 +11969,7 @@ int ha_mroonga::storage_encode_key(Field *field, const uchar *key,
DBUG_RETURN(error);
if (field->null_bit) {
+ is_null = *ptr;
ptr += 1;
}
@@ -12064,7 +12067,7 @@ int ha_mroonga::storage_encode_key(Field *field, const uchar *key,
#endif
#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2
case MYSQL_TYPE_DATETIME2:
- error = storage_encode_key_datetime2(field, ptr, buf, size);
+ error = storage_encode_key_datetime2(field, is_null, ptr, buf, size);
break;
#endif
#ifdef MRN_HAVE_MYSQL_TYPE_TIME2
diff --git a/storage/mroonga/ha_mroonga.hpp b/storage/mroonga/ha_mroonga.hpp
index 0b3ff92a9a8..68c79703903 100644
--- a/storage/mroonga/ha_mroonga.hpp
+++ b/storage/mroonga/ha_mroonga.hpp
@@ -796,7 +796,7 @@ private:
uchar *buf, uint *size);
#endif
#ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2
- int storage_encode_key_datetime2(Field *field, const uchar *key,
+ int storage_encode_key_datetime2(Field *field, bool is_null, const uchar *key,
uchar *buf, uint *size);
#endif
#ifdef MRN_HAVE_MYSQL_TYPE_TIME2
diff --git a/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp b/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp
index 9c56997d6d8..65c8259e0cc 100644
--- a/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp
+++ b/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp
@@ -89,11 +89,13 @@ namespace mrn {
for (int i = 0; i < n_key_parts && current_mysql_key < mysql_key_end; i++) {
KEY_PART_INFO *key_part = &(key_info_->key_part[i]);
Field *field = key_part->field;
+ bool is_null = false;
DBUG_PRINT("info", ("mroonga: key_part->length=%u", key_part->length));
if (field->null_bit) {
DBUG_PRINT("info", ("mroonga: field has null bit"));
*current_grn_key = 0;
+ is_null = *current_mysql_key;
current_mysql_key += 1;
current_grn_key += 1;
(*grn_key_length)++;
@@ -164,7 +166,7 @@ namespace mrn {
{
Field_datetimef *datetimef_field =
static_cast<Field_datetimef *>(field);
- long long int mysql_datetime_packed =
+ long long int mysql_datetime_packed = is_null ? 0 :
my_datetime_packed_from_binary(current_mysql_key,
datetimef_field->decimals());
MYSQL_TIME mysql_time;