Skip to content

Commit

Permalink
deploy: 75c7e8d
Browse files Browse the repository at this point in the history
  • Loading branch information
Xuanwo committed Feb 12, 2025
1 parent 0da246d commit bcad892
Showing 1 changed file with 3 additions and 237 deletions.
240 changes: 3 additions & 237 deletions api/src/iceberg/expr/visitors/page_index_evaluator.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -1405,123 +1405,6 @@
<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>
<a href="#1465" id="1465">1465</a>
<a href="#1466" id="1466">1466</a>
<a href="#1467" id="1467">1467</a>
<a href="#1468" id="1468">1468</a>
<a href="#1469" id="1469">1469</a>
<a href="#1470" id="1470">1470</a>
<a href="#1471" id="1471">1471</a>
<a href="#1472" id="1472">1472</a>
<a href="#1473" id="1473">1473</a>
<a href="#1474" id="1474">1474</a>
<a href="#1475" id="1475">1475</a>
<a href="#1476" id="1476">1476</a>
<a href="#1477" id="1477">1477</a>
<a href="#1478" id="1478">1478</a>
<a href="#1479" id="1479">1479</a>
<a href="#1480" id="1480">1480</a>
<a href="#1481" id="1481">1481</a>
<a href="#1482" id="1482">1482</a>
<a href="#1483" id="1483">1483</a>
<a href="#1484" id="1484">1484</a>
<a href="#1485" id="1485">1485</a>
<a href="#1486" id="1486">1486</a>
<a href="#1487" id="1487">1487</a>
<a href="#1488" id="1488">1488</a>
<a href="#1489" id="1489">1489</a>
<a href="#1490" id="1490">1490</a>
<a href="#1491" id="1491">1491</a>
<a href="#1492" id="1492">1492</a>
<a href="#1493" id="1493">1493</a>
<a href="#1494" id="1494">1494</a>
<a href="#1495" id="1495">1495</a>
<a href="#1496" id="1496">1496</a>
<a href="#1497" id="1497">1497</a>
<a href="#1498" id="1498">1498</a>
<a href="#1499" id="1499">1499</a>
<a href="#1500" id="1500">1500</a>
<a href="#1501" id="1501">1501</a>
<a href="#1502" id="1502">1502</a>
<a href="#1503" id="1503">1503</a>
<a href="#1504" id="1504">1504</a>
<a href="#1505" id="1505">1505</a>
<a href="#1506" id="1506">1506</a>
<a href="#1507" id="1507">1507</a>
<a href="#1508" id="1508">1508</a>
<a href="#1509" id="1509">1509</a>
<a href="#1510" id="1510">1510</a>
<a href="#1511" id="1511">1511</a>
<a href="#1512" id="1512">1512</a>
<a href="#1513" id="1513">1513</a>
<a href="#1514" id="1514">1514</a>
<a href="#1515" id="1515">1515</a>
<a href="#1516" id="1516">1516</a>
<a href="#1517" id="1517">1517</a>
<a href="#1518" id="1518">1518</a>
<a href="#1519" id="1519">1519</a>
<a href="#1520" id="1520">1520</a>
<a href="#1521" id="1521">1521</a>
<a href="#1522" id="1522">1522</a>
<a href="#1523" id="1523">1523</a>
<a href="#1524" id="1524">1524</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
Expand Down Expand Up @@ -1949,7 +1832,7 @@
}

<span class="kw">fn </span>or(<span class="kw-2">&amp;mut </span><span class="self">self</span>, lhs: RowSelection, rhs: RowSelection) -&gt; <span class="prelude-ty">Result</span>&lt;RowSelection&gt; {
<span class="prelude-val">Ok</span>(union_row_selections(<span class="kw-2">&amp;</span>lhs, <span class="kw-2">&amp;</span>rhs))
<span class="prelude-val">Ok</span>(lhs.union(<span class="kw-2">&amp;</span>rhs))
}

<span class="kw">fn </span>not(<span class="kw-2">&amp;mut </span><span class="self">self</span>, <span class="kw">_</span>: RowSelection) -&gt; <span class="prelude-ty">Result</span>&lt;RowSelection&gt; {
Expand Down Expand Up @@ -2296,99 +2179,12 @@
}
}

<span class="doccomment">/// Combine two lists of `RowSelection` return the union of them
/// For example:
/// self: NNYYYYNNYYNYN
/// other: NYNNNNNNY
///
/// returned: NYYYYYNNYYNYN
///
/// This can be removed from here once RowSelection::union is in parquet::arrow
/// (Hopefully once https://github.com/apache/arrow-rs/pull/6308 gets merged)
</span><span class="kw">fn </span>union_row_selections(left: <span class="kw-2">&amp;</span>RowSelection, right: <span class="kw-2">&amp;</span>RowSelection) -&gt; RowSelection {
<span class="kw">let </span><span class="kw-2">mut </span>l_iter = left.iter().copied().peekable();
<span class="kw">let </span><span class="kw-2">mut </span>r_iter = right.iter().copied().peekable();

<span class="kw">let </span>iter = std::iter::from_fn(<span class="kw">move </span>|| {
<span class="kw">loop </span>{
<span class="kw">let </span>l = l_iter.peek_mut();
<span class="kw">let </span>r = r_iter.peek_mut();

<span class="kw">match </span>(l, r) {
(<span class="prelude-val">Some</span>(a), <span class="kw">_</span>) <span class="kw">if </span>a.row_count == <span class="number">0 </span>=&gt; {
l_iter.next().unwrap();
}
(<span class="kw">_</span>, <span class="prelude-val">Some</span>(b)) <span class="kw">if </span>b.row_count == <span class="number">0 </span>=&gt; {
r_iter.next().unwrap();
}
(<span class="prelude-val">Some</span>(l), <span class="prelude-val">Some</span>(r)) =&gt; {
<span class="kw">return match </span>(l.skip, r.skip) {
<span class="comment">// Skip both ranges
</span>(<span class="bool-val">true</span>, <span class="bool-val">true</span>) =&gt; {
<span class="kw">if </span>l.row_count &lt; r.row_count {
<span class="kw">let </span>skip = l.row_count;
r.row_count -= l.row_count;
l_iter.next();
<span class="prelude-val">Some</span>(RowSelector::skip(skip))
} <span class="kw">else </span>{
<span class="kw">let </span>skip = r.row_count;
l.row_count -= skip;
r_iter.next();
<span class="prelude-val">Some</span>(RowSelector::skip(skip))
}
}
<span class="comment">// Keep rows from left
</span>(<span class="bool-val">false</span>, <span class="bool-val">true</span>) =&gt; {
<span class="kw">if </span>l.row_count &lt; r.row_count {
r.row_count -= l.row_count;
l_iter.next()
} <span class="kw">else </span>{
<span class="kw">let </span>r_row_count = r.row_count;
l.row_count -= r_row_count;
r_iter.next();
<span class="prelude-val">Some</span>(RowSelector::select(r_row_count))
}
}
<span class="comment">// Keep rows from right
</span>(<span class="bool-val">true</span>, <span class="bool-val">false</span>) =&gt; {
<span class="kw">if </span>l.row_count &lt; r.row_count {
<span class="kw">let </span>l_row_count = l.row_count;
r.row_count -= l_row_count;
l_iter.next();
<span class="prelude-val">Some</span>(RowSelector::select(l_row_count))
} <span class="kw">else </span>{
l.row_count -= r.row_count;
r_iter.next()
}
}
<span class="comment">// Keep at least one
</span><span class="kw">_ </span>=&gt; {
<span class="kw">if </span>l.row_count &lt; r.row_count {
r.row_count -= l.row_count;
l_iter.next()
} <span class="kw">else </span>{
l.row_count -= r.row_count;
r_iter.next()
}
}
};
}
(<span class="prelude-val">Some</span>(<span class="kw">_</span>), <span class="prelude-val">None</span>) =&gt; <span class="kw">return </span>l_iter.next(),
(<span class="prelude-val">None</span>, <span class="prelude-val">Some</span>(<span class="kw">_</span>)) =&gt; <span class="kw">return </span>r_iter.next(),
(<span class="prelude-val">None</span>, <span class="prelude-val">None</span>) =&gt; <span class="kw">return </span><span class="prelude-val">None</span>,
}
}
});

iter.collect()
}

<span class="attr">#[cfg(test)]
</span><span class="kw">mod </span>tests {
<span class="kw">use </span>std::collections::HashMap;
<span class="kw">use </span>std::sync::Arc;

<span class="kw">use </span>parquet::arrow::arrow_reader::{RowSelection, RowSelector};
<span class="kw">use </span>parquet::arrow::arrow_reader::RowSelector;
<span class="kw">use </span>parquet::basic::{LogicalType <span class="kw">as </span>ParquetLogicalType, Type <span class="kw">as </span>ParquetPhysicalType};
<span class="kw">use </span>parquet::data_type::ByteArray;
<span class="kw">use </span>parquet::file::metadata::{ColumnChunkMetaData, RowGroupMetaData};
Expand All @@ -2401,41 +2197,11 @@
};
<span class="kw">use </span>rand::{thread_rng, Rng};

<span class="kw">use super</span>::{union_row_selections, PageIndexEvaluator};
<span class="kw">use </span><span class="kw">super</span>::PageIndexEvaluator;
<span class="kw">use </span><span class="kw">crate</span>::expr::{Bind, Reference};
<span class="kw">use </span><span class="kw">crate</span>::spec::{Datum, NestedField, PrimitiveType, Schema, Type};
<span class="kw">use crate</span>::{ErrorKind, <span class="prelude-ty">Result</span>};

<span class="attr">#[test]
</span><span class="kw">fn </span>test_union_row_selections() {
<span class="kw">let </span>selection = RowSelection::from(<span class="macro">vec!</span>[RowSelector::select(<span class="number">1048576</span>)]);
<span class="kw">let </span>result = union_row_selections(<span class="kw-2">&amp;</span>selection, <span class="kw-2">&amp;</span>selection);
<span class="macro">assert_eq!</span>(result, selection);

<span class="comment">// NYNYY
</span><span class="kw">let </span>a = RowSelection::from(<span class="macro">vec!</span>[
RowSelector::skip(<span class="number">10</span>),
RowSelector::select(<span class="number">10</span>),
RowSelector::skip(<span class="number">10</span>),
RowSelector::select(<span class="number">20</span>),
]);

<span class="comment">// NNYYN
</span><span class="kw">let </span>b = RowSelection::from(<span class="macro">vec!</span>[
RowSelector::skip(<span class="number">20</span>),
RowSelector::select(<span class="number">20</span>),
RowSelector::skip(<span class="number">10</span>),
]);

<span class="kw">let </span>result = union_row_selections(<span class="kw-2">&amp;</span>a, <span class="kw-2">&amp;</span>b);

<span class="comment">// NYYYY
</span><span class="macro">assert_eq!</span>(result.iter().collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;(), <span class="macro">vec!</span>[
<span class="kw-2">&amp;</span>RowSelector::skip(<span class="number">10</span>),
<span class="kw-2">&amp;</span>RowSelector::select(<span class="number">40</span>)
]);
}

<span class="attr">#[test]
</span><span class="kw">fn </span>eval_matches_no_rows_for_empty_row_group() -&gt; <span class="prelude-ty">Result</span>&lt;()&gt; {
<span class="kw">let </span>row_group_metadata = create_row_group_metadata(<span class="number">0</span>, <span class="number">0</span>, <span class="prelude-val">None</span>, <span class="number">0</span>, <span class="prelude-val">None</span>)<span class="question-mark">?</span>;
Expand Down

0 comments on commit bcad892

Please sign in to comment.