Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude Service::AGGREGATE_ALL_VM_ATTRS from MiqExp.to_sql #16915

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 9 additions & 5 deletions lib/miq_expression.rb
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