2015-02-09 23:49:22 -05:00
|
|
|
#
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
|
|
# this work for additional information regarding copyright ownership.
|
|
|
|
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
# (the "License"); you may not use this file except in compliance with
|
|
|
|
# the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
|
|
|
|
"""
|
2015-03-31 21:31:36 -04:00
|
|
|
Important classes of Spark SQL and DataFrames:
|
2015-02-09 23:49:22 -05:00
|
|
|
|
2015-05-23 11:30:05 -04:00
|
|
|
- :class:`pyspark.sql.SQLContext`
|
2015-03-29 02:59:27 -04:00
|
|
|
Main entry point for :class:`DataFrame` and SQL functionality.
|
2015-05-23 11:30:05 -04:00
|
|
|
- :class:`pyspark.sql.DataFrame`
|
2015-03-29 02:59:27 -04:00
|
|
|
A distributed collection of data grouped into named columns.
|
2015-05-23 11:30:05 -04:00
|
|
|
- :class:`pyspark.sql.Column`
|
2015-03-29 02:59:27 -04:00
|
|
|
A column expression in a :class:`DataFrame`.
|
2015-05-23 11:30:05 -04:00
|
|
|
- :class:`pyspark.sql.Row`
|
2015-03-29 02:59:27 -04:00
|
|
|
A row of data in a :class:`DataFrame`.
|
2015-05-23 11:30:05 -04:00
|
|
|
- :class:`pyspark.sql.HiveContext`
|
2015-03-29 02:59:27 -04:00
|
|
|
Main entry point for accessing data stored in Apache Hive.
|
2015-05-23 11:30:05 -04:00
|
|
|
- :class:`pyspark.sql.GroupedData`
|
2015-03-31 03:25:23 -04:00
|
|
|
Aggregation methods, returned by :func:`DataFrame.groupBy`.
|
2015-05-23 11:30:05 -04:00
|
|
|
- :class:`pyspark.sql.DataFrameNaFunctions`
|
2015-03-31 03:25:23 -04:00
|
|
|
Methods for handling missing data (null values).
|
2015-05-23 11:30:05 -04:00
|
|
|
- :class:`pyspark.sql.DataFrameStatFunctions`
|
2015-05-13 00:43:34 -04:00
|
|
|
Methods for statistics functionality.
|
2015-05-23 11:30:05 -04:00
|
|
|
- :class:`pyspark.sql.functions`
|
2015-03-29 02:59:27 -04:00
|
|
|
List of built-in functions available for :class:`DataFrame`.
|
2015-05-23 11:30:05 -04:00
|
|
|
- :class:`pyspark.sql.types`
|
2015-03-31 21:31:36 -04:00
|
|
|
List of data types available.
|
2015-05-23 11:30:05 -04:00
|
|
|
- :class:`pyspark.sql.Window`
|
|
|
|
For working with window functions.
|
2015-02-09 23:49:22 -05:00
|
|
|
"""
|
2015-04-16 19:20:57 -04:00
|
|
|
from __future__ import absolute_import
|
|
|
|
|
2015-05-21 02:05:54 -04:00
|
|
|
|
|
|
|
def since(version):
|
2015-06-03 03:23:34 -04:00
|
|
|
"""
|
|
|
|
A decorator that annotates a function to append the version of Spark the function was added.
|
|
|
|
"""
|
|
|
|
import re
|
|
|
|
indent_p = re.compile(r'\n( +)')
|
|
|
|
|
2015-05-21 02:05:54 -04:00
|
|
|
def deco(f):
|
2015-06-03 03:23:34 -04:00
|
|
|
indents = indent_p.findall(f.__doc__)
|
|
|
|
indent = ' ' * (min(len(m) for m in indents) if indents else 0)
|
|
|
|
f.__doc__ = f.__doc__.rstrip() + "\n\n%s.. versionadded:: %s" % (indent, version)
|
2015-05-21 02:05:54 -04:00
|
|
|
return f
|
|
|
|
return deco
|
|
|
|
|
2015-06-03 03:23:34 -04:00
|
|
|
|
2015-02-09 23:49:22 -05:00
|
|
|
from pyspark.sql.types import Row
|
2015-04-16 19:20:57 -04:00
|
|
|
from pyspark.sql.context import SQLContext, HiveContext
|
2015-05-15 23:09:15 -04:00
|
|
|
from pyspark.sql.column import Column
|
|
|
|
from pyspark.sql.dataframe import DataFrame, SchemaRDD, DataFrameNaFunctions, DataFrameStatFunctions
|
|
|
|
from pyspark.sql.group import GroupedData
|
2015-05-19 17:23:28 -04:00
|
|
|
from pyspark.sql.readwriter import DataFrameReader, DataFrameWriter
|
2015-05-23 11:30:05 -04:00
|
|
|
from pyspark.sql.window import Window, WindowSpec
|
2015-02-09 23:49:22 -05:00
|
|
|
|
2015-06-03 03:23:34 -04:00
|
|
|
|
2015-02-09 23:49:22 -05:00
|
|
|
__all__ = [
|
2015-05-01 16:29:17 -04:00
|
|
|
'SQLContext', 'HiveContext', 'DataFrame', 'GroupedData', 'Column', 'Row',
|
2015-05-23 11:30:05 -04:00
|
|
|
'DataFrameNaFunctions', 'DataFrameStatFunctions', 'Window', 'WindowSpec',
|
2015-06-03 03:23:34 -04:00
|
|
|
'DataFrameReader', 'DataFrameWriter'
|
2015-02-09 23:49:22 -05:00
|
|
|
]
|