Skip to content

[WIP] Vectorized struct types - #180

Draft
artjomPlaunov wants to merge 15 commits into
duckdb:mainfrom
artjomPlaunov:vectorized-struct-types
Draft

[WIP] Vectorized struct types#180
artjomPlaunov wants to merge 15 commits into
duckdb:mainfrom
artjomPlaunov:vectorized-struct-types

Conversation

@artjomPlaunov

Copy link
Copy Markdown
Member

WIP, do not review yet; depends on #175 and #179 going in first.

// STRUCT(
//     amounts STRUCT(
//         small DECIMAL(4,2),   -- backed by INT16
//         large DECIMAL(38,2)   -- backed by HUGEINT
//     )
// ) -> BOOLEAN

inputVector, _ := state.GetInputChunk().GetVector(0)
input, _ := duckdb.GetStructView(inputVector)

smallVector, _ := input.Field("amounts", "small")
largeVector, _ := input.Field("amounts", "large")

small, _ := duckdb.GetVectorView[duckdb.DecimalValue](smallVector)
large, _ := duckdb.GetVectorView[duckdb.DecimalValue](largeVector)
result, _ := duckdb.GetVectorWriter[bool](state.GetResultVector())

for row := range input.Len() {
	a, aValid, _ := small.GetValue(row)
	b, bValid, _ := large.GetValue(row)

	if !aValid || !bValid {
		_ = result.SetNull(row)
		continue
	}

	_ = result.Set(row, a.Unscaled == b.Unscaled)
}

@artjomPlaunov
artjomPlaunov marked this pull request as draft September 2, 2026 11:32
@artjomPlaunov
artjomPlaunov force-pushed the vectorized-struct-types branch from bb2dd23 to 154c11e Compare September 3, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant