Skip to content

Commit 898a545

Browse files
committed
Add Apache License headers and fix code style
- Add Apache License headers to all Spark 4.0 example files - Fix code style with spotlessApply - Clean up ClickHouseSingleMixIn formatting Fixes check-license CI failures.
1 parent 27e2b3f commit 898a545

File tree

8 files changed

+90
-6
lines changed

8 files changed

+90
-6
lines changed

clickhouse-core/src/testFixtures/scala/com/clickhouse/spark/base/ClickHouseSingleMixIn.scala

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ package com.clickhouse.spark.base
1717
import com.clickhouse.spark.Utils
1818
import com.clickhouse.data.ClickHouseVersion
1919
import com.dimafeng.testcontainers.{ForAllTestContainer, JdbcDatabaseContainer, SingleContainer}
20-
import org.scalatest.{BeforeAndAfterAll}
20+
import org.scalatest.BeforeAndAfterAll
2121
import org.scalatest.funsuite.AnyFunSuite
2222
import org.testcontainers.containers.ClickHouseContainer
2323
import org.testcontainers.utility.{DockerImageName, MountableFile}
2424
import java.nio.file.{Path, Paths}
2525
import scala.collection.JavaConverters._
2626

27-
trait ClickHouseSingleMixIn extends AnyFunSuite with BeforeAndAfterAll with ForAllTestContainer with ClickHouseProvider {
27+
trait ClickHouseSingleMixIn extends AnyFunSuite with BeforeAndAfterAll with ForAllTestContainer
28+
with ClickHouseProvider {
2829
// format: off
2930
private val CLICKHOUSE_IMAGE: String = Utils.load("CLICKHOUSE_IMAGE", "clickhouse/clickhouse-server:23.8")
3031
private val CLICKHOUSE_USER: String = Utils.load("CLICKHOUSE_USER", "default")
@@ -87,9 +88,11 @@ trait ClickHouseSingleMixIn extends AnyFunSuite with BeforeAndAfterAll with ForA
8788
override def beforeAll(): Unit = {
8889
val startTime = System.currentTimeMillis()
8990
println(s"[ClickHouseSingleMixIn] Starting ClickHouse container: $CLICKHOUSE_IMAGE")
90-
super.beforeAll() // This starts the container and makes mappedPort available
91+
super.beforeAll() // This starts the container and makes mappedPort available
9192
val duration = System.currentTimeMillis() - startTime
92-
println(s"[ClickHouseSingleMixIn] ClickHouse container started in ${duration}ms at ${container.host}:${container.mappedPort(CLICKHOUSE_HTTP_PORT)}")
93+
println(
94+
s"[ClickHouseSingleMixIn] ClickHouse container started in ${duration}ms at ${container.host}:${container.mappedPort(CLICKHOUSE_HTTP_PORT)}"
95+
)
9396
}
9497

9598
override def afterAll(): Unit = {

spark-4.0/examples/DEBUGGING.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
<!--
2+
Licensed under the Apache License, Version 2.0 (the "License");
3+
you may not use this file except in compliance with the License.
4+
You may obtain a copy of the License at
5+
6+
https://www.apache.org/licenses/LICENSE-2.0
7+
8+
Unless required by applicable law or agreed to in writing, software
9+
distributed under the License is distributed on an "AS IS" BASIS,
10+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
See the License for the specific language governing permissions and
12+
limitations under the License.
13+
-->
14+
115
# Debugging Guide for ClickHouse Spark Connector
216

317
This guide shows how to debug the connector while running the example applications.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* https://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*/
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* https://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*/

spark-4.0/examples/build.gradle

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
/*
2-
* Examples module for Spark 4.0 (Scala 2.13)
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* https://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
313
*/
414

515
plugins {

spark-4.0/examples/build.sbt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* https://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*/
14+
115
name := "clickhouse-spark-examples"
216

317
version := "1.0"

spark-4.0/examples/run-example.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
#!/bin/bash
22

3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
317
# Script to run ClickHouse Spark examples with proper classpath
418
# Usage: ./run-example.sh [streaming|batch]
519
# Optional env vars to override connection (must also reflect in your code or use Spark conf flags):

spark-4.0/examples/src/main/scala/examples/SimpleBatchExample.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ object SimpleBatchExample {
4848
.config("spark.sql.catalog.clickhouse.password", password)
4949
.config("spark.sql.catalog.clickhouse.database", database)
5050
.config("spark.sql.catalog.clickhouse.option.ssl", (protocol == "https").toString)
51-
.config("spark.executor.extraJavaOptions", "--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED")
51+
.config(
52+
"spark.executor.extraJavaOptions",
53+
"--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED"
54+
)
5255
.getOrCreate()
5356

5457
spark.sparkContext.setLogLevel("WARN")

0 commit comments

Comments
 (0)