| |
| <!DOCTYPE html> |
| |
| <html> |
| <head> |
| <meta charset="utf-8" /> |
| <title>Spark SQL — PySpark 3.5.0 documentation</title> |
| |
| <link href="../../_static/styles/theme.css?digest=1999514e3f237ded88cf" rel="stylesheet"> |
| <link href="../../_static/styles/pydata-sphinx-theme.css?digest=1999514e3f237ded88cf" rel="stylesheet"> |
| |
| |
| <link rel="stylesheet" |
| href="../../_static/vendor/fontawesome/5.13.0/css/all.min.css"> |
| <link rel="preload" as="font" type="font/woff2" crossorigin |
| href="../../_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff2"> |
| <link rel="preload" as="font" type="font/woff2" crossorigin |
| href="../../_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2"> |
| |
| |
| |
| |
| |
| <link rel="stylesheet" href="../../_static/styles/pydata-sphinx-theme.css" type="text/css" /> |
| <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> |
| <link rel="stylesheet" type="text/css" href="../../_static/css/pyspark.css" /> |
| |
| <link rel="preload" as="script" href="../../_static/scripts/pydata-sphinx-theme.js?digest=1999514e3f237ded88cf"> |
| |
| <script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script> |
| <script src="../../_static/jquery.js"></script> |
| <script src="../../_static/underscore.js"></script> |
| <script src="../../_static/doctools.js"></script> |
| <script src="../../_static/language_data.js"></script> |
| <script src="../../_static/copybutton.js"></script> |
| <script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script> |
| <script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script> |
| <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true, "ignoreClass": "document", "processClass": "math|output_area"}})</script> |
| <link rel="canonical" href="https://spark.apache.org/docs/latest/api/python/user_guide/sql/index.html" /> |
| <link rel="search" title="Search" href="../../search.html" /> |
| <link rel="next" title="Apache Arrow in PySpark" href="arrow_pandas.html" /> |
| <link rel="prev" title="Python Package Management" href="../python_packaging.html" /> |
| <meta name="viewport" content="width=device-width, initial-scale=1" /> |
| <meta name="docsearch:language" content="None"> |
| |
| |
| <!-- Google Analytics --> |
| |
| </head> |
| <body data-spy="scroll" data-target="#bd-toc-nav" data-offset="80"> |
| |
| <div class="container-fluid" id="banner"></div> |
| |
| |
| <nav class="navbar navbar-light navbar-expand-lg bg-light fixed-top bd-navbar" id="navbar-main"><div class="container-xl"> |
| |
| <div id="navbar-start"> |
| |
| |
| |
| <a class="navbar-brand" href="../../index.html"> |
| <img src="../../_static/spark-logo-reverse.png" class="logo" alt="logo"> |
| </a> |
| |
| |
| |
| </div> |
| |
| <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-collapsible" aria-controls="navbar-collapsible" aria-expanded="false" aria-label="Toggle navigation"> |
| <span class="navbar-toggler-icon"></span> |
| </button> |
| |
| |
| <div id="navbar-collapsible" class="col-lg-9 collapse navbar-collapse"> |
| <div id="navbar-center" class="mr-auto"> |
| |
| <div class="navbar-center-item"> |
| <ul id="navbar-main-elements" class="navbar-nav"> |
| <li class="toctree-l1 nav-item"> |
| <a class="reference internal nav-link" href="../../index.html"> |
| Overview |
| </a> |
| </li> |
| |
| <li class="toctree-l1 nav-item"> |
| <a class="reference internal nav-link" href="../../getting_started/index.html"> |
| Getting Started |
| </a> |
| </li> |
| |
| <li class="toctree-l1 current active nav-item"> |
| <a class="reference internal nav-link" href="../index.html"> |
| User Guides |
| </a> |
| </li> |
| |
| <li class="toctree-l1 nav-item"> |
| <a class="reference internal nav-link" href="../../reference/index.html"> |
| API Reference |
| </a> |
| </li> |
| |
| <li class="toctree-l1 nav-item"> |
| <a class="reference internal nav-link" href="../../development/index.html"> |
| Development |
| </a> |
| </li> |
| |
| <li class="toctree-l1 nav-item"> |
| <a class="reference internal nav-link" href="../../migration_guide/index.html"> |
| Migration Guides |
| </a> |
| </li> |
| |
| |
| </ul> |
| </div> |
| |
| </div> |
| |
| <div id="navbar-end"> |
| |
| <div class="navbar-end-item"> |
| <ul id="navbar-icon-links" class="navbar-nav" aria-label="Icon Links"> |
| </ul> |
| </div> |
| |
| </div> |
| </div> |
| </div> |
| </nav> |
| |
| |
| <div class="container-xl"> |
| <div class="row"> |
| |
| |
| <!-- Only show if we have sidebars configured, else just a small margin --> |
| <div class="col-12 col-md-3 bd-sidebar"> |
| <div class="sidebar-start-items"><form class="bd-search d-flex align-items-center" action="../../search.html" method="get"> |
| <i class="icon fas fa-search"></i> |
| <input type="search" class="form-control" name="q" id="search-input" placeholder="Search the docs ..." aria-label="Search the docs ..." autocomplete="off" > |
| </form><nav class="bd-links" id="bd-docs-nav" aria-label="Main navigation"> |
| <div class="bd-toc-item active"> |
| <ul class="current nav bd-sidenav"> |
| <li class="toctree-l1"> |
| <a class="reference internal" href="../python_packaging.html"> |
| Python Package Management |
| </a> |
| </li> |
| <li class="toctree-l1 current active has-children"> |
| <a class="current reference internal" href="#"> |
| Spark SQL |
| </a> |
| <input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/> |
| <label for="toctree-checkbox-1"> |
| <i class="fas fa-chevron-down"> |
| </i> |
| </label> |
| <ul> |
| <li class="toctree-l2"> |
| <a class="reference internal" href="arrow_pandas.html"> |
| Apache Arrow in PySpark |
| </a> |
| </li> |
| <li class="toctree-l2"> |
| <a class="reference internal" href="python_udtf.html"> |
| Python User-defined Table Functions (UDTFs) |
| </a> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l1 has-children"> |
| <a class="reference internal" href="../pandas_on_spark/index.html"> |
| Pandas API on Spark |
| </a> |
| <input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/> |
| <label for="toctree-checkbox-2"> |
| <i class="fas fa-chevron-down"> |
| </i> |
| </label> |
| <ul> |
| <li class="toctree-l2"> |
| <a class="reference internal" href="../pandas_on_spark/options.html"> |
| Options and settings |
| </a> |
| </li> |
| <li class="toctree-l2"> |
| <a class="reference internal" href="../pandas_on_spark/pandas_pyspark.html"> |
| From/to pandas and PySpark DataFrames |
| </a> |
| </li> |
| <li class="toctree-l2"> |
| <a class="reference internal" href="../pandas_on_spark/transform_apply.html"> |
| Transform and apply a function |
| </a> |
| </li> |
| <li class="toctree-l2"> |
| <a class="reference internal" href="../pandas_on_spark/types.html"> |
| Type Support in Pandas API on Spark |
| </a> |
| </li> |
| <li class="toctree-l2"> |
| <a class="reference internal" href="../pandas_on_spark/typehints.html"> |
| Type Hints in Pandas API on Spark |
| </a> |
| </li> |
| <li class="toctree-l2"> |
| <a class="reference internal" href="../pandas_on_spark/from_to_dbms.html"> |
| From/to other DBMSes |
| </a> |
| </li> |
| <li class="toctree-l2"> |
| <a class="reference internal" href="../pandas_on_spark/best_practices.html"> |
| Best Practices |
| </a> |
| </li> |
| <li class="toctree-l2"> |
| <a class="reference internal" href="../pandas_on_spark/supported_pandas_api.html"> |
| Supported pandas API |
| </a> |
| </li> |
| <li class="toctree-l2"> |
| <a class="reference internal" href="../pandas_on_spark/faq.html"> |
| FAQ |
| </a> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| |
| </div> |
| </nav> |
| </div> |
| <div class="sidebar-end-items"> |
| </div> |
| </div> |
| |
| |
| |
| |
| <div class="d-none d-xl-block col-xl-2 bd-toc"> |
| |
| |
| <div class="toc-item"> |
| |
| |
| <nav id="bd-toc-nav"> |
| |
| </nav> |
| </div> |
| |
| <div class="toc-item"> |
| |
| </div> |
| |
| |
| </div> |
| |
| |
| |
| |
| |
| |
| <main class="col-12 col-md-9 col-xl-7 py-md-5 pl-md-5 pr-md-4 bd-content" role="main"> |
| |
| <div> |
| |
| <div class="section" id="spark-sql"> |
| <h1>Spark SQL<a class="headerlink" href="#spark-sql" title="Permalink to this headline">ΒΆ</a></h1> |
| <div class="toctree-wrapper compound"> |
| <ul> |
| <li class="toctree-l1"><a class="reference internal" href="arrow_pandas.html">Apache Arrow in PySpark</a><ul> |
| <li class="toctree-l2"><a class="reference internal" href="arrow_pandas.html#ensure-pyarrow-installed">Ensure PyArrow Installed</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="arrow_pandas.html#enabling-for-conversion-to-from-pandas">Enabling for Conversion to/from Pandas</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="arrow_pandas.html#pandas-udfs-a-k-a-vectorized-udfs">Pandas UDFs (a.k.a. Vectorized UDFs)</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="arrow_pandas.html#pandas-function-apis">Pandas Function APIs</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="arrow_pandas.html#arrow-python-udfs">Arrow Python UDFs</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="arrow_pandas.html#usage-notes">Usage Notes</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="python_udtf.html">Python User-defined Table Functions (UDTFs)</a><ul> |
| <li class="toctree-l2"><a class="reference internal" href="python_udtf.html#implementing-a-python-udtf">Implementing a Python UDTF</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="python_udtf.html#registering-and-using-python-udtfs-in-sql">Registering and Using Python UDTFs in SQL</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="python_udtf.html#arrow-optimization">Arrow Optimization</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="python_udtf.html#more-examples">More Examples</a></li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| |
| |
| </div> |
| |
| |
| <!-- Previous / next buttons --> |
| <div class='prev-next-area'> |
| <a class='left-prev' id="prev-link" href="../python_packaging.html" title="previous page"> |
| <i class="fas fa-angle-left"></i> |
| <div class="prev-next-info"> |
| <p class="prev-next-subtitle">previous</p> |
| <p class="prev-next-title">Python Package Management</p> |
| </div> |
| </a> |
| <a class='right-next' id="next-link" href="arrow_pandas.html" title="next page"> |
| <div class="prev-next-info"> |
| <p class="prev-next-subtitle">next</p> |
| <p class="prev-next-title">Apache Arrow in PySpark</p> |
| </div> |
| <i class="fas fa-angle-right"></i> |
| </a> |
| </div> |
| |
| </main> |
| |
| |
| </div> |
| </div> |
| |
| <script src="../../_static/scripts/pydata-sphinx-theme.js?digest=1999514e3f237ded88cf"></script> |
| <footer class="footer mt-5 mt-md-0"> |
| <div class="container"> |
| |
| <div class="footer-item"> |
| <p class="copyright"> |
| © Copyright .<br> |
| </p> |
| </div> |
| |
| <div class="footer-item"> |
| <p class="sphinx-version"> |
| Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.0.4.<br> |
| </p> |
| </div> |
| |
| </div> |
| </footer> |
| </body> |
| </html> |