Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lewiszlw committed Mar 26, 2024
1 parent d56fb1d commit da433e8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/function/covered_by.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ impl ScalarUDFImpl for CoveredByUdf {
_ => unreachable!(),
}
}

fn aliases(&self) -> &[String] {
&self.aliases
}
}

impl Default for CoveredByUdf {
Expand Down Expand Up @@ -129,14 +133,18 @@ mod tests {
ctx.register_udf(ScalarUDF::from(GeomFromTextUdf::new()));
ctx.register_udf(ScalarUDF::from(CoveredByUdf::new()));
let df = ctx
.sql("select ST_CoveredBy(ST_GeomFromText('LINESTRING ( 1 1, 0 2 )'), ST_GeomFromText('POINT(1 1)'))")
.sql("select ST_CoveredBy(ST_GeomFromText('POINT(1 1)'), ST_GeomFromText('LINESTRING ( 1 1, 0 2 )'))")
.await
.unwrap();
assert_eq!(
pretty_format_batches(&df.collect().await.unwrap())
.unwrap()
.to_string(),
""
"+----------------------------------------------------------------------------------------------------+
| ST_CoveredBy(ST_GeomFromText(Utf8(\"POINT(1 1)\")),ST_GeomFromText(Utf8(\"LINESTRING ( 1 1, 0 2 )\"))) |
+----------------------------------------------------------------------------------------------------+
| true |
+----------------------------------------------------------------------------------------------------+"
);
}
}
10 changes: 9 additions & 1 deletion src/function/covers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ impl ScalarUDFImpl for CoversUdf {
_ => unreachable!(),
}
}

fn aliases(&self) -> &[String] {
&self.aliases
}
}

impl Default for CoversUdf {
Expand Down Expand Up @@ -137,7 +141,11 @@ mod tests {
pretty_format_batches(&df.collect().await.unwrap())
.unwrap()
.to_string(),
""
"+-------------------------------------------------------------------------------------------------+
| ST_Covers(ST_GeomFromText(Utf8(\"LINESTRING ( 1 1, 0 2 )\")),ST_GeomFromText(Utf8(\"POINT(1 1)\"))) |
+-------------------------------------------------------------------------------------------------+
| true |
+-------------------------------------------------------------------------------------------------+"
);
}
}
10 changes: 9 additions & 1 deletion src/function/equals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ impl ScalarUDFImpl for EqualsUdf {
_ => unreachable!(),
}
}

fn aliases(&self) -> &[String] {
&self.aliases
}
}

impl Default for EqualsUdf {
Expand Down Expand Up @@ -137,7 +141,11 @@ mod tests {
pretty_format_batches(&df.collect().await.unwrap())
.unwrap()
.to_string(),
""
"+-----------------------------------------------------------------------------------------------------------------+
| ST_Equals(ST_GeomFromText(Utf8(\"LINESTRING(0 0, 10 10)\")),ST_GeomFromText(Utf8(\"LINESTRING(0 0, 5 5, 10 10)\"))) |
+-----------------------------------------------------------------------------------------------------------------+
| true |
+-----------------------------------------------------------------------------------------------------------------+"
);
}
}

0 comments on commit da433e8

Please sign in to comment.