Skip to content

Commit 70cf68b

Browse files
frankmcsherryclaude
andcommitted
repr: catch spike up to current main (re-migrate drifted refs + tests)
Rebased the int-unification spike onto current main. The base spike commit cherry-picked cleanly; this commit re-applies the mechanical follow-on work against the new base and migrates the references that landed in main after the original branch point (#37155, #37177, #36776 count-aware-aggregates, #36984): - production: signed-sum fold + SumInt16/32 narrow (relation/func.rs), the generate_series-unoptimized literal (sql/func.rs), and the generate_series collapse (projection_pushdown.rs: ReprScalarType::Int64 -> Int, and the literal_i64 closure's int2/4/8 arms collapse to one Datum::Int arm). - test/bench/doctest: ~292 Datum::IntN -> Datum::Int/UInt sites, plus the PropDatum::Int32 narrowings and an i64-typed literal in casts.rs. Workspace builds clean under --all-targets. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent dc7f7de commit 70cf68b

29 files changed

Lines changed: 257 additions & 259 deletions

File tree

src/adapter/src/coord.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5435,7 +5435,7 @@ mod arrangement_sizes_pruner_tests {
54355435
Row::pack_slice(&[
54365436
Datum::String("r1"),
54375437
Datum::String("u1"),
5438-
Datum::Int64(123),
5438+
Datum::Int(123),
54395439
Datum::TimestampTz(dt.try_into().expect("fits in TimestampTz")),
54405440
])
54415441
}

src/adapter/src/coord/peek.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1533,7 +1533,7 @@ mod tests {
15331533
let lookup = FastPathPlan::PeekExisting(
15341534
GlobalId::User(9),
15351535
GlobalId::User(11),
1536-
Some(vec![Row::pack(Some(Datum::Int32(5)))]),
1536+
Some(vec![Row::pack(Some(Datum::Int(5)))]),
15371537
MapFilterProject::new(3)
15381538
.filter(Some(
15391539
MirScalarExpr::column(0).call_unary(UnaryFunc::IsNull(IsNull)),

src/arrow-util/src/reader.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,8 +1040,8 @@ mod tests {
10401040

10411041
packer.extend([
10421042
Datum::True,
1043-
Datum::Int32(42),
1044-
Datum::UInt64(10000),
1043+
Datum::Int(42),
1044+
Datum::UInt(10000),
10451045
Datum::Float32(OrderedFloat::from(-1.1f32)),
10461046
Datum::String("hello world"),
10471047
Datum::Bytes(b"1010101"),
@@ -1052,7 +1052,7 @@ mod tests {
10521052
serde_json::json!({"code": 200, "email": "space_monkey@materialize.com"}),
10531053
)
10541054
.expect("failed to pack JSON");
1055-
packer.push_list([Datum::UInt32(200), Datum::UInt32(300)]);
1055+
packer.push_list([Datum::UInt(200), Datum::UInt(300)]);
10561056

10571057
let null_row = Row::pack(vec![Datum::Null; 9]);
10581058

@@ -1248,11 +1248,11 @@ mod tests {
12481248
.push_range(Range::new(Some((
12491249
RangeLowerBound {
12501250
inclusive: true,
1251-
bound: Some(Datum::Int32(1)),
1251+
bound: Some(Datum::Int(1)),
12521252
},
12531253
RangeUpperBound {
12541254
inclusive: true,
1255-
bound: Some(Datum::Int32(10)),
1255+
bound: Some(Datum::Int(10)),
12561256
},
12571257
))))
12581258
.unwrap();
@@ -1266,11 +1266,11 @@ mod tests {
12661266
.push_range(Range::new(Some((
12671267
RangeLowerBound {
12681268
inclusive: false,
1269-
bound: Some(Datum::Int32(5)),
1269+
bound: Some(Datum::Int(5)),
12701270
},
12711271
RangeUpperBound {
12721272
inclusive: false,
1273-
bound: Some(Datum::Int32(15)),
1273+
bound: Some(Datum::Int(15)),
12741274
},
12751275
))))
12761276
.unwrap();

src/catalog/src/expr_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ mod tests {
776776
/// That's sufficient for the expr cache tests, since the cache mostly treats expressions as
777777
/// opaque objects.
778778
fn gen_local_expressions() -> LocalExpressions {
779-
let datum = Datum::UInt64(rand::random());
779+
let datum = Datum::UInt(rand::random());
780780

781781
LocalExpressions {
782782
local_mir: OptimizedMirRelationExpr(MirRelationExpr::constant(

src/compute/benches/columnar_merge_batcher_row.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ fn make_row(key: u64) -> Row {
8787
let s = format!("k{:024x}", key);
8888
let mut row = Row::default();
8989
row.packer()
90-
.extend([Datum::Int64(i64::reinterpret_cast(key)), Datum::String(&s)]);
90+
.extend([Datum::Int(i64::reinterpret_cast(key)), Datum::String(&s)]);
9191
row
9292
}
9393

src/compute/benches/columnar_merger_row.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const SIZES: &[(&str, usize)] = &[
6161
];
6262

6363
/// Encoded Row payload size estimate used to derive element counts from
64-
/// byte targets. Each row carries `Datum::Int64(key)` plus a 24-char
64+
/// byte targets. Each row carries `Datum::Int(key)` plus a 24-char
6565
/// hex-string suffix; the columnar encoding is not byte-exact but lands
6666
/// near this number for both representations.
6767
const ROW_PAYLOAD_BYTES: usize = 32;
@@ -78,7 +78,7 @@ fn make_row(key: u64) -> Row {
7878
let s = format!("k{:024x}", key);
7979
let mut row = Row::default();
8080
row.packer()
81-
.extend([Datum::Int64(i64::reinterpret_cast(key)), Datum::String(&s)]);
81+
.extend([Datum::Int(i64::reinterpret_cast(key)), Datum::String(&s)]);
8282
row
8383
}
8484

@@ -162,7 +162,7 @@ fn configs(n: usize) -> [(&'static str, Vec<Tuple>, Vec<Tuple>); 3] {
162162
// string-suffix invariant intact.
163163
let datums: Vec<Datum> = d.iter().collect();
164164
let key = match datums[0] {
165-
Datum::Int64(k) => u64::reinterpret_cast(k) + n_u64,
165+
Datum::Int(k) => u64::reinterpret_cast(k) + n_u64,
166166
_ => unreachable!(),
167167
};
168168
(make_row(key), t, r)

src/compute/benches/correction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ fn make_correction(version: Version, metrics: &SinkMetrics) -> Corr {
165165

166166
fn row(key: u64, value: u64) -> Row {
167167
let payload = format!("payload-{value:016}");
168-
Row::pack_slice(&[Datum::UInt64(key), Datum::String(&payload)])
168+
Row::pack_slice(&[Datum::UInt(key), Datum::String(&payload)])
169169
}
170170

171171
/// Generate one batch of updates per distinct timestamp `0..num_ts`.

src/expr/benches/case_literal.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn if_then_else(cond: MirScalarExpr, then: MirScalarExpr, els: MirScalarExpr) ->
3232

3333
/// Build an i64 literal.
3434
fn lit_i64(v: i64) -> MirScalarExpr {
35-
MirScalarExpr::literal_ok(Datum::Int64(v), ReprScalarType::Int)
35+
MirScalarExpr::literal_ok(Datum::Int(v), ReprScalarType::Int)
3636
}
3737

3838
/// Column reference.
@@ -56,7 +56,7 @@ fn build_case_literal(n: usize) -> MirScalarExpr {
5656
let scalar = build_if_chain(n);
5757
let mut relation = mz_expr::MirRelationExpr::Map {
5858
input: Box::new(mz_expr::MirRelationExpr::constant(
59-
vec![vec![Datum::Int64(0)]],
59+
vec![vec![Datum::Int(0)]],
6060
ReprRelationType::new(vec![ReprColumnType {
6161
scalar_type: ReprScalarType::Int,
6262
nullable: false,
@@ -95,7 +95,7 @@ fn bench_case_literal(c: &mut Criterion) {
9595
];
9696

9797
for &(scenario, input) in scenarios {
98-
let datums = [Datum::Int64(input)];
98+
let datums = [Datum::Int(input)];
9999

100100
group.bench_function(format!("if_chain/{n}_arms/{scenario}"), |b| {
101101
b.iter(|| black_box(&if_chain).eval(black_box(&datums), black_box(&arena)))

src/expr/benches/window_functions.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,17 @@ fn order_aggregate_datums_benchmark(c: &mut Criterion) {
7575
for _i in 0..scale {
7676
datums.push(temp_storage.make_datum(|packer| {
7777
let orig_row_and_args = temp_storage.make_datum(|packer| {
78-
packer.push(Datum::Int32(3));
79-
packer.push(Datum::Int32(545577777));
80-
packer.push(Datum::Int32(123456789));
78+
packer.push(Datum::Int(3));
79+
packer.push(Datum::Int(545577777));
80+
packer.push(Datum::Int(123456789));
8181
packer.push(Datum::String("aaaaaaaaaa"));
8282
});
8383

8484
// An early version had non-random stuff here, but surprisingly this is much faster
8585
// to sort, so it's not representative.
86-
//let order_by_col_1 = Datum::Int32((scale - i) as i32);
86+
//let order_by_col_1 = Datum::Int((scale - i) as i32);
8787
// This is faster, probably because Int32 is easier to decode than a Timestamp.
88-
//let order_by_col_1 = Datum::Int32(distr.sample(&mut rng));
88+
//let order_by_col_1 = Datum::Int(distr.sample(&mut rng));
8989
// So, we generate a random timestamp. Timestamps are a common thing to order by in
9090
// window functions.
9191
let order_by_col_1 = Datum::TimestampTz(

src/expr/src/interpret.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,7 @@ mod tests {
17191719
func: Eq.into(),
17201720
expr1: Box::new(MirScalarExpr::column(0)),
17211721
expr2: Box::new(MirScalarExpr::literal_ok(
1722-
Datum::Int32(1727694505),
1722+
Datum::Int(1727694505),
17231723
ReprScalarType::Int,
17241724
)),
17251725
},
@@ -1732,7 +1732,7 @@ mod tests {
17321732
let relation = ReprRelationType::new(vec![ReprScalarType::Int.nullable(true)]);
17331733
let arena = RowArena::new();
17341734
let mut interpreter = ColumnSpecs::new(&relation, &arena);
1735-
interpreter.push_column(0, ResultSpec::value(Datum::Int32(-1294725158)));
1735+
interpreter.push_column(0, ResultSpec::value(Datum::Int(-1294725158)));
17361736
let spec = interpreter.mfp_filter(&mfp);
17371737
assert!(spec.range.may_fail());
17381738
}
@@ -1758,7 +1758,7 @@ mod tests {
17581758
#[mz_ore::test]
17591759
fn test_eval_range() {
17601760
// Example inspired by the tumbling windows temporal filter in the docs
1761-
let period_ms = MirScalarExpr::literal_ok(Datum::Int64(10), ReprScalarType::Int);
1761+
let period_ms = MirScalarExpr::literal_ok(Datum::Int(10), ReprScalarType::Int);
17621762
let expr = MirScalarExpr::CallBinary {
17631763
func: Gte.into(),
17641764
expr1: Box::new(MirScalarExpr::CallUnmaterializable(

0 commit comments

Comments
 (0)