Restrict the columns to fetch into this DataList

@param array $queriedColumns
@return static
187456
public function setQueriedColumns($queriedColumns)
    {
        return $this->alterDataQuery(function (DataQuery $query) use ($queriedColumns) {
            $query->setQueriedColumns($queriedColumns);
        });
    }
498568
public function withTrashed(...$columns)
    {
        if (empty($columns)) {
            $this->query->withTrashed();

            return $this;
        }

        if (is_array($columns[0])) {
            $columns = $columns[0];
        }

        $this->query->getQuery()->wheres = collect($this->query->getQuery()->wheres)
            ->reject(function ($where) use ($columns) {
                return $where['type'] === 'Null' && in_array($where['column'], $columns);
            })->values()->all();

        return $this;
    }
303675
public function setColumns(array $columns)
    {
        foreach ($columns as $column) {
            $this->columns[] = new Request\Column($column);
        }

        return $this;
    }
974789
public function select($columns= '*') {
        if (!is_array($columns)) {
            $columns= trim($columns);
            if ($columns == '*' || $columns === $this->_alias . '.*' || $columns === $this->xpdo->escape($this->_alias) . '.*') {
                $columns= $this->xpdo->getSelectColumns($this->_class, $this->_alias, $this->_alias . '_');
            }
            $columns= explode(',', $columns);
            foreach ($columns as $colKey => $column) $columns[$colKey] = trim($column);
        }
        if (is_array ($columns)) {
            if (!is_array($this->query['columns'])) {
                $this->query['columns']= $columns;
            } else {
                $this->query['columns']= array_merge($this->query['columns'], $columns);
            }
        }
        return $this;
    }
1115206
public function select($columns = '*') 
    {
        $this->sql = 'SELECT ';
        
        if(is_array($columns)) {
            foreach($columns as $column) {
                $this->sql .= $this->quoteColumnName($column) . ', ';
            }
            
            $this->sql = trim($this->sql, ', ') . ' ';
        } else {
            $this->sql .= '* ';
        }
        
        return $this;
    }
672728
public function select($columns)
    {
        if (is_array($columns)) {
            $this->columns = $columns;
        } elseif ($columns === '*') {
            $this->columns = ['*'];
        }
        return $this;
    }
338712
public function beforeGetFinalisedQuery(DataQuery $dataQuery, $queriedColumns = [], SQLSelect $sqlSelect)
    {
        // Get metadata and SQL from join table
        $hasManyRelation = $this->getParentRelationship($dataQuery);
        $joinTableSQLSelect = $hasManyRelation->dataQuery()->query();
        $joinTableSQL = $joinTableSQLSelect->sql($joinTableParameters);
        $joinTableColumns = array_keys($joinTableSQLSelect->getSelect()); // Get aliases (keys) only
        $joinTableAlias = $this->getJoinAlias();

        // Get fields to join on
        $localKey = $this->getLocalKey();
        $schema = DataObject::getSchema();
        $baseTable = $schema->baseDataClass($dataQuery->dataClass());
        $childField = $schema->sqlColumnForField($baseTable, 'ID');

        // Add select fields
        foreach ($joinTableColumns as $joinTableColumn) {
            $sqlSelect->selectField(
                "\"{$joinTableAlias}\".\"{$joinTableColumn}\"",
                "{$joinTableAlias}_{$joinTableColumn}"
            );
        }

        // Apply join and record sql for later insertion (at end of replacements)
        // By using a string placeholder $$_SUBQUERY_$$ we protect field/table rewrites from interfering twice
        // on the already-finalised inner list
        $sqlSelect->addInnerJoin(
            '(SELECT $$_SUBQUERY_$$)',
            "\"{$joinTableAlias}\".\"{$localKey}\" = {$childField}",
            $joinTableAlias,
            20,
            $joinTableParameters
        );
        $dataQuery->setQueryParam('Foreign.JoinTableSQL', $joinTableSQL);

        // After this join, and prior to afterGetFinalisedQuery, $sqlSelect will be populated with the
        // necessary sql rewrites (versioned, etc) that effect the base table.
        // By using a placeholder for the subquery we can protect the subquery (already rewritten)
        // from being re-written a second time. However we DO want the join predicate (above) to be rewritten.
        // See http://php.net/manual/en/function.str-replace.php#refsect1-function.str-replace-notes
        // for the reason we only add the final substitution at the end of getFinalisedQuery()
    }
998217
public function group($columns)
	{
		if (is_null($this->group))
		{
			$this->group = new Query\QueryElement('GROUP BY', $columns);
		}
		else
		{
			$this->group->append($columns);
		}

		return $this;
	}
166947
public function getQueryBuilder(ColumnCollection $columns, DataSetRequestInterface $request): QueryBuilder
    {
        $this->conditions = $this->getConditions($request);
        
        $this->queryBuilder->select($columns->getSelectClause());
        $this->queryBuilder->addOrderBy($this->getOrderByExpression($request, $columns));
        $this->queryBuilder->setFirstResult($request->getOffset());
        $this->setColumnConditions($columns);
        
        if ($request->getLimit() > 0) {
            $this->queryBuilder->setMaxResults($request->getLimit());
        }
        
        return $this->queryBuilder;
    }
106282
protected function getSelectColumns( $columns = null )
    {
        if ( null === $columns )
        {
            $label = true;
        }
        elseif ( ( $index = array_search( 'label', $columns ) ) )
        {
            $label = true;
            unset( $columns[$index] );
        }
        else
        {
            $label = false;
        }

        if ( null === $columns )
        {
            $proxyData = true;
        }
        elseif ( ( $index = array_search( 'proxyData', $columns ) ) )
        {
            $proxyData = true;
            unset( $columns[$index] );
        }
        else
        {
            $proxyData = false;
        }

        if ( null === $columns )
        {
            $level = false;
        }
        elseif ( ( $index = array_search( 'level', $columns ) ) )
        {
            $level = true;
            unset( $columns[$index] );
        }
        else
        {
            $level = false;
        }

        $columns = parent::getSelectColumns( $columns );

        if ( $label )
        {
            $platform = $this->getDbAdapter()
                             ->getPlatform();

            $columns['label'] = new Sql\Expression( '(' .
                $this->sql( $this->getTableInSchema(
                        static::$labelTableName
                     ) )
                     ->select()
                     ->columns( array( 'label' ) )
                     ->where( array(
                         new Sql\Predicate\Expression(
                             $platform->quoteIdentifierChain( array(
                                 static::$labelTableName, 'menuId'
                             ) ) .
                             ' = ' .
                             $platform->quoteIdentifierChain( array(
                                 static::$tableName, 'id'
                             ) )
                         )
                     ) )
                     ->order( array(
                         new Sql\Expression(
                             'CASE ? ' .
                                 'WHEN ? THEN 1 ' .
                                 'WHEN ? THEN 2 ' .
                                 'WHEN ? THEN 3 ' .
                                 'WHEN ? THEN 4 ' .
                                 'ELSE 5 ' .
                             'END ASC',
                             array(
                                 'locale',
                                 $this->getLocale(),
                                 $this->getPrimaryLanguage(),
                                 $this->getDefaultLocale(),
                                 'en',
                             ),
                             array(
                                 Sql\Expression::TYPE_IDENTIFIER,
                                 Sql\Expression::TYPE_VALUE,
                                 Sql\Expression::TYPE_VALUE,
                                 Sql\Expression::TYPE_VALUE,
                                 Sql\Expression::TYPE_VALUE,
                             )
                         ),
                     ) )
                     ->limit( 1 )
                     ->getSqlString( $platform ) .
            ')' );
        }

        if ( $proxyData )
        {
            $platform = $this->getDbAdapter()
                             ->getPlatform();

            $columns['proxyData'] = new Sql\Expression( '(' .
                $this->sql( $this->getTableInSchema(
                        static::$propertyTableName
                     ) )
                     ->select()
                     ->columns( array(
                         new Sql\Expression( 'TEXT( ARRAY_TO_JSON(
                             ARRAY_AGG( ? ORDER BY ? ASC )
                         ) )', array(
                             static::$propertyTableName,
                             'name',
                         ), array(
                             Sql\Expression::TYPE_IDENTIFIER,
                             Sql\Expression::TYPE_IDENTIFIER,
                         ) )
                     ) )
                     ->where( array(
                         new Sql\Predicate\Expression(
                             $platform->quoteIdentifierChain( array(
                                 static::$propertyTableName, 'menuId'
                             ) ) .
                             ' = ' .
                             $platform->quoteIdentifierChain( array(
                                 static::$tableName, 'id'
                             ) )
                         )
                     ) )
                     ->getSqlString( $platform ) .
            ')' );
        }

        if ( $level )
        {
            $columns['level'] = new Sql\Expression( '(' .
                $this->sql( null )
                     ->select( array(
                         'ascendants' => static::$tableName,
                     ) )
                     ->columns( array( new Sql\Expression( 'COUNT(*) - 1' ) ) )
                     ->where( array(
                         new Sql\Predicate\Expression(
                             $platform->quoteIdentifierChain( array(
                                 static::$tableName, 'left'
                             ) ) .
                             ' BETWEEN ' .
                             $platform->quoteIdentifierChain( array(
                                 'ascendants', 'left'
                             ) ) .
                             ' AND ' .
                             $platform->quoteIdentifierChain( array(
                                 'ascendants', 'right'
                             ) )
                         )
                     ) )
                     ->getSqlString( $platform ) .
            ')' );
        }

        return $columns;
    }
711120
public function targetColumns($columns) {
        $this->targetColumns = is_array($columns) ? $columns : explode(',',
                        $columns);
        return $this;
    }
1302294
public function columns($columns) {
        if (is_array($columns)) {
            $this->sql .= '(`' . implode('`, `', $columns) . '`) ';
        } else if (is_string($columns)) {
            $this->sql .= "($columns) ";
        }
        return $this;
    }
734014
protected function runPaginationCountQuery($columns = ['*'])
    {
        return $this->cloneWithout(['columns', 'orders', 'limit', 'offset'])
            ->cloneWithoutBindings(['select', 'order'])
            ->setAggregate('count', $this->withoutSelectAliases($columns))
            ->get()->all();
    }
117594
protected function runPaginationCountQuery($columns = ['*'])
    {
        $without = $this->unions ? ['orders', 'limit', 'offset'] : ['columns', 'orders', 'limit', 'offset'];

        return $this->cloneWithout($without)
                    ->cloneWithoutBindings($this->unions ? ['order'] : ['select', 'order'])
                    ->setAggregate('count', $this->withoutSelectAliases($columns))
                    ->get()->all();
    }
125765
public Query<T> setColumnNames(Collection<N> columnNames) {
    if ( columnNames != null && columnNames.size() > 0) {
      slicePredicate.setColumnNames(columnNames);
    } else {
      slicePredicate.setKeysOnlyPredicate();
    }
    return this;
  }
823793
public function orderByArray(array $columns): BaseQueryRelateContract
    {
        array_walk($columns, function ($value, $key) {
            $this->query->orderBy($key, $value);
        });

        return $this;
    }
1270445
public function orderColumns(array $columns, $sql, $bindings = [])
    {
        foreach ($columns as $column) {
            $this->orderColumn($column, str_replace(':column', $column, $sql), $bindings);
        }

        return $this;
    }