blob: a21783d421cf5c64f138f0eab3ede0a41bbbbad1 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_201) on Tue Aug 25 16:06:02 PDT 2020 -->
<title>ORCSchemaUtil</title>
<meta name="date" content="2020-08-25">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ORCSchemaUtil";
}
}
catch(err) {
}
//-->
var methods = {"i0":9,"i1":9,"i2":9,"i3":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";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.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">
<li><a href="../../../../org/apache/iceberg/orc/OrcRowReader.html" title="interface in org.apache.iceberg.orc"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../org/apache/iceberg/orc/ORCSchemaUtil.BinaryType.html" title="enum in org.apache.iceberg.orc"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/iceberg/orc/ORCSchemaUtil.html" target="_top">Frames</a></li>
<li><a href="ORCSchemaUtil.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></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>
</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 name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.iceberg.orc</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>
<br>
<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 ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/iceberg/orc/ORCSchemaUtil.BinaryType.html" title="enum in org.apache.iceberg.orc">ORCSchemaUtil.BinaryType</a></span></code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/iceberg/orc/ORCSchemaUtil.LongType.html" title="enum in org.apache.iceberg.orc">ORCSchemaUtil.LongType</a></span></code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/iceberg/orc/ORCSchemaUtil.html#ICEBERG_BINARY_TYPE_ATTRIBUTE">ICEBERG_BINARY_TYPE_ATTRIBUTE</a></span></code>
<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>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/iceberg/orc/ORCSchemaUtil.html#ICEBERG_LONG_TYPE_ATTRIBUTE">ICEBERG_LONG_TYPE_ATTRIBUTE</a></span></code>
<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>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<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="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>static org.apache.orc.TypeDescription</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/iceberg/orc/ORCSchemaUtil.html#buildOrcProjection-org.apache.iceberg.Schema-org.apache.orc.TypeDescription-">buildOrcProjection</a></span>(<a href="../../../../org/apache/iceberg/Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;schema,
org.apache.orc.TypeDescription&nbsp;originalOrcSchema)</code>
<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>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/iceberg/orc/ORCSchemaUtil.html#convert-org.apache.iceberg.Schema-">convert</a></span>(<a href="../../../../org/apache/iceberg/Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;schema)</code>&nbsp;</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>static <a href="../../../../org/apache/iceberg/Schema.html" title="class in org.apache.iceberg">Schema</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/iceberg/orc/ORCSchemaUtil.html#convert-org.apache.orc.TypeDescription-">convert</a></span>(org.apache.orc.TypeDescription&nbsp;orcSchema)</code>
<div class="block">Convert an ORC schema to an Iceberg schema.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>static java.util.Map&lt;java.lang.Integer,java.lang.String&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/iceberg/orc/ORCSchemaUtil.html#idToOrcName-org.apache.iceberg.Schema-">idToOrcName</a></span>(<a href="../../../../org/apache/iceberg/Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;schema)</code>
<div class="block">Generates mapping from field IDs to ORC qualified names.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="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>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="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 name="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>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="convert-org.apache.iceberg.Schema-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>convert</h4>
<pre>public static&nbsp;org.apache.orc.TypeDescription&nbsp;convert(<a href="../../../../org/apache/iceberg/Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;schema)</pre>
</li>
</ul>
<a name="convert-org.apache.orc.TypeDescription-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>convert</h4>
<pre>public static&nbsp;<a href="../../../../org/apache/iceberg/Schema.html" title="class in org.apache.iceberg">Schema</a>&nbsp;convert(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 name="buildOrcProjection-org.apache.iceberg.Schema-org.apache.orc.TypeDescription-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>buildOrcProjection</h4>
<pre>public static&nbsp;org.apache.orc.TypeDescription&nbsp;buildOrcProjection(<a href="../../../../org/apache/iceberg/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.
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 name="idToOrcName-org.apache.iceberg.Schema-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>idToOrcName</h4>
<pre>public static&nbsp;java.util.Map&lt;java.lang.Integer,java.lang.String&gt;&nbsp;idToOrcName(<a href="../../../../org/apache/iceberg/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>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.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">
<li><a href="../../../../org/apache/iceberg/orc/OrcRowReader.html" title="interface in org.apache.iceberg.orc"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../org/apache/iceberg/orc/ORCSchemaUtil.BinaryType.html" title="enum in org.apache.iceberg.orc"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/iceberg/orc/ORCSchemaUtil.html" target="_top">Frames</a></li>
<li><a href="ORCSchemaUtil.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.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>
</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 name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>