| <!DOCTYPE html> | |
| <html lang="en" data-content_root="../" > | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" /> | |
| <title>Real-time Write and Read — Apache Paimon C++</title> | |
| <script data-cfasync="false"> | |
| document.documentElement.dataset.mode = localStorage.getItem("mode") || ""; | |
| document.documentElement.dataset.theme = localStorage.getItem("theme") || ""; | |
| </script> | |
| <!-- | |
| this give us a css class that will be invisible only if js is disabled | |
| --> | |
| <noscript> | |
| <style> | |
| .pst-js-only { display: none !important; } | |
| </style> | |
| </noscript> | |
| <!-- Loaded before other Sphinx assets --> | |
| <link href="../_static/styles/theme.css?digest=75c7c72ae941e8b558d8" rel="stylesheet" /> | |
| <link href="../_static/styles/pydata-sphinx-theme.css?digest=75c7c72ae941e8b558d8" rel="stylesheet" /> | |
| <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=8f2a1f02" /> | |
| <link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" /> | |
| <link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=6a604523" /> | |
| <link rel="stylesheet" type="text/css" href="../_static/theme_overrides.css?v=d7227091" /> | |
| <!-- So that users can add custom icons --> | |
| <script defer src="../_static/scripts/fontawesome.js?digest=75c7c72ae941e8b558d8"></script> | |
| <!-- Pre-loaded scripts that we'll load fully later --> | |
| <link rel="preload" as="script" href="../_static/scripts/bootstrap.js?digest=75c7c72ae941e8b558d8" /> | |
| <link rel="preload" as="script" href="../_static/scripts/pydata-sphinx-theme.js?digest=75c7c72ae941e8b558d8" /> | |
| <script src="../_static/documentation_options.js?v=9873aeb8"></script> | |
| <script src="../_static/doctools.js?v=fd6eb6e6"></script> | |
| <script src="../_static/sphinx_highlight.js?v=6ffebe34"></script> | |
| <script src="../_static/clipboard.min.js?v=a7894cd8"></script> | |
| <script src="../_static/copybutton.js?v=3bb21c8c"></script> | |
| <script data-sd-tabs-storage-prefix="sphinx-design-tab-id-" src="../_static/design-tabs.js?v=fcb327ea"></script> | |
| <script>DOCUMENTATION_OPTIONS.pagename = 'user_guide/realtime';</script> | |
| <script> | |
| DOCUMENTATION_OPTIONS.theme_version = '0.24.0'; | |
| DOCUMENTATION_OPTIONS.theme_switcher_json_url = 'https://paimon.apache.org/docs/cpp/main/_static/versions.json'; | |
| DOCUMENTATION_OPTIONS.theme_switcher_version_match = 'main'; | |
| DOCUMENTATION_OPTIONS.show_version_warning_banner = | |
| true; | |
| </script> | |
| <script>DOCUMENTATION_OPTIONS.search_as_you_type = false;</script> | |
| <link rel="index" title="Index" href="../genindex.html" /> | |
| <link rel="search" title="Search" href="../search.html" /> | |
| <link rel="next" title="Commit" href="commit.html" /> | |
| <link rel="prev" title="Write" href="write.html" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"/> | |
| <meta name="color-scheme" content="light dark"/> | |
| <meta name="docsearch:language" content="en"/> | |
| <meta name="docsearch:version" content="0.5.0" /> | |
| <script src="../_static/searchtools.js"></script> | |
| <script src="../_static/language_data.js"></script> | |
| <script src="../searchindex.js"></script> | |
| </head> | |
| <body data-default-mode=""> | |
| <div id="pst-skip-link" class="skip-link d-print-none"><a href="#main-content">Skip to main content</a></div> | |
| <div id="pst-scroll-pixel-helper"></div> | |
| <button type="button" class="btn rounded-pill" id="pst-back-to-top"> | |
| <i class="fa-solid fa-arrow-up"></i>Back to top</button> | |
| <dialog id="pst-search-dialog"> | |
| <form class="bd-search d-flex align-items-center" | |
| action="../search.html" | |
| method="get"> | |
| <i class="fa-solid fa-magnifying-glass"></i> | |
| <input type="search" | |
| class="form-control" | |
| name="q" | |
| placeholder="Search the docs ..." | |
| aria-label="Search the docs ..." | |
| autocomplete="off" | |
| autocorrect="off" | |
| autocapitalize="off" | |
| spellcheck="false"/> | |
| <span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span> | |
| </form> | |
| </dialog> | |
| <div class="pst-async-banner-revealer d-none"> | |
| <aside id="bd-header-version-warning" class="d-none d-print-none" aria-label="Version warning"></aside> | |
| </div> | |
| <header id="pst-header" class="bd-header navbar navbar-expand-lg bd-navbar d-print-none"> | |
| <div class="bd-header__inner bd-page-width"> | |
| <button type="button" class="pst-navbar-icon sidebar-toggle primary-toggle" aria-label="Site navigation" aria-expanded="false" aria-controls="pst-primary-sidebar-modal"> | |
| <span class="fa-solid fa-bars"></span> | |
| </button> | |
| <div class=" navbar-header-items__start"> | |
| <div class="navbar-item"> | |
| <a class="navbar-brand logo" href="../index.html"> | |
| <p class="title logo__title">Apache Paimon C++</p> | |
| </a></div> | |
| </div> | |
| <div class=" navbar-header-items"> | |
| <div class="me-auto navbar-header-items__center"> | |
| <div class="navbar-item"> | |
| <nav> | |
| <ul class="bd-navbar-elements navbar-nav"> | |
| <li class="nav-item "> | |
| <a class="nav-link nav-internal" href="../getting_started.html"> | |
| Getting Started | |
| </a> | |
| </li> | |
| <li class="nav-item current active"> | |
| <a class="nav-link nav-internal" href="../user_guide.html"> | |
| User Guide | |
| </a> | |
| </li> | |
| <li class="nav-item "> | |
| <a class="nav-link nav-internal" href="../examples/index.html"> | |
| Examples | |
| </a> | |
| </li> | |
| <li class="nav-item "> | |
| <a class="nav-link nav-internal" href="../api.html"> | |
| API Reference | |
| </a> | |
| </li> | |
| </ul> | |
| </nav></div> | |
| </div> | |
| <div class="navbar-header-items__end"> | |
| <div class="navbar-item navbar-persistent--container"> | |
| <button type="button" class="btn search-button-field search-button__button pst-js-only" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip"> | |
| <i class="fa-solid fa-magnifying-glass"></i> | |
| <span class="search-button__default-text">Search</span> | |
| <span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span> | |
| </button> | |
| </div> | |
| <div class="navbar-item"> | |
| <div class="version-switcher__container dropdown pst-js-only"> | |
| <button id="pst-version-switcher-button-2" | |
| type="button" | |
| class="version-switcher__button btn btn-sm dropdown-toggle" | |
| data-bs-toggle="dropdown" | |
| aria-haspopup="listbox" | |
| aria-controls="pst-version-switcher-list-2" | |
| aria-label="Version switcher list" | |
| > | |
| Choose version <!-- this text may get changed later by javascript --> | |
| <span class="caret"></span> | |
| </button> | |
| <div id="pst-version-switcher-list-2" | |
| class="version-switcher__menu dropdown-menu list-group-flush py-0" | |
| role="listbox" aria-labelledby="pst-version-switcher-button-2"> | |
| <!-- dropdown will be populated by javascript on page load --> | |
| </div> | |
| </div></div> | |
| <div class="navbar-item"> | |
| <div class="theme-switch-container dropdown pst-js-only" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Color mode"> | |
| <button type="button" class="btn btn-sm nav-link pst-navbar-icon theme-switch-button dropdown-toggle" aria-label="Color mode" data-bs-toggle="dropdown"> | |
| <i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light" title="Light"></i> | |
| <i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark" title="Dark"></i> | |
| <i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto" title="System Settings"></i> | |
| </button> | |
| <ul class="dropdown-menu dropdown-menu-end"> | |
| <li><button type="button" class="dropdown-item d-flex align-items-center theme-change-button" data-mode="auto"><i class="fa-solid fa-circle-half-stroke fa-lg me-1"></i>System Settings</button></li> | |
| <li><button type="button" class="dropdown-item d-flex align-items-center theme-change-button" data-mode="light"><i class="fa-solid fa-sun fa-lg me-1"></i>Light</button></li> | |
| <li><button type="button" class="dropdown-item d-flex align-items-center theme-change-button" data-mode="dark"><i class="fa-solid fa-moon fa-lg me-1"></i>Dark</button></li> | |
| </ul> | |
| </div></div> | |
| <div class="navbar-item"><ul class="navbar-icon-links" | |
| aria-label="Icon Links"> | |
| <li class="nav-item"> | |
| <a href="https://github.com/apache/paimon-cpp" title="GitHub" class="nav-link pst-navbar-icon" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><i class="fa-brands fa-square-github fa-lg" aria-hidden="true"></i><span class="visually-hidden">GitHub</span></a> | |
| </li> | |
| </ul></div> | |
| </div> | |
| </div> | |
| <div class="navbar-persistent--mobile"> | |
| <button type="button" class="btn search-button-field search-button__button pst-js-only" title="Search" aria-label="Search" data-bs-placement="bottom" data-bs-toggle="tooltip"> | |
| <i class="fa-solid fa-magnifying-glass"></i> | |
| <span class="search-button__default-text">Search</span> | |
| <span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd class="kbd-shortcut__modifier">K</kbd></span> | |
| </button> | |
| </div> | |
| <button type="button" class="pst-navbar-icon sidebar-toggle secondary-toggle" aria-label="On this page" aria-expanded="false" aria-controls="pst-secondary-sidebar-modal"> | |
| <span class="fa-solid fa-outdent"></span> | |
| </button> | |
| </div> | |
| </header> | |
| <div class="bd-container"> | |
| <div class="bd-container__inner bd-page-width"> | |
| <dialog id="pst-primary-sidebar-modal" tabindex="-1"></dialog> | |
| <div id="pst-primary-sidebar" class="bd-sidebar-primary bd-sidebar"> | |
| <div class="sidebar-header-items sidebar-primary__section"> | |
| <div class="sidebar-header-items__center"> | |
| <div class="navbar-item"> | |
| <nav> | |
| <ul class="bd-navbar-elements navbar-nav"> | |
| <li class="nav-item "> | |
| <a class="nav-link nav-internal" href="../getting_started.html"> | |
| Getting Started | |
| </a> | |
| </li> | |
| <li class="nav-item current active"> | |
| <a class="nav-link nav-internal" href="../user_guide.html"> | |
| User Guide | |
| </a> | |
| </li> | |
| <li class="nav-item "> | |
| <a class="nav-link nav-internal" href="../examples/index.html"> | |
| Examples | |
| </a> | |
| </li> | |
| <li class="nav-item "> | |
| <a class="nav-link nav-internal" href="../api.html"> | |
| API Reference | |
| </a> | |
| </li> | |
| </ul> | |
| </nav></div> | |
| </div> | |
| <div class="sidebar-header-items__end"> | |
| <div class="navbar-item"> | |
| <div class="version-switcher__container dropdown pst-js-only"> | |
| <button id="pst-version-switcher-button-3" | |
| type="button" | |
| class="version-switcher__button btn btn-sm dropdown-toggle" | |
| data-bs-toggle="dropdown" | |
| aria-haspopup="listbox" | |
| aria-controls="pst-version-switcher-list-3" | |
| aria-label="Version switcher list" | |
| > | |
| Choose version <!-- this text may get changed later by javascript --> | |
| <span class="caret"></span> | |
| </button> | |
| <div id="pst-version-switcher-list-3" | |
| class="version-switcher__menu dropdown-menu list-group-flush py-0" | |
| role="listbox" aria-labelledby="pst-version-switcher-button-3"> | |
| <!-- dropdown will be populated by javascript on page load --> | |
| </div> | |
| </div></div> | |
| <div class="navbar-item"> | |
| <div class="theme-switch-container dropdown pst-js-only" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Color mode"> | |
| <button type="button" class="btn btn-sm nav-link pst-navbar-icon theme-switch-button dropdown-toggle" aria-label="Color mode" data-bs-toggle="dropdown"> | |
| <i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light" title="Light"></i> | |
| <i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark" title="Dark"></i> | |
| <i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto" title="System Settings"></i> | |
| </button> | |
| <ul class="dropdown-menu dropdown-menu-end"> | |
| <li><button type="button" class="dropdown-item d-flex align-items-center theme-change-button" data-mode="auto"><i class="fa-solid fa-circle-half-stroke fa-lg me-1"></i>System Settings</button></li> | |
| <li><button type="button" class="dropdown-item d-flex align-items-center theme-change-button" data-mode="light"><i class="fa-solid fa-sun fa-lg me-1"></i>Light</button></li> | |
| <li><button type="button" class="dropdown-item d-flex align-items-center theme-change-button" data-mode="dark"><i class="fa-solid fa-moon fa-lg me-1"></i>Dark</button></li> | |
| </ul> | |
| </div></div> | |
| <div class="navbar-item"><ul class="navbar-icon-links" | |
| aria-label="Icon Links"> | |
| <li class="nav-item"> | |
| <a href="https://github.com/apache/paimon-cpp" title="GitHub" class="nav-link pst-navbar-icon" rel="noopener" target="_blank" data-bs-toggle="tooltip" data-bs-placement="bottom"><i class="fa-brands fa-square-github fa-lg" aria-hidden="true"></i><span class="visually-hidden">GitHub</span></a> | |
| </li> | |
| </ul></div> | |
| </div> | |
| </div> | |
| <div class="sidebar-primary-items__start sidebar-primary__section"> | |
| <div class="sidebar-primary-item pst-sidebar-collapse"><button type="button" id="pst-collapse-sidebar-button" aria-expanded="true" aria-controls="pst-primary-sidebar"> | |
| <svg class="pst-icon" role="img" aria-hidden="true" focusable="false" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> | |
| <path fill="currentColor" d="M3 15.5C2.36232 15.5 1.74874 15.2564 1.28478 14.8189C0.820828 14.3815 0.541576 13.7832 0.504167 13.1467L0.5 13L0.5 3C0.499965 2.36232 0.743605 1.74874 1.18107 1.28478C1.61854 0.820828 2.21676 0.541576 2.85333 0.504167L3 0.5L13 0.5C13.6377 0.499965 14.2513 0.743605 14.7152 1.18107C15.1792 1.61854 15.4584 2.21676 15.4958 2.85333L15.5 3L15.5 13C15.5 13.6377 15.2564 14.2513 14.8189 14.7152C14.3815 15.1792 13.7832 15.4584 13.1467 15.4958L13 15.5L3 15.5ZM3 13.8333L10.5 13.8333L10.5 2.16667L3 2.16667C2.79589 2.16669 2.59889 2.24163 2.44636 2.37726C2.29383 2.5129 2.19638 2.69979 2.1725 2.9025L2.16667 3L2.16667 13C2.16669 13.2041 2.24163 13.4011 2.37726 13.5536C2.5129 13.7062 2.69979 13.8036 2.9025 13.8275L3 13.8333ZM6.65583 10.325L6.5775 10.2558L4.91083 8.58917C4.76735 8.44567 4.68116 8.25476 4.66843 8.05223C4.65569 7.84971 4.71729 7.6495 4.84167 7.48917L4.91083 7.41083L6.5775 5.74417C6.72747 5.59471 6.9287 5.50794 7.14032 5.50148C7.35194 5.49502 7.55809 5.56935 7.7169 5.70937C7.8757 5.8494 7.97525 6.04463 7.99533 6.25539C8.01541 6.46616 7.95451 6.67667 7.825 6.84417L7.75583 6.9225L6.67917 8L7.75583 9.0775C7.89931 9.22099 7.98551 9.41191 7.99824 9.61443C8.01097 9.81695 7.94938 10.0172 7.825 10.1775L7.75583 10.2558C7.61234 10.3993 7.42142 10.4855 7.2189 10.4982C7.01638 10.511 6.81617 10.4494 6.65583 10.325Z"/> | |
| </svg> | |
| <span class="pst-collapse-sidebar-label">Collapse Sidebar</span> | |
| <span class="pst-expand-sidebar-label">Expand Sidebar</span> | |
| </button></div> | |
| <div class="sidebar-primary-item"> | |
| <nav class="bd-docs-nav bd-links" | |
| aria-label="Section Navigation"> | |
| <p class="bd-links__title" role="heading" aria-level="1">Section Navigation</p> | |
| <div class="bd-toc-item navbar-nav"><ul class="current nav bd-sidenav"> | |
| <li class="toctree-l1"><a class="reference internal" href="catalog.html">Catalog</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="schema.html">Schema</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="snapshot.html">Snapshot</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="manifest.html">Manifest</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="manifest_cache.html">Manifest Cache</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="manifest_entry_cache.html">Manifest Entry Cache</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="parquet_metadata_cache.html">Parquet Metadata Cache</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="data_types.html">Data Types</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="primary_key_table.html">Primary Key Table</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="append_only_table.html">Append Only Table</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="format_table.html">Format Table</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="system_tables.html">System Tables</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="write.html">Write</a></li> | |
| <li class="toctree-l1 current active"><a aria-current="page" class="current reference internal" href="#">Real-time Write and Read</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="commit.html">Commit</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="compaction.html">Compaction</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="read.html">Read</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="metrics.html">Metrics reference</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="clean.html">Data Cleanup</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="prefetch.html">Prefetch</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="arrow.html">Memory Format</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="file_index.html">File Index</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="global_index.html">Global Index</a></li> | |
| <li class="toctree-l1"><a class="reference internal" href="primary_key_global_index.html">Primary Key Global Index</a></li> | |
| </ul> | |
| </div> | |
| </nav></div> | |
| </div> | |
| <div class="sidebar-primary-items__end sidebar-primary__section"> | |
| <div class="sidebar-primary-item"> | |
| <div id="ethical-ad-placement" | |
| class="flat" | |
| data-ea-publisher="readthedocs" | |
| data-ea-type="readthedocs-sidebar" | |
| data-ea-manual="true"> | |
| </div></div> | |
| </div> | |
| </div> | |
| <main id="main-content" class="bd-main" role="main"> | |
| <div class="bd-content"> | |
| <div class="bd-article-container"> | |
| <div class="bd-header-article d-print-none"> | |
| <div class="header-article-items header-article__inner"> | |
| <div class="header-article-items__start"> | |
| <div class="header-article-item"> | |
| <nav aria-label="Breadcrumb" class="d-print-none"> | |
| <ul class="bd-breadcrumbs"> | |
| <li class="breadcrumb-item breadcrumb-home"> | |
| <a href="../index.html" class="nav-link" aria-label="Home"> | |
| <i class="fa-solid fa-house"></i> | |
| </a> | |
| </li> | |
| <li class="breadcrumb-item"><a href="../user_guide.html" class="nav-link">User Guide</a></li> | |
| <li class="breadcrumb-item active" aria-current="page"><span class="ellipsis">Real-time Write and Read</span></li> | |
| </ul> | |
| </nav> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div id="searchbox"></div> | |
| <article class="bd-article"> | |
| <section id="real-time-write-and-read"> | |
| <h1>Real-time Write and Read<a class="headerlink" href="#real-time-write-and-read" title="Link to this heading">#</a></h1> | |
| <p>Real-time mode makes writes visible to queries in the same process before a | |
| snapshot commit. A shared <code class="docutils literal notranslate"><span class="pre">RealtimeContext</span></code> owns the uncommitted stores; | |
| queries combine an immutable view of those stores with committed table files. | |
| Readers without that context see only committed files.</p> | |
| <p>Real-time storage is pluggable through the <code class="docutils literal notranslate"><span class="pre">RealtimeStore</span></code> interface. The | |
| default implementation uses Apache Arrow to buffer rows and serve reads. | |
| Applications can provide their own <code class="docutils literal notranslate"><span class="pre">RealtimeStoreFactory</span></code> through | |
| <code class="docutils literal notranslate"><span class="pre">RealtimeContext::Create(factory)</span></code> to customize storage and retrieval while | |
| keeping Paimon’s real-time write, read, and commit lifecycle.</p> | |
| <p>Durability still comes from snapshot commits. Upstream must retain replayable | |
| input and provide monotonically increasing offsets for each partition-bucket. | |
| Real-time operations currently support only the main branch. Use a separate | |
| context for each table, and coordinate a single active writer for each | |
| partition-bucket.</p> | |
| <section id="modes-and-capabilities"> | |
| <h2>Modes and Capabilities<a class="headerlink" href="#modes-and-capabilities" title="Link to this heading">#</a></h2> | |
| <p>The table schema and options select the mode; there is no separate | |
| <code class="docutils literal notranslate"><span class="pre">realtime.mode</span></code> option.</p> | |
| <div class="pst-scrollable-table-container"><table class="table"> | |
| <colgroup> | |
| <col style="width: 18.0%" /> | |
| <col style="width: 25.0%" /> | |
| <col style="width: 27.0%" /> | |
| <col style="width: 30.0%" /> | |
| </colgroup> | |
| <thead> | |
| <tr class="row-odd"><th class="head"><p>Mode</p></th> | |
| <th class="head"><p>Selection</p></th> | |
| <th class="head"><p>Uncommitted state</p></th> | |
| <th class="head"><p>Query semantics</p></th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr class="row-even"><td><p>Append</p></td> | |
| <td><p>No primary key; no real-time deduplicate key</p></td> | |
| <td><p>Arrow batches in write order</p></td> | |
| <td><p>Concatenate committed files and the visible memory tail</p></td> | |
| </tr> | |
| <tr class="row-odd"><td><p>PK MOR</p></td> | |
| <td><p>Primary key; <code class="docutils literal notranslate"><span class="pre">deletion-vectors.enabled=false</span></code></p></td> | |
| <td><p>Batches sorted by primary key and sequence number</p></td> | |
| <td><p>Merge disk runs, sealed batches, and building batches by primary key</p></td> | |
| </tr> | |
| <tr class="row-even"><td><p>PK DV</p></td> | |
| <td><p>Primary key; <code class="docutils literal notranslate"><span class="pre">merge-engine=deduplicate</span></code>; | |
| <code class="docutils literal notranslate"><span class="pre">deletion-vectors.enabled=true</span></code></p></td> | |
| <td><p>The same sorted PK store as PK MOR</p></td> | |
| <td><p>Apply committed DVs, then merge disk and memory by primary key</p></td> | |
| </tr> | |
| <tr class="row-odd"><td><p>Append deduplicate</p></td> | |
| <td><p>Append table with <code class="docutils literal notranslate"><span class="pre">realtime.deduplicate-key-fields</span></code> set and | |
| <code class="docutils literal notranslate"><span class="pre">deletion-vectors.enabled=true</span></code></p></td> | |
| <td><p>Mark superseded rows in an in-memory DV during writes; persist DV files | |
| at commit</p></td> | |
| <td><p>Full predicate pushdown; apply the in-memory DV to disk and memory reads | |
| without MOR</p></td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| </div> | |
| <p>All four modes support read-before-prepare, sealed-but-uncommitted reads, | |
| partition-bucket isolation, offset-aware commit and recovery, immutable read | |
| views, projection, and optional sealed-segment spill with the default store. | |
| The shared read pipeline also handles nested projection, selected MAP keys, | |
| and supported VARIANT access over physical store fields. Predicate pruning | |
| and exact residual filtering follow the mode-specific rules below.</p> | |
| <p>Append accepts <code class="docutils literal notranslate"><span class="pre">INSERT</span></code> only. PK and append deduplicate also accept | |
| <code class="docutils literal notranslate"><span class="pre">UPDATE_AFTER</span></code>, <code class="docutils literal notranslate"><span class="pre">DELETE</span></code>, and <code class="docutils literal notranslate"><span class="pre">UPDATE_BEFORE</span></code>. PK supports composite | |
| primary keys with <code class="docutils literal notranslate"><span class="pre">merge-engine=deduplicate</span></code> or <code class="docutils literal notranslate"><span class="pre">merge-engine=partial-update</span></code>. | |
| PK realtime partial-update requires deletion vectors disabled | |
| (<code class="docutils literal notranslate"><span class="pre">deletion-vectors.enabled=false</span></code>). Partial update uses the existing merge | |
| function and its sequence-group, field-aggregation, and delete options. Append deduplicate currently | |
| accepts exactly one non-null, non-nested key field and is experimental: its | |
| persisted index format may change.</p> | |
| <p>PK DV and append deduplicate are different designs. PK DV retains primary-key | |
| merge semantics; append deduplicate uses a persisted stable row offset and | |
| does not turn the table into a primary-key table.</p> | |
| </section> | |
| <section id="configuration"> | |
| <h2>Configuration<a class="headerlink" href="#configuration" title="Link to this heading">#</a></h2> | |
| <section id="common-options"> | |
| <h3>Common Options<a class="headerlink" href="#common-options" title="Link to this heading">#</a></h3> | |
| <div class="pst-scrollable-table-container"><table class="table"> | |
| <colgroup> | |
| <col style="width: 33.0%" /> | |
| <col style="width: 15.0%" /> | |
| <col style="width: 52.0%" /> | |
| </colgroup> | |
| <thead> | |
| <tr class="row-odd"><th class="head"><p>Option</p></th> | |
| <th class="head"><p>Default</p></th> | |
| <th class="head"><p>Meaning</p></th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">realtime.enabled</span></code></p></td> | |
| <td><p><code class="docutils literal notranslate"><span class="pre">false</span></code></p></td> | |
| <td><p>Enables real-time operations. The builders must also receive a shared | |
| <code class="docutils literal notranslate"><span class="pre">RealtimeContext</span></code> to select process-local writing and union reading.</p></td> | |
| </tr> | |
| <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">realtime.spill-enabled</span></code></p></td> | |
| <td><p><code class="docutils literal notranslate"><span class="pre">false</span></code></p></td> | |
| <td><p>The default store synchronously spills frozen Arrow data to temporary | |
| IPC files during explicit <code class="docutils literal notranslate"><span class="pre">Seal</span></code>. Prepare does not trigger spill.</p></td> | |
| </tr> | |
| <tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">realtime.read-view-ttl</span></code></p></td> | |
| <td><p><code class="docutils literal notranslate"><span class="pre">5</span> <span class="pre">min</span></code></p></td> | |
| <td><p>Positive lifetime of a scan’s read-view ticket before reader creation.</p></td> | |
| </tr> | |
| <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">realtime.store.stats-mode</span></code></p></td> | |
| <td><p><code class="docutils literal notranslate"><span class="pre">none</span></code></p></td> | |
| <td><p><code class="docutils literal notranslate"><span class="pre">none</span></code> or <code class="docutils literal notranslate"><span class="pre">full</span></code>. Full mode collects per-batch min/max and null counts | |
| for conservative predicate pruning, including retained spill metadata.</p></td> | |
| </tr> | |
| <tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">realtime.index.<index_name>.columns</span></code></p></td> | |
| <td><p>Unset</p></td> | |
| <td><p>Comma-separated fields indexed in memory by the default Arrow store. | |
| Available in append and append deduplicate modes; independent of | |
| <code class="docutils literal notranslate"><span class="pre">realtime.store.stats-mode</span></code>.</p></td> | |
| </tr> | |
| <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">realtime.deduplicate-key-fields</span></code></p></td> | |
| <td><p>Unset</p></td> | |
| <td><p>Selects append deduplicate mode. Although expressed as a comma-separated | |
| list, currently exactly one field is accepted.</p></td> | |
| </tr> | |
| <tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">bucket</span></code></p></td> | |
| <td><p>Must be set</p></td> | |
| <td><p>Real-time mode requires fixed buckets: <code class="docutils literal notranslate"><span class="pre">bucket</span> <span class="pre">></span> <span class="pre">0</span></code>.</p></td> | |
| </tr> | |
| <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">read.batch-size</span></code></p></td> | |
| <td><p><code class="docutils literal notranslate"><span class="pre">1024</span></code></p></td> | |
| <td><p>Maximum raw batch size returned by the default store’s query readers; | |
| not the number of visible rows after bitmap filtering.</p></td> | |
| </tr> | |
| <tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">spill-compression</span></code></p></td> | |
| <td><p><code class="docutils literal notranslate"><span class="pre">zstd</span></code></p></td> | |
| <td><p>Compression used by temporary spill files.</p></td> | |
| </tr> | |
| <tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">spill-compression.zstd-level</span></code></p></td> | |
| <td><p><code class="docutils literal notranslate"><span class="pre">1</span></code></p></td> | |
| <td><p>Compression level when using Zstandard.</p></td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| </div> | |
| <p>Set <code class="docutils literal notranslate"><span class="pre">WriteContextBuilder::WithTempDirectory()</span></code> when enabling spill. The | |
| default factory rejects spill without a non-empty temporary directory or a | |
| file system. Spill is explicit at seal boundaries; the normal write-buffer | |
| memory manager does not automatically bound real-time store memory.</p> | |
| <p>Setting <code class="docutils literal notranslate"><span class="pre">realtime.enabled=true</span></code> alone does not attach an in-process store. | |
| This permits a separate ordinary writer to compact committed files without | |
| joining the real-time context. It does not permit ordinary row writes into an | |
| append deduplicate table.</p> | |
| </section> | |
| <section id="mode-specific-setup"> | |
| <h3>Mode-specific Setup<a class="headerlink" href="#mode-specific-setup" title="Link to this heading">#</a></h3> | |
| <p>For append mode, create a table without primary keys and use:</p> | |
| <div class="highlight-text notranslate"><div class="highlight"><pre><span></span>bucket = 4 | |
| realtime.enabled = true | |
| </pre></div> | |
| </div> | |
| <p>For PK MOR, define the table’s primary keys and use:</p> | |
| <div class="highlight-text notranslate"><div class="highlight"><pre><span></span>bucket = 4 | |
| realtime.enabled = true | |
| merge-engine = deduplicate | |
| deletion-vectors.enabled = false | |
| </pre></div> | |
| </div> | |
| <p>For PK DV, define primary keys and enable DVs instead:</p> | |
| <div class="highlight-text notranslate"><div class="highlight"><pre><span></span>bucket = 4 | |
| realtime.enabled = true | |
| merge-engine = deduplicate | |
| deletion-vectors.enabled = true | |
| </pre></div> | |
| </div> | |
| <p>Both PK modes use the same real-time writer and store. PK DV uses the normal | |
| PK deletion-vector and compaction infrastructure; it does not require the | |
| append deduplicate <code class="docutils literal notranslate"><span class="pre">.offset</span></code> sidecar or an offset bitmap file index.</p> | |
| <p>For append deduplicate, create a table with no primary keys. Its schema must | |
| contain <code class="docutils literal notranslate"><span class="pre">_REALTIME_OFFSET</span> <span class="pre">BIGINT</span> <span class="pre">NOT</span> <span class="pre">NULL</span></code> and a non-null key, for example | |
| <code class="docutils literal notranslate"><span class="pre">id</span> <span class="pre">BIGINT</span> <span class="pre">NOT</span> <span class="pre">NULL</span></code>. Deduplication is scoped to a partition: the same key may | |
| exist independently in different partitions. The bucket key must use only | |
| deduplicate key fields; applications are responsible for assigning rows to the | |
| correct bucket. For example, use <code class="docutils literal notranslate"><span class="pre">bucket-key=id</span></code>:</p> | |
| <div class="highlight-text notranslate"><div class="highlight"><pre><span></span>bucket = 4 | |
| bucket-key = id | |
| realtime.enabled = true | |
| realtime.deduplicate-key-fields = id | |
| deletion-vectors.enabled = true | |
| deletion-vectors.bitmap64 = false | |
| file-index.read.enabled = true | |
| file-index.bitmap.columns = _REALTIME_OFFSET | |
| </pre></div> | |
| </div> | |
| <p>The two indexes serve different purposes:</p> | |
| <ul class="simple"> | |
| <li><p>The <code class="docutils literal notranslate"><span class="pre">.offset</span></code> sidecar looks up existing offsets by deduplicate key during | |
| writes, so superseded rows can be marked in the in-memory DV.</p></li> | |
| <li><p><code class="docutils literal notranslate"><span class="pre">file-index.bitmap.columns=_REALTIME_OFFSET</span></code> builds an offset index used | |
| during queries to quickly map in-memory DV offsets to exact file row | |
| positions and filter those rows.</p></li> | |
| </ul> | |
| <p>The offset column must have an index supporting exact BIGINT <code class="docutils literal notranslate"><span class="pre">IN</span></code> and | |
| <code class="docutils literal notranslate"><span class="pre">NOT_IN</span></code> row-position matching. Among Paimon’s default plugins, supported | |
| choices include <code class="docutils literal notranslate"><span class="pre">bitmap</span></code>, <code class="docutils literal notranslate"><span class="pre">bsi</span></code>, and <code class="docutils literal notranslate"><span class="pre">range-bitmap</span></code>. Indexes may be embedded | |
| in file metadata or stored in an external file-index file. Approximate indexes | |
| such as Bloom filters are insufficient.</p> | |
| <p>Index capabilities are checked when creating a table and loading its schema, | |
| not for each file during reads. Applications must keep the index configuration | |
| consistent with existing files and ensure that those files have compatible | |
| exact indexes.</p> | |
| <p>The bitmap64 prohibition concerns persisted file DVs; logical deleted offsets | |
| are still represented by <code class="docutils literal notranslate"><span class="pre">RoaringBitmap64</span></code> in memory.</p> | |
| <p>The <code class="docutils literal notranslate"><span class="pre">.offset</span></code> sidecar lookup uses <code class="docutils literal notranslate"><span class="pre">cache-page-size</span></code>, | |
| <code class="docutils literal notranslate"><span class="pre">lookup.cache-max-memory-size</span></code>, and | |
| <code class="docutils literal notranslate"><span class="pre">lookup.cache.high-priority-pool-ratio</span></code>. These configure its lookup cache, | |
| not a total memory limit for the real-time store.</p> | |
| </section> | |
| </section> | |
| <section id="input-schema-and-offsets"> | |
| <h2>Input Schema and Offsets<a class="headerlink" href="#input-schema-and-offsets" title="Link to this heading">#</a></h2> | |
| <p>Offsets are application-assigned, non-negative <code class="docutils literal notranslate"><span class="pre">int64</span></code> values scoped to one | |
| logical partition-bucket. They must be strictly increasing within each input | |
| batch and across subsequent batches. Gaps are allowed; reuse or backward | |
| movement is rejected. <code class="docutils literal notranslate"><span class="pre">INT64_MAX</span></code> cannot be an input offset because the | |
| exclusive end must also fit in <code class="docutils literal notranslate"><span class="pre">int64</span></code>.</p> | |
| <div class="pst-scrollable-table-container"><table class="table"> | |
| <colgroup> | |
| <col style="width: 20.0%" /> | |
| <col style="width: 45.0%" /> | |
| <col style="width: 35.0%" /> | |
| </colgroup> | |
| <thead> | |
| <tr class="row-odd"><th class="head"><p>Mode</p></th> | |
| <th class="head"><p><code class="docutils literal notranslate"><span class="pre">FileStoreWrite::Write</span></code> input layout</p></th> | |
| <th class="head"><p>Persisted offset</p></th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr class="row-even"><td><p>Append</p></td> | |
| <td><p><code class="docutils literal notranslate"><span class="pre">[_REALTIME_OFFSET,</span> <span class="pre">table</span> <span class="pre">fields...]</span></code></p></td> | |
| <td><p>Internal prefix removed before writing data files</p></td> | |
| </tr> | |
| <tr class="row-odd"><td><p>PK MOR / PK DV</p></td> | |
| <td><p><code class="docutils literal notranslate"><span class="pre">[_REALTIME_OFFSET,</span> <span class="pre">table</span> <span class="pre">fields...]</span></code></p></td> | |
| <td><p>Internal prefix removed before writing data files</p></td> | |
| </tr> | |
| <tr class="row-even"><td><p>Append deduplicate</p></td> | |
| <td><p>Table schema in its declared field order, including <code class="docutils literal notranslate"><span class="pre">_REALTIME_OFFSET</span></code></p></td> | |
| <td><p>Normal table column retained in data files and compaction output</p></td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| </div> | |
| <p>Do not add the internal offset prefix to the formal table schema in ordinary | |
| append or PK mode. In append deduplicate mode, do not add a second prefix: the | |
| offset is already a formal field and may occupy any declared position.</p> | |
| <p>Construct Arrow batches in the required layout and set their partition and | |
| bucket with <code class="docutils literal notranslate"><span class="pre">RecordBatchBuilder::SetPartition()</span></code> and <code class="docutils literal notranslate"><span class="pre">SetBucket()</span></code>. Routing | |
| and offset assignment belong to the application. Deduplication never crosses | |
| partition-bucket boundaries.</p> | |
| <p>For PK writes, the framework adds <code class="docutils literal notranslate"><span class="pre">_SEQUENCE_NUMBER</span></code> and <code class="docutils literal notranslate"><span class="pre">_VALUE_KIND</span></code> and | |
| sorts each stored batch by primary key, then sequence number. Input offsets | |
| are validated before sorting. The sequence number, not the numeric offset, | |
| resolves PK versions; application-defined <code class="docutils literal notranslate"><span class="pre">sequence.field</span></code> is not supported | |
| by real-time PK mode.</p> | |
| <p>An <code class="docutils literal notranslate"><span class="pre">OffsetRange</span></code> is half-open: <code class="docutils literal notranslate"><span class="pre">[begin,</span> <span class="pre">end)</span></code>. It is an event-progress | |
| envelope, not a row count. For example, input offsets <code class="docutils literal notranslate"><span class="pre">10,</span> <span class="pre">12,</span> <span class="pre">15</span></code> cover | |
| <code class="docutils literal notranslate"><span class="pre">[10,</span> <span class="pre">16)</span></code>. Deletes consume offsets even when they produce no data-file row, | |
| so a delete-only prepare can advance progress with an empty data increment.</p> | |
| </section> | |
| <section id="api-lifecycle"> | |
| <h2>API Lifecycle<a class="headerlink" href="#api-lifecycle" title="Link to this heading">#</a></h2> | |
| <p>Use the same <code class="docutils literal notranslate"><span class="pre">RealtimeContext</span></code> for writing, planning, and reading. Enable | |
| streaming mode on the writer for progress-aware checkpoints; real-time union | |
| queries themselves use batch scans.</p> | |
| <p>The snippets below run inside a <code class="docutils literal notranslate"><span class="pre">Status</span></code> or <code class="docutils literal notranslate"><span class="pre">Result</span></code>-returning function | |
| using the <code class="docutils literal notranslate"><span class="pre">paimon</span></code> namespace. They assume an existing native table, | |
| <code class="docutils literal notranslate"><span class="pre">table_path</span></code>, a stable <code class="docutils literal notranslate"><span class="pre">commit_user</span></code>, the mode-specific <code class="docutils literal notranslate"><span class="pre">options</span></code> map, | |
| and an input <code class="docutils literal notranslate"><span class="pre">batch</span></code> built as described above.</p> | |
| <div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">PAIMON_ASSIGN_OR_RAISE</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o"><</span><span class="n">RealtimeContext</span><span class="o">></span><span class="w"> </span><span class="n">realtime</span><span class="p">,</span> | |
| <span class="w"> </span><span class="n">RealtimeContext</span><span class="o">::</span><span class="n">Create</span><span class="p">());</span> | |
| <span class="n">WriteContextBuilder</span><span class="w"> </span><span class="nf">write_builder</span><span class="p">(</span><span class="n">table_path</span><span class="p">,</span><span class="w"> </span><span class="n">commit_user</span><span class="p">);</span> | |
| <span class="n">write_builder</span><span class="p">.</span><span class="n">SetOptions</span><span class="p">(</span><span class="n">options</span><span class="p">)</span> | |
| <span class="w"> </span><span class="p">.</span><span class="n">WithStreamingMode</span><span class="p">(</span><span class="nb">true</span><span class="p">)</span> | |
| <span class="w"> </span><span class="p">.</span><span class="n">WithRealtimeContext</span><span class="p">(</span><span class="n">realtime</span><span class="p">);</span> | |
| <span class="n">PAIMON_ASSIGN_OR_RAISE</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">unique_ptr</span><span class="o"><</span><span class="n">WriteContext</span><span class="o">></span><span class="w"> </span><span class="n">write_context</span><span class="p">,</span> | |
| <span class="w"> </span><span class="n">write_builder</span><span class="p">.</span><span class="n">Finish</span><span class="p">());</span> | |
| <span class="n">PAIMON_ASSIGN_OR_RAISE</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">unique_ptr</span><span class="o"><</span><span class="n">FileStoreWrite</span><span class="o">></span><span class="w"> </span><span class="n">writer</span><span class="p">,</span> | |
| <span class="w"> </span><span class="n">FileStoreWrite</span><span class="o">::</span><span class="n">Create</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">write_context</span><span class="p">)));</span> | |
| <span class="n">PAIMON_RETURN_NOT_OK</span><span class="p">(</span><span class="n">writer</span><span class="o">-></span><span class="n">Write</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">batch</span><span class="p">)));</span> | |
| </pre></div> | |
| </div> | |
| <p>To query before preparing or committing:</p> | |
| <div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="n">ScanContextBuilder</span><span class="w"> </span><span class="nf">scan_builder</span><span class="p">(</span><span class="n">table_path</span><span class="p">);</span> | |
| <span class="n">scan_builder</span><span class="p">.</span><span class="n">SetOptions</span><span class="p">(</span><span class="n">options</span><span class="p">).</span><span class="n">WithRealtimeContext</span><span class="p">(</span><span class="n">realtime</span><span class="p">);</span> | |
| <span class="n">PAIMON_ASSIGN_OR_RAISE</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">unique_ptr</span><span class="o"><</span><span class="n">ScanContext</span><span class="o">></span><span class="w"> </span><span class="n">scan_context</span><span class="p">,</span> | |
| <span class="w"> </span><span class="n">scan_builder</span><span class="p">.</span><span class="n">Finish</span><span class="p">());</span> | |
| <span class="n">PAIMON_ASSIGN_OR_RAISE</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">unique_ptr</span><span class="o"><</span><span class="n">TableScan</span><span class="o">></span><span class="w"> </span><span class="n">scan</span><span class="p">,</span> | |
| <span class="w"> </span><span class="n">TableScan</span><span class="o">::</span><span class="n">Create</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">scan_context</span><span class="p">)));</span> | |
| <span class="n">PAIMON_ASSIGN_OR_RAISE</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o"><</span><span class="n">Plan</span><span class="o">></span><span class="w"> </span><span class="n">plan</span><span class="p">,</span><span class="w"> </span><span class="n">scan</span><span class="o">-></span><span class="n">CreatePlan</span><span class="p">());</span> | |
| <span class="n">ReadContextBuilder</span><span class="w"> </span><span class="nf">read_builder</span><span class="p">(</span><span class="n">table_path</span><span class="p">);</span> | |
| <span class="n">read_builder</span><span class="p">.</span><span class="n">SetOptions</span><span class="p">(</span><span class="n">options</span><span class="p">).</span><span class="n">WithRealtimeContext</span><span class="p">(</span><span class="n">realtime</span><span class="p">);</span> | |
| <span class="n">PAIMON_ASSIGN_OR_RAISE</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">unique_ptr</span><span class="o"><</span><span class="n">ReadContext</span><span class="o">></span><span class="w"> </span><span class="n">read_context</span><span class="p">,</span> | |
| <span class="w"> </span><span class="n">read_builder</span><span class="p">.</span><span class="n">Finish</span><span class="p">());</span> | |
| <span class="n">PAIMON_ASSIGN_OR_RAISE</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">unique_ptr</span><span class="o"><</span><span class="n">TableRead</span><span class="o">></span><span class="w"> </span><span class="n">read</span><span class="p">,</span> | |
| <span class="w"> </span><span class="n">TableRead</span><span class="o">::</span><span class="n">Create</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">read_context</span><span class="p">)));</span> | |
| <span class="n">PAIMON_ASSIGN_OR_RAISE</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">unique_ptr</span><span class="o"><</span><span class="n">BatchReader</span><span class="o">></span><span class="w"> </span><span class="n">reader</span><span class="p">,</span> | |
| <span class="w"> </span><span class="n">read</span><span class="o">-></span><span class="n">CreateReader</span><span class="p">(</span><span class="n">plan</span><span class="o">-></span><span class="n">Splits</span><span class="p">()));</span> | |
| <span class="c1">// Consume NextBatch() or NextBatchWithBitmap(), then Close() the reader.</span> | |
| </pre></div> | |
| </div> | |
| <p>Apply the same query predicate to scan and read. If exact residual filtering | |
| must happen inside the library, call | |
| <code class="docutils literal notranslate"><span class="pre">ReadContextBuilder::EnablePredicateFilter(true)</span></code>. File and batch statistics | |
| are conservative pruning, not a substitute for evaluating the user predicate.</p> | |
| <p>Checkpoint with progress-aware APIs:</p> | |
| <div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="k">const</span><span class="w"> </span><span class="kt">int64_t</span><span class="w"> </span><span class="n">checkpoint_id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span> | |
| <span class="n">PAIMON_ASSIGN_OR_RAISE</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o"><</span><span class="n">RealtimeCommitProgress</span><span class="o">></span><span class="w"> </span><span class="n">progress</span><span class="p">,</span> | |
| <span class="w"> </span><span class="n">writer</span><span class="o">-></span><span class="n">PrepareCommitWithProgress</span><span class="p">(</span><span class="n">checkpoint_id</span><span class="p">));</span> | |
| <span class="n">CommitContextBuilder</span><span class="w"> </span><span class="nf">commit_builder</span><span class="p">(</span><span class="n">table_path</span><span class="p">,</span><span class="w"> </span><span class="n">commit_user</span><span class="p">);</span> | |
| <span class="n">PAIMON_ASSIGN_OR_RAISE</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">unique_ptr</span><span class="o"><</span><span class="n">CommitContext</span><span class="o">></span><span class="w"> </span><span class="n">commit_context</span><span class="p">,</span> | |
| <span class="w"> </span><span class="n">commit_builder</span><span class="p">.</span><span class="n">SetOptions</span><span class="p">(</span><span class="n">options</span><span class="p">).</span><span class="n">Finish</span><span class="p">());</span> | |
| <span class="n">PAIMON_ASSIGN_OR_RAISE</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">unique_ptr</span><span class="o"><</span><span class="n">FileStoreCommit</span><span class="o">></span><span class="w"> </span><span class="n">commit</span><span class="p">,</span> | |
| <span class="w"> </span><span class="n">FileStoreCommit</span><span class="o">::</span><span class="n">Create</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">move</span><span class="p">(</span><span class="n">commit_context</span><span class="p">)));</span> | |
| <span class="n">PAIMON_ASSIGN_OR_RAISE</span><span class="p">(</span> | |
| <span class="w"> </span><span class="kt">int64_t</span><span class="w"> </span><span class="n">snapshot_id</span><span class="p">,</span> | |
| <span class="w"> </span><span class="n">commit</span><span class="o">-></span><span class="n">CommitWithProgress</span><span class="p">(</span><span class="n">progress</span><span class="p">,</span><span class="w"> </span><span class="n">checkpoint_id</span><span class="p">,</span><span class="w"> </span><span class="cm">/*watermark=*/</span><span class="n">std</span><span class="o">::</span><span class="n">nullopt</span><span class="p">));</span> | |
| <span class="n">PAIMON_RETURN_NOT_OK</span><span class="p">(</span><span class="n">writer</span><span class="o">-></span><span class="n">RefreshCommittedSnapshot</span><span class="p">(</span><span class="n">snapshot_id</span><span class="p">));</span> | |
| <span class="n">PAIMON_RETURN_NOT_OK</span><span class="p">(</span><span class="n">writer</span><span class="o">-></span><span class="n">Close</span><span class="p">());</span> | |
| </pre></div> | |
| </div> | |
| <p>The operations have different responsibilities:</p> | |
| <ol class="arabic simple"> | |
| <li><p><code class="docutils literal notranslate"><span class="pre">Write</span></code> publishes rows to the process-local building store.</p></li> | |
| <li><p>Optional <code class="docutils literal notranslate"><span class="pre">Seal</span></code> freezes a segment, opens a new building segment, and may | |
| spill. It does not create a committed snapshot or prepare data-file messages.</p></li> | |
| <li><p><code class="docutils literal notranslate"><span class="pre">PrepareCommitWithProgress</span></code> freezes the current building segment without | |
| spilling and writes it together with earlier sealed segments to table data | |
| files, returning their offset ranges together with commit messages. It does | |
| not publish a snapshot or reclaim the real-time data.</p></li> | |
| <li><p><code class="docutils literal notranslate"><span class="pre">CommitWithProgress</span></code> atomically publishes files, indexes, and the updated | |
| partition-bucket offset map. The snapshot’s <code class="docutils literal notranslate"><span class="pre">realtime.offsets</span></code> property | |
| references a metadata file containing the durable progress.</p></li> | |
| <li><p><code class="docutils literal notranslate"><span class="pre">RefreshCommittedSnapshot</span></code> loads the committed progress and reclaims | |
| fully covered sealed segments. Deduplicate refresh also replaces the active | |
| file-key lookup atomically with memory/DV advancement.</p></li> | |
| </ol> | |
| <p>Keep every prepared-but-uncommitted <code class="docutils literal notranslate"><span class="pre">RealtimeCommitProgress</span></code> entry. If a later | |
| checkpoint subsumes earlier prepares, pass the complete outstanding prefix to | |
| commit, not just the latest prepare result. Offset gaps make omitted prepares | |
| indistinguishable from valid sparse input, and skipping one can cause data loss.</p> | |
| <p><code class="docutils literal notranslate"><span class="pre">CommitMessage</span></code> serialization does not contain the progress range or the | |
| deduplicate <code class="docutils literal notranslate"><span class="pre">deleted_offsets</span></code> bitmap. Preserve the complete progress when | |
| coordinating checkpoints. Snapshot conflicts are retried internally against | |
| the latest snapshot; commit identifiers must follow the streaming commit | |
| protocol. With a version-managed catalog, configure the writer and committer | |
| with the same <code class="docutils literal notranslate"><span class="pre">WithCatalog()</span></code> catalog and identifier.</p> | |
| </section> | |
| <section id="read-views-and-consistency"> | |
| <h2>Read Views and Consistency<a class="headerlink" href="#read-views-and-consistency" title="Link to this heading">#</a></h2> | |
| <p>Planning first pins immutable memory views and then plans committed disk data. | |
| For each active partition-bucket it captures two exclusive bounds:</p> | |
| <div class="highlight-text notranslate"><div class="highlight"><pre><span></span>disk: progress covered by the selected snapshot | |
| memory: [committed_end_offset, memory_end_offset) | |
| </pre></div> | |
| </div> | |
| <p>Filtering memory by these bounds prevents duplicate reads after a commit and | |
| excludes writes after the captured memory view. Existing views remain valid | |
| across later writes, seals, spill publication, and refresh-driven reclamation.</p> | |
| <p>Ordinary append scans keep earlier disk splits independently schedulable and | |
| attach the memory view to a tail split. PK and append deduplicate group a | |
| partition-bucket’s disk splits with its memory view so that merge or pending | |
| deletion semantics cover the whole bucket.</p> | |
| <p>A real-time split carries an opaque read-view ticket. Resolve it with the same | |
| context in the same process. Successful reader creation consumes the ticket; | |
| failed creation retains it until its TTL expires. Once a reader is created, | |
| the reader pins its view independently of ticket expiry. Replan if a ticket | |
| expires, or if a previously consumed split needs to be read again.</p> | |
| <p>An explicit snapshot id is accepted only if its progress is not behind the | |
| context’s reclaimed progress for relevant active stores. It does not restore | |
| an old in-memory state and is not unrestricted historical time travel. For a | |
| disk-only historical query, do not attach the real-time context.</p> | |
| </section> | |
| <section id="in-memory-predicate-indexes"> | |
| <h2>In-memory Predicate Indexes<a class="headerlink" href="#in-memory-predicate-indexes" title="Link to this heading">#</a></h2> | |
| <p>The default Arrow store supports optional predicate indexes on key or value fields | |
| in append and append deduplicate modes. PK modes are unsupported. For example:</p> | |
| <div class="highlight-text notranslate"><div class="highlight"><pre><span></span>realtime.enabled = true | |
| realtime.index.hash.columns = id,payload | |
| realtime.store.stats-mode = full | |
| </pre></div> | |
| </div> | |
| <p>The built-in <code class="docutils literal notranslate"><span class="pre">hash</span></code> plugin is <strong>experimental</strong>; its implementation and supported | |
| capabilities may change. It supports equality and <code class="docutils literal notranslate"><span class="pre">IN</span></code> predicates on boolean, | |
| integer, floating-point, string, binary, and date fields. Decimal, timestamp, and | |
| nested types are currently unsupported. Use a comma-separated list to index | |
| multiple fields; indexing <code class="docutils literal notranslate"><span class="pre">_REALTIME_OFFSET</span></code> is unsupported.</p> | |
| <p>Note that this index does not currently handle hash collisions.</p> | |
| <p>Indexes and batch statistics work independently and can be enabled together. | |
| For <code class="docutils literal notranslate"><span class="pre">id</span> <span class="pre">=</span> <span class="pre">7</span> <span class="pre">AND</span> <span class="pre">score</span> <span class="pre">></span> <span class="pre">100</span></code>, an index supporting equality on <code class="docutils literal notranslate"><span class="pre">id</span></code> selects | |
| candidate offsets; statistics can then skip batches whose maximum <code class="docutils literal notranslate"><span class="pre">score</span></code> | |
| is at most 100. | |
| Statistics cover entire batches, so mixed batches still need row-level | |
| filtering. Keep predicate fields in the read schema and enable | |
| <code class="docutils literal notranslate"><span class="pre">ReadContextBuilder::EnablePredicateFilter(true)</span></code> for exact filtering.</p> | |
| <p>In-memory and disk indexes are configured independently. Use | |
| <code class="docutils literal notranslate"><span class="pre">file-index.<type>.columns</span></code> to enable indexes for committed files.</p> | |
| <section id="real-time-vector-search"> | |
| <h3>Real-time Vector Search<a class="headerlink" href="#real-time-vector-search" title="Link to this heading">#</a></h3> | |
| <p>Build with <code class="docutils literal notranslate"><span class="pre">-DPAIMON_ENABLE_LUMINA=ON</span></code> to enable real-time Lumina vector search. | |
| For Lumina options and limits, see <code class="docutils literal notranslate"><span class="pre">docs/api/Streamer.md</span></code> and <code class="docutils literal notranslate"><span class="pre">docs/reference</span></code> | |
| in the Lumina release package.</p> | |
| <div class="highlight-text notranslate"><div class="highlight"><pre><span></span>realtime.index.lumina.columns = embedding | |
| realtime.index.lumina.embedding.index.type = bruteforce | |
| realtime.index.lumina.embedding.index.dimension = 2 | |
| realtime.index.lumina.embedding.distance.metric = l2 | |
| realtime.index.lumina.embedding.encoding.type = rawf32 | |
| </pre></div> | |
| </div> | |
| <p>Queries over both memory and disk require <code class="docutils literal notranslate"><span class="pre">realtime.index.lumina.columns</span></code> and | |
| <code class="docutils literal notranslate"><span class="pre">file-index.lumina.columns</span></code>, each with its own per-column options. Keep dimension | |
| and distance metric consistent; other options can differ.</p> | |
| <p>Use <code class="docutils literal notranslate"><span class="pre">ReadContextBuilder::EnablePreciseFileIndexEvaluate(true)</span></code> with | |
| <code class="docutils literal notranslate"><span class="pre">SetVectorSearch()</span></code>. Keep scalar predicate fields in the read projection and | |
| project <code class="docutils literal notranslate"><span class="pre">_embedding_INDEX_SCORE</span></code> for scores. Scalar filters, including those | |
| without indexes, and committed or pending DVs are applied before vector TopK.</p> | |
| <p>The table reader returns global TopK across the disk files and memory segments | |
| in all splits supplied to <code class="docutils literal notranslate"><span class="pre">TableRead::CreateReader()</span></code>. | |
| Real-time vector tag predicates are unsupported.</p> | |
| </section> | |
| </section> | |
| <section id="implementation-by-mode"> | |
| <h2>Implementation by Mode<a class="headerlink" href="#implementation-by-mode" title="Link to this heading">#</a></h2> | |
| <section id="append"> | |
| <h3>Append<a class="headerlink" href="#append" title="Link to this heading">#</a></h3> | |
| <p><code class="docutils literal notranslate"><span class="pre">RealtimeAppendOnlyWriter</span></code> validates offsets and writes to an | |
| <code class="docutils literal notranslate"><span class="pre">APPEND_ONLY</span></code> store. The default <code class="docutils literal notranslate"><span class="pre">ArrowRealtimeStore</span></code> retains building | |
| batches and immutable sealed segments in write order. Query readers use | |
| optional predicate indexes and batch statistics to prune candidates, project | |
| the requested fields, and apply the visible offset range before removing the | |
| hidden offset column.</p> | |
| <p>Preparing reads sealed segments through the ordinary <code class="docutils literal notranslate"><span class="pre">AppendOnlyWriter</span></code>, | |
| removing the internal offset prefix before writing table files. Queries do not | |
| need key lookup or version merge; disk and memory readers are concatenated.</p> | |
| </section> | |
| <section id="primary-key-mor"> | |
| <h3>Primary Key MOR<a class="headerlink" href="#primary-key-mor" title="Link to this heading">#</a></h3> | |
| <p><code class="docutils literal notranslate"><span class="pre">RealtimePrimaryKeyWriter</span></code> materializes PK transport batches with sequence | |
| number, row kind, and offset. Each sorted batch is an independent merge input; | |
| multiple stored batches do not form a single globally sorted stream.</p> | |
| <p>Query construction merges sorted disk sections and the memory readers, applies | |
| the configured merge engine, and drops final delete records. It collects all | |
| disk splits belonging to the active partition-bucket, rather than merging | |
| memory against only one disk split. Preparing similarly merges the sealed | |
| streams before handing them to <code class="docutils literal notranslate"><span class="pre">MergeTreeWriter</span></code> to write normal PK files.</p> | |
| <p>Partial update reuses the existing framework merge logic and options. The store | |
| continues to hold sorted batches and spill them without merging. Real-time | |
| compaction remains disabled.</p> | |
| <p>Only primary-key predicates are safe to push into unresolved versions. A | |
| predicate on a value column must be evaluated after version merge: filtering | |
| out the newest value first could incorrectly expose an older matching value.</p> | |
| </section> | |
| <section id="primary-key-dv"> | |
| <h3>Primary Key DV<a class="headerlink" href="#primary-key-dv" title="Link to this heading">#</a></h3> | |
| <p>PK DV uses the same real-time PK write and sequence-number logic. During a | |
| union read, committed file DVs remove already-invalid physical rows, but L0 | |
| runs and memory may still contain duplicate keys and delete records. The final | |
| reader therefore still performs a primary-key merge across disk and memory.</p> | |
| <p>For real-time scans, L0 is retained instead of being skipped as in the normal | |
| DV batch scan. Predicate handling distinguishes storage levels:</p> | |
| <ul class="simple"> | |
| <li><p>High-level files (<code class="docutils literal notranslate"><span class="pre">level</span> <span class="pre">></span> <span class="pre">0</span></code>) can use the full predicate for statistics and | |
| file-index pruning under committed DV semantics.</p></li> | |
| <li><p>L0 and memory receive only primary-key predicates before merge.</p></li> | |
| <li><p>The full residual predicate is applied after merge when explicitly enabled | |
| in the read context.</p></li> | |
| </ul> | |
| <p>Enabling DVs does not make uncommitted PK data append-only and does not make | |
| arbitrary value-predicate pushdown safe for L0 or memory.</p> | |
| </section> | |
| <section id="append-deduplicate-offset-dv"> | |
| <h3>Append Deduplicate / Offset DV<a class="headerlink" href="#append-deduplicate-offset-dv" title="Link to this heading">#</a></h3> | |
| <p>This mode uses two independent lookup directions:</p> | |
| <div class="highlight-text notranslate"><div class="highlight"><pre><span></span>key -> logical offset(s) memory key indexes / .offset sidecars | |
| logical offset -> physical row positions exact _REALTIME_OFFSET file index | |
| </pre></div> | |
| </div> | |
| <p>For each write, <code class="docutils literal notranslate"><span class="pre">RealtimeDeduplicateWriter</span></code> looks up existing keys across | |
| committed files, sealed segments, and the building segment. Matching old offsets | |
| are marked deleted, and within-batch duplicates are resolved in row order. | |
| Add rows are appended to the store; delete events update only the key/DV state, | |
| without persisting a delete row.</p> | |
| <p>Deduplicate key-to-latest-offset lookups and DV bitmaps use copy-on-write | |
| snapshots, so later writes do not change the state held by existing lookups, | |
| read views, or seal checkpoints. The optional predicate indexes share | |
| append-only postings instead.</p> | |
| <p>Memory reads use the read view’s DV to exclude rows whose offsets are marked | |
| deleted.</p> | |
| <p>Disk reads apply both committed file DVs and pending offset deletions. Pending | |
| deletions become per-file <code class="docutils literal notranslate"><span class="pre">_REALTIME_OFFSET</span> <span class="pre">NOT</span> <span class="pre">IN</span> <span class="pre">(...)</span></code> predicates, trimmed | |
| using reliable min/max statistics or left untrimmed when statistics are missing | |
| or ambiguous. The exact file index enforces these predicates independently of | |
| optional residual filtering. The offset is omitted from the final result unless | |
| the user selected it.</p> | |
| <p>Prepare retains each seal’s logical deletion checkpoint and writes surviving | |
| add rows with their original offsets. Each output file gets a <code class="docutils literal notranslate"><span class="pre">.offset</span></code> | |
| sidecar mapping key fingerprints to offsets, separate from the exact offset | |
| file index.</p> | |
| <p>Each commit attempt resolves deleted offsets to row positions in the latest | |
| snapshot’s files and the prepared new files, then merges them into the committed | |
| file DVs. Repeating this resolution on retries handles file changes caused by | |
| conflicting commits or compaction.</p> | |
| </section> | |
| </section> | |
| <section id="spill-and-memory-accounting"> | |
| <h2>Spill and Memory Accounting<a class="headerlink" href="#spill-and-memory-accounting" title="Link to this heading">#</a></h2> | |
| <p>The default store freezes the current building data and opens a new building | |
| segment under a short lock. Explicit <code class="docutils literal notranslate"><span class="pre">Seal</span></code> writes the frozen segment to an | |
| Arrow IPC spill file outside the write lock when spill is enabled. Prepare | |
| freezes without spilling and writes directly to table data files, reading any | |
| earlier spilled segments as needed. There is no background spill worker: the | |
| seal/prepare thread waits for its I/O, while another thread can write to the | |
| new building segment.</p> | |
| <p>Deduplicate uses two-phase seal to freeze data, key index, offset range, and DV | |
| checkpoint at the same boundary. The frozen segment remains queryable and its | |
| keys remain discoverable while spill is in progress. Only after writing and | |
| closing the file successfully is its stored representation replaced. A spill | |
| failure keeps the in-memory segment and cleans up the incomplete file, but is | |
| still terminal for the owning writer/context.</p> | |
| <p>Old views can retain the memory representation after spill or reclamation; | |
| new views use the published representation. Spill files are deleted when the | |
| store and all remaining handles/readers have released them. They are temporary | |
| storage, not a recoverable log after process restart. Predicate indexes, | |
| deduplicate key indexes, DVs, and full-mode statistics remain in memory after | |
| spill. Predicate index memory is included in store memory accounting.</p> | |
| <p><code class="docutils literal notranslate"><span class="pre">RealtimeContext::GetMetrics()</span></code> and real-time writer metrics expose:</p> | |
| <ul class="simple"> | |
| <li><p><code class="docutils literal notranslate"><span class="pre">realtimeBuildingMemoryBytes</span></code>, <code class="docutils literal notranslate"><span class="pre">realtimeSealedMemoryBytes</span></code>, | |
| <code class="docutils literal notranslate"><span class="pre">realtimeTotalMemoryBytes</span></code>;</p></li> | |
| <li><p><code class="docutils literal notranslate"><span class="pre">realtimeBuildingRowCount</span></code>, <code class="docutils literal notranslate"><span class="pre">realtimeSealedRowCount</span></code>, | |
| <code class="docutils literal notranslate"><span class="pre">realtimeTotalRowCount</span></code>.</p></li> | |
| </ul> | |
| <p>These are current store accounting, not process RSS or a visible-row count. | |
| Rows include stored versions hidden by merge/DV filtering. Memory counts include | |
| Arrow buffers and retained statistics; deduplicate also counts retained key-map | |
| buffers, row-offset bitmaps, and distinct deletion checkpoints.</p> | |
| </section> | |
| <section id="recovery-schema-changes-and-compaction"> | |
| <h2>Recovery, Schema Changes, and Compaction<a class="headerlink" href="#recovery-schema-changes-and-compaction" title="Link to this heading">#</a></h2> | |
| <section id="recovery-and-failure-handling"> | |
| <h3>Recovery and Failure Handling<a class="headerlink" href="#recovery-and-failure-handling" title="Link to this heading">#</a></h3> | |
| <p>Read durable progress with <code class="docutils literal notranslate"><span class="pre">RealtimeSnapshotOffsets::ReadAllOffsets()</span></code> or | |
| <code class="docutils literal notranslate"><span class="pre">ReadOffset()</span></code> from a committed snapshot. Replay starting at the returned | |
| offset. If <code class="docutils literal notranslate"><span class="pre">ReadOffset()</span></code> returns <code class="docutils literal notranslate"><span class="pre">-1</span></code> for a partition-bucket, use the | |
| upstream’s initial position.</p> | |
| <p>A new context restores committed progress, but uncommitted data requires | |
| upstream replay. Reusing a healthy context preserves its uncommitted tail; | |
| retain any outstanding prepared progress when replacing the writer.</p> | |
| <p>After a write/flush, seal, prepare, or terminal progress-commit failure, discard | |
| the writer and context and recover from the latest committed progress. Closing | |
| with unprepared data also invalidates the context. Prepare alone is not durable: | |
| retain prepared progress until commit, even after the writer closes.</p> | |
| </section> | |
| <section id="schema-changes"> | |
| <h3>Schema Changes<a class="headerlink" href="#schema-changes" title="Link to this heading">#</a></h3> | |
| <p>Reusing a live store requires the same physical schema and mode. After a schema | |
| change, recreate the context and writer and replay uncommitted input. | |
| <code class="docutils literal notranslate"><span class="pre">data-evolution.enabled</span></code> is not supported in real-time mode.</p> | |
| <p>Deduplicate reads and lookups support historical file schemas, which must remain | |
| available together with their key options. Key renames and field reordering are | |
| supported when key field ID, type, and non-nullability stay compatible. | |
| <code class="docutils literal notranslate"><span class="pre">_REALTIME_OFFSET</span></code> must retain its name, field ID, and non-null int64 type.</p> | |
| </section> | |
| <section id="compaction-and-destructive-operations"> | |
| <h3>Compaction and Destructive Operations<a class="headerlink" href="#compaction-and-destructive-operations" title="Link to this heading">#</a></h3> | |
| <p>The real-time writer does not compact files automatically or support explicit | |
| <code class="docutils literal notranslate"><span class="pre">Compact</span></code>. Use a separate ordinary compaction writer without | |
| <code class="docutils literal notranslate"><span class="pre">WithRealtimeContext()</span></code>, then refresh to the resulting snapshot.</p> | |
| <p>Append deduplicate compaction preserves surviving offsets, rebuilds indexes, | |
| and remaps the latest deletions to the output files. External rewrites must not | |
| drop the required offsets or indexes.</p> | |
| <p>Overwrite, truncate, partition drop, and rollback may reset progress and are not | |
| automatically coordinated with active real-time writers. Stop affected writers, | |
| recreate their contexts, and reset the upstream recovery position before resuming.</p> | |
| </section> | |
| </section> | |
| <section id="extension-points-and-current-limits"> | |
| <h2>Extension Points and Current Limits<a class="headerlink" href="#extension-points-and-current-limits" title="Link to this heading">#</a></h2> | |
| <p><code class="docutils literal notranslate"><span class="pre">RealtimeContext::Create(factory)</span></code> accepts a custom <code class="docutils literal notranslate"><span class="pre">RealtimeStoreFactory</span></code>. | |
| Custom stores manage buffering, read views, and spill while following the | |
| <code class="docutils literal notranslate"><span class="pre">RealtimeStore</span></code> contracts. Paimon manages table files, indexes, merge semantics, | |
| and commits. Append deduplicate also keeps key indexes and DVs in the framework; | |
| custom delegates need <code class="docutils literal notranslate"><span class="pre">TwoPhaseSealableRealtimeStore</span></code> to enable its spill.</p> | |
| <p>Current restrictions include:</p> | |
| <ul class="simple"> | |
| <li><p>Native tables on the main branch with fixed positive bucket counts and full | |
| write schemas only.</p></li> | |
| <li><p>Process-local batch union scans only. Streaming scans, limit pushdown, | |
| global-index result splits, and count-only real-time readers are unsupported. | |
| Precise index evaluation and Lumina vector search support append and append | |
| deduplicate modes; primary-key real-time search is unsupported.</p></li> | |
| <li><p>PK mode supports deduplicate with default delete handling, or partial update | |
| with deletion vectors disabled and its existing delete and sequence-group | |
| options. Both require ascending sequence order and <code class="docutils literal notranslate"><span class="pre">changelog-producer=none</span></code>. Custom | |
| <code class="docutils literal notranslate"><span class="pre">sequence.field</span></code>, floating-point keys, PK global indexes, lookup without DVs, | |
| and read-optimized union scans are unsupported.</p></li> | |
| <li><p>Append deduplicate requires a single non-null scalar key, a persisted offset | |
| column, exact offset file-index reads, and non-bitmap64 DVs. Existing ordinary | |
| append files are not migrated automatically.</p></li> | |
| <li><p>Spill covers Arrow data, not predicate indexes, key indexes, or DVs, and | |
| provides neither a hard memory limit nor crash recovery.</p></li> | |
| </ul> | |
| </section> | |
| <section id="code-map"> | |
| <h2>Code Map<a class="headerlink" href="#code-map" title="Link to this heading">#</a></h2> | |
| <ul class="simple"> | |
| <li><p><code class="docutils literal notranslate"><span class="pre">include/paimon/realtime/</span></code>: public context, store, progress, and recovery APIs.</p></li> | |
| <li><p><code class="docutils literal notranslate"><span class="pre">src/paimon/core/realtime/</span></code>: mode-specific writers, default Arrow store, | |
| deduplicate wrapper/indexes, schema layout, and memory-read pipeline.</p></li> | |
| <li><p><code class="docutils literal notranslate"><span class="pre">src/paimon/core/table/source/realtime_table_scan.cpp</span></code>: memory pinning, | |
| snapshot-progress validation, and partition-bucket split grouping.</p></li> | |
| <li><p><code class="docutils literal notranslate"><span class="pre">src/paimon/core/table/source/append_only_table_read.cpp</span></code>: append union reads | |
| and per-file pending offset-DV predicates.</p></li> | |
| <li><p><code class="docutils literal notranslate"><span class="pre">src/paimon/core/operation/merge_file_split_read.cpp</span></code>: PK disk/memory merge | |
| and level-aware predicate pushdown.</p></li> | |
| <li><p><code class="docutils literal notranslate"><span class="pre">src/paimon/core/operation/commit/realtime_*</span></code>: durable progress, logical-DV | |
| materialization, commit retry, and compaction DV remapping.</p></li> | |
| <li><p><code class="docutils literal notranslate"><span class="pre">test/inte/realtime_write_inte_test.cpp</span></code>: lifecycle and mode-specific | |
| integration coverage; store/reader unit tests live next to their implementation.</p></li> | |
| </ul> | |
| </section> | |
| </section> | |
| </article> | |
| <footer class="prev-next-footer d-print-none"> | |
| <div class="prev-next-area"> | |
| <a class="left-prev" | |
| href="write.html" | |
| title="previous page"> | |
| <i class="fa-solid fa-angle-left"></i> | |
| <div class="prev-next-info"> | |
| <p class="prev-next-subtitle">previous</p> | |
| <p class="prev-next-title">Write</p> | |
| </div> | |
| </a> | |
| <a class="right-next" | |
| href="commit.html" | |
| title="next page"> | |
| <div class="prev-next-info"> | |
| <p class="prev-next-subtitle">next</p> | |
| <p class="prev-next-title">Commit</p> | |
| </div> | |
| <i class="fa-solid fa-angle-right"></i> | |
| </a> | |
| </div> | |
| </footer> | |
| </div> | |
| <dialog id="pst-secondary-sidebar-modal" tabindex="-1"></dialog> | |
| <div id="pst-secondary-sidebar" class="bd-sidebar-secondary bd-toc"><div class="sidebar-secondary-items sidebar-secondary__inner"> | |
| <div class="sidebar-secondary-item"> | |
| <div | |
| id="pst-page-navigation-heading-2" | |
| class="page-toc tocsection onthispage"> | |
| <i class="fa-solid fa-list"></i> On this page | |
| </div> | |
| <nav id="pst-page-toc-nav" class="page-toc" aria-labelledby="pst-page-navigation-heading-2"> | |
| <ul class="pst-show_toc_level nav section-nav flex-column"> | |
| <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#modes-and-capabilities">Modes and Capabilities</a></li> | |
| <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#configuration">Configuration</a><ul class="pst-show_toc_level nav section-nav flex-column"> | |
| <li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#common-options">Common Options</a></li> | |
| <li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#mode-specific-setup">Mode-specific Setup</a></li> | |
| </ul> | |
| </li> | |
| <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#input-schema-and-offsets">Input Schema and Offsets</a></li> | |
| <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#api-lifecycle">API Lifecycle</a></li> | |
| <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#read-views-and-consistency">Read Views and Consistency</a></li> | |
| <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#in-memory-predicate-indexes">In-memory Predicate Indexes</a><ul class="pst-show_toc_level nav section-nav flex-column"> | |
| <li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#real-time-vector-search">Real-time Vector Search</a></li> | |
| </ul> | |
| </li> | |
| <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#implementation-by-mode">Implementation by Mode</a><ul class="pst-show_toc_level nav section-nav flex-column"> | |
| <li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#append">Append</a></li> | |
| <li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#primary-key-mor">Primary Key MOR</a></li> | |
| <li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#primary-key-dv">Primary Key DV</a></li> | |
| <li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#append-deduplicate-offset-dv">Append Deduplicate / Offset DV</a></li> | |
| </ul> | |
| </li> | |
| <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#spill-and-memory-accounting">Spill and Memory Accounting</a></li> | |
| <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#recovery-schema-changes-and-compaction">Recovery, Schema Changes, and Compaction</a><ul class="pst-show_toc_level nav section-nav flex-column"> | |
| <li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#recovery-and-failure-handling">Recovery and Failure Handling</a></li> | |
| <li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#schema-changes">Schema Changes</a></li> | |
| <li class="toc-h3 nav-item toc-entry"><a class="reference internal nav-link" href="#compaction-and-destructive-operations">Compaction and Destructive Operations</a></li> | |
| </ul> | |
| </li> | |
| <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#extension-points-and-current-limits">Extension Points and Current Limits</a></li> | |
| <li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#code-map">Code Map</a></li> | |
| </ul> | |
| </nav></div> | |
| <div class="sidebar-secondary-item"> | |
| <div class="tocsection editthispage"> | |
| <a href="https://github.com/apache/paimon-cpp/edit/main/docs/source/user_guide/realtime.rst"> | |
| <i class="fa-solid fa-pencil"></i> | |
| Edit on GitHub | |
| </a> | |
| </div> | |
| </div> | |
| </div></div> | |
| </div> | |
| <footer class="bd-footer-content"> | |
| </footer> | |
| </main> | |
| </div> | |
| </div> | |
| <!-- Scripts loaded after <body> so the DOM is not blocked --> | |
| <script defer src="../_static/scripts/bootstrap.js?digest=75c7c72ae941e8b558d8"></script> | |
| <script defer src="../_static/scripts/pydata-sphinx-theme.js?digest=75c7c72ae941e8b558d8"></script> | |
| <footer class="bd-footer"> | |
| <div class="bd-footer__inner bd-page-width"> | |
| <div class="footer-items__start"> | |
| <div class="footer-item"> | |
| <p class="copyright"> | |
| © Copyright 2026-2026 Apache Software Foundation. | |
| <br/> | |
| </p> | |
| </div> | |
| <div class="footer-item"> | |
| <p class="sphinx-version"> | |
| Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 9.2.0. | |
| </p> | |
| </div> | |
| </div> | |
| <div class="footer-items__end"> | |
| <div class="footer-item"> | |
| <p class="theme-version"> | |
| <!-- # L10n: Setting the PST URL as an argument as this does not need to be localized --> | |
| Built with the <a href="https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html">PyData Sphinx Theme</a> 0.24.0. | |
| </p></div> | |
| </div> | |
| </div> | |
| </footer> | |
| </body> | |
| </html> |