Skip to content

[WIP] Vectorized scalar types - #179

Draft
artjomPlaunov wants to merge 14 commits into
duckdb:mainfrom
artjomPlaunov:vectorized-scalar-types
Draft

[WIP] Vectorized scalar types#179
artjomPlaunov wants to merge 14 commits into
duckdb:mainfrom
artjomPlaunov:vectorized-scalar-types

Conversation

@artjomPlaunov

@artjomPlaunov artjomPlaunov commented Sep 2, 2026

Copy link
Copy Markdown
Member

Do not review yet, this depends on #175 going in first, and is currently just a sketch to get a feel for what we want the API to look like, before actually committing to the API + adding nested types on top of this as a subsequent PR.

// check_amount(DECIMAL(4,2), DECIMAL(38,2), TIMESTAMP) -> BOOLEAN

smallVector, _ := state.GetInputChunk().GetVector(0)
largeVector, _ := state.GetInputChunk().GetVector(1)
timeVector, _ := state.GetInputChunk().GetVector(2)

small, _ := duckdb.GetVectorView[duckdb.DecimalValue](smallVector)
large, _ := duckdb.GetVectorView[duckdb.DecimalValue](largeVector)
timestamps, _ := duckdb.GetVectorView[time.Time](timeVector)

result, _ := duckdb.GetVectorWriter[bool](state.GetResultVector())

for row := range small.Len() {
	a, aValid, _ := small.GetValue(row) // DECIMAL backed by INT16
	b, bValid, _ := large.GetValue(row) // DECIMAL backed by HUGEINT
	ts, tsValid, _ := timestamps.GetValue(row)

	if aValid && bValid && tsValid {
		_ = result.Set(row,
			a.Unscaled == b.Unscaled && ts.Year() >= 2025,
		)
	}
}

@artjomPlaunov
artjomPlaunov marked this pull request as draft September 2, 2026 11:11
@artjomPlaunov
artjomPlaunov force-pushed the vectorized-scalar-types branch from ea093e1 to d7f7ef5 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