berkaysynnada commented on code in PR #11584: URL: https://github.com/apache/datafusion/pull/11584#discussion_r1687532640
########## datafusion/expr/src/interval_arithmetic.rs: ########## @@ -332,6 +332,46 @@ impl Interval { Ok(Self::new(unbounded_endpoint.clone(), unbounded_endpoint)) } + /// Creates an interval between -∞ to ∞. + pub fn make_infinity_interval(data_type: &DataType) -> Result<Self> { + Self::try_new( + ScalarValue::new_neg_infinity(data_type)?, + ScalarValue::new_infinity(data_type)?, + ) + } + + /// Creates an interval between -1 to 1. + pub fn make_symmetric_unit_interval(data_type: &DataType) -> Result<Self> { + Self::try_new( + ScalarValue::new_negative_one(data_type)?, + ScalarValue::new_one(data_type)?, + ) + } + + /// Create an interval from -π to π. + pub fn make_symmetric_pi_interval(data_type: &DataType) -> Result<Self> { + Self::try_new( + ScalarValue::new_negative_pi(data_type)?, + ScalarValue::new_pi(data_type)?, + ) + } + + /// Create an interval from -π/2 to π/2. + pub fn make_symmetric_half_pi_interval(data_type: &DataType) -> Result<Self> { + Self::try_new( + ScalarValue::new_neg_frac_pi_2(data_type)?, + ScalarValue::new_frac_pi_2(data_type)?, + ) + } + + /// Create an interval from 0 to infinity. + pub fn make_non_negative_infinity_interval(data_type: &DataType) -> Result<Self> { Review Comment: Same suggestion applies here as well -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org