def query(self, expr: str, inplace: bool=False) -> Optional['DataFrame']:
    "\n        Query the columns of a DataFrame with a boolean expression.\n\n        .. note:: Internal columns that starting with a '__' prefix are able to access, however,\n            they are not supposed to be accessed.\n\n        .. note:: This API delegates to Spark SQL so the syntax follows Spark SQL. Therefore, the\n            pandas specific syntax such as `@` is not supported. If you want the pandas syntax,\n            you can work around with :meth:`DataFrame.pandas_on_spark.apply_batch`, but you should\n            be aware that `query_func` will be executed at different nodes in a distributed manner.\n            So, for example, to use `@` syntax, make sure the variable is serialized by, for\n            example, putting it within the closure as below.\n\n            >>> df = ps.DataFrame({'A': range(2000), 'B': range(2000)})\n            >>> def query_func(pdf):\n            ...     num = 1995\n            ...     return pdf.query('A > @num')\n            >>> df.pandas_on_spark.apply_batch(query_func)\n                     A     B\n            1996  1996  1996\n            1997  1997  1997\n            1998  1998  1998\n            1999  1999  1999\n\n        Parameters\n        ----------\n        expr : str\n            The query string to evaluate.\n\n            You can refer to column names that contain spaces by surrounding\n            them in backticks.\n\n            For example, if one of your columns is called ``a a`` and you want\n            to sum it with ``b``, your query should be ```a a` + b``.\n\n        inplace : bool\n            Whether the query should modify the data in place or return\n            a modified copy.\n\n        Returns\n        -------\n        DataFrame\n            DataFrame resulting from the provided query expression.\n\n        Examples\n        --------\n        >>> df = ps.DataFrame({'A': range(1, 6),\n        ...                    'B': range(10, 0, -2),\n        ...                    'C C': range(10, 5, -1)})\n        >>> df\n           A   B  C C\n        0  1  10   10\n        1  2   8    9\n        2  3   6    8\n        3  4   4    7\n        4  5   2    6\n\n        >>> df.query('A > B')\n           A  B  C C\n        4  5  2    6\n\n        The previous expression is equivalent to\n\n        >>> df[df.A > df.B]\n           A  B  C C\n        4  5  2    6\n\n        For columns with spaces in their name, you can use backtick quoting.\n\n        >>> df.query('B == `C C`')\n           A   B  C C\n        0  1  10   10\n\n        The previous expression is equivalent to\n\n        >>> df[df.B == df['C C']]\n           A   B  C C\n        0  1  10   10\n        "
    if isinstance(self.columns, pd.MultiIndex):
        raise TypeError("Doesn't support for MultiIndex columns")
    if (not isinstance(expr, str)):
        raise TypeError('expr must be a string to be evaluated, {} given'.format(type(expr).__name__))
    inplace = validate_bool_kwarg(inplace, 'inplace')
    data_columns = [label[0] for label in self._internal.column_labels]
    sdf = self._internal.spark_frame.select((self._internal.index_spark_columns + [scol.alias(col) for (scol, col) in zip(self._internal.data_spark_columns, data_columns)])).filter(expr)
    internal = self._internal.with_new_sdf(sdf, data_columns=data_columns)
    if inplace:
        self._update_internal_frame(internal)
        return None
    else:
        return DataFrame(internal)
Query the columns of a DataFrame with a boolean expression.

.. note:: Internal columns that starting with a '__' prefix are able to access, however,
    they are not supposed to be accessed.

.. note:: This API delegates to Spark SQL so the syntax follows Spark SQL. Therefore, the
    pandas specific syntax such as `@` is not supported. If you want the pandas syntax,
    you can work around with :meth:`DataFrame.pandas_on_spark.apply_batch`, but you should
    be aware that `query_func` will be executed at different nodes in a distributed manner.
    So, for example, to use `@` syntax, make sure the variable is serialized by, for
    example, putting it within the closure as below.

    >>> df = ps.DataFrame({'A': range(2000), 'B': range(2000)})
    >>> def query_func(pdf):
    ...     num = 1995
    ...     return pdf.query('A > @num')
    >>> df.pandas_on_spark.apply_batch(query_func)
             A     B
    1996  1996  1996
    1997  1997  1997
    1998  1998  1998
    1999  1999  1999

Parameters
----------
expr : str
    The query string to evaluate.

    You can refer to column names that contain spaces by surrounding
    them in backticks.

    For example, if one of your columns is called ``a a`` and you want
    to sum it with ``b``, your query should be ```a a` + b``.

inplace : bool
    Whether the query should modify the data in place or return
    a modified copy.

Returns
-------
DataFrame
    DataFrame resulting from the provided query expression.

Examples
--------
>>> df = ps.DataFrame({'A': range(1, 6),
...                    'B': range(10, 0, -2),
...                    'C C': range(10, 5, -1)})
>>> df
   A   B  C C
0  1  10   10
1  2   8    9
2  3   6    8
3  4   4    7
4  5   2    6

>>> df.query('A > B')
   A  B  C C
4  5  2    6

The previous expression is equivalent to

>>> df[df.A > df.B]
   A  B  C C
4  5  2    6

For columns with spaces in their name, you can use backtick quoting.

>>> df.query('B == `C C`')
   A   B  C C
0  1  10   10

The previous expression is equivalent to

>>> df[df.B == df['C C']]
   A   B  C C
0  1  10   10
def query(self, expr: str, inplace: bool=False) -> Optional['DataFrame']:
    "\n        Query the columns of a DataFrame with a boolean expression.\n\n        .. note:: Internal columns that starting with a '__' prefix are able to access, however,\n            they are not supposed to be accessed.\n\n        .. note:: This API delegates to Spark SQL so the syntax follows Spark SQL. Therefore, the\n            pandas specific syntax such as `@` is not supported. If you want the pandas syntax,\n            you can work around with :meth:`DataFrame.pandas_on_spark.apply_batch`, but you should\n            be aware that `query_func` will be executed at different nodes in a distributed manner.\n            So, for example, to use `@` syntax, make sure the variable is serialized by, for\n            example, putting it within the closure as below.\n\n            >>> df = ps.DataFrame({'A': range(2000), 'B': range(2000)})\n            >>> def query_func(pdf):\n            ...     num = 1995\n            ...     return pdf.query('A > @num')\n            >>> df.pandas_on_spark.apply_batch(query_func)\n                     A     B\n            1996  1996  1996\n            1997  1997  1997\n            1998  1998  1998\n            1999  1999  1999\n\n        Parameters\n        ----------\n        expr : str\n            The query string to evaluate.\n\n            You can refer to column names that contain spaces by surrounding\n            them in backticks.\n\n            For example, if one of your columns is called ``a a`` and you want\n            to sum it with ``b``, your query should be ```a a` + b``.\n\n        inplace : bool\n            Whether the query should modify the data in place or return\n            a modified copy.\n\n        Returns\n        -------\n        DataFrame\n            DataFrame resulting from the provided query expression.\n\n        Examples\n        --------\n        >>> df = ps.DataFrame({'A': range(1, 6),\n        ...                    'B': range(10, 0, -2),\n        ...                    'C C': range(10, 5, -1)})\n        >>> df\n           A   B  C C\n        0  1  10   10\n        1  2   8    9\n        2  3   6    8\n        3  4   4    7\n        4  5   2    6\n\n        >>> df.query('A > B')\n           A  B  C C\n        4  5  2    6\n\n        The previous expression is equivalent to\n\n        >>> df[df.A > df.B]\n           A  B  C C\n        4  5  2    6\n\n        For columns with spaces in their name, you can use backtick quoting.\n\n        >>> df.query('B == `C C`')\n           A   B  C C\n        0  1  10   10\n\n        The previous expression is equivalent to\n\n        >>> df[df.B == df['C C']]\n           A   B  C C\n        0  1  10   10\n        "
    if isinstance(self.columns, pd.MultiIndex):
        raise TypeError("Doesn't support for MultiIndex columns")
    if (not isinstance(expr, str)):
        raise TypeError('expr must be a string to be evaluated, {} given'.format(type(expr).__name__))
    inplace = validate_bool_kwarg(inplace, 'inplace')
    data_columns = [label[0] for label in self._internal.column_labels]
    sdf = self._internal.spark_frame.select((self._internal.index_spark_columns + [scol.alias(col) for (scol, col) in zip(self._internal.data_spark_columns, data_columns)])).filter(expr)
    internal = self._internal.with_new_sdf(sdf, data_columns=data_columns)
    if inplace:
        self._update_internal_frame(internal)
        return None
    else:
        return DataFrame(internal)