Normalizes a column.

@param  array $column A column definition.
@return array         A normalized column array.
542487
protected function _initColumn($column)
    {
        $defaults = [
            'type'  => 'string',
            'array' => false
        ];
        if (is_string($column)) {
            $column = ['type' => $column];
        } elseif (isset($column[0])) {
            $column['type'] = $column[0];
            unset($column[0]);
        }
        $column += $defaults;
        return $column + ['null' => false];
    }
1205812
private function buildColumns(array $columns)
    {
        $this->columns = [];
        foreach ($columns as $key => $column)
        {
            $column = new DataTableColumn($column);
            $this->columns[$key] = $column;
            if($column->getName() != ""){
                $this->columns[$column->getName()] = $column;
            }
            if($column->getData() != ""){
                $this->columns[$column->getData()] = $column;
            }
        }
    }
977211
public function orHavingMultiple(array $columns)
    {
        $instance = $this->havingStrategyInstance();

        $instance->havingStrategy()->orHavingMultiple($columns);

        return $instance;
    }
251463
public function normalizeColumns()
	{
		$model_alias = $this->getAlias();
		$ret = array();

		foreach( $this->getColumns() as $descriptor )
		{
			$alias = $descriptor[0];
			if( $alias === $model_alias )
			{
				if( null === $descriptor[2] && $descriptor[1] === '*' )
				{
					foreach( array_keys($this->schemaColumnsGet()) as $column_name )
					{
						$ret []= array($alias, $column_name, null);
					}
				}
				else
				{
					$ret []= $descriptor;
				}
			}
			else
			{
				$ret []= $descriptor;
			}
		}

		$this->resetColumns( $ret );
	}
1252156
public function columns($columns = [])
    {
        if (func_num_args() == 0) {
            return $this->columns;
        }

        if (func_num_args() == 1 && is_array($columns)) {
            foreach ($columns as $column => $label) {
                $this->column($column, $label);
            }

            return;
        }

        foreach (func_get_args() as $column) {
            $this->column($column);
        }
    }
1003416
function columns(column) {
    if (!column) {
      return this;
    }
    this._statements.push({
      grouping: 'columns',
      value: normalizeArr.apply(null, arguments)
    });
    return this;
  }
711120
public function targetColumns($columns) {
        $this->targetColumns = is_array($columns) ? $columns : explode(',',
                        $columns);
        return $this;
    }
781137
public function setColumns(array $columns)
    {
        foreach ($columns as $column) {
            $this->columns->push($column);
        }

        return $this;
    }
16906
public function avg($column)
    {
        $result = $this->getBuilder()->avg($column);

        // Reset query builder
        $this->resetBuilder();

        return $result;
    }
340666
protected function addMissingWeights(array $columns)
    {
        $parsed = [];

        foreach ($columns as $column => $weight) {
            if (is_numeric($column)) {
                list($column, $weight) = [$weight, $this->weight];
            }

            $parsed[$column] = $weight;
        }

        return $parsed;
    }
1104309
public function values($column) {
		$res = [];
		while($row = $this->next())
			$res[] = $row[$column];
		return $res;
	}
580799
public function normalizeColumns(array &$rows) : array
    {
        $maxNumColumns = 0;

        // Find the max number of columns that appear in any given row
        foreach ($rows as $row) {
            $maxNumColumns = max($maxNumColumns, count($row));
        }

        $maxLengths = array_pad([], $maxNumColumns, 0);

        // Normalize the number of columns in each row
        foreach ($rows as &$row) {
            $row = array_pad($row, $maxNumColumns, '');
        }

        // Get the length of the longest value in each column
        foreach ($rows as &$row) {
            foreach ($row as $column => &$value) {
                $value = trim($value);
                $maxLengths[$column] = max($maxLengths[$column], mb_strlen($value));
            }
        }

        return $maxLengths;
    }
162649
protected function handleSetColumns(array $columns)
    {
        if (empty($columns)) {
            return '';
        }

        $sql = [];

        foreach ($columns as $column) {
            $sql[] = $this->wrap($column['column']) . ' = ' . $this->param($column['value']);
        }

        return ' SET ' . implode(', ', $sql);
    }
1189527
public function columns(array $columns)
    {
        $this->getColumns()->setColumns($columns);

        $this->manager->columns();

        return $this;
    }
1278202
public function columns($columns = '*')
    {
        $result = '';
        if (is_array($columns)) {
            foreach ($columns as $key => $val) {
                $result .= ($result == '' ? '' : ', ') . (is_int($key) ? $val : ($key . " AS `{$val}`"));
            }
        } else {
            $result = implode(', ', func_get_args());
        }
        $this->sql['columns'] == '' || ($this->sql['columns'] .= ' ,');
        $this->sql['columns'] .= $result;
        return $this;
    }
944110
protected function prepareColumn(Column $column)
    {
        $typeMapper = $this->getDataType();

        $type = $typeMapper::getType($column->getType());
        $length = $column->getLength() ?: $typeMapper::getLength($type);

        $length = $length ? '(' . $length . ')' : null;

        $column->type($type);

        // Prepare default value
        $this->prepareDefaultValue($column);

        return $column->length($length);
    }
625795
public function group($column) : self
    {
        if (!is_array($column)) {
            $column = [ $column ];
        }
        foreach ($column as $k => $v) {
            $column[$k] = $this->getColumn($v)['name'];
        }
        return $this->groupBy(implode(', ', $column), []);
    }