blob: 9657d69d8be4a6a8972bbd1278ec6e935de4b5c8 [file] [log] [blame]
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.9.8" xml:lang="en-US">
<compounddef id="bucket__util_8cc" kind="file" language="C++">
<compoundname>bucket_util.cc</compoundname>
<includes refid="bucket__util_8h" local="yes">iceberg/util/bucket_util.h</includes>
<includes local="no">utility</includes>
<includes refid="literal_8h" local="yes">iceberg/expression/literal.h</includes>
<includes refid="endian_8h" local="yes">iceberg/util/endian.h</includes>
<includes refid="murmurhash3__internal_8h" local="yes">iceberg/util/murmurhash3_internal.h</includes>
<incdepgraph>
<node id="30">
<label>iceberg/exception.h</label>
<link refid="exception_8h"/>
<childnode refid="31" relation="include">
</childnode>
<childnode refid="5" relation="include">
</childnode>
</node>
<node id="12">
<label>iceberg/expression/literal.h</label>
<link refid="literal_8h_source"/>
<childnode refid="13" relation="include">
</childnode>
<childnode refid="14" relation="include">
</childnode>
<childnode refid="9" relation="include">
</childnode>
<childnode refid="15" relation="include">
</childnode>
<childnode refid="16" relation="include">
</childnode>
<childnode refid="5" relation="include">
</childnode>
<childnode refid="6" relation="include">
</childnode>
<childnode refid="17" relation="include">
</childnode>
<childnode refid="32" relation="include">
</childnode>
<childnode refid="23" relation="include">
</childnode>
<childnode refid="35" relation="include">
</childnode>
<childnode refid="36" relation="include">
</childnode>
</node>
<node id="5">
<label>iceberg/iceberg_export.h</label>
<link refid="iceberg__export_8h_source"/>
</node>
<node id="6">
<label>iceberg/result.h</label>
<link refid="result_8h_source"/>
<childnode refid="7" relation="include">
</childnode>
<childnode refid="8" relation="include">
</childnode>
<childnode refid="9" relation="include">
</childnode>
<childnode refid="5" relation="include">
</childnode>
</node>
<node id="21">
<label>iceberg/schema_field.h</label>
<link refid="schema__field_8h"/>
<childnode refid="3" relation="include">
</childnode>
<childnode refid="14" relation="include">
</childnode>
<childnode refid="9" relation="include">
</childnode>
<childnode refid="22" relation="include">
</childnode>
<childnode refid="5" relation="include">
</childnode>
<childnode refid="6" relation="include">
</childnode>
<childnode refid="10" relation="include">
</childnode>
<childnode refid="23" relation="include">
</childnode>
</node>
<node id="17">
<label>iceberg/type.h</label>
<link refid="type_8h"/>
<childnode refid="18" relation="include">
</childnode>
<childnode refid="3" relation="include">
</childnode>
<childnode refid="14" relation="include">
</childnode>
<childnode refid="19" relation="include">
</childnode>
<childnode refid="4" relation="include">
</childnode>
<childnode refid="9" relation="include">
</childnode>
<childnode refid="20" relation="include">
</childnode>
<childnode refid="16" relation="include">
</childnode>
<childnode refid="5" relation="include">
</childnode>
<childnode refid="6" relation="include">
</childnode>
<childnode refid="21" relation="include">
</childnode>
<childnode refid="23" relation="include">
</childnode>
<childnode refid="24" relation="include">
</childnode>
</node>
<node id="10">
<label>iceberg/type_fwd.h</label>
<link refid="type__fwd_8h"/>
</node>
<node id="1">
<label>iceberg/util/bucket_util.cc</label>
<link refid="bucket__util_8cc"/>
<childnode refid="2" relation="include">
</childnode>
<childnode refid="11" relation="include">
</childnode>
<childnode refid="12" relation="include">
</childnode>
<childnode refid="37" relation="include">
</childnode>
<childnode refid="39" relation="include">
</childnode>
</node>
<node id="2">
<label>iceberg/util/bucket_util.h</label>
<link refid="bucket__util_8h_source"/>
<childnode refid="3" relation="include">
</childnode>
<childnode refid="4" relation="include">
</childnode>
<childnode refid="5" relation="include">
</childnode>
<childnode refid="6" relation="include">
</childnode>
<childnode refid="10" relation="include">
</childnode>
</node>
<node id="32">
<label>iceberg/util/decimal.h</label>
<link refid="decimal_8h"/>
<childnode refid="18" relation="include">
</childnode>
<childnode refid="13" relation="include">
</childnode>
<childnode refid="3" relation="include">
</childnode>
<childnode refid="33" relation="include">
</childnode>
<childnode refid="9" relation="include">
</childnode>
<childnode refid="22" relation="include">
</childnode>
<childnode refid="34" relation="include">
</childnode>
<childnode refid="16" relation="include">
</childnode>
<childnode refid="5" relation="include">
</childnode>
<childnode refid="6" relation="include">
</childnode>
<childnode refid="23" relation="include">
</childnode>
<childnode refid="35" relation="include">
</childnode>
</node>
<node id="37">
<label>iceberg/util/endian.h</label>
<link refid="endian_8h"/>
<childnode refid="38" relation="include">
</childnode>
<childnode refid="25" relation="include">
</childnode>
<childnode refid="3" relation="include">
</childnode>
</node>
<node id="23">
<label>iceberg/util/formattable.h</label>
<link refid="formattable_8h"/>
<childnode refid="9" relation="include">
</childnode>
<childnode refid="5" relation="include">
</childnode>
</node>
<node id="35">
<label>iceberg/util/int128.h</label>
<link refid="int128_8h"/>
</node>
<node id="24">
<label>iceberg/util/lazy.h</label>
<link refid="lazy_8h"/>
<childnode refid="25" relation="include">
</childnode>
<childnode refid="26" relation="include">
</childnode>
<childnode refid="27" relation="include">
</childnode>
<childnode refid="6" relation="include">
</childnode>
<childnode refid="28" relation="include">
</childnode>
</node>
<node id="28">
<label>iceberg/util/macros.h</label>
<link refid="macros_8h_source"/>
<childnode refid="29" relation="include">
</childnode>
<childnode refid="30" relation="include">
</childnode>
<childnode refid="6" relation="include">
</childnode>
</node>
<node id="39">
<label>iceberg/util/murmurhash3_internal.h</label>
<link refid="murmurhash3__internal_8h_source"/>
<childnode refid="3" relation="include">
</childnode>
</node>
<node id="36">
<label>iceberg/util/uuid.h</label>
<link refid="uuid_8h"/>
<childnode refid="18" relation="include">
</childnode>
<childnode refid="3" relation="include">
</childnode>
<childnode refid="4" relation="include">
</childnode>
<childnode refid="22" relation="include">
</childnode>
<childnode refid="5" relation="include">
</childnode>
<childnode refid="6" relation="include">
</childnode>
<childnode refid="23" relation="include">
</childnode>
</node>
<node id="18">
<label>array</label>
</node>
<node id="38">
<label>bit</label>
</node>
<node id="29">
<label>cassert</label>
</node>
<node id="13">
<label>compare</label>
</node>
<node id="25">
<label>concepts</label>
</node>
<node id="3">
<label>cstdint</label>
</node>
<node id="7">
<label>expected</label>
</node>
<node id="8">
<label>format</label>
</node>
<node id="26">
<label>functional</label>
</node>
<node id="33">
<label>iosfwd</label>
</node>
<node id="14">
<label>memory</label>
</node>
<node id="27">
<label>mutex</label>
</node>
<node id="19">
<label>optional</label>
</node>
<node id="4">
<label>span</label>
</node>
<node id="31">
<label>stdexcept</label>
</node>
<node id="9">
<label>string</label>
</node>
<node id="22">
<label>string_view</label>
</node>
<node id="34">
<label>type_traits</label>
</node>
<node id="20">
<label>unordered_map</label>
</node>
<node id="11">
<label>utility</label>
</node>
<node id="15">
<label>variant</label>
</node>
<node id="16">
<label>vector</label>
</node>
</incdepgraph>
<innernamespace refid="namespaceiceberg">iceberg</innernamespace>
<sectiondef kind="define">
<memberdef kind="define" id="bucket__util_8cc_1a2b42a119c25531f781e593e9a7fbfb40" prot="public" static="no">
<name>DISPATCH_HASH_LITERAL</name>
<param><defname>TYPE_ID</defname></param>
<initializer> case TYPE_ID: \
hash_value = HashLiteral&lt;TYPE_ID&gt;(literal); \
break;</initializer>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="iceberg/util/bucket_util.cc" line="112" column="9" bodyfile="iceberg/util/bucket_util.cc" bodystart="112" bodyend="115"/>
</memberdef>
</sectiondef>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<programlisting>
<codeline lineno="1"><highlight class="comment">/*</highlight></codeline>
<codeline lineno="2"><highlight class="comment"><sp/>*<sp/>Licensed<sp/>to<sp/>the<sp/>Apache<sp/>Software<sp/>Foundation<sp/>(ASF)<sp/>under<sp/>one</highlight></codeline>
<codeline lineno="3"><highlight class="comment"><sp/>*<sp/>or<sp/>more<sp/>contributor<sp/>license<sp/>agreements.<sp/><sp/>See<sp/>the<sp/>NOTICE<sp/>file</highlight></codeline>
<codeline lineno="4"><highlight class="comment"><sp/>*<sp/>distributed<sp/>with<sp/>this<sp/>work<sp/>for<sp/>additional<sp/>information</highlight></codeline>
<codeline lineno="5"><highlight class="comment"><sp/>*<sp/>regarding<sp/>copyright<sp/>ownership.<sp/><sp/>The<sp/>ASF<sp/>licenses<sp/>this<sp/>file</highlight></codeline>
<codeline lineno="6"><highlight class="comment"><sp/>*<sp/>to<sp/>you<sp/>under<sp/>the<sp/>Apache<sp/>License,<sp/>Version<sp/>2.0<sp/>(the</highlight></codeline>
<codeline lineno="7"><highlight class="comment"><sp/>*<sp/>&quot;License&quot;);<sp/>you<sp/>may<sp/>not<sp/>use<sp/>this<sp/>file<sp/>except<sp/>in<sp/>compliance</highlight></codeline>
<codeline lineno="8"><highlight class="comment"><sp/>*<sp/>with<sp/>the<sp/>License.<sp/><sp/>You<sp/>may<sp/>obtain<sp/>a<sp/>copy<sp/>of<sp/>the<sp/>License<sp/>at</highlight></codeline>
<codeline lineno="9"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="10"><highlight class="comment"><sp/>*<sp/><sp/><sp/>http://www.apache.org/licenses/LICENSE-2.0</highlight></codeline>
<codeline lineno="11"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="12"><highlight class="comment"><sp/>*<sp/>Unless<sp/>required<sp/>by<sp/>applicable<sp/>law<sp/>or<sp/>agreed<sp/>to<sp/>in<sp/>writing,</highlight></codeline>
<codeline lineno="13"><highlight class="comment"><sp/>*<sp/>software<sp/>distributed<sp/>under<sp/>the<sp/>License<sp/>is<sp/>distributed<sp/>on<sp/>an</highlight></codeline>
<codeline lineno="14"><highlight class="comment"><sp/>*<sp/>&quot;AS<sp/>IS&quot;<sp/>BASIS,<sp/>WITHOUT<sp/>WARRANTIES<sp/>OR<sp/>CONDITIONS<sp/>OF<sp/>ANY</highlight></codeline>
<codeline lineno="15"><highlight class="comment"><sp/>*<sp/>KIND,<sp/>either<sp/>express<sp/>or<sp/>implied.<sp/><sp/>See<sp/>the<sp/>License<sp/>for<sp/>the</highlight></codeline>
<codeline lineno="16"><highlight class="comment"><sp/>*<sp/>specific<sp/>language<sp/>governing<sp/>permissions<sp/>and<sp/>limitations</highlight></codeline>
<codeline lineno="17"><highlight class="comment"><sp/>*<sp/>under<sp/>the<sp/>License.</highlight></codeline>
<codeline lineno="18"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="19"><highlight class="normal"></highlight></codeline>
<codeline lineno="20"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;iceberg/util/bucket_util.h&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="21"><highlight class="normal"></highlight></codeline>
<codeline lineno="22"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;utility&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="23"><highlight class="normal"></highlight></codeline>
<codeline lineno="24"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;iceberg/expression/literal.h&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="25"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="endian_8h" kindref="compound">iceberg/util/endian.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="26"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;iceberg/util/murmurhash3_internal.h&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="27"><highlight class="normal"></highlight></codeline>
<codeline lineno="28"><highlight class="normal"></highlight><highlight class="keyword">namespace<sp/></highlight><highlight class="normal">iceberg<sp/>{</highlight></codeline>
<codeline lineno="29"><highlight class="normal"></highlight></codeline>
<codeline lineno="30"><highlight class="normal"></highlight><highlight class="keyword">namespace<sp/></highlight><highlight class="normal">{</highlight></codeline>
<codeline lineno="31"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal"><sp/>&lt;TypeId<sp/>type_</highlight><highlight class="keywordtype">id</highlight><highlight class="normal">&gt;</highlight></codeline>
<codeline lineno="32"><highlight class="normal">int32_t<sp/>HashLiteral(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Literal&amp;<sp/>literal)<sp/>{</highlight></codeline>
<codeline lineno="33"><highlight class="normal"><sp/><sp/>std::unreachable();</highlight></codeline>
<codeline lineno="34"><highlight class="normal">}</highlight></codeline>
<codeline lineno="35"><highlight class="normal"></highlight></codeline>
<codeline lineno="36"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal"><sp/>&lt;&gt;</highlight></codeline>
<codeline lineno="37"><highlight class="normal">int32_t<sp/>HashLiteral&lt;TypeId::kInt&gt;(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Literal&amp;<sp/>literal)<sp/>{</highlight></codeline>
<codeline lineno="38"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="classiceberg_1_1BucketUtils_1a962814a130e993b6261b66baf567a108" kindref="member">BucketUtils::HashInt</ref>(std::get&lt;int32_t&gt;(literal.value()));</highlight></codeline>
<codeline lineno="39"><highlight class="normal">}</highlight></codeline>
<codeline lineno="40"><highlight class="normal"></highlight></codeline>
<codeline lineno="41"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal"><sp/>&lt;&gt;</highlight></codeline>
<codeline lineno="42"><highlight class="normal">int32_t<sp/>HashLiteral&lt;TypeId::kDate&gt;(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Literal&amp;<sp/>literal)<sp/>{</highlight></codeline>
<codeline lineno="43"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="classiceberg_1_1BucketUtils_1a962814a130e993b6261b66baf567a108" kindref="member">BucketUtils::HashInt</ref>(std::get&lt;int32_t&gt;(literal.value()));</highlight></codeline>
<codeline lineno="44"><highlight class="normal">}</highlight></codeline>
<codeline lineno="45"><highlight class="normal"></highlight></codeline>
<codeline lineno="46"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal"><sp/>&lt;&gt;</highlight></codeline>
<codeline lineno="47"><highlight class="normal">int32_t<sp/>HashLiteral&lt;TypeId::kLong&gt;(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Literal&amp;<sp/>literal)<sp/>{</highlight></codeline>
<codeline lineno="48"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="classiceberg_1_1BucketUtils_1a3758950de65efeca87341467d70d23d4" kindref="member">BucketUtils::HashLong</ref>(std::get&lt;int64_t&gt;(literal.value()));</highlight></codeline>
<codeline lineno="49"><highlight class="normal">}</highlight></codeline>
<codeline lineno="50"><highlight class="normal"></highlight></codeline>
<codeline lineno="51"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal"><sp/>&lt;&gt;</highlight></codeline>
<codeline lineno="52"><highlight class="normal">int32_t<sp/>HashLiteral&lt;TypeId::kTime&gt;(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Literal&amp;<sp/>literal)<sp/>{</highlight></codeline>
<codeline lineno="53"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="classiceberg_1_1BucketUtils_1a3758950de65efeca87341467d70d23d4" kindref="member">BucketUtils::HashLong</ref>(std::get&lt;int64_t&gt;(literal.value()));</highlight></codeline>
<codeline lineno="54"><highlight class="normal">}</highlight></codeline>
<codeline lineno="55"><highlight class="normal"></highlight></codeline>
<codeline lineno="56"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal"><sp/>&lt;&gt;</highlight></codeline>
<codeline lineno="57"><highlight class="normal">int32_t<sp/>HashLiteral&lt;TypeId::kTimestamp&gt;(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Literal&amp;<sp/>literal)<sp/>{</highlight></codeline>
<codeline lineno="58"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="classiceberg_1_1BucketUtils_1a3758950de65efeca87341467d70d23d4" kindref="member">BucketUtils::HashLong</ref>(std::get&lt;int64_t&gt;(literal.value()));</highlight></codeline>
<codeline lineno="59"><highlight class="normal">}</highlight></codeline>
<codeline lineno="60"><highlight class="normal"></highlight></codeline>
<codeline lineno="61"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal"><sp/>&lt;&gt;</highlight></codeline>
<codeline lineno="62"><highlight class="normal">int32_t<sp/>HashLiteral&lt;TypeId::kTimestampTz&gt;(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Literal&amp;<sp/>literal)<sp/>{</highlight></codeline>
<codeline lineno="63"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="classiceberg_1_1BucketUtils_1a3758950de65efeca87341467d70d23d4" kindref="member">BucketUtils::HashLong</ref>(std::get&lt;int64_t&gt;(literal.value()));</highlight></codeline>
<codeline lineno="64"><highlight class="normal">}</highlight></codeline>
<codeline lineno="65"><highlight class="normal"></highlight></codeline>
<codeline lineno="66"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal"><sp/>&lt;&gt;</highlight></codeline>
<codeline lineno="67"><highlight class="normal">int32_t<sp/>HashLiteral&lt;TypeId::kDecimal&gt;(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Literal&amp;<sp/>literal)<sp/>{</highlight></codeline>
<codeline lineno="68"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">auto</highlight><highlight class="normal">&amp;<sp/><ref refid="group__type-factories_1gaf9e64fe9d9556ef90130264f95b4d9f2" kindref="member">decimal</ref><sp/>=<sp/>std::get&lt;Decimal&gt;(literal.value());</highlight></codeline>
<codeline lineno="69"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="classiceberg_1_1BucketUtils_1ab795f70e2af267ac89b0d42f313028c0" kindref="member">BucketUtils::HashBytes</ref>(<ref refid="group__type-factories_1gaf9e64fe9d9556ef90130264f95b4d9f2" kindref="member">decimal</ref>.ToBigEndian());</highlight></codeline>
<codeline lineno="70"><highlight class="normal">}</highlight></codeline>
<codeline lineno="71"><highlight class="normal"></highlight></codeline>
<codeline lineno="72"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal"><sp/>&lt;&gt;</highlight></codeline>
<codeline lineno="73"><highlight class="normal">int32_t<sp/>HashLiteral&lt;TypeId::kString&gt;(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Literal&amp;<sp/>literal)<sp/>{</highlight></codeline>
<codeline lineno="74"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">auto</highlight><highlight class="normal">&amp;<sp/>str<sp/>=<sp/>std::get&lt;std::string&gt;(literal.value());</highlight></codeline>
<codeline lineno="75"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="classiceberg_1_1BucketUtils_1ab795f70e2af267ac89b0d42f313028c0" kindref="member">BucketUtils::HashBytes</ref>(</highlight></codeline>
<codeline lineno="76"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>std::span&lt;const<sp/>uint8_t&gt;(</highlight><highlight class="keyword">reinterpret_cast&lt;</highlight><highlight class="keyword">const<sp/></highlight><highlight class="normal">uint8_t*</highlight><highlight class="keyword">&gt;</highlight><highlight class="normal">(str.data()),<sp/>str.size()));</highlight></codeline>
<codeline lineno="77"><highlight class="normal">}</highlight></codeline>
<codeline lineno="78"><highlight class="normal"></highlight></codeline>
<codeline lineno="79"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal"><sp/>&lt;&gt;</highlight></codeline>
<codeline lineno="80"><highlight class="normal">int32_t<sp/>HashLiteral&lt;TypeId::kUuid&gt;(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Literal&amp;<sp/>literal)<sp/>{</highlight></codeline>
<codeline lineno="81"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">auto</highlight><highlight class="normal">&amp;<sp/><ref refid="group__type-factories_1gafcf0f5e6522390678b91a9515b174bcf" kindref="member">uuid</ref><sp/>=<sp/>std::get&lt;Uuid&gt;(literal.value());</highlight></codeline>
<codeline lineno="82"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="classiceberg_1_1BucketUtils_1ab795f70e2af267ac89b0d42f313028c0" kindref="member">BucketUtils::HashBytes</ref>(<ref refid="group__type-factories_1gafcf0f5e6522390678b91a9515b174bcf" kindref="member">uuid</ref>.bytes());</highlight></codeline>
<codeline lineno="83"><highlight class="normal">}</highlight></codeline>
<codeline lineno="84"><highlight class="normal"></highlight></codeline>
<codeline lineno="85"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal"><sp/>&lt;&gt;</highlight></codeline>
<codeline lineno="86"><highlight class="normal">int32_t<sp/>HashLiteral&lt;TypeId::kBinary&gt;(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Literal&amp;<sp/>literal)<sp/>{</highlight></codeline>
<codeline lineno="87"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">auto</highlight><highlight class="normal">&amp;<sp/><ref refid="group__type-factories_1ga33cd0c2e979eebcccc89cdbcd3f6af99" kindref="member">binary</ref><sp/>=<sp/>std::get&lt;std::vector&lt;uint8_t&gt;&gt;(literal.value());</highlight></codeline>
<codeline lineno="88"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="classiceberg_1_1BucketUtils_1ab795f70e2af267ac89b0d42f313028c0" kindref="member">BucketUtils::HashBytes</ref>(<ref refid="group__type-factories_1ga33cd0c2e979eebcccc89cdbcd3f6af99" kindref="member">binary</ref>);</highlight></codeline>
<codeline lineno="89"><highlight class="normal">}</highlight></codeline>
<codeline lineno="90"><highlight class="normal"></highlight></codeline>
<codeline lineno="91"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal"><sp/>&lt;&gt;</highlight></codeline>
<codeline lineno="92"><highlight class="normal">int32_t<sp/>HashLiteral&lt;TypeId::kFixed&gt;(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Literal&amp;<sp/>literal)<sp/>{</highlight></codeline>
<codeline lineno="93"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">auto</highlight><highlight class="normal">&amp;<sp/><ref refid="group__type-factories_1gab0c125df895ca2e1f90a05c9b0704cf5" kindref="member">fixed</ref><sp/>=<sp/>std::get&lt;std::vector&lt;uint8_t&gt;&gt;(literal.value());</highlight></codeline>
<codeline lineno="94"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="classiceberg_1_1BucketUtils_1ab795f70e2af267ac89b0d42f313028c0" kindref="member">BucketUtils::HashBytes</ref>(<ref refid="group__type-factories_1gab0c125df895ca2e1f90a05c9b0704cf5" kindref="member">fixed</ref>);</highlight></codeline>
<codeline lineno="95"><highlight class="normal">}</highlight></codeline>
<codeline lineno="96"><highlight class="normal"></highlight></codeline>
<codeline lineno="97"><highlight class="normal">}<sp/><sp/></highlight><highlight class="comment">//<sp/>namespace</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="98"><highlight class="normal"></highlight></codeline>
<codeline lineno="99"><highlight class="normal">int32_t<sp/><ref refid="classiceberg_1_1BucketUtils_1ab795f70e2af267ac89b0d42f313028c0" kindref="member">BucketUtils::HashBytes</ref>(std::span&lt;const<sp/>uint8_t&gt;<sp/>bytes)<sp/>{</highlight></codeline>
<codeline lineno="100"><highlight class="normal"><sp/><sp/>int32_t<sp/>hash_value<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="101"><highlight class="normal"><sp/><sp/>MurmurHash3_x86_32(bytes.data(),<sp/>bytes.size(),<sp/>0,<sp/>&amp;hash_value);</highlight></codeline>
<codeline lineno="102"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>hash_value;</highlight></codeline>
<codeline lineno="103"><highlight class="normal">}</highlight></codeline>
<codeline lineno="104"><highlight class="normal"></highlight></codeline>
<codeline lineno="105"><highlight class="normal">int32_t<sp/><ref refid="classiceberg_1_1BucketUtils_1a3758950de65efeca87341467d70d23d4" kindref="member">BucketUtils::HashLong</ref>(int64_t<sp/>value)<sp/>{</highlight></codeline>
<codeline lineno="106"><highlight class="normal"><sp/><sp/>int32_t<sp/>hash_value<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="107"><highlight class="normal"><sp/><sp/>value<sp/>=<sp/><ref refid="endian_8h_1a213342dba249a0224ead295465dbbfd0" kindref="member">ToLittleEndian</ref>(value);</highlight></codeline>
<codeline lineno="108"><highlight class="normal"><sp/><sp/>MurmurHash3_x86_32(&amp;value,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(int64_t),<sp/>0,<sp/>&amp;hash_value);</highlight></codeline>
<codeline lineno="109"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>hash_value;</highlight></codeline>
<codeline lineno="110"><highlight class="normal">}</highlight></codeline>
<codeline lineno="111"><highlight class="normal"></highlight></codeline>
<codeline lineno="112"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>DISPATCH_HASH_LITERAL(TYPE_ID)<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>\</highlight></codeline>
<codeline lineno="113"><highlight class="preprocessor"><sp/><sp/>case<sp/>TYPE_ID:<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>\</highlight></codeline>
<codeline lineno="114"><highlight class="preprocessor"><sp/><sp/><sp/><sp/>hash_value<sp/>=<sp/>HashLiteral&lt;TYPE_ID&gt;(literal);<sp/>\</highlight></codeline>
<codeline lineno="115"><highlight class="preprocessor"><sp/><sp/><sp/><sp/>break;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="116"><highlight class="normal"></highlight></codeline>
<codeline lineno="117"><highlight class="normal">Result&lt;int32_t&gt;<sp/><ref refid="classiceberg_1_1BucketUtils_1a870e1bdf607990bebf4732eded33adab" kindref="member">BucketUtils::BucketIndex</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>Literal&amp;<sp/>literal,<sp/>int32_t<sp/>num_buckets)<sp/>{</highlight></codeline>
<codeline lineno="118"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(num_buckets<sp/>&lt;=<sp/>0)<sp/>[[unlikely]]<sp/>{</highlight></codeline>
<codeline lineno="119"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>InvalidArgument(</highlight><highlight class="stringliteral">&quot;Number<sp/>of<sp/>buckets<sp/>must<sp/>be<sp/>positive,<sp/>got<sp/>{}&quot;</highlight><highlight class="normal">,<sp/>num_buckets);</highlight></codeline>
<codeline lineno="120"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="121"><highlight class="normal"></highlight></codeline>
<codeline lineno="122"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(literal.IsAboveMax()<sp/>||<sp/>literal.IsBelowMin())<sp/>[[unlikely]]<sp/>{</highlight></codeline>
<codeline lineno="123"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>NotSupported(</highlight><highlight class="stringliteral">&quot;Cannot<sp/>compute<sp/>bucket<sp/>index<sp/>for<sp/>{}&quot;</highlight><highlight class="normal">,<sp/>literal.ToString());</highlight></codeline>
<codeline lineno="124"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="125"><highlight class="normal"></highlight></codeline>
<codeline lineno="126"><highlight class="normal"><sp/><sp/>int32_t<sp/>hash_value<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="127"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(literal.type()-&gt;type_id())<sp/>{</highlight></codeline>
<codeline lineno="128"><highlight class="normal"><sp/><sp/><sp/><sp/>DISPATCH_HASH_LITERAL(TypeId::kInt)</highlight></codeline>
<codeline lineno="129"><highlight class="normal"><sp/><sp/><sp/><sp/>DISPATCH_HASH_LITERAL(TypeId::kDate)</highlight></codeline>
<codeline lineno="130"><highlight class="normal"><sp/><sp/><sp/><sp/>DISPATCH_HASH_LITERAL(TypeId::kLong)</highlight></codeline>
<codeline lineno="131"><highlight class="normal"><sp/><sp/><sp/><sp/>DISPATCH_HASH_LITERAL(TypeId::kTime)</highlight></codeline>
<codeline lineno="132"><highlight class="normal"><sp/><sp/><sp/><sp/>DISPATCH_HASH_LITERAL(TypeId::kTimestamp)</highlight></codeline>
<codeline lineno="133"><highlight class="normal"><sp/><sp/><sp/><sp/>DISPATCH_HASH_LITERAL(TypeId::kTimestampTz)</highlight></codeline>
<codeline lineno="134"><highlight class="normal"><sp/><sp/><sp/><sp/>DISPATCH_HASH_LITERAL(TypeId::kDecimal)</highlight></codeline>
<codeline lineno="135"><highlight class="normal"><sp/><sp/><sp/><sp/>DISPATCH_HASH_LITERAL(TypeId::kString)</highlight></codeline>
<codeline lineno="136"><highlight class="normal"><sp/><sp/><sp/><sp/>DISPATCH_HASH_LITERAL(TypeId::kUuid)</highlight></codeline>
<codeline lineno="137"><highlight class="normal"><sp/><sp/><sp/><sp/>DISPATCH_HASH_LITERAL(TypeId::kBinary)</highlight></codeline>
<codeline lineno="138"><highlight class="normal"><sp/><sp/><sp/><sp/>DISPATCH_HASH_LITERAL(TypeId::kFixed)</highlight></codeline>
<codeline lineno="139"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="140"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>NotSupported(</highlight><highlight class="stringliteral">&quot;Hashing<sp/>not<sp/>supported<sp/>for<sp/>type<sp/>{}&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="141"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>literal.type()-&gt;ToString());</highlight></codeline>
<codeline lineno="142"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="143"><highlight class="normal"></highlight></codeline>
<codeline lineno="144"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(hash_value<sp/>&amp;<sp/>std::numeric_limits&lt;int32_t&gt;::max())<sp/>%<sp/>num_buckets;</highlight></codeline>
<codeline lineno="145"><highlight class="normal">}</highlight></codeline>
<codeline lineno="146"><highlight class="normal"></highlight></codeline>
<codeline lineno="147"><highlight class="normal">}<sp/><sp/></highlight><highlight class="comment">//<sp/>namespace<sp/>iceberg</highlight><highlight class="normal"></highlight></codeline>
</programlisting>
<location file="iceberg/util/bucket_util.cc"/>
</compounddef>
</doxygen>