Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
expr optimize: add support for assign and ref
- Loading branch information
Showing
5 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
require "expression_tree/accessor" | ||
require "expression_tree/assign" | ||
require "expression_tree/binary_operation" | ||
require "expression_tree/constant" | ||
require "expression_tree/function_call" | ||
require "expression_tree/index_column" | ||
require "expression_tree/logical_operation" | ||
require "expression_tree/procedure" | ||
require "expression_tree/reference" | ||
require "expression_tree/table" | ||
require "expression_tree/unary_operation" | ||
require "expression_tree/variable" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Groonga | ||
module ExpressionTree | ||
class Assign | ||
attr_reader :variable | ||
attr_reader :value | ||
def initialize(variable, value) | ||
@variable = variable | ||
@value = value | ||
end | ||
|
||
def build(expression) | ||
@variable.build(expression) | ||
@value.build(expression) | ||
expression.append_operator(Operator::ASSIGN, 2) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Groonga | ||
module ExpressionTree | ||
class Reference | ||
attr_reader :column | ||
def initialize(column) | ||
@column = column | ||
end | ||
|
||
def build(expression) | ||
expression.append_object(@column, Operator::GET_REF, 1) | ||
end | ||
|
||
def estimate_size(table) | ||
table.size | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
RUBY_SCRIPT_FILES = \ | ||
accessor.rb \ | ||
assign.rb \ | ||
binary_operation.rb \ | ||
constant.rb \ | ||
function_call.rb \ | ||
index_column.rb \ | ||
logical_operation.rb \ | ||
procedure.rb \ | ||
reference.rb \ | ||
table.rb \ | ||
unary_operation.rb \ | ||
variable.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters