[Groonga-commit] groonga/groonga at 2dd0e4a [master] expr optimize: add support for null

Back to archive index
Kouhei Sutou null+****@clear*****
Mon Mar 4 18:09:15 JST 2019


Kouhei Sutou	2019-03-04 18:09:15 +0900 (Mon, 04 Mar 2019)

  Revision: 2dd0e4ab05c5e5f79f747899b892f8c6ead70a4a
  https://github.com/groonga/groonga/commit/2dd0e4ab05c5e5f79f747899b892f8c6ead70a4a

  Message:
    expr optimize: add support for null

  Added files:
    lib/mrb/scripts/expression_tree/null.rb
  Modified files:
    lib/mrb/scripts/expression_tree.rb
    lib/mrb/scripts/expression_tree/sources.am
    lib/mrb/scripts/expression_tree_builder.rb

  Modified: lib/mrb/scripts/expression_tree.rb (+1 -0)
===================================================================
--- lib/mrb/scripts/expression_tree.rb    2019-03-04 18:02:55 +0900 (fcf21cc69)
+++ lib/mrb/scripts/expression_tree.rb    2019-03-04 18:09:15 +0900 (8901950c1)
@@ -7,6 +7,7 @@ require "expression_tree/function_call"
 require "expression_tree/index_column"
 require "expression_tree/logical_operation"
 require "expression_tree/member"
+require "expression_tree/null"
 require "expression_tree/procedure"
 require "expression_tree/reference"
 require "expression_tree/table"

  Added: lib/mrb/scripts/expression_tree/null.rb (+17 -0) 100644
===================================================================
--- /dev/null
+++ lib/mrb/scripts/expression_tree/null.rb    2019-03-04 18:09:15 +0900 (0cb3554c8)
@@ -0,0 +1,17 @@
+module Groonga
+  module ExpressionTree
+    class Null
+      def build(expression)
+        expression.append_constant(nil, Operator::PUSH, 1)
+      end
+
+      def estimatable?
+        true
+      end
+
+      def estimate_size(table)
+        0
+      end
+    end
+  end
+end

  Modified: lib/mrb/scripts/expression_tree/sources.am (+1 -0)
===================================================================
--- lib/mrb/scripts/expression_tree/sources.am    2019-03-04 18:02:55 +0900 (46caed209)
+++ lib/mrb/scripts/expression_tree/sources.am    2019-03-04 18:09:15 +0900 (9e4b115ad)
@@ -8,6 +8,7 @@ RUBY_SCRIPT_FILES =				\
 	index_column.rb				\
 	logical_operation.rb			\
 	member.rb				\
+	null.rb					\
 	procedure.rb				\
 	reference.rb				\
 	table.rb				\

  Modified: lib/mrb/scripts/expression_tree_builder.rb (+2 -0)
===================================================================
--- lib/mrb/scripts/expression_tree_builder.rb    2019-03-04 18:02:55 +0900 (076f3e26f)
+++ lib/mrb/scripts/expression_tree_builder.rb    2019-03-04 18:09:15 +0900 (75af9395f)
@@ -142,6 +142,8 @@ module Groonga
             node = ExpressionTree::Accessor.new(code.value)
           when Table
             node = ExpressionTree::Table.new(code.value)
+          when Void
+            node = ExpressionTree::Null.new
           else
             node = ExpressionTree::Constant.new(code.value.value)
           end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190304/c685c215/attachment-0001.html>


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