From f8a0bb183627d28fdc150f6057723ca605925ab9 Mon Sep 17 00:00:00 2001 From: Bing Li Date: Mon, 19 Aug 2024 15:55:46 -0700 Subject: [PATCH] fix formatter --- .github/workflows/code-format-check.yml | 16 +- .../com/snowflake/snowpark/functions.scala | 6 +- .../snowpark/internal/ScalaFunctions.scala | 172 ++++++++++-------- .../snowflake/snowpark/types/StructType.scala | 3 +- 4 files changed, 103 insertions(+), 94 deletions(-) diff --git a/.github/workflows/code-format-check.yml b/.github/workflows/code-format-check.yml index f5fde8c8..bc112dce 100644 --- a/.github/workflows/code-format-check.yml +++ b/.github/workflows/code-format-check.yml @@ -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 \ No newline at end of file diff --git a/src/main/scala/com/snowflake/snowpark/functions.scala b/src/main/scala/com/snowflake/snowpark/functions.scala index 96d06d22..60dafdba 100644 --- a/src/main/scala/com/snowflake/snowpark/functions.scala +++ b/src/main/scala/com/snowflake/snowpark/functions.scala @@ -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", | @@ -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", | diff --git a/src/main/scala/com/snowflake/snowpark/internal/ScalaFunctions.scala b/src/main/scala/com/snowflake/snowpark/internal/ScalaFunctions.scala index bffef909..56276148 100644 --- a/src/main/scala/com/snowflake/snowpark/internal/ScalaFunctions.scala +++ b/src/main/scala/com/snowflake/snowpark/internal/ScalaFunctions.scala @@ -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) } @@ -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) } @@ -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) } @@ -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) } @@ -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) } @@ -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) } @@ -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) } @@ -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) } @@ -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) } @@ -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) } diff --git a/src/main/scala/com/snowflake/snowpark/types/StructType.scala b/src/main/scala/com/snowflake/snowpark/types/StructType.scala index d55f526d..88c8ce63 100644 --- a/src/main/scala/com/snowflake/snowpark/types/StructType.scala +++ b/src/main/scala/com/snowflake/snowpark/types/StructType.scala @@ -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 *