Skip to content

Commit a63ae1b

Browse files
committed
off by default, restore env var and deprecate
Signed-off-by: Onur Satici <onur@spiraldb.com>
1 parent 085c250 commit a63ae1b

8 files changed

Lines changed: 214 additions & 23 deletions

File tree

vortex-file/public-api.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,8 @@ pub fn vortex_file::WriteStrategyBuilder::build(self) -> alloc::sync::Arc<dyn vo
348348

349349
pub fn vortex_file::WriteStrategyBuilder::with_allow_encodings(self, vortex_utils::aliases::hash_set::HashSet<vortex_array::array::ArrayId>) -> Self
350350

351+
pub fn vortex_file::WriteStrategyBuilder::with_array_tree(self, bool) -> Self
352+
351353
pub fn vortex_file::WriteStrategyBuilder::with_btrblocks_builder(self, vortex_btrblocks::builder::BtrBlocksCompressorBuilder) -> Self
352354

353355
pub fn vortex_file::WriteStrategyBuilder::with_compressor<C: vortex_layout::layouts::compressed::CompressorPlugin>(self, C) -> Self

vortex-file/src/strategy.rs

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ pub struct WriteStrategyBuilder {
144144
field_writers: HashMap<FieldPath, Arc<dyn LayoutStrategy>>,
145145
allow_encodings: Option<HashSet<ArrayId>>,
146146
flat_strategy: Option<Arc<dyn LayoutStrategy>>,
147+
array_tree: bool,
147148
}
148149

149150
impl Default for WriteStrategyBuilder {
@@ -156,6 +157,7 @@ impl Default for WriteStrategyBuilder {
156157
field_writers: HashMap::new(),
157158
allow_encodings: Some(ALLOWED_ENCODINGS.clone()),
158159
flat_strategy: None,
160+
array_tree: false,
159161
}
160162
}
161163
}
@@ -188,11 +190,31 @@ impl WriteStrategyBuilder {
188190
///
189191
/// By default, this uses [`FlatLayoutStrategy`]. This can be used to substitute a custom
190192
/// layout strategy, e.g. one that inlines constant array buffers for GPU reads.
193+
///
194+
/// Passing a custom flat strategy implicitly disables the array-tree outlining feature
195+
/// (see [`Self::with_array_tree`]), since the custom strategy owns the leaf format.
191196
pub fn with_flat_strategy(mut self, flat: Arc<dyn LayoutStrategy>) -> Self {
192197
self.flat_strategy = Some(flat);
193198
self
194199
}
195200

201+
/// Enable array-tree outlining: each chunk's encoding tree (without per-chunk statistics)
202+
/// is collected into a single auxiliary segment per column rather than being inlined
203+
/// alongside the chunk's data.
204+
///
205+
/// Disabled by default. When enabled, the written file uses two encodings that older
206+
/// readers will not understand: [`vortex_layout::layouts::array_tree::ArrayTreeFlatLayout`]
207+
/// at the data leaves and a wrapping [`vortex_layout::layouts::array_tree::ArrayTreeLayout`]
208+
/// that owns the consolidated auxiliary segment. Once you opt in, files written by this
209+
/// builder require a reader that recognizes both encodings.
210+
///
211+
/// Has no effect if a custom flat strategy is provided via
212+
/// [`Self::with_flat_strategy`] — the user-supplied leaf format wins.
213+
pub fn with_array_tree(mut self, array_tree: bool) -> Self {
214+
self.array_tree = array_tree;
215+
self
216+
}
217+
196218
/// Override the default [`BtrBlocksCompressorBuilder`] used for compression.
197219
///
198220
/// The builder is finalized during [`build`](Self::build), producing two compressors: one for
@@ -221,21 +243,22 @@ impl WriteStrategyBuilder {
221243
Arc::new(FlatLayoutStrategy::default())
222244
};
223245

224-
// Build the data pipeline leaf. When the user provides a custom flat strategy, use it
225-
// directly — they own the leaf format and array tree wrapping does not apply.
226-
// Otherwise, create a TX/RX pair for array tree collection.
227-
let (data_leaf, array_tree_collector): (Arc<dyn LayoutStrategy>, _) =
228-
if self.flat_strategy.is_some() {
229-
(Arc::clone(&flat), None)
246+
// Build the data pipeline leaf. Array-tree outlining requires both opt-in via
247+
// `with_array_tree(true)` AND no custom flat strategy (the user's strategy owns the
248+
// leaf format in that case).
249+
let array_tree_enabled = self.array_tree && self.flat_strategy.is_none();
250+
let (data_leaf, array_tree_collector): (Arc<dyn LayoutStrategy>, _) = if !array_tree_enabled
251+
{
252+
(Arc::clone(&flat), None)
253+
} else {
254+
let data_flat = if let Some(allow_encodings) = &self.allow_encodings {
255+
FlatLayoutStrategy::default().with_allow_encodings(allow_encodings.clone())
230256
} else {
231-
let data_flat = if let Some(allow_encodings) = &self.allow_encodings {
232-
FlatLayoutStrategy::default().with_allow_encodings(allow_encodings.clone())
233-
} else {
234-
FlatLayoutStrategy::default()
235-
};
236-
let (collector, leaf) = writer::writer(data_flat, Arc::clone(&flat));
237-
(Arc::new(leaf), Some(collector))
257+
FlatLayoutStrategy::default()
238258
};
259+
let (collector, leaf) = writer::writer(data_flat, Arc::clone(&flat));
260+
(Arc::new(leaf), Some(collector))
261+
};
239262

240263
// 7. for each chunk create a flat layout
241264
let chunked = ChunkedLayoutStrategy::new(data_leaf);

vortex-file/src/tests.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,8 +2005,12 @@ async fn test_segment_ordering_array_trees_consolidated_and_after_data() -> Vort
20052005
.unwrap();
20062006

20072007
let mut buf = ByteBufferMut::empty();
2008+
let strategy = crate::WriteStrategyBuilder::default()
2009+
.with_array_tree(true)
2010+
.build();
20082011
let summary = SESSION
20092012
.write_options()
2013+
.with_strategy(strategy)
20102014
.write(&mut buf, st.into_array().to_array_stream())
20112015
.await?;
20122016

@@ -2092,8 +2096,12 @@ async fn test_segment_ordering_array_trees_before_zones() -> VortexResult<()> {
20922096
.unwrap();
20932097

20942098
let mut buf = ByteBufferMut::empty();
2099+
let strategy = crate::WriteStrategyBuilder::default()
2100+
.with_array_tree(true)
2101+
.build();
20952102
let summary = SESSION
20962103
.write_options()
2104+
.with_strategy(strategy)
20972105
.write(&mut buf, st.into_array().to_array_stream())
20982106
.await?;
20992107

vortex-layout/public-api.lock

Lines changed: 103 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,51 @@ pub fn vortex_layout::layouts::array_tree::ArrayTree::segment_ids(&Self::Layout)
8888

8989
pub fn vortex_layout::layouts::array_tree::ArrayTree::with_children(&mut Self::Layout, alloc::vec::Vec<vortex_layout::LayoutRef>) -> vortex_error::VortexResult<()>
9090

91+
pub struct vortex_layout::layouts::array_tree::ArrayTreeFlat
92+
93+
impl core::fmt::Debug for vortex_layout::layouts::array_tree::ArrayTreeFlat
94+
95+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::fmt(&self, &mut core::fmt::Formatter<'_>) -> core::fmt::Result
96+
97+
impl vortex_layout::VTable for vortex_layout::layouts::array_tree::ArrayTreeFlat
98+
99+
pub type vortex_layout::layouts::array_tree::ArrayTreeFlat::Encoding = vortex_layout::layouts::array_tree::ArrayTreeFlatLayoutEncoding
100+
101+
pub type vortex_layout::layouts::array_tree::ArrayTreeFlat::Layout = vortex_layout::layouts::array_tree::ArrayTreeFlatLayout
102+
103+
pub type vortex_layout::layouts::array_tree::ArrayTreeFlat::Metadata = vortex_array::metadata::EmptyMetadata
104+
105+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::build(&Self::Encoding, &vortex_array::dtype::DType, u64, &vortex_array::metadata::EmptyMetadata, alloc::vec::Vec<vortex_layout::segments::SegmentId>, &dyn vortex_layout::LayoutChildren, &vortex_session::registry::ReadContext) -> vortex_error::VortexResult<Self::Layout>
106+
107+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::child(&Self::Layout, usize) -> vortex_error::VortexResult<vortex_layout::LayoutRef>
108+
109+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::child_type(&Self::Layout, usize) -> vortex_layout::LayoutChildType
110+
111+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::dtype(&Self::Layout) -> &vortex_array::dtype::DType
112+
113+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::encoding(&Self::Layout) -> vortex_layout::LayoutEncodingRef
114+
115+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::id(&Self::Encoding) -> vortex_layout::LayoutId
116+
117+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::metadata(&Self::Layout) -> Self::Metadata
118+
119+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::nchildren(&Self::Layout) -> usize
120+
121+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::new_reader(&Self::Layout, alloc::sync::Arc<str>, alloc::sync::Arc<dyn vortex_layout::segments::SegmentSource>, &vortex_session::VortexSession, &vortex_layout::LayoutReaderContext) -> vortex_error::VortexResult<vortex_layout::LayoutReaderRef>
122+
123+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::row_count(&Self::Layout) -> u64
124+
125+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::segment_ids(&Self::Layout) -> alloc::vec::Vec<vortex_layout::segments::SegmentId>
126+
127+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::with_children(&mut Self::Layout, alloc::vec::Vec<vortex_layout::LayoutRef>) -> vortex_error::VortexResult<()>
128+
91129
pub struct vortex_layout::layouts::array_tree::ArrayTreeFlatLayout
92130

93131
impl vortex_layout::layouts::array_tree::ArrayTreeFlatLayout
94132

95-
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlatLayout::compact_tree(&self) -> core::option::Option<&vortex_buffer::ByteBuffer>
96-
97133
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlatLayout::inner(&self) -> &vortex_layout::layouts::flat::FlatLayout
98134

99-
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlatLayout::new(vortex_layout::layouts::flat::FlatLayout, vortex_buffer::ByteBuffer) -> Self
135+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlatLayout::new(vortex_layout::layouts::flat::FlatLayout) -> Self
100136

101137
impl core::clone::Clone for vortex_layout::layouts::array_tree::ArrayTreeFlatLayout
102138

@@ -1680,6 +1716,38 @@ pub fn vortex_layout::layouts::array_tree::ArrayTree::segment_ids(&Self::Layout)
16801716

16811717
pub fn vortex_layout::layouts::array_tree::ArrayTree::with_children(&mut Self::Layout, alloc::vec::Vec<vortex_layout::LayoutRef>) -> vortex_error::VortexResult<()>
16821718

1719+
impl vortex_layout::VTable for vortex_layout::layouts::array_tree::ArrayTreeFlat
1720+
1721+
pub type vortex_layout::layouts::array_tree::ArrayTreeFlat::Encoding = vortex_layout::layouts::array_tree::ArrayTreeFlatLayoutEncoding
1722+
1723+
pub type vortex_layout::layouts::array_tree::ArrayTreeFlat::Layout = vortex_layout::layouts::array_tree::ArrayTreeFlatLayout
1724+
1725+
pub type vortex_layout::layouts::array_tree::ArrayTreeFlat::Metadata = vortex_array::metadata::EmptyMetadata
1726+
1727+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::build(&Self::Encoding, &vortex_array::dtype::DType, u64, &vortex_array::metadata::EmptyMetadata, alloc::vec::Vec<vortex_layout::segments::SegmentId>, &dyn vortex_layout::LayoutChildren, &vortex_session::registry::ReadContext) -> vortex_error::VortexResult<Self::Layout>
1728+
1729+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::child(&Self::Layout, usize) -> vortex_error::VortexResult<vortex_layout::LayoutRef>
1730+
1731+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::child_type(&Self::Layout, usize) -> vortex_layout::LayoutChildType
1732+
1733+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::dtype(&Self::Layout) -> &vortex_array::dtype::DType
1734+
1735+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::encoding(&Self::Layout) -> vortex_layout::LayoutEncodingRef
1736+
1737+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::id(&Self::Encoding) -> vortex_layout::LayoutId
1738+
1739+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::metadata(&Self::Layout) -> Self::Metadata
1740+
1741+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::nchildren(&Self::Layout) -> usize
1742+
1743+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::new_reader(&Self::Layout, alloc::sync::Arc<str>, alloc::sync::Arc<dyn vortex_layout::segments::SegmentSource>, &vortex_session::VortexSession, &vortex_layout::LayoutReaderContext) -> vortex_error::VortexResult<vortex_layout::LayoutReaderRef>
1744+
1745+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::row_count(&Self::Layout) -> u64
1746+
1747+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::segment_ids(&Self::Layout) -> alloc::vec::Vec<vortex_layout::segments::SegmentId>
1748+
1749+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::with_children(&mut Self::Layout, alloc::vec::Vec<vortex_layout::LayoutRef>) -> vortex_error::VortexResult<()>
1750+
16831751
impl vortex_layout::VTable for vortex_layout::layouts::chunked::Chunked
16841752

16851753
pub type vortex_layout::layouts::chunked::Chunked::Encoding = vortex_layout::layouts::chunked::ChunkedLayoutEncoding
@@ -2298,6 +2366,38 @@ pub fn vortex_layout::layouts::array_tree::ArrayTree::segment_ids(&Self::Layout)
22982366

22992367
pub fn vortex_layout::layouts::array_tree::ArrayTree::with_children(&mut Self::Layout, alloc::vec::Vec<vortex_layout::LayoutRef>) -> vortex_error::VortexResult<()>
23002368

2369+
impl vortex_layout::VTable for vortex_layout::layouts::array_tree::ArrayTreeFlat
2370+
2371+
pub type vortex_layout::layouts::array_tree::ArrayTreeFlat::Encoding = vortex_layout::layouts::array_tree::ArrayTreeFlatLayoutEncoding
2372+
2373+
pub type vortex_layout::layouts::array_tree::ArrayTreeFlat::Layout = vortex_layout::layouts::array_tree::ArrayTreeFlatLayout
2374+
2375+
pub type vortex_layout::layouts::array_tree::ArrayTreeFlat::Metadata = vortex_array::metadata::EmptyMetadata
2376+
2377+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::build(&Self::Encoding, &vortex_array::dtype::DType, u64, &vortex_array::metadata::EmptyMetadata, alloc::vec::Vec<vortex_layout::segments::SegmentId>, &dyn vortex_layout::LayoutChildren, &vortex_session::registry::ReadContext) -> vortex_error::VortexResult<Self::Layout>
2378+
2379+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::child(&Self::Layout, usize) -> vortex_error::VortexResult<vortex_layout::LayoutRef>
2380+
2381+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::child_type(&Self::Layout, usize) -> vortex_layout::LayoutChildType
2382+
2383+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::dtype(&Self::Layout) -> &vortex_array::dtype::DType
2384+
2385+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::encoding(&Self::Layout) -> vortex_layout::LayoutEncodingRef
2386+
2387+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::id(&Self::Encoding) -> vortex_layout::LayoutId
2388+
2389+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::metadata(&Self::Layout) -> Self::Metadata
2390+
2391+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::nchildren(&Self::Layout) -> usize
2392+
2393+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::new_reader(&Self::Layout, alloc::sync::Arc<str>, alloc::sync::Arc<dyn vortex_layout::segments::SegmentSource>, &vortex_session::VortexSession, &vortex_layout::LayoutReaderContext) -> vortex_error::VortexResult<vortex_layout::LayoutReaderRef>
2394+
2395+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::row_count(&Self::Layout) -> u64
2396+
2397+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::segment_ids(&Self::Layout) -> alloc::vec::Vec<vortex_layout::segments::SegmentId>
2398+
2399+
pub fn vortex_layout::layouts::array_tree::ArrayTreeFlat::with_children(&mut Self::Layout, alloc::vec::Vec<vortex_layout::LayoutRef>) -> vortex_error::VortexResult<()>
2400+
23012401
impl vortex_layout::VTable for vortex_layout::layouts::chunked::Chunked
23022402

23032403
pub type vortex_layout::layouts::chunked::Chunked::Encoding = vortex_layout::layouts::chunked::ChunkedLayoutEncoding

vortex-layout/src/display.rs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,24 @@ use vortex_error::VortexResult;
1010
use vortex_utils::aliases::hash_map::HashMap;
1111

1212
use crate::LayoutRef;
13+
use crate::layouts::array_tree::ArrayTreeFlat;
1314
use crate::layouts::flat::Flat;
1415
use crate::layouts::flat::FlatLayout;
1516
use crate::segments::SegmentId;
1617
use crate::segments::SegmentSource;
1718

19+
/// Returns the inner [`FlatLayout`] that owns a data segment, regardless of whether the
20+
/// layout is a plain [`Flat`] or an [`ArrayTreeFlat`] (which wraps a [`FlatLayout`]).
21+
///
22+
/// Used by display routines that want to render leaf-layout buffer info uniformly across
23+
/// both encodings — the on-disk data segment shape is identical.
24+
fn as_flat_view(layout: &LayoutRef) -> Option<&FlatLayout> {
25+
if let Some(flat) = layout.as_opt::<Flat>() {
26+
return Some(flat);
27+
}
28+
layout.as_opt::<ArrayTreeFlat>().map(|atf| atf.inner())
29+
}
30+
1831
/// Display the layout as a tree, fetching segment sizes from the segment source.
1932
///
2033
/// # Warning
@@ -49,13 +62,18 @@ pub(super) async fn display_tree_with_segment_sizes(
4962
})
5063
}
5164

52-
/// Collect segment IDs that need to be fetched (those without inline array_tree).
65+
/// Collect segment IDs that need to be fetched.
66+
///
67+
/// For a [`Flat`] with an inline array_tree (the deprecated env-var path), buffer info can be
68+
/// parsed directly from the layout metadata — we skip those. Otherwise we fetch the data
69+
/// segment and parse its trailing flatbuffer. [`ArrayTreeFlat`] leaves have the same on-disk
70+
/// shape as a plain [`Flat`] (their compact tree is stored separately in the parent's
71+
/// auxiliary child), so we treat them the same here.
5372
fn collect_segments_to_fetch(
5473
layout: &LayoutRef,
5574
segment_ids: &mut Vec<SegmentId>,
5675
) -> VortexResult<()> {
57-
// For FlatLayout, only add if there's no inline array_tree
58-
if let Some(flat_layout) = layout.as_opt::<Flat>() {
76+
if let Some(flat_layout) = as_flat_view(layout) {
5977
if flat_layout.array_tree().is_none() {
6078
segment_ids.push(flat_layout.segment_id());
6179
}
@@ -146,8 +164,8 @@ impl DisplayLayoutTree {
146164
node_parts.push(format!("rows: {}", layout.row_count()));
147165
}
148166

149-
// For FlatLayout, show buffer info
150-
if let Some(flat_layout) = layout.as_opt::<Flat>() {
167+
// For FlatLayout (and ArrayTreeFlat which wraps one), show buffer info
168+
if let Some(flat_layout) = as_flat_view(&layout) {
151169
node_parts.push(format_flat_layout_buffers(
152170
flat_layout,
153171
self.segment_buffer_sizes.as_ref(),

vortex-layout/src/layouts/array_tree/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ use vortex_session::VortexSession;
3636
use vortex_session::registry::ReadContext;
3737
use vortex_utils::aliases::hash_map::HashMap;
3838

39+
pub use self::flat::ArrayTreeFlat;
3940
pub use self::flat::ArrayTreeFlatLayout;
4041
pub use self::flat::ArrayTreeFlatLayoutEncoding;
4142
use crate::LayoutChildType;
@@ -47,7 +48,6 @@ use crate::LayoutRef;
4748
use crate::VTable;
4849
use crate::children::LayoutChildren;
4950
use crate::children::OwnedLayoutChildren;
50-
use crate::layouts::array_tree::flat::ArrayTreeFlat;
5151
use crate::layouts::array_tree::reader::ArrayTreeFlatReader;
5252
use crate::layouts::array_tree::reader::ArrayTreeReader;
5353
use crate::segments::SegmentId;

vortex-layout/src/layouts/flat/mod.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
mod reader;
55
pub mod writer;
66

7+
use std::env;
78
use std::sync::Arc;
9+
use std::sync::LazyLock;
810

911
use vortex_array::DeserializeMetadata;
1012
use vortex_array::ProstMetadata;
@@ -29,6 +31,34 @@ use crate::segments::SegmentId;
2931
use crate::segments::SegmentSource;
3032
use crate::vtable;
3133

34+
/// Returns `true` if the `FLAT_LAYOUT_INLINE_ARRAY_NODE` environment variable is set to `1`,
35+
/// instructing the flat writer to inline each chunk's compact encoding tree as a trailing
36+
/// buffer in its data segment.
37+
///
38+
/// # Deprecation
39+
///
40+
/// This knob is retained for backward compatibility with files and tooling that depend on the
41+
/// inline encoding-tree footer. The supported path forward is to opt in to the
42+
/// `ArrayTreeLayout` outlining feature on the file write strategy
43+
/// (`WriteStrategyBuilder::with_array_tree(true)`), which consolidates encoding trees into a
44+
/// single auxiliary segment per column rather than scattering them across data segments.
45+
/// A one-shot warning is emitted on the first read of the env var so the deprecation is
46+
/// visible to operators.
47+
pub(super) fn flat_layout_inline_array_node() -> bool {
48+
static FLAT_LAYOUT_INLINE_ARRAY_NODE: LazyLock<bool> = LazyLock::new(|| {
49+
let enabled = env::var("FLAT_LAYOUT_INLINE_ARRAY_NODE").is_ok_and(|v| v == "1");
50+
if enabled {
51+
tracing::warn!(
52+
"FLAT_LAYOUT_INLINE_ARRAY_NODE is deprecated: prefer enabling ArrayTreeLayout \
53+
outlining via WriteStrategyBuilder::with_array_tree(true). The env var path \
54+
will be removed in a future release."
55+
);
56+
}
57+
enabled
58+
});
59+
*FLAT_LAYOUT_INLINE_ARRAY_NODE
60+
}
61+
3262
vtable!(Flat);
3363

3464
impl VTable for Flat {

0 commit comments

Comments
 (0)