Module: Veritas::SQL::Generator::Function::Aggregate
- Includes:
- Veritas::SQL::Generator::Function
- Included in:
- Relation::Unary
- Defined in:
- lib/veritas/sql/generator/function/aggregate.rb
Overview
Generates an SQL statement for an aggregate function
Constant Summary collapse
- COUNT =
'COUNT'.freeze
- SUM =
'SUM'.freeze
- MINIMUM =
'MIN'.freeze
- MAXIMUM =
'MAX'.freeze
- MEAN =
'AVG'.freeze
- VARIANCE =
'VAR_POP'.freeze
- STANDARD_DEVIATION =
'STDDEV_POP'.freeze
Constants included from Identifier
Identifier::ESCAPED_QUOTE, Identifier::QUOTE
Constants included from Literal
Literal::ESCAPED_QUOTE, Literal::FALSE, Literal::NULL, Literal::QUOTE, Literal::SEPARATOR, Literal::TIME_SCALE, Literal::TRUE
Instance Method Summary collapse
-
#visit_veritas_aggregate_count(count) ⇒ #to_s
private
Visit a count aggregate function.
-
#visit_veritas_aggregate_maximum(maximum) ⇒ #to_s
private
Visit a maximum aggregate function.
-
#visit_veritas_aggregate_mean(mean) ⇒ #to_s
private
Visit a mean aggregate function.
-
#visit_veritas_aggregate_minimum(minimum) ⇒ #to_s
private
Visit a minimum aggregate function.
-
#visit_veritas_aggregate_standard_deviation(standard_deviation) ⇒ #to_s
private
Visit a standard deviation aggregate function.
-
#visit_veritas_aggregate_sum(sum) ⇒ #to_s
private
Visit a sum aggregate function.
-
#visit_veritas_aggregate_variance(variance) ⇒ #to_s
private
Visit a variance aggregate function.
Methods included from Attribute
Methods included from Identifier
Methods included from Literal
dup_frozen, #visit_class, #visit_date, #visit_date_time, #visit_enumerable, #visit_false_class, #visit_nil_class, #visit_numeric, #visit_string, #visit_time, #visit_true_class
Instance Method Details
#visit_veritas_aggregate_count(count) ⇒ #to_s
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Visit a count aggregate function
27 28 29 |
# File 'lib/veritas/sql/generator/function/aggregate.rb', line 27 def visit_veritas_aggregate_count(count) unary_prefix_operation_sql(COUNT, count) end |
#visit_veritas_aggregate_maximum(maximum) ⇒ #to_s
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Visit a maximum aggregate function
61 62 63 64 |
# File 'lib/veritas/sql/generator/function/aggregate.rb', line 61 def visit_veritas_aggregate_maximum(maximum) # TODO: wrap this in a coalesce operation once the default can be made sane unary_prefix_operation_sql(MAXIMUM, maximum) end |
#visit_veritas_aggregate_mean(mean) ⇒ #to_s
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Visit a mean aggregate function
73 74 75 |
# File 'lib/veritas/sql/generator/function/aggregate.rb', line 73 def visit_veritas_aggregate_mean(mean) unary_prefix_operation_sql(MEAN, mean) end |
#visit_veritas_aggregate_minimum(minimum) ⇒ #to_s
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Visit a minimum aggregate function
49 50 51 52 |
# File 'lib/veritas/sql/generator/function/aggregate.rb', line 49 def visit_veritas_aggregate_minimum(minimum) # TODO: wrap this in a coalesce operation once the default can be made sane unary_prefix_operation_sql(MINIMUM, minimum) end |
#visit_veritas_aggregate_standard_deviation(standard_deviation) ⇒ #to_s
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Visit a standard deviation aggregate function
95 96 97 |
# File 'lib/veritas/sql/generator/function/aggregate.rb', line 95 def visit_veritas_aggregate_standard_deviation(standard_deviation) unary_prefix_operation_sql(STANDARD_DEVIATION, standard_deviation) end |
#visit_veritas_aggregate_sum(sum) ⇒ #to_s
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Visit a sum aggregate function
38 39 40 |
# File 'lib/veritas/sql/generator/function/aggregate.rb', line 38 def visit_veritas_aggregate_sum(sum) aggregate_function_sql(SUM, sum) end |
#visit_veritas_aggregate_variance(variance) ⇒ #to_s
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Visit a variance aggregate function
84 85 86 |
# File 'lib/veritas/sql/generator/function/aggregate.rb', line 84 def visit_veritas_aggregate_variance(variance) unary_prefix_operation_sql(VARIANCE, variance) end |