Repository: ray-project/ray
File: python/ray/data/dataset.py (Python)

Code before:
            Column        Type
            ------        ----
            sepal.length  double
            sepal.width   double
            petal.length  double
            petal.width   double
            variety       string
            >>> ds.select_columns(["sepal.length", "sepal.width"]).schema()
            Column        Type
            ------        ----
            sepal.length  double
            sepal.width   double

        Time complexity: O(dataset size / parallelism)

        Args:
            cols: Names of the columns to select. If a name isn't in the
                dataset schema, an exception is raised. Columns also should be unique.
            compute: This argument is deprecated. Use ``concurrency`` argument.
            concurrency: The maximum number of Ray workers to use concurrently.
            **ray_remote_args: Additional resource requirements to request from
                Ray (e.g., num_gpus=1 to request GPUs for the map tasks). See
                :func:`ray.remote` for details.

        Returns:
            A new :class:`Dataset` is composed of specified columns.
        """  # noqa: E501
        from ray.data.expressions import col

        if isinstance(cols, str):
            exprs = [col(cols)]
        elif isinstance(cols, list):
            if not all(isinstance(col, str) for col in cols):
                raise ValueError(
                    "select_columns requires all elements of 'cols' to be strings."
                )
            if len(cols) != len(set(cols)):
                raise ValueError(
                    "select_columns expected unique column names, "
                    f"got duplicate column names: {cols}"
                )
            exprs = [col(c) for c in cols]
        else:
            raise TypeError(
                "select_columns requires 'cols' to be a string or a list of strings."
            )
        compute = TaskPoolStrategy(size=concurrency)

        plan = self._plan.copy()
        select_op = Project(
            self._logical_plan.dag,

Review comment (suggestion):
```suggestion
            A new :class:`Dataset` composed with the specified columns.
```

Code after:
            sepal.width   double
            petal.length  double
            petal.width   double
            variety       string
            >>> ds.select_columns(["sepal.length", "sepal.width"]).schema()
            Column        Type
            ------        ----
            sepal.length  double
            sepal.width   double

        Time complexity: O(dataset size / parallelism)

        Args:
            cols: Names of the columns to select. If a name isn't in the
                dataset schema, an exception is raised. Columns also should be unique.
            compute: This argument is deprecated. Use ``concurrency`` argument.
            concurrency: The maximum number of Ray workers to use concurrently.
            **ray_remote_args: Additional resource requirements to request from
                Ray (e.g., num_gpus=1 to request GPUs for the map tasks). See
                :func:`ray.remote` for details.

        Returns:
            A new :class:`Dataset` composed with the specified columns.
        """  # noqa: E501
        from ray.data.expressions import col

        if isinstance(cols, str):
            exprs = [col(cols)]
        elif isinstance(cols, list):
            if not all(isinstance(col, str) for col in cols):
                raise ValueError(
                    "select_columns requires all elements of 'cols' to be strings."
                )
            if len(cols) != len(set(cols)):
                raise ValueError(
                    "select_columns expected unique column names, "
                    f"got duplicate column names: {cols}"
                )
            exprs = [col(c) for c in cols]
        else:
            raise TypeError(
                "select_columns requires 'cols' to be a string or a list of strings."
            )
        compute = TaskPoolStrategy(size=concurrency)

        plan = self._plan.copy()
        select_op = Project(
            self._logical_plan.dag,
            exprs=exprs,
            compute=compute,
            ray_remote_args=ray_remote_args,