Skip to content

Commit

Permalink
Merge pull request #16915 from NickLaMuro/bz-1539710-quick-fix-avoid-…
Browse files Browse the repository at this point in the history
…service-agg-col-with-miq-exp

Exclude Service::AGGREGATE_ALL_VM_ATTRS from MiqExp.to_sql
  • Loading branch information
gtanzillo authored Jan 31, 2018
2 parents 0ae4687 + 0d32b87 commit 5709538
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/miq_expression.rb
Original file line number Diff line number Diff line change
Expand Up @@ -476,15 +476,19 @@ def self.get_col_info(field, options = {})
result[:format_sub_type] = f.sub_type
result[:virtual_column] = model.virtual_attribute?(col.to_s)
result[:sql_support] = !result[:virtual_reflection] && model.attribute_supported_by_sql?(col.to_s)
result[:excluded_by_preprocess_options] = exclude_col_by_preprocess_options?(col, options)
result[:excluded_by_preprocess_options] = exclude_col_by_preprocess_options?(f, options)
end
result
end

def self.exclude_col_by_preprocess_options?(col, options)
return false unless options.kind_of?(Hash)
return false unless options[:vim_performance_daily_adhoc]
Metric::Rollup.excluded_col_for_expression?(col.to_sym)
def self.exclude_col_by_preprocess_options?(field, options)
if options.kind_of?(Hash) && options[:vim_performance_daily_adhoc]
Metric::Rollup.excluded_col_for_expression?(field.column.to_sym)
elsif field.target == Service
Service::AGGREGATE_ALL_VM_ATTRS.include?(field.column.to_sym)
else
false
end
end

def lenient_evaluate(obj, tz = nil)
Expand Down

0 comments on commit 5709538

Please sign in to comment.