[Groonga-commit] groonga/groonga [master] min: use Float as the smallest number type instead of Time

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Sep 23 18:44:09 JST 2012


Kouhei Sutou	2012-09-23 18:44:09 +0900 (Sun, 23 Sep 2012)

  New Revision: 13f5a313e35b01a1b5c5f42ec31e3538995f9e40
  https://github.com/groonga/groonga/commit/13f5a313e35b01a1b5c5f42ec31e3538995f9e40

  Log:
    min: use Float as the smallest number type instead of Time

  Added files:
    test/function/suite/select/function/min/only_time.test
  Copied files:
    test/function/suite/select/function/min/mix_time_float.expected
      (from test/function/suite/select/function/min/mix_time.expected)
  Modified files:
    lib/proc.c
  Renamed files:
    test/function/suite/select/function/min/mix_time_float.test
      (from test/function/suite/select/function/min/mix_time.test)
    test/function/suite/select/function/min/only_float.expected
      (from test/function/suite/select/function/min/mix_float.expected)
    test/function/suite/select/function/min/only_float.test
      (from test/function/suite/select/function/min/mix_float.test)
    test/function/suite/select/function/min/only_time.expected
      (from test/function/suite/select/function/min/mix_time.expected)

  Modified: lib/proc.c (+3 -3)
===================================================================
--- lib/proc.c    2012-09-23 18:39:24 +0900 (e476bbe)
+++ lib/proc.c    2012-09-23 18:44:09 +0900 (1f5c40f)
@@ -2631,10 +2631,10 @@ smaller_number_type(grn_id type1, grn_id type2)
   }
 
   switch (type1) {
-  case GRN_DB_TIME :
-    return type1;
   case GRN_DB_FLOAT :
-    if (type2 == GRN_DB_TIME) {
+    return type1;
+  case GRN_DB_TIME :
+    if (type2 == GRN_DB_FLOAT) {
       return type2;
     } else {
       return type1;

  Copied: test/function/suite/select/function/min/mix_time_float.expected (+1 -1) 92%
===================================================================
--- test/function/suite/select/function/min/mix_time.expected    2012-09-23 18:39:24 +0900 (d3ebe61)
+++ test/function/suite/select/function/min/mix_time_float.expected    2012-09-23 18:44:09 +0900 (923eb5a)
@@ -9,7 +9,7 @@ load --table Values
 {"time_value":-1348322135.12666}
 ]
 [[0,0.0,0.0],1]
-select Values   --filter true   --output_columns '_id,output'   --scorer 'output = min(29, time_value, 29.29)'
+select Values   --filter true   --output_columns '_id,output'   --scorer 'output = min(-29, time_value, 29.29)'
 [
   [
     0,

  Renamed: test/function/suite/select/function/min/mix_time_float.test (+1 -1) 83%
===================================================================
--- test/function/suite/select/function/min/mix_time.test    2012-09-23 18:39:24 +0900 (87aa0ad)
+++ test/function/suite/select/function/min/mix_time_float.test    2012-09-23 18:44:09 +0900 (3f761b9)
@@ -10,4 +10,4 @@ load --table Values
 select Values \
   --filter true \
   --output_columns '_id,output' \
-  --scorer 'output = min(29, time_value, 29.29)'
+  --scorer 'output = min(-29, time_value, 29.29)'

  Renamed: test/function/suite/select/function/min/only_float.expected (+0 -0) 100%
===================================================================

  Renamed: test/function/suite/select/function/min/only_float.test (+0 -0) 100%
===================================================================

  Renamed: test/function/suite/select/function/min/only_time.expected (+7 -3) 63%
===================================================================
--- test/function/suite/select/function/min/mix_time.expected    2012-09-23 18:39:24 +0900 (d3ebe61)
+++ test/function/suite/select/function/min/only_time.expected    2012-09-23 18:44:09 +0900 (9337cd2)
@@ -1,15 +1,19 @@
 table_create Values TABLE_NO_KEY
 [[0,0.0,0.0],true]
-column_create Values time_value COLUMN_SCALAR Time
+column_create Values past COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Values now COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Values feature COLUMN_SCALAR Time
 [[0,0.0,0.0],true]
 column_create Values output COLUMN_SCALAR Time
 [[0,0.0,0.0],true]
 load --table Values
 [
-{"time_value":-1348322135.12666}
+{"past":-1348322135.12666, "now":1348322135.12666, "feature":1848322135.12666}
 ]
 [[0,0.0,0.0],1]
-select Values   --filter true   --output_columns '_id,output'   --scorer 'output = min(29, time_value, 29.29)'
+select Values   --filter true   --output_columns '_id,output'   --scorer 'output = min(now, past, feature)'
 [
   [
     0,

  Added: test/function/suite/select/function/min/only_time.test (+15 -0) 100644
===================================================================
--- /dev/null
+++ test/function/suite/select/function/min/only_time.test    2012-09-23 18:44:09 +0900 (43308e0)
@@ -0,0 +1,15 @@
+table_create Values TABLE_NO_KEY
+column_create Values past COLUMN_SCALAR Time
+column_create Values now COLUMN_SCALAR Time
+column_create Values feature COLUMN_SCALAR Time
+column_create Values output COLUMN_SCALAR Time
+
+load --table Values
+[
+{"past":-1348322135.12666, "now":1348322135.12666, "feature":1848322135.12666}
+]
+
+select Values \
+  --filter true \
+  --output_columns '_id,output' \
+  --scorer 'output = min(now, past, feature)'
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index