blob: 24938f16bcb50ba0e6d8945a611b37bd999c6217 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>SparkSchemaUtil</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
<script type="text/javascript" src="../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../jquery/jquery-3.5.1.js"></script>
<script type="text/javascript" src="../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="SparkSchemaUtil";
}
}
catch(err) {
}
//-->
var data = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9,"i10":9,"i11":9,"i12":9,"i13":9,"i14":9,"i15":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../";
var useModuleDirectories = true;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">org.apache.iceberg.spark</a></div>
<h2 title="Class SparkSchemaUtil" class="title">Class SparkSchemaUtil</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.apache.iceberg.spark.SparkSchemaUtil</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<pre>public class <span class="typeNameLabel">SparkSchemaUtil</span>
extends java.lang.Object</pre>
<div class="block">Helper methods for working with Spark/Hive metadata.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>static org.apache.spark.sql.types.StructType</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#convert(org.apache.iceberg.Schema)">convert</a></span>&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;schema)</code></th>
<td class="colLast">
<div class="block">Convert a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> to a <code>Spark type</code>.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>static <a href="../Schema.html" title="class in org.apache.iceberg">Schema</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#convert(org.apache.iceberg.Schema,org.apache.spark.sql.types.StructType)">convert</a></span>&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;baseSchema,
org.apache.spark.sql.types.StructType&nbsp;sparkType)</code></th>
<td class="colLast">
<div class="block">Convert a Spark <code>struct</code> to a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> based on the given schema.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>static <a href="../Schema.html" title="class in org.apache.iceberg">Schema</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#convert(org.apache.iceberg.Schema,org.apache.spark.sql.types.StructType,boolean)">convert</a></span>&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;baseSchema,
org.apache.spark.sql.types.StructType&nbsp;sparkType,
boolean&nbsp;caseSensitive)</code></th>
<td class="colLast">
<div class="block">Convert a Spark <code>struct</code> to a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> based on the given schema.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>static org.apache.spark.sql.types.DataType</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#convert(org.apache.iceberg.types.Type)">convert</a></span>&#8203;(<a href="../types/Type.html" title="interface in org.apache.iceberg.types">Type</a>&nbsp;type)</code></th>
<td class="colLast">
<div class="block">Convert a <a href="../types/Type.html" title="interface in org.apache.iceberg.types"><code>Type</code></a> to a <code>Spark type</code>.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>static <a href="../types/Type.html" title="interface in org.apache.iceberg.types">Type</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#convert(org.apache.spark.sql.types.DataType)">convert</a></span>&#8203;(org.apache.spark.sql.types.DataType&nbsp;sparkType)</code></th>
<td class="colLast">
<div class="block">Convert a Spark <code>struct</code> to a <a href="../types/Type.html" title="interface in org.apache.iceberg.types"><code>Type</code></a> with new field ids.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>static <a href="../Schema.html" title="class in org.apache.iceberg">Schema</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#convert(org.apache.spark.sql.types.StructType)">convert</a></span>&#8203;(org.apache.spark.sql.types.StructType&nbsp;sparkType)</code></th>
<td class="colLast">
<div class="block">Convert a Spark <code>struct</code> to a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> with new field ids.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>static <a href="../Schema.html" title="class in org.apache.iceberg">Schema</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#convertWithFreshIds(org.apache.iceberg.Schema,org.apache.spark.sql.types.StructType)">convertWithFreshIds</a></span>&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;baseSchema,
org.apache.spark.sql.types.StructType&nbsp;sparkType)</code></th>
<td class="colLast">
<div class="block">Convert a Spark <code>struct</code> to a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> based on the given schema.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>static <a href="../Schema.html" title="class in org.apache.iceberg">Schema</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#convertWithFreshIds(org.apache.iceberg.Schema,org.apache.spark.sql.types.StructType,boolean)">convertWithFreshIds</a></span>&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;baseSchema,
org.apache.spark.sql.types.StructType&nbsp;sparkType,
boolean&nbsp;caseSensitive)</code></th>
<td class="colLast">
<div class="block">Convert a Spark <code>struct</code> to a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> based on the given schema.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>static long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#estimateSize(org.apache.spark.sql.types.StructType,long)">estimateSize</a></span>&#8203;(org.apache.spark.sql.types.StructType&nbsp;tableSchema,
long&nbsp;totalRecords)</code></th>
<td class="colLast">
<div class="block">Estimate approximate table size based on Spark schema and total records.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>static java.util.Map&lt;java.lang.Integer,&#8203;java.lang.String&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#indexQuotedNameById(org.apache.iceberg.Schema)">indexQuotedNameById</a></span>&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;schema)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>static <a href="../Schema.html" title="class in org.apache.iceberg">Schema</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#prune(org.apache.iceberg.Schema,org.apache.spark.sql.types.StructType)">prune</a></span>&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;schema,
org.apache.spark.sql.types.StructType&nbsp;requestedType)</code></th>
<td class="colLast">
<div class="block">Prune columns from a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> using a <code>Spark type</code> projection.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>static <a href="../Schema.html" title="class in org.apache.iceberg">Schema</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#prune(org.apache.iceberg.Schema,org.apache.spark.sql.types.StructType,java.util.List)">prune</a></span>&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;schema,
org.apache.spark.sql.types.StructType&nbsp;requestedType,
java.util.List&lt;<a href="../expressions/Expression.html" title="interface in org.apache.iceberg.expressions">Expression</a>&gt;&nbsp;filters)</code></th>
<td class="colLast">
<div class="block">Prune columns from a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> using a <code>Spark type</code> projection.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>static <a href="../Schema.html" title="class in org.apache.iceberg">Schema</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#prune(org.apache.iceberg.Schema,org.apache.spark.sql.types.StructType,org.apache.iceberg.expressions.Expression,boolean)">prune</a></span>&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;schema,
org.apache.spark.sql.types.StructType&nbsp;requestedType,
<a href="../expressions/Expression.html" title="interface in org.apache.iceberg.expressions">Expression</a>&nbsp;filter,
boolean&nbsp;caseSensitive)</code></th>
<td class="colLast">
<div class="block">Prune columns from a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> using a <code>Spark type</code> projection.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>static <a href="../Schema.html" title="class in org.apache.iceberg">Schema</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#schemaForTable(org.apache.spark.sql.SparkSession,java.lang.String)">schemaForTable</a></span>&#8203;(org.apache.spark.sql.SparkSession&nbsp;spark,
java.lang.String&nbsp;name)</code></th>
<td class="colLast">
<div class="block">Returns a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> for the given table with fresh field ids.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>static <a href="../PartitionSpec.html" title="class in org.apache.iceberg">PartitionSpec</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#specForTable(org.apache.spark.sql.SparkSession,java.lang.String)">specForTable</a></span>&#8203;(org.apache.spark.sql.SparkSession&nbsp;spark,
java.lang.String&nbsp;name)</code></th>
<td class="colLast">
<div class="block">Returns a <a href="../PartitionSpec.html" title="class in org.apache.iceberg"><code>PartitionSpec</code></a> for the given table.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>static void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#validateMetadataColumnReferences(org.apache.iceberg.Schema,org.apache.iceberg.Schema)">validateMetadataColumnReferences</a></span>&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;tableSchema,
<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;readSchema)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="schemaForTable(org.apache.spark.sql.SparkSession,java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>schemaForTable</h4>
<pre class="methodSignature">public static&nbsp;<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;schemaForTable&#8203;(org.apache.spark.sql.SparkSession&nbsp;spark,
java.lang.String&nbsp;name)</pre>
<div class="block">Returns a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> for the given table with fresh field ids.
<p>This creates a Schema for an existing table by looking up the table's schema with Spark and
converting that schema. Spark/Hive partition columns are included in the schema.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>spark</code> - a Spark session</dd>
<dd><code>name</code> - a table name and (optional) database</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a Schema for the table, if found</dd>
</dl>
</li>
</ul>
<a id="specForTable(org.apache.spark.sql.SparkSession,java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>specForTable</h4>
<pre class="methodSignature">public static&nbsp;<a href="../PartitionSpec.html" title="class in org.apache.iceberg">PartitionSpec</a>&nbsp;specForTable&#8203;(org.apache.spark.sql.SparkSession&nbsp;spark,
java.lang.String&nbsp;name)
throws org.apache.spark.sql.AnalysisException</pre>
<div class="block">Returns a <a href="../PartitionSpec.html" title="class in org.apache.iceberg"><code>PartitionSpec</code></a> for the given table.
<p>This creates a partition spec for an existing table by looking up the table's schema and
creating a spec with identity partitions for each partition column.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>spark</code> - a Spark session</dd>
<dd><code>name</code> - a table name and (optional) database</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a PartitionSpec for the table</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>org.apache.spark.sql.AnalysisException</code> - if thrown by the Spark catalog</dd>
</dl>
</li>
</ul>
<a id="convert(org.apache.iceberg.Schema)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>convert</h4>
<pre class="methodSignature">public static&nbsp;org.apache.spark.sql.types.StructType&nbsp;convert&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;schema)</pre>
<div class="block">Convert a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> to a <code>Spark type</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>schema</code> - a Schema</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the equivalent Spark type</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the type cannot be converted to Spark</dd>
</dl>
</li>
</ul>
<a id="convert(org.apache.iceberg.types.Type)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>convert</h4>
<pre class="methodSignature">public static&nbsp;org.apache.spark.sql.types.DataType&nbsp;convert&#8203;(<a href="../types/Type.html" title="interface in org.apache.iceberg.types">Type</a>&nbsp;type)</pre>
<div class="block">Convert a <a href="../types/Type.html" title="interface in org.apache.iceberg.types"><code>Type</code></a> to a <code>Spark type</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>type</code> - a Type</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the equivalent Spark type</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the type cannot be converted to Spark</dd>
</dl>
</li>
</ul>
<a id="convert(org.apache.spark.sql.types.StructType)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>convert</h4>
<pre class="methodSignature">public static&nbsp;<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;convert&#8203;(org.apache.spark.sql.types.StructType&nbsp;sparkType)</pre>
<div class="block">Convert a Spark <code>struct</code> to a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> with new field ids.
<p>This conversion assigns fresh ids.
<p>Some data types are represented as the same Spark type. These are converted to a default
type.
<p>To convert using a reference schema for field ids and ambiguous types, use <a href="#convert(org.apache.iceberg.Schema,org.apache.spark.sql.types.StructType)"><code>convert(Schema, StructType)</code></a>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sparkType</code> - a Spark StructType</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the equivalent Schema</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the type cannot be converted</dd>
</dl>
</li>
</ul>
<a id="convert(org.apache.spark.sql.types.DataType)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>convert</h4>
<pre class="methodSignature">public static&nbsp;<a href="../types/Type.html" title="interface in org.apache.iceberg.types">Type</a>&nbsp;convert&#8203;(org.apache.spark.sql.types.DataType&nbsp;sparkType)</pre>
<div class="block">Convert a Spark <code>struct</code> to a <a href="../types/Type.html" title="interface in org.apache.iceberg.types"><code>Type</code></a> with new field ids.
<p>This conversion assigns fresh ids.
<p>Some data types are represented as the same Spark type. These are converted to a default
type.
<p>To convert using a reference schema for field ids and ambiguous types, use <a href="#convert(org.apache.iceberg.Schema,org.apache.spark.sql.types.StructType)"><code>convert(Schema, StructType)</code></a>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sparkType</code> - a Spark DataType</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the equivalent Type</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the type cannot be converted</dd>
</dl>
</li>
</ul>
<a id="convert(org.apache.iceberg.Schema,org.apache.spark.sql.types.StructType)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>convert</h4>
<pre class="methodSignature">public static&nbsp;<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;convert&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;baseSchema,
org.apache.spark.sql.types.StructType&nbsp;sparkType)</pre>
<div class="block">Convert a Spark <code>struct</code> to a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> based on the given schema.
<p>This conversion does not assign new ids; it uses ids from the base schema.
<p>Data types, field order, and nullability will match the spark type. This conversion may
return a schema that is not compatible with base schema.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>baseSchema</code> - a Schema on which conversion is based</dd>
<dd><code>sparkType</code> - a Spark StructType</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the equivalent Schema</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the type cannot be converted or there are missing ids</dd>
</dl>
</li>
</ul>
<a id="convert(org.apache.iceberg.Schema,org.apache.spark.sql.types.StructType,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>convert</h4>
<pre class="methodSignature">public static&nbsp;<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;convert&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;baseSchema,
org.apache.spark.sql.types.StructType&nbsp;sparkType,
boolean&nbsp;caseSensitive)</pre>
<div class="block">Convert a Spark <code>struct</code> to a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> based on the given schema.
<p>This conversion does not assign new ids; it uses ids from the base schema.
<p>Data types, field order, and nullability will match the spark type. This conversion may
return a schema that is not compatible with base schema.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>baseSchema</code> - a Schema on which conversion is based</dd>
<dd><code>sparkType</code> - a Spark StructType</dd>
<dd><code>caseSensitive</code> - when false, the case of schema fields is ignored</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the equivalent Schema</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the type cannot be converted or there are missing ids</dd>
</dl>
</li>
</ul>
<a id="convertWithFreshIds(org.apache.iceberg.Schema,org.apache.spark.sql.types.StructType)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>convertWithFreshIds</h4>
<pre class="methodSignature">public static&nbsp;<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;convertWithFreshIds&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;baseSchema,
org.apache.spark.sql.types.StructType&nbsp;sparkType)</pre>
<div class="block">Convert a Spark <code>struct</code> to a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> based on the given schema.
<p>This conversion will assign new ids for fields that are not found in the base schema.
<p>Data types, field order, and nullability will match the spark type. This conversion may
return a schema that is not compatible with base schema.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>baseSchema</code> - a Schema on which conversion is based</dd>
<dd><code>sparkType</code> - a Spark StructType</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the equivalent Schema</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the type cannot be converted or there are missing ids</dd>
</dl>
</li>
</ul>
<a id="convertWithFreshIds(org.apache.iceberg.Schema,org.apache.spark.sql.types.StructType,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>convertWithFreshIds</h4>
<pre class="methodSignature">public static&nbsp;<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;convertWithFreshIds&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;baseSchema,
org.apache.spark.sql.types.StructType&nbsp;sparkType,
boolean&nbsp;caseSensitive)</pre>
<div class="block">Convert a Spark <code>struct</code> to a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> based on the given schema.
<p>This conversion will assign new ids for fields that are not found in the base schema.
<p>Data types, field order, and nullability will match the spark type. This conversion may
return a schema that is not compatible with base schema.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>baseSchema</code> - a Schema on which conversion is based</dd>
<dd><code>sparkType</code> - a Spark StructType</dd>
<dd><code>caseSensitive</code> - when false, case of field names in schema is ignored</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the equivalent Schema</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the type cannot be converted or there are missing ids</dd>
</dl>
</li>
</ul>
<a id="prune(org.apache.iceberg.Schema,org.apache.spark.sql.types.StructType)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>prune</h4>
<pre class="methodSignature">public static&nbsp;<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;prune&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;schema,
org.apache.spark.sql.types.StructType&nbsp;requestedType)</pre>
<div class="block">Prune columns from a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> using a <code>Spark type</code> projection.
<p>This requires that the Spark type is a projection of the Schema. Nullability and types must
match.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>schema</code> - a Schema</dd>
<dd><code>requestedType</code> - a projection of the Spark representation of the Schema</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a Schema corresponding to the Spark projection</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the Spark type does not match the Schema</dd>
</dl>
</li>
</ul>
<a id="prune(org.apache.iceberg.Schema,org.apache.spark.sql.types.StructType,java.util.List)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>prune</h4>
<pre class="methodSignature">public static&nbsp;<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;prune&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;schema,
org.apache.spark.sql.types.StructType&nbsp;requestedType,
java.util.List&lt;<a href="../expressions/Expression.html" title="interface in org.apache.iceberg.expressions">Expression</a>&gt;&nbsp;filters)</pre>
<div class="block">Prune columns from a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> using a <code>Spark type</code> projection.
<p>This requires that the Spark type is a projection of the Schema. Nullability and types must
match.
<p>The filters list of <a href="../expressions/Expression.html" title="interface in org.apache.iceberg.expressions"><code>Expression</code></a> is used to ensure that columns referenced by filters
are projected.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>schema</code> - a Schema</dd>
<dd><code>requestedType</code> - a projection of the Spark representation of the Schema</dd>
<dd><code>filters</code> - a list of filters</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a Schema corresponding to the Spark projection</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the Spark type does not match the Schema</dd>
</dl>
</li>
</ul>
<a id="prune(org.apache.iceberg.Schema,org.apache.spark.sql.types.StructType,org.apache.iceberg.expressions.Expression,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>prune</h4>
<pre class="methodSignature">public static&nbsp;<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;prune&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;schema,
org.apache.spark.sql.types.StructType&nbsp;requestedType,
<a href="../expressions/Expression.html" title="interface in org.apache.iceberg.expressions">Expression</a>&nbsp;filter,
boolean&nbsp;caseSensitive)</pre>
<div class="block">Prune columns from a <a href="../Schema.html" title="class in org.apache.iceberg"><code>Schema</code></a> using a <code>Spark type</code> projection.
<p>This requires that the Spark type is a projection of the Schema. Nullability and types must
match.
<p>The filters list of <a href="../expressions/Expression.html" title="interface in org.apache.iceberg.expressions"><code>Expression</code></a> is used to ensure that columns referenced by filters
are projected.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>schema</code> - a Schema</dd>
<dd><code>requestedType</code> - a projection of the Spark representation of the Schema</dd>
<dd><code>filter</code> - a filters</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a Schema corresponding to the Spark projection</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the Spark type does not match the Schema</dd>
</dl>
</li>
</ul>
<a id="estimateSize(org.apache.spark.sql.types.StructType,long)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>estimateSize</h4>
<pre class="methodSignature">public static&nbsp;long&nbsp;estimateSize&#8203;(org.apache.spark.sql.types.StructType&nbsp;tableSchema,
long&nbsp;totalRecords)</pre>
<div class="block">Estimate approximate table size based on Spark schema and total records.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>tableSchema</code> - Spark schema</dd>
<dd><code>totalRecords</code> - total records in the table</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>approximate size based on table schema</dd>
</dl>
</li>
</ul>
<a id="validateMetadataColumnReferences(org.apache.iceberg.Schema,org.apache.iceberg.Schema)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>validateMetadataColumnReferences</h4>
<pre class="methodSignature">public static&nbsp;void&nbsp;validateMetadataColumnReferences&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;tableSchema,
<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;readSchema)</pre>
</li>
</ul>
<a id="indexQuotedNameById(org.apache.iceberg.Schema)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>indexQuotedNameById</h4>
<pre class="methodSignature">public static&nbsp;java.util.Map&lt;java.lang.Integer,&#8203;java.lang.String&gt;&nbsp;indexQuotedNameById&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;schema)</pre>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
</footer>
</body>
</html>