This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch gh-pages
in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git


The following commit(s) were added to refs/heads/gh-pages by this push:
     new 3e412f8c deploy: 12e12e274571d7aa75c023f6bcd5164984041881
3e412f8c is described below

commit 3e412f8c8896dc7d3ddd053b502fa516e61684ab
Author: Xuanwo <[email protected]>
AuthorDate: Fri Sep 20 12:02:08 2024 +0000

    deploy: 12e12e274571d7aa75c023f6bcd5164984041881
---
 api/iceberg/all.html                               |   2 +-
 api/iceberg/arrow/fn.arrow_schema_to_schema.html   |   2 +-
 api/iceberg/arrow/fn.arrow_type_to_type.html       |   2 +
 api/iceberg/arrow/fn.schema_to_arrow_schema.html   |   2 +-
 api/iceberg/arrow/fn.type_to_arrow_type.html       |   2 +
 api/iceberg/arrow/index.html                       |   2 +-
 .../arrow/schema/fn.arrow_type_to_type.html        |  11 ++
 .../arrow/schema/fn.type_to_arrow_type.html        |  11 ++
 api/iceberg/arrow/sidebar-items.js                 |   2 +-
 api/iceberg/spec/struct.Schema.html                |   2 +-
 api/search-index.js                                |   2 +-
 api/search.desc/iceberg/iceberg-desc-0-.js         |   2 +-
 api/src/iceberg/arrow/schema.rs.html               | 206 ++++++++++++++++++++-
 13 files changed, 233 insertions(+), 15 deletions(-)

diff --git a/api/iceberg/all.html b/api/iceberg/all.html
index d34f2fc3..51ef7804 100644
--- a/api/iceberg/all.html
+++ b/api/iceberg/all.html
@@ -1 +1 @@
-<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta 
name="viewport" content="width=device-width, initial-scale=1.0"><meta 
name="generator" content="rustdoc"><meta name="description" content="List of 
all items in this crate"><title>List of all items in this 
crate</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d
 [...]
\ No newline at end of file
+<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta 
name="viewport" content="width=device-width, initial-scale=1.0"><meta 
name="generator" content="rustdoc"><meta name="description" content="List of 
all items in this crate"><title>List of all items in this 
crate</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d
 [...]
\ No newline at end of file
diff --git a/api/iceberg/arrow/fn.arrow_schema_to_schema.html 
b/api/iceberg/arrow/fn.arrow_schema_to_schema.html
index 3e1eab1f..b80b22ae 100644
--- a/api/iceberg/arrow/fn.arrow_schema_to_schema.html
+++ b/api/iceberg/arrow/fn.arrow_schema_to_schema.html
@@ -1,2 +1,2 @@
-<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta 
name="viewport" content="width=device-width, initial-scale=1.0"><meta 
name="generator" content="rustdoc"><meta name="description" content="Convert 
Arrow schema to ceberg schema."><title>arrow_schema_to_schema in iceberg::arrow 
- 
Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSa
 [...]
+<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta 
name="viewport" content="width=device-width, initial-scale=1.0"><meta 
name="generator" content="rustdoc"><meta name="description" content="Convert 
Arrow schema to ceberg schema."><title>arrow_schema_to_schema in iceberg::arrow 
- 
Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSa
 [...]
 </div></details></section></div></main></body></html>
\ No newline at end of file
diff --git a/api/iceberg/arrow/fn.arrow_type_to_type.html 
b/api/iceberg/arrow/fn.arrow_type_to_type.html
new file mode 100644
index 00000000..65e673ad
--- /dev/null
+++ b/api/iceberg/arrow/fn.arrow_type_to_type.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta 
name="viewport" content="width=device-width, initial-scale=1.0"><meta 
name="generator" content="rustdoc"><meta name="description" content="Convert 
Arrow type to iceberg type."><title>arrow_type_to_type in iceberg::arrow - 
Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medi
 [...]
+</div></details></section></div></main></body></html>
\ No newline at end of file
diff --git a/api/iceberg/arrow/fn.schema_to_arrow_schema.html 
b/api/iceberg/arrow/fn.schema_to_arrow_schema.html
index 4e962cf4..f7aacbd9 100644
--- a/api/iceberg/arrow/fn.schema_to_arrow_schema.html
+++ b/api/iceberg/arrow/fn.schema_to_arrow_schema.html
@@ -1,2 +1,2 @@
-<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta 
name="viewport" content="width=device-width, initial-scale=1.0"><meta 
name="generator" content="rustdoc"><meta name="description" content="Convert 
iceberg schema to an arrow schema."><title>schema_to_arrow_schema in 
iceberg::arrow - 
Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,Fi
 [...]
+<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta 
name="viewport" content="width=device-width, initial-scale=1.0"><meta 
name="generator" content="rustdoc"><meta name="description" content="Convert 
iceberg schema to an arrow schema."><title>schema_to_arrow_schema in 
iceberg::arrow - 
Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,Fi
 [...]
 </div></details></section></div></main></body></html>
\ No newline at end of file
diff --git a/api/iceberg/arrow/fn.type_to_arrow_type.html 
b/api/iceberg/arrow/fn.type_to_arrow_type.html
new file mode 100644
index 00000000..a659fa52
--- /dev/null
+++ b/api/iceberg/arrow/fn.type_to_arrow_type.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta 
name="viewport" content="width=device-width, initial-scale=1.0"><meta 
name="generator" content="rustdoc"><meta name="description" content="Convert 
iceberg type to an arrow type."><title>type_to_arrow_type in iceberg::arrow - 
Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-M
 [...]
+</div></details></section></div></main></body></html>
\ No newline at end of file
diff --git a/api/iceberg/arrow/index.html b/api/iceberg/arrow/index.html
index 3b12294e..aa57b5fb 100644
--- a/api/iceberg/arrow/index.html
+++ b/api/iceberg/arrow/index.html
@@ -1,2 +1,2 @@
 <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta 
name="viewport" content="width=device-width, initial-scale=1.0"><meta 
name="generator" content="rustdoc"><meta name="description" content="Conversion 
between Iceberg and Arrow schema"><title>iceberg::arrow - 
Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e497
 [...]
-</div></details><h2 id="structs" class="section-header">Structs<a 
href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div 
class="item-name"><a class="struct" href="struct.ArrowReader.html" 
title="struct iceberg::arrow::ArrowReader">ArrowReader</a></div><div 
class="desc docblock-short">Reads data from Parquet files</div></li><li><div 
class="item-name"><a class="struct" href="struct.ArrowReaderBuilder.html" 
title="struct iceberg::arrow::ArrowReaderBuilder">ArrowReaderBuild [...]
\ No newline at end of file
+</div></details><h2 id="structs" class="section-header">Structs<a 
href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div 
class="item-name"><a class="struct" href="struct.ArrowReader.html" 
title="struct iceberg::arrow::ArrowReader">ArrowReader</a></div><div 
class="desc docblock-short">Reads data from Parquet files</div></li><li><div 
class="item-name"><a class="struct" href="struct.ArrowReaderBuilder.html" 
title="struct iceberg::arrow::ArrowReaderBuilder">ArrowReaderBuild [...]
\ No newline at end of file
diff --git a/api/iceberg/arrow/schema/fn.arrow_type_to_type.html 
b/api/iceberg/arrow/schema/fn.arrow_type_to_type.html
new file mode 100644
index 00000000..5f69cc02
--- /dev/null
+++ b/api/iceberg/arrow/schema/fn.arrow_type_to_type.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta http-equiv="refresh" 
content="0;URL=../../../iceberg/arrow/fn.arrow_type_to_type.html">
+    <title>Redirection</title>
+</head>
+<body>
+    <p>Redirecting to <a 
href="../../../iceberg/arrow/fn.arrow_type_to_type.html">../../../iceberg/arrow/fn.arrow_type_to_type.html</a>...</p>
+    
<script>location.replace("../../../iceberg/arrow/fn.arrow_type_to_type.html" + 
location.search + location.hash);</script>
+</body>
+</html>
\ No newline at end of file
diff --git a/api/iceberg/arrow/schema/fn.type_to_arrow_type.html 
b/api/iceberg/arrow/schema/fn.type_to_arrow_type.html
new file mode 100644
index 00000000..440361c5
--- /dev/null
+++ b/api/iceberg/arrow/schema/fn.type_to_arrow_type.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta http-equiv="refresh" 
content="0;URL=../../../iceberg/arrow/fn.type_to_arrow_type.html">
+    <title>Redirection</title>
+</head>
+<body>
+    <p>Redirecting to <a 
href="../../../iceberg/arrow/fn.type_to_arrow_type.html">../../../iceberg/arrow/fn.type_to_arrow_type.html</a>...</p>
+    
<script>location.replace("../../../iceberg/arrow/fn.type_to_arrow_type.html" + 
location.search + location.hash);</script>
+</body>
+</html>
\ No newline at end of file
diff --git a/api/iceberg/arrow/sidebar-items.js 
b/api/iceberg/arrow/sidebar-items.js
index 99459a5a..5bfb0c34 100644
--- a/api/iceberg/arrow/sidebar-items.js
+++ b/api/iceberg/arrow/sidebar-items.js
@@ -1 +1 @@
-window.SIDEBAR_ITEMS = 
{"fn":["arrow_schema_to_schema","schema_to_arrow_schema"],"struct":["ArrowReader","ArrowReaderBuilder"],"trait":["ArrowSchemaVisitor"]};
\ No newline at end of file
+window.SIDEBAR_ITEMS = 
{"fn":["arrow_schema_to_schema","arrow_type_to_type","schema_to_arrow_schema","type_to_arrow_type"],"struct":["ArrowReader","ArrowReaderBuilder"],"trait":["ArrowSchemaVisitor"]};
\ No newline at end of file
diff --git a/api/iceberg/spec/struct.Schema.html 
b/api/iceberg/spec/struct.Schema.html
index c80413af..6db2e5eb 100644
--- a/api/iceberg/spec/struct.Schema.html
+++ b/api/iceberg/spec/struct.Schema.html
@@ -21,7 +21,7 @@
     __D: <a class="trait" 
href="https://docs.rs/serde/1.0.210/serde/de/trait.Deserializer.html"; 
title="trait 
serde::de::Deserializer">Deserializer</a>&lt;'de&gt;,</div></h4></section></summary><div
 class='docblock'>Deserialize this value from the given Serde deserializer. <a 
href="https://docs.rs/serde/1.0.210/serde/de/trait.Deserialize.html#tymethod.deserialize";>Read
 more</a></div></details></div></details><details class="toggle 
implementors-toggle" open><summary><section id="impl-Displ [...]
 by <code>==</code>.</div></details><details class="toggle method-toggle" 
open><summary><section id="method.ne" class="method trait-impl"><span 
class="rightside"><span class="since" title="Stable since Rust version 
1.0.0">1.0.0</span> · <a class="src" 
href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#263";>source</a></span><a
 href="#method.ne" class="anchor">§</a><h4 class="code-header">fn <a 
href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne";
 class= [...]
 sufficient, and should not be overridden without very good 
reason.</div></details></div></details><details class="toggle 
implementors-toggle" open><summary><section id="impl-Serialize-for-Schema" 
class="impl"><a class="src rightside" 
href="../../src/iceberg/spec/schema.rs.html#45">source</a><a 
href="#impl-Serialize-for-Schema" class="anchor">§</a><h3 
class="code-header">impl <a class="trait" 
href="https://docs.rs/serde/1.0.210/serde/ser/trait.Serialize.html"; 
title="trait serde::ser::Seri [...]
-    __S: <a class="trait" 
href="https://docs.rs/serde/1.0.210/serde/ser/trait.Serializer.html"; 
title="trait 
serde::ser::Serializer">Serializer</a>,</div></h4></section></summary><div 
class='docblock'>Serialize this value into the given Serde serializer. <a 
href="https://docs.rs/serde/1.0.210/serde/ser/trait.Serialize.html#tymethod.serialize";>Read
 more</a></div></details></div></details><details class="toggle 
implementors-toggle" open><summary><section 
id="impl-TryFrom%3C%26Schema%3E-for- [...]
+    __S: <a class="trait" 
href="https://docs.rs/serde/1.0.210/serde/ser/trait.Serializer.html"; 
title="trait 
serde::ser::Serializer">Serializer</a>,</div></h4></section></summary><div 
class='docblock'>Serialize this value into the given Serde serializer. <a 
href="https://docs.rs/serde/1.0.210/serde/ser/trait.Serialize.html#tymethod.serialize";>Read
 more</a></div></details></div></details><details class="toggle 
implementors-toggle" open><summary><section 
id="impl-TryFrom%3C%26Schema%3E-for- [...]
     T: 'static + ?<a class="trait" 
href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html"; 
title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div 
class="impl-items"><details class="toggle method-toggle" open><summary><section 
id="method.type_id" class="method trait-impl"><a class="src rightside" 
href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#141";>source</a><a 
href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href 
[...]
     T: ?<a class="trait" 
href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html"; 
title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div 
class="impl-items"><details class="toggle method-toggle" open><summary><section 
id="method.borrow" class="method trait-impl"><a class="src rightside" 
href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#210";>source</a><a
 href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a 
href="https:/ [...]
     T: ?<a class="trait" 
href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html"; 
title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div 
class="impl-items"><details class="toggle method-toggle" open><summary><section 
id="method.borrow_mut" class="method trait-impl"><a class="src rightside" 
href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#217";>source</a><a
 href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a 
href= [...]
diff --git a/api/search-index.js b/api/search-index.js
index b59c7500..79d4a857 100644
--- a/api/search-index.js
+++ b/api/search-index.js
@@ -1,5 +1,5 @@
 var searchIndex = new Map(JSON.parse('[\
-["iceberg",{"t":"PPPPPKPPPPPFGPPPFFPPPPPPIPPPPPPFFFGGPPPFNCNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMMOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMMQNNNNNNNNNNNNNNCNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMNNNNNNNNNNNNNNNNNNNNNNNNNCNMMMOONNNOOONOMNNNNNONOOMOCOONNNNONCOCMNNNNNNNNNNCCNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMMNNNNNNNNNNNNNCOOOOOOOOOOOOOOOOOOOOOOOOOFFKRRNNNNNNNNHNNNNNNNNNNNNNNNNNNNNNNNNNNNMMMNMHMNNNNNNNNNNNNPPPPPPPPFKRGFIPPPPPPPPFPPPPPPPPPGGFPPFPIPPFNNMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
 [...]
+["iceberg",{"t":"PPPPPKPPPPPFGPPPFFPPPPPPIPPPPPPFFFGGPPPFNCNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMMOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMMQNNNNNNNNNNNNNNCNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMNNNNNNNNNNNNNNNNNNNNNNNNNCNMMMOONNNOOONOMNNNNNONOOMOCOONNNNONCOCMNNNNNNNNNNCCNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNMMNNNNNNNNNNNNNCOOOOOOOOOOOOOOOOOOOOOOOOOFFKRRNNNNNNNNHHNNNNNNNNNNNNNNNNNNNNNNNNNNNMMMNMHMNNNNNNNHNNNNNPPPPPPPPFKRGFIPPPPPPPPFPPPPPPPPPGGFPPFPIPPFNNMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
 [...]
 
["iceberg_catalog_glue",{"t":"SSSSSFFNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNQ","n":["AWS_ACCESS_KEY_ID","AWS_PROFILE_NAME","AWS_REGION_NAME","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","GlueCatalog","GlueCatalogConfig","borrow","borrow","borrow_mut","borrow_mut","builder","create_namespace","create_table","deref","deref","deref_mut","deref_mut","drop","drop","drop_namespace","drop_table","file_io","fmt","fmt","from","from","get_namespace","init","init","into","into","into_shared","i
 [...]
 
["iceberg_catalog_hms",{"t":"PPFFGNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN","n":["Buffered","Framed","HmsCatalog","HmsCatalogConfig","HmsThriftTransport","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","builder","create_namespace","create_table","default","deref","deref","deref","deref_mut","deref_mut","deref_mut","drop","drop","drop","drop_namespace","drop_table","file_io","fmt","fmt","fmt","from","from","from","get_namespace","init","init","init","into
 [...]
 
["iceberg_catalog_memory",{"t":"FNNNNNNNNNNNNNNNNNNNNNNNNNNN","n":["MemoryCatalog","borrow","borrow_mut","create_namespace","create_table","deref","deref_mut","drop","drop_namespace","drop_table","fmt","from","get_namespace","init","into","list_namespaces","list_tables","load_table","namespace_exists","new","rename_table","table_exists","try_from","try_into","type_id","update_namespace","update_table","vzip"],"q":[[0,"iceberg_catalog_memory"],[28,"iceberg_catalog_memory::catalog"],[29,"i
 [...]
diff --git a/api/search.desc/iceberg/iceberg-desc-0-.js 
b/api/search.desc/iceberg/iceberg-desc-0-.js
index 17988bd0..339e00f1 100644
--- a/api/search.desc/iceberg/iceberg-desc-0-.js
+++ b/api/search.desc/iceberg/iceberg-desc-0-.js
@@ -1 +1 @@
-searchState.loadedDescShard("iceberg", 0, "Apache Iceberg Official Native Rust 
Implementation\nAdd a new schema to the table\nAdd snapshot to table.\nAdd sort 
order to table.\nAdd a new partition spec to the table\nAssign a new UUID to 
the table\nThe catalog API for Iceberg Rust.\nThe table’s current schema id 
must match the requirement.\nIceberg data is invalid.\nThe table’s default sort 
order id must match the …\nThe table’s default spec id must match the 
requirement.\nContains the err [...]
\ No newline at end of file
+searchState.loadedDescShard("iceberg", 0, "Apache Iceberg Official Native Rust 
Implementation\nAdd a new schema to the table\nAdd snapshot to table.\nAdd sort 
order to table.\nAdd a new partition spec to the table\nAssign a new UUID to 
the table\nThe catalog API for Iceberg Rust.\nThe table’s current schema id 
must match the requirement.\nIceberg data is invalid.\nThe table’s default sort 
order id must match the …\nThe table’s default spec id must match the 
requirement.\nContains the err [...]
\ No newline at end of file
diff --git a/api/src/iceberg/arrow/schema.rs.html 
b/api/src/iceberg/arrow/schema.rs.html
index 9542d5c7..663e4a91 100644
--- a/api/src/iceberg/arrow/schema.rs.html
+++ b/api/src/iceberg/arrow/schema.rs.html
@@ -1366,6 +1366,102 @@
 <a href="#1366" id="1366">1366</a>
 <a href="#1367" id="1367">1367</a>
 <a href="#1368" id="1368">1368</a>
+<a href="#1369" id="1369">1369</a>
+<a href="#1370" id="1370">1370</a>
+<a href="#1371" id="1371">1371</a>
+<a href="#1372" id="1372">1372</a>
+<a href="#1373" id="1373">1373</a>
+<a href="#1374" id="1374">1374</a>
+<a href="#1375" id="1375">1375</a>
+<a href="#1376" id="1376">1376</a>
+<a href="#1377" id="1377">1377</a>
+<a href="#1378" id="1378">1378</a>
+<a href="#1379" id="1379">1379</a>
+<a href="#1380" id="1380">1380</a>
+<a href="#1381" id="1381">1381</a>
+<a href="#1382" id="1382">1382</a>
+<a href="#1383" id="1383">1383</a>
+<a href="#1384" id="1384">1384</a>
+<a href="#1385" id="1385">1385</a>
+<a href="#1386" id="1386">1386</a>
+<a href="#1387" id="1387">1387</a>
+<a href="#1388" id="1388">1388</a>
+<a href="#1389" id="1389">1389</a>
+<a href="#1390" id="1390">1390</a>
+<a href="#1391" id="1391">1391</a>
+<a href="#1392" id="1392">1392</a>
+<a href="#1393" id="1393">1393</a>
+<a href="#1394" id="1394">1394</a>
+<a href="#1395" id="1395">1395</a>
+<a href="#1396" id="1396">1396</a>
+<a href="#1397" id="1397">1397</a>
+<a href="#1398" id="1398">1398</a>
+<a href="#1399" id="1399">1399</a>
+<a href="#1400" id="1400">1400</a>
+<a href="#1401" id="1401">1401</a>
+<a href="#1402" id="1402">1402</a>
+<a href="#1403" id="1403">1403</a>
+<a href="#1404" id="1404">1404</a>
+<a href="#1405" id="1405">1405</a>
+<a href="#1406" id="1406">1406</a>
+<a href="#1407" id="1407">1407</a>
+<a href="#1408" id="1408">1408</a>
+<a href="#1409" id="1409">1409</a>
+<a href="#1410" id="1410">1410</a>
+<a href="#1411" id="1411">1411</a>
+<a href="#1412" id="1412">1412</a>
+<a href="#1413" id="1413">1413</a>
+<a href="#1414" id="1414">1414</a>
+<a href="#1415" id="1415">1415</a>
+<a href="#1416" id="1416">1416</a>
+<a href="#1417" id="1417">1417</a>
+<a href="#1418" id="1418">1418</a>
+<a href="#1419" id="1419">1419</a>
+<a href="#1420" id="1420">1420</a>
+<a href="#1421" id="1421">1421</a>
+<a href="#1422" id="1422">1422</a>
+<a href="#1423" id="1423">1423</a>
+<a href="#1424" id="1424">1424</a>
+<a href="#1425" id="1425">1425</a>
+<a href="#1426" id="1426">1426</a>
+<a href="#1427" id="1427">1427</a>
+<a href="#1428" id="1428">1428</a>
+<a href="#1429" id="1429">1429</a>
+<a href="#1430" id="1430">1430</a>
+<a href="#1431" id="1431">1431</a>
+<a href="#1432" id="1432">1432</a>
+<a href="#1433" id="1433">1433</a>
+<a href="#1434" id="1434">1434</a>
+<a href="#1435" id="1435">1435</a>
+<a href="#1436" id="1436">1436</a>
+<a href="#1437" id="1437">1437</a>
+<a href="#1438" id="1438">1438</a>
+<a href="#1439" id="1439">1439</a>
+<a href="#1440" id="1440">1440</a>
+<a href="#1441" id="1441">1441</a>
+<a href="#1442" id="1442">1442</a>
+<a href="#1443" id="1443">1443</a>
+<a href="#1444" id="1444">1444</a>
+<a href="#1445" id="1445">1445</a>
+<a href="#1446" id="1446">1446</a>
+<a href="#1447" id="1447">1447</a>
+<a href="#1448" id="1448">1448</a>
+<a href="#1449" id="1449">1449</a>
+<a href="#1450" id="1450">1450</a>
+<a href="#1451" id="1451">1451</a>
+<a href="#1452" id="1452">1452</a>
+<a href="#1453" id="1453">1453</a>
+<a href="#1454" id="1454">1454</a>
+<a href="#1455" id="1455">1455</a>
+<a href="#1456" id="1456">1456</a>
+<a href="#1457" id="1457">1457</a>
+<a href="#1458" id="1458">1458</a>
+<a href="#1459" id="1459">1459</a>
+<a href="#1460" id="1460">1460</a>
+<a href="#1461" id="1461">1461</a>
+<a href="#1462" id="1462">1462</a>
+<a href="#1463" id="1463">1463</a>
+<a href="#1464" id="1464">1464</a>
 </pre></div><pre class="rust"><code><span class="comment">// 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
@@ -1539,7 +1635,6 @@
 }
 
 <span class="doccomment">/// Visit list types in post order.
-</span><span class="attr">#[allow(dead_code)]
 </span><span class="kw">fn </span>visit_list&lt;V: ArrowSchemaVisitor&gt;(
     data_type: <span class="kw-2">&amp;</span>DataType,
     element_field: <span class="kw-2">&amp;</span>Field,
@@ -1552,7 +1647,6 @@
 }
 
 <span class="doccomment">/// Visit struct type in post order.
-</span><span class="attr">#[allow(dead_code)]
 </span><span class="kw">fn </span>visit_struct&lt;V: 
ArrowSchemaVisitor&gt;(fields: <span class="kw-2">&amp;</span>Fields, visitor: 
<span class="kw-2">&amp;mut </span>V) -&gt; <span 
class="prelude-ty">Result</span>&lt;V::T&gt; {
     <span class="kw">let </span><span class="kw-2">mut </span>results = 
Vec::with_capacity(fields.len());
     <span class="kw">for </span>field <span class="kw">in </span>fields {
@@ -1566,7 +1660,6 @@
 }
 
 <span class="doccomment">/// Visit schema in post order.
-</span><span class="attr">#[allow(dead_code)]
 </span><span class="kw">fn </span>visit_schema&lt;V: 
ArrowSchemaVisitor&gt;(schema: <span class="kw-2">&amp;</span>ArrowSchema, 
visitor: <span class="kw-2">&amp;mut </span>V) -&gt; <span 
class="prelude-ty">Result</span>&lt;V::U&gt; {
     <span class="kw">let </span><span class="kw-2">mut </span>results = 
Vec::with_capacity(schema.fields().len());
     <span class="kw">for </span>field <span class="kw">in 
</span>schema.fields() {
@@ -1579,12 +1672,17 @@
 }
 
 <span class="doccomment">/// Convert Arrow schema to ceberg schema.
-</span><span class="attr">#[allow(dead_code)]
 </span><span class="kw">pub fn </span>arrow_schema_to_schema(schema: <span 
class="kw-2">&amp;</span>ArrowSchema) -&gt; <span 
class="prelude-ty">Result</span>&lt;Schema&gt; {
     <span class="kw">let </span><span class="kw-2">mut </span>visitor = 
ArrowSchemaConverter::new();
     visit_schema(schema, <span class="kw-2">&amp;mut </span>visitor)
 }
 
+<span class="doccomment">/// Convert Arrow type to iceberg type.
+</span><span class="kw">pub fn </span>arrow_type_to_type(ty: <span 
class="kw-2">&amp;</span>DataType) -&gt; <span 
class="prelude-ty">Result</span>&lt;Type&gt; {
+    <span class="kw">let </span><span class="kw-2">mut </span>visitor = 
ArrowSchemaConverter::new();
+    visit_type(ty, <span class="kw-2">&amp;mut </span>visitor)
+}
+
 <span class="kw">const </span>ARROW_FIELD_DOC_KEY: <span 
class="kw-2">&amp;</span>str = <span class="string">"doc"</span>;
 
 <span class="kw">fn </span>get_field_id(field: <span 
class="kw-2">&amp;</span>Field) -&gt; <span 
class="prelude-ty">Result</span>&lt;i32&gt; {
@@ -1614,8 +1712,7 @@
 <span class="kw">struct </span>ArrowSchemaConverter;
 
 <span class="kw">impl </span>ArrowSchemaConverter {
-    <span class="attr">#[allow(dead_code)]
-    </span><span class="kw">fn </span>new() -&gt; <span class="self">Self 
</span>{
+    <span class="kw">fn </span>new() -&gt; <span class="self">Self </span>{
         <span class="self">Self </span>{}
     }
 
@@ -1983,6 +2080,15 @@
     }
 }
 
+<span class="doccomment">/// Convert iceberg type to an arrow type.
+</span><span class="kw">pub fn </span>type_to_arrow_type(ty: <span 
class="kw-2">&amp;</span><span class="kw">crate</span>::spec::Type) -&gt; <span 
class="kw">crate</span>::Result&lt;DataType&gt; {
+    <span class="kw">let </span><span class="kw-2">mut </span>converter = 
ToArrowSchemaConverter;
+    <span class="kw">match </span><span 
class="kw">crate</span>::spec::visit_type(ty, <span class="kw-2">&amp;mut 
</span>converter)<span class="question-mark">? </span>{
+        ArrowSchemaOrFieldOrType::Type(ty) =&gt; <span 
class="prelude-val">Ok</span>(ty),
+        <span class="kw">_ </span>=&gt; <span 
class="macro">unreachable!</span>(),
+    }
+}
+
 <span class="doccomment">/// Convert Iceberg Datum to Arrow Datum.
 </span><span class="kw">pub</span>(<span class="kw">crate</span>) <span 
class="kw">fn </span>get_arrow_datum(datum: <span 
class="kw-2">&amp;</span>Datum) -&gt; <span 
class="prelude-ty">Result</span>&lt;Box&lt;<span class="kw">dyn 
</span>ArrowDatum + Send&gt;&gt; {
     <span class="kw">match </span>(datum.data_type(), datum.literal()) {
@@ -2147,7 +2253,7 @@
     <span class="kw">use </span>arrow_schema::{DataType, Field, Schema <span 
class="kw">as </span>ArrowSchema, TimeUnit};
 
     <span class="kw">use super</span>::<span class="kw-2">*</span>;
-    <span class="kw">use </span><span class="kw">crate</span>::spec::Schema;
+    <span class="kw">use </span><span class="kw">crate</span>::spec::{Literal, 
Schema};
 
     <span class="doccomment">/// Create a simple field with metadata.
     </span><span class="kw">fn </span>simple_field(name: <span 
class="kw-2">&amp;</span>str, ty: DataType, nullable: bool, value: <span 
class="kw-2">&amp;</span>str) -&gt; Field {
@@ -2733,5 +2839,91 @@
         <span class="kw">let </span>converted_arrow_schema = 
schema_to_arrow_schema(<span class="kw-2">&amp;</span>schema).unwrap();
         <span class="macro">assert_eq!</span>(converted_arrow_schema, 
arrow_schema);
     }
+
+    <span class="attr">#[test]
+    </span><span class="kw">fn </span>test_type_conversion() {
+        <span class="comment">// test primitive type
+        </span>{
+            <span class="kw">let </span>arrow_type = DataType::Int32;
+            <span class="kw">let </span>iceberg_type = 
Type::Primitive(PrimitiveType::Int);
+            <span class="macro">assert_eq!</span>(arrow_type, 
type_to_arrow_type(<span class="kw-2">&amp;</span>iceberg_type).unwrap());
+            <span class="macro">assert_eq!</span>(iceberg_type, 
arrow_type_to_type(<span class="kw-2">&amp;</span>arrow_type).unwrap());
+        }
+
+        <span class="comment">// test struct type
+        </span>{
+            <span class="comment">// no metadata will cause error
+            </span><span class="kw">let </span>arrow_type = 
DataType::Struct(Fields::from(<span class="macro">vec!</span>[
+                Field::new(<span class="string">"a"</span>, DataType::Int64, 
<span class="bool-val">false</span>),
+                Field::new(<span class="string">"b"</span>, DataType::Utf8, 
<span class="bool-val">true</span>),
+            ]));
+            <span class="macro">assert_eq!</span>(
+                <span class="kw-2">&amp;</span>arrow_type_to_type(<span 
class="kw-2">&amp;</span>arrow_type).unwrap_err().to_string(),
+                <span class="string">"DataInvalid =&gt; Field id not found in 
metadata"
+            </span>);
+
+            <span class="kw">let </span>arrow_type = 
DataType::Struct(Fields::from(<span class="macro">vec!</span>[
+                Field::new(<span class="string">"a"</span>, DataType::Int64, 
<span class="bool-val">false</span>).with_metadata(HashMap::from_iter([(
+                    PARQUET_FIELD_ID_META_KEY.to_string(),
+                    <span class="number">1</span>.to_string(),
+                )])),
+                Field::new(<span class="string">"b"</span>, DataType::Utf8, 
<span class="bool-val">true</span>).with_metadata(HashMap::from_iter([(
+                    PARQUET_FIELD_ID_META_KEY.to_string(),
+                    <span class="number">2</span>.to_string(),
+                )])),
+            ]));
+            <span class="kw">let </span>iceberg_type = 
Type::Struct(StructType::new(<span class="macro">vec!</span>[
+                NestedField {
+                    id: <span class="number">1</span>,
+                    doc: <span class="prelude-val">None</span>,
+                    name: <span class="string">"a"</span>.to_string(),
+                    required: <span class="bool-val">true</span>,
+                    field_type: Box::new(Type::Primitive(PrimitiveType::Long)),
+                    initial_default: <span class="prelude-val">None</span>,
+                    write_default: <span class="prelude-val">None</span>,
+                }
+                .into(),
+                NestedField {
+                    id: <span class="number">2</span>,
+                    doc: <span class="prelude-val">None</span>,
+                    name: <span class="string">"b"</span>.to_string(),
+                    required: <span class="bool-val">false</span>,
+                    field_type: 
Box::new(Type::Primitive(PrimitiveType::String)),
+                    initial_default: <span class="prelude-val">None</span>,
+                    write_default: <span class="prelude-val">None</span>,
+                }
+                .into(),
+            ]));
+            <span class="macro">assert_eq!</span>(iceberg_type, 
arrow_type_to_type(<span class="kw-2">&amp;</span>arrow_type).unwrap());
+            <span class="macro">assert_eq!</span>(arrow_type, 
type_to_arrow_type(<span class="kw-2">&amp;</span>iceberg_type).unwrap());
+
+            <span class="comment">// initial_default and write_default is 
ignored
+            </span><span class="kw">let </span>iceberg_type = 
Type::Struct(StructType::new(<span class="macro">vec!</span>[
+                NestedField {
+                    id: <span class="number">1</span>,
+                    doc: <span class="prelude-val">None</span>,
+                    name: <span class="string">"a"</span>.to_string(),
+                    required: <span class="bool-val">true</span>,
+                    field_type: Box::new(Type::Primitive(PrimitiveType::Long)),
+                    initial_default: <span 
class="prelude-val">Some</span>(Literal::Primitive(PrimitiveLiteral::Int(<span 
class="number">114514</span>))),
+                    write_default: <span class="prelude-val">None</span>,
+                }
+                .into(),
+                NestedField {
+                    id: <span class="number">2</span>,
+                    doc: <span class="prelude-val">None</span>,
+                    name: <span class="string">"b"</span>.to_string(),
+                    required: <span class="bool-val">false</span>,
+                    field_type: 
Box::new(Type::Primitive(PrimitiveType::String)),
+                    initial_default: <span class="prelude-val">None</span>,
+                    write_default: <span 
class="prelude-val">Some</span>(Literal::Primitive(PrimitiveLiteral::String(
+                        <span class="string">"514"</span>.to_string(),
+                    ))),
+                }
+                .into(),
+            ]));
+            <span class="macro">assert_eq!</span>(arrow_type, 
type_to_arrow_type(<span class="kw-2">&amp;</span>iceberg_type).unwrap());
+        }
+    }
 }
 </code></pre></div></section></main></body></html>
\ No newline at end of file

Reply via email to