Skip to content

Commit

Permalink
Reformatted
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-sjayabalan committed Aug 15, 2024
1 parent d14ff9f commit cb7e041
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
5 changes: 2 additions & 3 deletions src/main/java/com/snowflake/snowpark_java/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -3882,7 +3882,7 @@ public static Column listagg(Column col) {
}

/**
*
* Signature - snowflake.snowpark.functions.regexp_extract (value: Union[Column, str], regexp:
* Union[Column, str], idx: int) Column Extract a specific group matched by a regex, from the
* specified string column. If the regex did not match, or the specified group did not match, an
Expand Down Expand Up @@ -3995,7 +3995,7 @@ public static Column collect_list(Column col) {
return new Column(com.snowflake.snowpark.functions.collect_list(col.toScalaColumn()));
}

* Returns a Column expression with values sorted in descending order.
/* Returns a Column expression with values sorted in descending order.
*
* <p>Example: order column values in descending
*
Expand Down Expand Up @@ -4166,7 +4166,6 @@ public static Column last(Column col) {
return new Column(functions.last(col.toScalaColumn()));
}


/**
* Calls a user-defined function (UDF) by name.
*
Expand Down
3 changes: 1 addition & 2 deletions src/main/scala/com/snowflake/snowpark/functions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3328,7 +3328,7 @@ object functions {
*/
def collect_list(s: String): Column = array_agg(col(s))

* Returns a Column expression with values sorted in descending order.
/* Returns a Column expression with values sorted in descending order.
* Example:
* {{{
* val df = session.createDataFrame(Seq(1, 2, 3)).toDF("id")
Expand Down Expand Up @@ -3498,7 +3498,6 @@ object functions {
def last(c: Column): Column =
builtin("LAST_VALUE")(c)


/**
* Invokes a built-in snowflake function with the specified name and arguments.
* Arguments can be of two types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2766,7 +2766,6 @@ public void any_value() {
}

@Test

public void regexp_extract() {
DataFrame df = getSession().sql("select * from values('A MAN A PLAN A CANAL') as T(a)");
Row[] expected = {Row.create("MAN")};
Expand Down Expand Up @@ -2813,6 +2812,8 @@ public void substring_index() {
checkAnswer(
df.select(Functions.substring_index(df.col("a"), "was", 1)),
new Row[] {Row.create(7)},
false);
}

public void test_asc() {
DataFrame df = getSession().sql("select * from values(3),(1),(2) as t(a)");
Expand Down Expand Up @@ -2874,7 +2875,6 @@ public void last() {
Functions.last(df.col("name"))
.over(Window.partitionBy(df.col("grade")).orderBy(df.col("score").desc()))),
expected,

false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2195,7 +2195,6 @@ trait FunctionSuite extends TestData {
expected,
sort = false)


expected = Seq(Row(null))
checkAnswer(
data.select(regexp_extract(col("a"), "A\\W+(\\w+)", 1, 4, 1)),
Expand All @@ -2221,7 +2220,7 @@ trait FunctionSuite extends TestData {
val df = Seq("It was the best of times, it was the worst of times").toDF("a")
checkAnswer(df.select(substring_index(col("a"), "was", 1)), Seq(Row(7)), sort = false)
}

test("desc column order") {
val input = Seq(1, 2, 3).toDF("data")
val expected = Seq(3, 2, 1).toDF("data")
Expand Down Expand Up @@ -2289,7 +2288,6 @@ trait FunctionSuite extends TestData {
sort = false)
}


}

class EagerFunctionSuite extends FunctionSuite with EagerSession
Expand Down

0 comments on commit cb7e041

Please sign in to comment.