Skip to content

Commit

Permalink
refactor: make structs public and implement Default trait (#14030)
Browse files Browse the repository at this point in the history
  • Loading branch information
dharanad authored Jan 6, 2025
1 parent b2f8e94 commit 4e877a0
Show file tree
Hide file tree
Showing 18 changed files with 125 additions and 17 deletions.
8 changes: 7 additions & 1 deletion datafusion/functions-nested/src/cardinality.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,16 @@ impl Cardinality {
)
)]
#[derive(Debug)]
pub(super) struct Cardinality {
pub struct Cardinality {
signature: Signature,
aliases: Vec<String>,
}

impl Default for Cardinality {
fn default() -> Self {
Self::new()
}
}
impl ScalarUDFImpl for Cardinality {
fn as_any(&self) -> &dyn Any {
self
Expand Down
8 changes: 7 additions & 1 deletion datafusion/functions-nested/src/dimension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,17 @@ make_udf_expr_and_func!(
)
)]
#[derive(Debug)]
pub(super) struct ArrayDims {
pub struct ArrayDims {
signature: Signature,
aliases: Vec<String>,
}

impl Default for ArrayDims {
fn default() -> Self {
Self::new()
}
}

impl ArrayDims {
pub fn new() -> Self {
Self {
Expand Down
8 changes: 7 additions & 1 deletion datafusion/functions-nested/src/distance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,17 @@ make_udf_expr_and_func!(
)
)]
#[derive(Debug)]
pub(super) struct ArrayDistance {
pub struct ArrayDistance {
signature: Signature,
aliases: Vec<String>,
}

impl Default for ArrayDistance {
fn default() -> Self {
Self::new()
}
}

impl ArrayDistance {
pub fn new() -> Self {
Self {
Expand Down
8 changes: 7 additions & 1 deletion datafusion/functions-nested/src/empty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,16 @@ make_udf_expr_and_func!(
)
)]
#[derive(Debug)]
pub(super) struct ArrayEmpty {
pub struct ArrayEmpty {
signature: Signature,
aliases: Vec<String>,
}

impl Default for ArrayEmpty {
fn default() -> Self {
Self::new()
}
}
impl ArrayEmpty {
pub fn new() -> Self {
Self {
Expand Down
8 changes: 7 additions & 1 deletion datafusion/functions-nested/src/except.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,17 @@ make_udf_expr_and_func!(
)
)]
#[derive(Debug)]
pub(super) struct ArrayExcept {
pub struct ArrayExcept {
signature: Signature,
aliases: Vec<String>,
}

impl Default for ArrayExcept {
fn default() -> Self {
Self::new()
}
}

impl ArrayExcept {
pub fn new() -> Self {
Self {
Expand Down
8 changes: 7 additions & 1 deletion datafusion/functions-nested/src/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,17 @@ make_udf_expr_and_func!(
)
)]
#[derive(Debug)]
pub(super) struct ArrayElement {
pub struct ArrayElement {
signature: Signature,
aliases: Vec<String>,
}

impl Default for ArrayElement {
fn default() -> Self {
Self::new()
}
}

impl ArrayElement {
pub fn new() -> Self {
Self {
Expand Down
8 changes: 7 additions & 1 deletion datafusion/functions-nested/src/map_extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,17 @@ SELECT map_extract(MAP {'x': 10, 'y': NULL, 'z': 30}, 'y');
)
)]
#[derive(Debug)]
pub(super) struct MapExtract {
pub struct MapExtract {
signature: Signature,
aliases: Vec<String>,
}

impl Default for MapExtract {
fn default() -> Self {
Self::new()
}
}

impl MapExtract {
pub fn new() -> Self {
Self {
Expand Down
8 changes: 7 additions & 1 deletion datafusion/functions-nested/src/map_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,16 @@ SELECT map_keys(map([100, 5], [42, 43]));
)
)]
#[derive(Debug)]
pub(crate) struct MapKeysFunc {
pub struct MapKeysFunc {
signature: Signature,
}

impl Default for MapKeysFunc {
fn default() -> Self {
Self::new()
}
}

impl MapKeysFunc {
pub fn new() -> Self {
Self {
Expand Down
6 changes: 6 additions & 0 deletions datafusion/functions-nested/src/map_values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ pub(crate) struct MapValuesFunc {
signature: Signature,
}

impl Default for MapValuesFunc {
fn default() -> Self {
Self::new()
}
}

impl MapValuesFunc {
pub fn new() -> Self {
Self {
Expand Down
8 changes: 7 additions & 1 deletion datafusion/functions-nested/src/position.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,16 @@ make_udf_expr_and_func!(
argument(name = "index", description = "Index at which to start searching.")
)]
#[derive(Debug)]
pub(super) struct ArrayPosition {
pub struct ArrayPosition {
signature: Signature,
aliases: Vec<String>,
}

impl Default for ArrayPosition {
fn default() -> Self {
Self::new()
}
}
impl ArrayPosition {
pub fn new() -> Self {
Self {
Expand Down
8 changes: 7 additions & 1 deletion datafusion/functions-nested/src/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,16 @@ make_udf_expr_and_func!(
)
)]
#[derive(Debug)]
pub(super) struct Range {
pub struct Range {
signature: Signature,
aliases: Vec<String>,
}

impl Default for Range {
fn default() -> Self {
Self::new()
}
}
impl Range {
pub fn new() -> Self {
Self {
Expand Down
8 changes: 7 additions & 1 deletion datafusion/functions-nested/src/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,17 @@ make_udf_expr_and_func!(
)
)]
#[derive(Debug)]
pub(super) struct ArrayRemove {
pub struct ArrayRemove {
signature: Signature,
aliases: Vec<String>,
}

impl Default for ArrayRemove {
fn default() -> Self {
Self::new()
}
}

impl ArrayRemove {
pub fn new() -> Self {
Self {
Expand Down
8 changes: 7 additions & 1 deletion datafusion/functions-nested/src/repeat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,17 @@ make_udf_expr_and_func!(
)
)]
#[derive(Debug)]
pub(super) struct ArrayRepeat {
pub struct ArrayRepeat {
signature: Signature,
aliases: Vec<String>,
}

impl Default for ArrayRepeat {
fn default() -> Self {
Self::new()
}
}

impl ArrayRepeat {
pub fn new() -> Self {
Self {
Expand Down
8 changes: 7 additions & 1 deletion datafusion/functions-nested/src/replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,17 @@ make_udf_expr_and_func!(ArrayReplaceAll,
argument(name = "to", description = "Final element.")
)]
#[derive(Debug)]
pub(super) struct ArrayReplace {
pub struct ArrayReplace {
signature: Signature,
aliases: Vec<String>,
}

impl Default for ArrayReplace {
fn default() -> Self {
Self::new()
}
}

impl ArrayReplace {
pub fn new() -> Self {
Self {
Expand Down
8 changes: 7 additions & 1 deletion datafusion/functions-nested/src/resize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,17 @@ make_udf_expr_and_func!(
)
)]
#[derive(Debug)]
pub(super) struct ArrayResize {
pub struct ArrayResize {
signature: Signature,
aliases: Vec<String>,
}

impl Default for ArrayResize {
fn default() -> Self {
Self::new()
}
}

impl ArrayResize {
pub fn new() -> Self {
Self {
Expand Down
8 changes: 7 additions & 1 deletion datafusion/functions-nested/src/reverse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,17 @@ make_udf_expr_and_func!(
)
)]
#[derive(Debug)]
pub(super) struct ArrayReverse {
pub struct ArrayReverse {
signature: Signature,
aliases: Vec<String>,
}

impl Default for ArrayReverse {
fn default() -> Self {
Self::new()
}
}

impl ArrayReverse {
pub fn new() -> Self {
Self {
Expand Down
8 changes: 7 additions & 1 deletion datafusion/functions-nested/src/set_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,17 @@ make_udf_expr_and_func!(
)
)]
#[derive(Debug)]
pub(super) struct ArrayUnion {
pub struct ArrayUnion {
signature: Signature,
aliases: Vec<String>,
}

impl Default for ArrayUnion {
fn default() -> Self {
Self::new()
}
}

impl ArrayUnion {
pub fn new() -> Self {
Self {
Expand Down
8 changes: 7 additions & 1 deletion datafusion/functions-nested/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,17 @@ make_udf_expr_and_func!(
)
)]
#[derive(Debug)]
pub(super) struct ArrayToString {
pub struct ArrayToString {
signature: Signature,
aliases: Vec<String>,
}

impl Default for ArrayToString {
fn default() -> Self {
Self::new()
}
}

impl ArrayToString {
pub fn new() -> Self {
Self {
Expand Down

0 comments on commit 4e877a0

Please sign in to comment.