Skip to content

Commit

Permalink
fix formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-bli committed Aug 19, 2024
1 parent eb044e0 commit f8a0bb1
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 94 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/code-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ on:
branches: [ main ]
pull_request:
branches: '**'

jobs:
test:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup JDK
uses: actions/setup-java@v3
- name: Checkout Code
uses: actions/checkout@v2
- name: Install Java
uses: actions/setup-java@v1
with:
distribution: temurin
java-version: 8
- name: Check Code Format
java-version: 1.8
- name: Check Format
run: scripts/format_checker.sh
6 changes: 2 additions & 4 deletions src/main/scala/com/snowflake/snowpark/functions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1024,8 +1024,7 @@ object functions {
* Seq(("many-many-words", "-"), ("hello--hello", "--"))).toDF("V", "D")
* df.select(split(col("V"), col("D"))).show()
* }}}
* -------------------------
* \|"SPLIT(""V"", ""D"")" | -------------------------
* ------------------------- \|"SPLIT(""V"", ""D"")" | -------------------------
* | [ |
* |:---------|
* | "many", |
Expand All @@ -1043,8 +1042,7 @@ object functions {
* val df = session.createDataFrame(Seq("many-many-words", "hello-hi-hello")).toDF("V")
* df.select(split(col("V"), lit("-"))).show()
* }}}
* -------------------------
* \|"SPLIT(""V"", ""D"")" | -------------------------
* ------------------------- \|"SPLIT(""V"", ""D"")" | -------------------------
* | [ |
* |:---------|
* | "many", |
Expand Down
172 changes: 92 additions & 80 deletions src/main/scala/com/snowflake/snowpark/internal/ScalaFunctions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -559,10 +559,10 @@ object ScalaFunctions {
.foreach(isSupported(_))
isSupported(typeOf[RT])
val returnColumn = schemaForWrapper[RT]
val inputColumns
: Seq[UdfColumnSchema] = schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: Nil
val inputColumns: Seq[UdfColumnSchema] =
schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: Nil
UserDefinedFunction(func, returnColumn, inputColumns)
}

Expand Down Expand Up @@ -694,12 +694,12 @@ object ScalaFunctions {
).foreach(isSupported(_))
isSupported(typeOf[RT])
val returnColumn = schemaForWrapper[RT]
val inputColumns
: Seq[UdfColumnSchema] = schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: schemaForWrapper[
A7
] :: schemaForWrapper[A8] :: schemaForWrapper[A9] :: schemaForWrapper[A10] :: Nil
val inputColumns: Seq[UdfColumnSchema] =
schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: schemaForWrapper[
A7
] :: schemaForWrapper[A8] :: schemaForWrapper[A9] :: schemaForWrapper[A10] :: Nil
UserDefinedFunction(func, returnColumn, inputColumns)
}

Expand Down Expand Up @@ -882,14 +882,16 @@ object ScalaFunctions {
).foreach(isSupported(_))
isSupported(typeOf[RT])
val returnColumn = schemaForWrapper[RT]
val inputColumns
: Seq[UdfColumnSchema] = schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: schemaForWrapper[
A7
] :: schemaForWrapper[A8] :: schemaForWrapper[A9] :: schemaForWrapper[A10] :: schemaForWrapper[
A11
] :: schemaForWrapper[A12] :: schemaForWrapper[A13] :: schemaForWrapper[A14] :: Nil
val inputColumns: Seq[UdfColumnSchema] =
schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: schemaForWrapper[
A7
] :: schemaForWrapper[A8] :: schemaForWrapper[A9] :: schemaForWrapper[
A10
] :: schemaForWrapper[
A11
] :: schemaForWrapper[A12] :: schemaForWrapper[A13] :: schemaForWrapper[A14] :: Nil
UserDefinedFunction(func, returnColumn, inputColumns)
}

Expand Down Expand Up @@ -1071,16 +1073,18 @@ object ScalaFunctions {
).foreach(isSupported(_))
isSupported(typeOf[RT])
val returnColumn = schemaForWrapper[RT]
val inputColumns
: Seq[UdfColumnSchema] = schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: schemaForWrapper[
A7
] :: schemaForWrapper[A8] :: schemaForWrapper[A9] :: schemaForWrapper[A10] :: schemaForWrapper[
A11
] :: schemaForWrapper[A12] :: schemaForWrapper[A13] :: schemaForWrapper[
A14
] :: schemaForWrapper[A15] :: schemaForWrapper[A16] :: schemaForWrapper[A17] :: Nil
val inputColumns: Seq[UdfColumnSchema] =
schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: schemaForWrapper[
A7
] :: schemaForWrapper[A8] :: schemaForWrapper[A9] :: schemaForWrapper[
A10
] :: schemaForWrapper[
A11
] :: schemaForWrapper[A12] :: schemaForWrapper[A13] :: schemaForWrapper[
A14
] :: schemaForWrapper[A15] :: schemaForWrapper[A16] :: schemaForWrapper[A17] :: Nil
UserDefinedFunction(func, returnColumn, inputColumns)
}

Expand Down Expand Up @@ -1328,18 +1332,20 @@ object ScalaFunctions {
).foreach(isSupported(_))
isSupported(typeOf[RT])
val returnColumn = schemaForWrapper[RT]
val inputColumns
: Seq[UdfColumnSchema] = schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: schemaForWrapper[
A7
] :: schemaForWrapper[A8] :: schemaForWrapper[A9] :: schemaForWrapper[A10] :: schemaForWrapper[
A11
] :: schemaForWrapper[A12] :: schemaForWrapper[A13] :: schemaForWrapper[
A14
] :: schemaForWrapper[A15] :: schemaForWrapper[A16] :: schemaForWrapper[
A17
] :: schemaForWrapper[A18] :: schemaForWrapper[A19] :: schemaForWrapper[A20] :: Nil
val inputColumns: Seq[UdfColumnSchema] =
schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: schemaForWrapper[
A7
] :: schemaForWrapper[A8] :: schemaForWrapper[A9] :: schemaForWrapper[
A10
] :: schemaForWrapper[
A11
] :: schemaForWrapper[A12] :: schemaForWrapper[A13] :: schemaForWrapper[
A14
] :: schemaForWrapper[A15] :: schemaForWrapper[A16] :: schemaForWrapper[
A17
] :: schemaForWrapper[A18] :: schemaForWrapper[A19] :: schemaForWrapper[A20] :: Nil
UserDefinedFunction(func, returnColumn, inputColumns)
}

Expand Down Expand Up @@ -1843,10 +1849,10 @@ object ScalaFunctions {
.foreach(isSupported)
isSupported(typeOf[RT])
val returnColumn = schemaForWrapper[RT]
val inputColumns
: Seq[UdfColumnSchema] = schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: Nil
val inputColumns: Seq[UdfColumnSchema] =
schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: Nil
StoredProcedure(sp, returnColumn, inputColumns)
}

Expand Down Expand Up @@ -1978,12 +1984,12 @@ object ScalaFunctions {
).foreach(isSupported)
isSupported(typeOf[RT])
val returnColumn = schemaForWrapper[RT]
val inputColumns
: Seq[UdfColumnSchema] = schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: schemaForWrapper[
A7
] :: schemaForWrapper[A8] :: schemaForWrapper[A9] :: schemaForWrapper[A10] :: Nil
val inputColumns: Seq[UdfColumnSchema] =
schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: schemaForWrapper[
A7
] :: schemaForWrapper[A8] :: schemaForWrapper[A9] :: schemaForWrapper[A10] :: Nil
StoredProcedure(sp, returnColumn, inputColumns)
}

Expand Down Expand Up @@ -2166,14 +2172,16 @@ object ScalaFunctions {
).foreach(isSupported)
isSupported(typeOf[RT])
val returnColumn = schemaForWrapper[RT]
val inputColumns
: Seq[UdfColumnSchema] = schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: schemaForWrapper[
A7
] :: schemaForWrapper[A8] :: schemaForWrapper[A9] :: schemaForWrapper[A10] :: schemaForWrapper[
A11
] :: schemaForWrapper[A12] :: schemaForWrapper[A13] :: schemaForWrapper[A14] :: Nil
val inputColumns: Seq[UdfColumnSchema] =
schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: schemaForWrapper[
A7
] :: schemaForWrapper[A8] :: schemaForWrapper[A9] :: schemaForWrapper[
A10
] :: schemaForWrapper[
A11
] :: schemaForWrapper[A12] :: schemaForWrapper[A13] :: schemaForWrapper[A14] :: Nil
StoredProcedure(sp, returnColumn, inputColumns)
}

Expand Down Expand Up @@ -2375,16 +2383,18 @@ object ScalaFunctions {
).foreach(isSupported)
isSupported(typeOf[RT])
val returnColumn = schemaForWrapper[RT]
val inputColumns
: Seq[UdfColumnSchema] = schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: schemaForWrapper[
A7
] :: schemaForWrapper[A8] :: schemaForWrapper[A9] :: schemaForWrapper[A10] :: schemaForWrapper[
A11
] :: schemaForWrapper[A12] :: schemaForWrapper[A13] :: schemaForWrapper[
A14
] :: schemaForWrapper[A15] :: schemaForWrapper[A16] :: schemaForWrapper[A17] :: Nil
val inputColumns: Seq[UdfColumnSchema] =
schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: schemaForWrapper[
A7
] :: schemaForWrapper[A8] :: schemaForWrapper[A9] :: schemaForWrapper[
A10
] :: schemaForWrapper[
A11
] :: schemaForWrapper[A12] :: schemaForWrapper[A13] :: schemaForWrapper[
A14
] :: schemaForWrapper[A15] :: schemaForWrapper[A16] :: schemaForWrapper[A17] :: Nil
StoredProcedure(sp, returnColumn, inputColumns)
}

Expand Down Expand Up @@ -2635,18 +2645,20 @@ object ScalaFunctions {
).foreach(isSupported)
isSupported(typeOf[RT])
val returnColumn = schemaForWrapper[RT]
val inputColumns
: Seq[UdfColumnSchema] = schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: schemaForWrapper[
A7
] :: schemaForWrapper[A8] :: schemaForWrapper[A9] :: schemaForWrapper[A10] :: schemaForWrapper[
A11
] :: schemaForWrapper[A12] :: schemaForWrapper[A13] :: schemaForWrapper[
A14
] :: schemaForWrapper[A15] :: schemaForWrapper[A16] :: schemaForWrapper[
A17
] :: schemaForWrapper[A18] :: schemaForWrapper[A19] :: schemaForWrapper[A20] :: Nil
val inputColumns: Seq[UdfColumnSchema] =
schemaForWrapper[A1] :: schemaForWrapper[A2] :: schemaForWrapper[
A3
] :: schemaForWrapper[A4] :: schemaForWrapper[A5] :: schemaForWrapper[A6] :: schemaForWrapper[
A7
] :: schemaForWrapper[A8] :: schemaForWrapper[A9] :: schemaForWrapper[
A10
] :: schemaForWrapper[
A11
] :: schemaForWrapper[A12] :: schemaForWrapper[A13] :: schemaForWrapper[
A14
] :: schemaForWrapper[A15] :: schemaForWrapper[A16] :: schemaForWrapper[
A17
] :: schemaForWrapper[A18] :: schemaForWrapper[A19] :: schemaForWrapper[A20] :: Nil
StoredProcedure(sp, returnColumn, inputColumns)
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/scala/com/snowflake/snowpark/types/StructType.scala
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ class ColumnIdentifier private (normalizedName: String) {
/** Returns the name of column. Name format:
* 1. if the name quoted.
* a. starts with _A-Z and follows by _A-Z0-9$: remove quotes b. starts with $ and follows
* by digits: remove quotes c. otherwise, do nothing
* 2. if not quoted.
* by digits: remove quotes c. otherwise, do nothing 2. if not quoted.
* a. starts with _a-zA-Z and follows by _a-zA-Z0-9$, upper case all letters. b. starts with
* $ and follows by digits, do nothing c. otherwise, quote name
*
Expand Down

0 comments on commit f8a0bb1

Please sign in to comment.