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

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Sep 23 18:39:24 JST 2012


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

  New Revision: 676f7a4c143713e82f984b4e6b436a8a94117bbe
  https://github.com/groonga/groonga/commit/676f7a4c143713e82f984b4e6b436a8a94117bbe

  Log:
    max: use Float as the largest number type instead of Time

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

  Modified: lib/proc.c (+3 -3)
===================================================================
--- lib/proc.c    2012-09-23 18:37:51 +0900 (984106b)
+++ lib/proc.c    2012-09-23 18:39:24 +0900 (e476bbe)
@@ -2606,10 +2606,10 @@ larger_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;

  Renamed: test/function/suite/select/function/max/mix_time_float.expected (+1 -1) 89%
===================================================================
--- test/function/suite/select/function/max/mix_time.expected    2012-09-23 18:37:51 +0900 (de8f6cc)
+++ test/function/suite/select/function/max/mix_time_float.expected    2012-09-23 18:39:24 +0900 (809c78e)
@@ -9,5 +9,5 @@ load --table Values
 {"time_value":1348322135.12666}
 ]
 [[0,0.0,0.0],1]
-select Values   --filter true   --output_columns '_id,output'   --scorer 'output = max(29, time_value, 29.29)'
+select Values   --filter true   --output_columns '_id,output'   --scorer 'output = max(-29, time_value, 29.29)'
 [[0,0.0,0.0],[[[1],[["_id","UInt32"],["output","Time"]],[1,1348322135.12666]]]]

  Renamed: test/function/suite/select/function/max/mix_time_float.test (+1 -1) 83%
===================================================================
--- test/function/suite/select/function/max/mix_time.test    2012-09-23 18:37:51 +0900 (0ec4d01)
+++ test/function/suite/select/function/max/mix_time_float.test    2012-09-23 18:39:24 +0900 (29519f6)
@@ -10,4 +10,4 @@ load --table Values
 select Values \
   --filter true \
   --output_columns '_id,output' \
-  --scorer 'output = max(29, time_value, 29.29)'
+  --scorer 'output = max(-29, time_value, 29.29)'

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

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

  Added: test/function/suite/select/function/max/only_time.expected (+17 -0) 100644
===================================================================
--- /dev/null
+++ test/function/suite/select/function/max/only_time.expected    2012-09-23 18:39:24 +0900 (9dd8fa7)
@@ -0,0 +1,17 @@
+table_create Values TABLE_NO_KEY
+[[0,0.0,0.0],true]
+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
+[
+{"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 = max(now, past, feature)'
+[[0,0.0,0.0],[[[1],[["_id","UInt32"],["output","Time"]],[1,1848322135.12666]]]]

  Added: test/function/suite/select/function/max/only_time.test (+15 -0) 100644
===================================================================
--- /dev/null
+++ test/function/suite/select/function/max/only_time.test    2012-09-23 18:39:24 +0900 (f1cfe4e)
@@ -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 = max(now, past, feature)'
-------------- next part --------------
HTML����������������������������...
Descargar 



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