-
Couldn't load subscription status.
- Fork 421
feat: support WITHIN filter
#5397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
523719e
af94d9c
e795edb
3c1dda1
e9754ed
9057bf6
6d519ac
58518ad
cbb6892
901bce2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -44,6 +44,7 @@ impl MathFunction { | |||||
| registry.register(Arc::new(RateFunction)); | ||||||
| registry.register(Arc::new(RangeFunction)); | ||||||
| registry.register(Arc::new(ClampFunction)); | ||||||
| registry.register(Arc::new(WithinFilterFunction)); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -87,3 +88,39 @@ impl Function for RangeFunction { | |||||
| .context(GeneralDataFusionSnafu) | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| #[derive(Clone, Debug, Default)] | ||||||
| struct WithinFilterFunction; | ||||||
|
|
||||||
| impl fmt::Display for WithinFilterFunction { | ||||||
| fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||||||
| write!(f, "WithinFilterFunction") | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| pub const WITHIN_FILTER_NAME: &str = "within_filter"; | ||||||
|
|
||||||
| impl Function for WithinFilterFunction { | ||||||
| fn name(&self) -> &str { | ||||||
| WITHIN_FILTER_NAME | ||||||
| } | ||||||
|
|
||||||
| fn return_type(&self, _input_types: &[ConcreteDataType]) -> Result<ConcreteDataType> { | ||||||
| Ok(ConcreteDataType::boolean_datatype()) | ||||||
| } | ||||||
|
|
||||||
| fn signature(&self) -> Signature { | ||||||
| Signature::uniform( | ||||||
| 2, | ||||||
| vec![ConcreteDataType::string_datatype()], | ||||||
| Volatility::Immutable, | ||||||
| ) | ||||||
| } | ||||||
|
|
||||||
| fn eval(&self, _func_ctx: FunctionContext, _columns: &[VectorRef]) -> Result<VectorRef> { | ||||||
| Err(DataFusionError::Internal( | ||||||
| "within_filter function just a empty function, it should not be eval!".into(), | ||||||
|
||||||
| "within_filter function just a empty function, it should not be eval!".into(), | |
| "The within_filter function is a placeholder and should not be evaluated.".into(), |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -58,6 +58,7 @@ use crate::query_engine::options::QueryOptions; | |||||||||||||||||||||||||||||
| use crate::query_engine::DefaultSerializer; | ||||||||||||||||||||||||||||||
| use crate::range_select::planner::RangeSelectPlanner; | ||||||||||||||||||||||||||||||
| use crate::region_query::RegionQueryHandlerRef; | ||||||||||||||||||||||||||||||
| use crate::within_filter::WithinFilterRule; | ||||||||||||||||||||||||||||||
| use crate::QueryEngineContext; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| /// Query engine global state | ||||||||||||||||||||||||||||||
|
|
@@ -93,10 +94,14 @@ impl QueryEngineState { | |||||||||||||||||||||||||||||
| let runtime_env = Arc::new(RuntimeEnv::default()); | ||||||||||||||||||||||||||||||
| let session_config = SessionConfig::new().with_create_default_catalog_and_schema(false); | ||||||||||||||||||||||||||||||
| // Apply extension rules | ||||||||||||||||||||||||||||||
| let mut extension_rules = Vec::new(); | ||||||||||||||||||||||||||||||
| // TODO: remove Vec<Arc<(dyn ExtensionAnalyzerRule + std::marker::Send + Sync + 'static)>> | ||||||||||||||||||||||||||||||
| let mut extension_rules: Vec< | ||||||||||||||||||||||||||||||
| Arc<(dyn ExtensionAnalyzerRule + std::marker::Send + Sync + 'static)>, | ||||||||||||||||||||||||||||||
| > = Vec::new(); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| // The [`TypeConversionRule`] must be at first | ||||||||||||||||||||||||||||||
| extension_rules.insert(0, Arc::new(TypeConversionRule) as _); | ||||||||||||||||||||||||||||||
| extension_rules.push(Arc::new(WithinFilterRule::new())); | ||||||||||||||||||||||||||||||
|
Comment on lines
+97
to
+104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| // Apply the datafusion rules | ||||||||||||||||||||||||||||||
| let mut analyzer = Analyzer::new(); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change the repo now?