<commit_before>class MiqExpression
  require_nested :Tag
  include Vmdb::Logging
  attr_accessor :exp, :context_type, :preprocess_options

  BASE_TABLES = %w(
    AuditEvent
    AvailabilityZone
    BottleneckEvent
    ChargebackVm
    ChargebackContainerProject
    CloudResourceQuota
    CloudTenant
    CloudVolume
    Compliance
    ManageIQ::Providers::Foreman::ConfigurationManager::ConfiguredSystem
    ManageIQ::Providers::ConfigurationManager
    Container
    ContainerGroup
    ContainerImage
    ContainerImageRegistry
    ContainerNode
    ContainerProject
    ContainerReplicator
    ContainerRoute
    ContainerService
    ManageIQ::Providers::CloudManager
    EmsCluster
    EmsClusterPerformance
    EmsEvent
    ManageIQ::Providers::InfraManager
    ExtManagementSystem
    ExtManagementSystemPerformance
    Flavor
    Host
    HostAggregate
    HostPerformance
    MiqGroup
    MiqRegion
    MiqRequest
    MiqServer
    MiqTemplate
    MiqWorker
    OntapFileShare
    OntapLogicalDisk
    OntapStorageSystem
    OntapStorageVolume
    OntapVolumeMetricsRollup
    OrchestrationStack
    OrchestrationTemplate
    PolicyEvent
    ResourcePool
    SecurityGroup
    Service
    ServiceTemplate
    Storage
    StorageFile
    StoragePerformance
    Switch
    ManageIQ::Providers::CloudManager::Template
    ManageIQ::Providers::InfraManager::Template
    Tenant
    User
    VimPerformanceTrend
    Vm
    ManageIQ::Providers::CloudManager::Vm
    ManageIQ::Providers::InfraManager::Vm
    VmPerformance
    Zone
  )

  INCLUDE_TABLES = %w(
    advanced_settings
    audit_events
    availability_zones
    cloud_networks
    cloud_resource_quotas
    cloud_tenants
    compliances
    compliance_details
    computer_systems
    configuration_profiles
    configuration_managers
    configured_systems
    containers
    container_groups
    container_projects
    container_images
    container_nodes
    customization_scripts
    customization_script_media
    customization_script_ptables
    disks
    ems_events
    ems_clusters
    ems_custom_attributes
    evm_owners
    event_logs
    ext_management_systems
    filesystem_drivers
    filesystems
    firewall_rules
    flavors
    groups
    guest_applications
    guest_devices
    hardwares
    hosts
    host_aggregates
    host_services
    kernel_drivers
    key_pairs
    lans
    last_compliances
    linux_initprocesses
    miq_actions
    miq_approval_stamps
    miq_custom_attributes
    miq_policy_sets
    miq_provisions
    miq_regions
    miq_requests
    miq_scsi_luns
    miq_servers
    miq_workers
    ontap_concrete_extents
    ontap_file_shares
    ontap_logical_disks
    ontap_plex_extents
    ontap_raid_group_extents
    ontap_storage_systems
    ontap_storage_volumes
    openscap_results
    openscap_rule_results
    orchestration_stack_outputs
    orchestration_stack_parameters
    orchestration_stack_resources
    orchestration_templates
    operating_system_flavors
    partitions
    ports
    processes
    miq_provision_templates
    miq_provision_vms
    miq_templates
    networks
    nics
    operating_systems
    patches
    registry_items
    resource_pools
    security_groups
    service_templates
    services
    snapshots
    stacks
    storages
    storage_adapters
    storage_files
    switches
    tenant_quotas
    users
    vms
    volumes
    win32_services
    zones
    storage_systems
    file_systems
    hosted_file_shares
    file_shares
    logical_disks
    storage_volumes
    base_storage_extents
    top_storage_extents
  )

  EXCLUDE_COLUMNS = %w(
    ^.*_id$
    ^id$
    ^min_derived_storage.*$
    ^max_derived_storage.*$
    assoc_ids
    capture_interval
    filters
    icon

    intervals_in_rollup

    max_cpu_ready_delta_summation
    max_cpu_system_delta_summation
    max_cpu_used_delta_summation
    max_cpu_wait_delta_summation
    max_derived_cpu_available
    max_derived_cpu_reserved
    max_derived_memory_available
    max_derived_memory_reserved

    memory_usage

    min_cpu_ready_delta_summation
    min_cpu_system_delta_summation
    min_cpu_used_delta_summation
    min_cpu_wait_delta_summation
    min_derived_memory_available
    min_derived_memory_reserved
    min_derived_cpu_available
    min_derived_cpu_reserved

    min_max

    options
    password
    policy_settings
    ^reserved$
    resource_id
    settings
    tag_names
    v_qualified_desc

    disk_io_cost
    disk_io_metric
    net_io_cost
    net_io_metric
    fixed_2_cost
  )

  EXCLUDE_EXCEPTIONS = %w(
    capacity_profile_1_memory_per_vm_with_min_max
    capacity_profile_1_vcpu_per_vm_with_min_max
    capacity_profile_2_memory_per_vm_with_min_max
    capacity_profile_2_vcpu_per_vm_with_min_max
    chain_id
    guid
    openscap_id
  )

  TAG_CLASSES = {
    'ManageIQ::Providers::CloudManager'           => 'ext_management_system',
    'EmsCluster'                                  => 'ems_cluster',
    'ManageIQ::Providers::InfraManager'           => 'ext_management_system',
    'ExtManagementSystem'                         => 'ext_management_system',
    'Host'                                        => 'host',
    'MiqGroup'                                    => 'miq_group',
    'MiqTemplate'                                 => 'miq_template',
    'ResourcePool'                                => 'resource_pool',
    'Service'                                     => 'service',
    'Storage'                                     => 'storage',
    'ManageIQ::Providers::CloudManager::Template' => 'miq_template',
    'ManageIQ::Providers::InfraManager::Template' => 'miq_template',
    'User'                                        => 'user',
    'Vm'                                          => 'vm',
    'VmOrTemplate'                                => 'vm',
    'ManageIQ::Providers::CloudManager::Vm'       => 'vm',
    'ManageIQ::Providers::InfraManager::Vm'       => 'vm',
    'ContainerProject'                            => 'container_project'
  }
  EXCLUDE_FROM_RELATS = {
    "ManageIQ::Providers::CloudManager" => ["hosts", "ems_clusters", "resource_pools"]
  }

  FORMAT_SUB_TYPES = {
    :boolean     => {
      :short_name => _("Boolean"),
      :title      => _("Enter true or false")
    },
    :bytes       => {<commit_msg>Add ::ContainerManager to the TAG_CLASSES to display its tags in advanced search<commit_after>class MiqExpression
  require_nested :Tag
  include Vmdb::Logging
  attr_accessor :exp, :context_type, :preprocess_options

  BASE_TABLES = %w(
    AuditEvent
    AvailabilityZone
    BottleneckEvent
    ChargebackVm
    ChargebackContainerProject
    CloudResourceQuota
    CloudTenant
    CloudVolume
    Compliance
    ManageIQ::Providers::Foreman::ConfigurationManager::ConfiguredSystem
    ManageIQ::Providers::ConfigurationManager
    Container
    ContainerGroup
    ContainerImage
    ContainerImageRegistry
    ContainerNode
    ContainerProject
    ContainerReplicator
    ContainerRoute
    ContainerService
    ManageIQ::Providers::CloudManager
    EmsCluster
    EmsClusterPerformance
    EmsEvent
    ManageIQ::Providers::InfraManager
    ExtManagementSystem
    ExtManagementSystemPerformance
    Flavor
    Host
    HostAggregate
    HostPerformance
    MiqGroup
    MiqRegion
    MiqRequest
    MiqServer
    MiqTemplate
    MiqWorker
    OntapFileShare
    OntapLogicalDisk
    OntapStorageSystem
    OntapStorageVolume
    OntapVolumeMetricsRollup
    OrchestrationStack
    OrchestrationTemplate
    PolicyEvent
    ResourcePool
    SecurityGroup
    Service
    ServiceTemplate
    Storage
    StorageFile
    StoragePerformance
    Switch
    ManageIQ::Providers::CloudManager::Template
    ManageIQ::Providers::InfraManager::Template
    Tenant
    User
    VimPerformanceTrend
    Vm
    ManageIQ::Providers::CloudManager::Vm
    ManageIQ::Providers::InfraManager::Vm
    VmPerformance
    Zone
  )

  INCLUDE_TABLES = %w(
    advanced_settings
    audit_events
    availability_zones
    cloud_networks
    cloud_resource_quotas
    cloud_tenants
    compliances
    compliance_details
    computer_systems
    configuration_profiles
    configuration_managers
    configured_systems
    containers
    container_groups
    container_projects
    container_images
    container_nodes
    customization_scripts
    customization_script_media
    customization_script_ptables
    disks
    ems_events
    ems_clusters
    ems_custom_attributes
    evm_owners
    event_logs
    ext_management_systems
    filesystem_drivers
    filesystems
    firewall_rules
    flavors
    groups
    guest_applications
    guest_devices
    hardwares
    hosts
    host_aggregates
    host_services
    kernel_drivers
    key_pairs
    lans
    last_compliances
    linux_initprocesses
    miq_actions
    miq_approval_stamps
    miq_custom_attributes
    miq_policy_sets
    miq_provisions
    miq_regions
    miq_requests
    miq_scsi_luns
    miq_servers
    miq_workers
    ontap_concrete_extents
    ontap_file_shares
    ontap_logical_disks
    ontap_plex_extents
    ontap_raid_group_extents
    ontap_storage_systems
    ontap_storage_volumes
    openscap_results
    openscap_rule_results
    orchestration_stack_outputs
    orchestration_stack_parameters
    orchestration_stack_resources
    orchestration_templates
    operating_system_flavors
    partitions
    ports
    processes
    miq_provision_templates
    miq_provision_vms
    miq_templates
    networks
    nics
    operating_systems
    patches
    registry_items
    resource_pools
    security_groups
    service_templates
    services
    snapshots
    stacks
    storages
    storage_adapters
    storage_files
    switches
    tenant_quotas
    users
    vms
    volumes
    win32_services
    zones
    storage_systems
    file_systems
    hosted_file_shares
    file_shares
    logical_disks
    storage_volumes
    base_storage_extents
    top_storage_extents
  )

  EXCLUDE_COLUMNS = %w(
    ^.*_id$
    ^id$
    ^min_derived_storage.*$
    ^max_derived_storage.*$
    assoc_ids
    capture_interval
    filters
    icon

    intervals_in_rollup

    max_cpu_ready_delta_summation
    max_cpu_system_delta_summation
    max_cpu_used_delta_summation
    max_cpu_wait_delta_summation
    max_derived_cpu_available
    max_derived_cpu_reserved
    max_derived_memory_available
    max_derived_memory_reserved

    memory_usage

    min_cpu_ready_delta_summation
    min_cpu_system_delta_summation
    min_cpu_used_delta_summation
    min_cpu_wait_delta_summation
    min_derived_memory_available
    min_derived_memory_reserved
    min_derived_cpu_available
    min_derived_cpu_reserved

    min_max

    options
    password
    policy_settings
    ^reserved$
    resource_id
    settings
    tag_names
    v_qualified_desc

    disk_io_cost
    disk_io_metric
    net_io_cost
    net_io_metric
    fixed_2_cost
  )

  EXCLUDE_EXCEPTIONS = %w(
    capacity_profile_1_memory_per_vm_with_min_max
    capacity_profile_1_vcpu_per_vm_with_min_max
    capacity_profile_2_memory_per_vm_with_min_max
    capacity_profile_2_vcpu_per_vm_with_min_max
    chain_id
    guid
    openscap_id
  )

  TAG_CLASSES = {
    'ManageIQ::Providers::CloudManager'           => 'ext_management_system',
    'EmsCluster'                                  => 'ems_cluster',
    'ManageIQ::Providers::InfraManager'           => 'ext_management_system',
    'ManageIQ::Providers::ContainerManager'       => 'ext_management_system',
    'ExtManagementSystem'                         => 'ext_management_system',
    'Host'                                        => 'host',
    'MiqGroup'                                    => 'miq_group',
    'MiqTemplate'                                 => 'miq_template',
    'ResourcePool'                                => 'resource_pool',
    'Service'                                     => 'service',
    'Storage'                                     => 'storage',
    'ManageIQ::Providers::CloudManager::Template' => 'miq_template',
    'ManageIQ::Providers::InfraManager::Template' => 'miq_template',
    'User'                                        => 'user',
    'Vm'                                          => 'vm',
    'VmOrTemplate'                                => 'vm',
    'ManageIQ::Providers::CloudManager::Vm'       => 'vm',
    'ManageIQ::Providers::InfraManager::Vm'       => 'vm',
    'ContainerProject'                            => 'container_project'
  }
  EXCLUDE_FROM_RELATS = {
    "ManageIQ::Providers::CloudManager" => ["hosts", "ems_clusters", "resource_pools"]
  }

  FORMAT_SUB_TYPES = {
    :boolean     => {
      :short_name => _("Boolean"),
      :title      => _("Enter true or false")
    },
    :bytes       => {
{'fraction_non_alphanumeric': 0.04732752531198493, 'fraction_numerical': 0.0010988148496978258, 'mean_word_length': 2.574193548387097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 50, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1318539', 'n_tokens_mistral': 3995, 'n_tokens_neox': 3856, 'n_words': 577}