blob: db89af2855c9df6b732fb346ba21e67aeb982566 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>ORCSchemaUtil</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="ORCSchemaUtil";
}
}
catch(err) {
}
//-->
var data = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":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><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&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><a href="#field.detail">Field</a>&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.orc</a></div>
<h2 title="Class ORCSchemaUtil" class="title">Class ORCSchemaUtil</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.apache.iceberg.orc.ORCSchemaUtil</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<pre>public final class <span class="typeNameLabel">ORCSchemaUtil</span>
extends java.lang.Object</pre>
<div class="block">Utilities for mapping Iceberg to ORC schemas.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary">
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="ORCSchemaUtil.BinaryType.html" title="enum in org.apache.iceberg.orc">ORCSchemaUtil.BinaryType</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="ORCSchemaUtil.LongType.html" title="enum in org.apache.iceberg.orc">ORCSchemaUtil.LongType</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- =========== FIELD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Field</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#ICEBERG_BINARY_TYPE_ATTRIBUTE">ICEBERG_BINARY_TYPE_ATTRIBUTE</a></span></code></th>
<td class="colLast">
<div class="block">The name of the ORC <code>TypeDescription</code> attribute indicating the Iceberg type corresponding
to an ORC binary type.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#ICEBERG_LONG_TYPE_ATTRIBUTE">ICEBERG_LONG_TYPE_ATTRIBUTE</a></span></code></th>
<td class="colLast">
<div class="block">The name of the ORC <code>TypeDescription</code> attribute indicating the Iceberg type corresponding
to an ORC long type.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ========== 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.orc.TypeDescription</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#buildOrcProjection(org.apache.iceberg.Schema,org.apache.orc.TypeDescription)">buildOrcProjection</a></span>&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;schema,
org.apache.orc.TypeDescription&nbsp;originalOrcSchema)</code></th>
<td class="colLast">
<div class="block">Converts an Iceberg schema to a corresponding ORC schema within the context of an existing ORC
file schema.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>static org.apache.orc.TypeDescription</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">&nbsp;</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.orc.TypeDescription)">convert</a></span>&#8203;(org.apache.orc.TypeDescription&nbsp;orcSchema)</code></th>
<td class="colLast">
<div class="block">Convert an ORC schema to an Iceberg schema.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>static int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#fieldId(org.apache.orc.TypeDescription)">fieldId</a></span>&#8203;(org.apache.orc.TypeDescription&nbsp;orcType)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i4" class="altColor">
<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="#idToOrcName(org.apache.iceberg.Schema)">idToOrcName</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">Generates mapping from field IDs to ORC qualified names.</div>
</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">
<!-- ============ FIELD DETAIL =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a id="ICEBERG_BINARY_TYPE_ATTRIBUTE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ICEBERG_BINARY_TYPE_ATTRIBUTE</h4>
<pre>public static final&nbsp;java.lang.String ICEBERG_BINARY_TYPE_ATTRIBUTE</pre>
<div class="block">The name of the ORC <code>TypeDescription</code> attribute indicating the Iceberg type corresponding
to an ORC binary type. The values for this attribute are denoted in <code>BinaryType</code>.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../constant-values.html#org.apache.iceberg.orc.ORCSchemaUtil.ICEBERG_BINARY_TYPE_ATTRIBUTE">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="ICEBERG_LONG_TYPE_ATTRIBUTE">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>ICEBERG_LONG_TYPE_ATTRIBUTE</h4>
<pre>public static final&nbsp;java.lang.String ICEBERG_LONG_TYPE_ATTRIBUTE</pre>
<div class="block">The name of the ORC <code>TypeDescription</code> attribute indicating the Iceberg type corresponding
to an ORC long type. The values for this attribute are denoted in <code>LongType</code>.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../constant-values.html#org.apache.iceberg.orc.ORCSchemaUtil.ICEBERG_LONG_TYPE_ATTRIBUTE">Constant Field Values</a></dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<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.orc.TypeDescription&nbsp;convert&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;schema)</pre>
</li>
</ul>
<a id="convert(org.apache.orc.TypeDescription)">
<!-- -->
</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.orc.TypeDescription&nbsp;orcSchema)</pre>
<div class="block">Convert an ORC schema to an Iceberg schema. This method handles the convertion from the
original Iceberg column mapping IDs if present in the ORC column attributes, otherwise, ORC
columns with no Iceberg IDs will be ignored and skipped in the conversion.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the Iceberg schema</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if ORC schema has no columns with Iceberg ID attributes</dd>
</dl>
</li>
</ul>
<a id="buildOrcProjection(org.apache.iceberg.Schema,org.apache.orc.TypeDescription)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>buildOrcProjection</h4>
<pre class="methodSignature">public static&nbsp;org.apache.orc.TypeDescription&nbsp;buildOrcProjection&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;schema,
org.apache.orc.TypeDescription&nbsp;originalOrcSchema)</pre>
<div class="block">Converts an Iceberg schema to a corresponding ORC schema within the context of an existing ORC
file schema. This method also handles schema evolution from the original ORC file schema to the
given Iceberg schema. It builds the desired reader schema with the schema evolution rules and
pass that down to the ORC reader, which would then use its schema evolution to map that to the
writer’s schema.
<p>Example: <code>
Iceberg writer ORC writer
struct&lt;a (1): int, b (2): string&gt; struct&lt;a: int, b: string&gt;
struct&lt;a (1): struct&lt;b (2): string, c (3): date&gt;&gt; struct&lt;a: struct&lt;b:string, c:date&gt;&gt;
</code> Iceberg reader ORC reader <code>
struct&lt;a (2): string, c (3): date&gt; struct&lt;b: string, c: date&gt;
struct&lt;aa (1): struct&lt;cc (3): date, bb (2): string&gt;&gt; struct&lt;a: struct&lt;c:date, b:string&gt;&gt;
</code></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>schema</code> - an Iceberg schema</dd>
<dd><code>originalOrcSchema</code> - an existing ORC file schema</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the resulting ORC schema</dd>
</dl>
</li>
</ul>
<a id="fieldId(org.apache.orc.TypeDescription)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>fieldId</h4>
<pre class="methodSignature">public static&nbsp;int&nbsp;fieldId&#8203;(org.apache.orc.TypeDescription&nbsp;orcType)</pre>
</li>
</ul>
<a id="idToOrcName(org.apache.iceberg.Schema)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>idToOrcName</h4>
<pre class="methodSignature">public static&nbsp;java.util.Map&lt;java.lang.Integer,&#8203;java.lang.String&gt;&nbsp;idToOrcName&#8203;(<a href="../Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;schema)</pre>
<div class="block">Generates mapping from field IDs to ORC qualified names. See <code>IdToOrcName</code> for details.</div>
</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><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&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><a href="#field.detail">Field</a>&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>