<commit_before>module Influxdb
  module Arel
    class SelectManager < Arel::TreeManager
      DIRECTIONS = [:asc, :desc].freeze

      def initialize(*tables, &block)
        super()
        @ast = Nodes::SelectStatement.new
        from(*tables, &block)
      end

      def group(*attributes, &block)
        ast.groups |= Clauses::GroupClause.new(*attributes, &block).to_arel
        self
      end

      def group!(*attributes, &block)
        ast.groups = process_value_with_bang(Clauses::GroupClause, attributes, &block)
        self
      end

      def group_values
        ast.groups
      end

      def select(*attributes, &block)
        ast.attributes |= Clauses::SelectClause.new(*attributes, &block).to_arel
        self
      end

      def select!(*attributes, &block)
        ast.attributes = process_value_with_bang(Clauses::SelectClause, attributes, &block)
        self
      end

      def select_values
        ast.attributes
      end

      def fill(value)
        ast.fill = Nodes::Fill.new(value)
        self
      end

      def fill_value
        ast.fill
      end

      def from(*new_tables, &block)
        new_tables = new_tables.compact
        return self if new_tables.empty? && !block_given?

        expr = Clauses::FromClause.new(*new_tables, &block).to_arel

        case expr
        when Array
          regexps, merges, joins, others = separate_tables(expr.to_a)
          ast.regexp = Nodes::Table.new(regexps.first) if regexps
          ast.join = joins.first if joins
          ast.merge = merges.first if merges
          ast.tables = others
        when Nodes::Join
          ast.join = expr
        when Nodes::Merge
          ast.merge = expr
        when Regexp
          ast.regexp = expr
        else
          ast.tables = Array(expr)<commit_msg>Fixed SelectManager#from when setting table name as Regexp <commit_after>module Influxdb
  module Arel
    class SelectManager < Arel::TreeManager
      DIRECTIONS = [:asc, :desc].freeze

      def initialize(*tables, &block)
        super()
        @ast = Nodes::SelectStatement.new
        from(*tables, &block)
      end

      def group(*attributes, &block)
        ast.groups |= Clauses::GroupClause.new(*attributes, &block).to_arel
        self
      end

      def group!(*attributes, &block)
        ast.groups = process_value_with_bang(Clauses::GroupClause, attributes, &block)
        self
      end

      def group_values
        ast.groups
      end

      def select(*attributes, &block)
        ast.attributes |= Clauses::SelectClause.new(*attributes, &block).to_arel
        self
      end

      def select!(*attributes, &block)
        ast.attributes = process_value_with_bang(Clauses::SelectClause, attributes, &block)
        self
      end

      def select_values
        ast.attributes
      end

      def fill(value)
        ast.fill = Nodes::Fill.new(value)
        self
      end

      def fill_value
        ast.fill
      end

      def from(*new_tables, &block)
        new_tables = new_tables.compact
        return self if new_tables.empty? && !block_given?

        expr = Clauses::FromClause.new(*new_tables, &block).to_arel

        case expr
        when Array
          regexps, merges, joins, others = separate_tables(expr.to_a)
          ast.regexp = Nodes::Table.new(regexps.first) if regexps
          ast.join = joins.first if joins
          ast.merge = merges.first if merges
          ast.tables = others if others
        when Nodes::Join
          ast.join = expr
        when Nodes::Merge
          ast.merge = expr
        when Regexp
          ast.regexp = expr
        else
          ast.tables = Array(expr)
{'fraction_non_alphanumeric': 0.09088427947598253, 'fraction_numerical': 0.0, 'mean_word_length': 2.021434460016488, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2473558', 'n_tokens_mistral': 1079, 'n_tokens_neox': 1049, 'n_words': 253}