Skip to content

Conversation

@connortsui20
Copy link
Contributor

@connortsui20 connortsui20 commented Feb 12, 2026

TODO

Right now this doesn't compile because it is blocked on a few other things. The tests in vortex-scalar do pass though (when it does compile), so not everything is terrible

Signed-off-by: Connor Tsui <[email protected]>
@connortsui20 connortsui20 requested a review from gatesn February 12, 2026 20:55
@connortsui20 connortsui20 added the changelog/break A breaking API change label Feb 12, 2026
Copy link
Contributor

@gatesn gatesn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have a think about how we can attach logic to the ExtDTypeVTable such that we don't need to provide the session if we already have a DType

/// Unlike [`try_downcast`], this borrows rather than consuming `self`.
///
/// [`try_downcast`]: ExtScalarValueRef::try_downcast
pub fn try_get_vtable<V: ExtScalarVTable>(&self) -> Option<&V> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be keen to try and remove functions like this, they're probably superfluous / not called?

/// # Errors
///
/// Returns an error if the underlying [`fmt::Write`] operation fails.
pub fn fmt_ext_scalar(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have this function on the public API?

///
/// Note that this is not strictly necessary since [`ExtScalarValueAdapter`] and
/// [`ExtScalarValueAdapterImpl`] are both private to this module, this is just for hygiene.
mod sealed {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You added sealed for scalars, but removed it for dtypes?

/// [`ExtScalarValueAdapter`].
///
/// [`ExtDTypeImpl`]: vortex_dtype::extension
trait ExtScalarValueAdapterImpl: sealed::Sealed + 'static + Send + Sync {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think DynExtScalarValue is a bit neater than AdapterImpl

ExtDTypeVTable::id(self)
}

fn create_ext_scalar_value_ref(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fn build is what we call it in array land?

mod bool;
mod decimal;
mod extension;
mod ext;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the name change? Needless API churn

}

#[test]
#[should_panic(expected = "Cannot convert extension scalar")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should still panic shouldn't it?

pub fn extension<V: ExtScalarVTable + Default>(metadata: V::Metadata, value: Scalar) -> Self {
let ext_dtype = ExtDType::<V>::try_new(metadata, value.dtype().clone())
.vortex_expect("Failed to create extension dtype");
let storage_value = value.into_value();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can value.into_parts() to avoid the dtype clone above.
Also rename value -> storage

/// # Errors
///
/// Returns an error if the given [`DType`] and [`ScalarValue`] are incompatible.
pub fn validate(dtype: &DType, value: Option<&ScalarValue>) -> VortexResult<()> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious if this actually needs to be public

}

/// Check if the given [`ScalarValue`] is compatible with the given [`DType`].
pub fn is_compatible(dtype: &DType, value: Option<&ScalarValue>) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/break A breaking API change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants