From 7bb593ef7e01d197d48f56eba8ebbf8914b574aa Mon Sep 17 00:00:00 2001 From: Jimmy Lu Date: Thu, 24 Oct 2024 16:08:51 -0700 Subject: [PATCH] Add fb_regex_match_any (#11273) Summary: X-link: https://github.com/facebookexternal/presto-facebook/pull/3019 Reviewed By: kevinwilfong Differential Revision: D64356475 --- velox/vector/BaseVector.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/velox/vector/BaseVector.h b/velox/vector/BaseVector.h index 18f5725d4e767..ec9ce0a0d883b 100644 --- a/velox/vector/BaseVector.h +++ b/velox/vector/BaseVector.h @@ -145,6 +145,28 @@ class BaseVector { return static_cast(this); } + template + T* asChecked() { + auto* casted = as(); + VELOX_CHECK_NOT_NULL( + casted, + "Wrong type cast expected {}, but got {}", + typeid(T).name(), + typeid(*this).name()); + return casted; + } + + template + const T* asChecked() const { + auto* casted = as(); + VELOX_CHECK_NOT_NULL( + casted, + "Wrong type cast expected {}, but got {}", + typeid(T).name(), + typeid(*this).name()); + return casted; + } + template const FlatVector* asFlatVector() const { return dynamic_cast*>(this);