Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Example .scalafix.conf section
OrganizeImports {
groups = [
"re:javax?\\..*" # Matches java and javax
"re:scala\\..*" # Matches scala
"*" # Matches everything else (effectively the 3rdParty group)
"re:io\\.delta\\.sharing\\..*" # Matches deltaSharing specifically
]
# You will need to configure other OrganizeImports options based on your preferences
# For example:
removeUnused = false
# blankLines = Auto
importsOrder = SymbolsFirst
importSelectorsOrder = Keep
groupedImports = Keep # Or Merge, Keep
# ... other options ...
}
14 changes: 8 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,15 @@ lazy val server = (project in file("server")) enablePlugins(JavaAppPackaging) se
libraryDependencies ++= Seq(
// Pin versions for jackson libraries as the new version of `jackson-module-scala` introduces a
// breaking change making us not able to use `delta-standalone`.
"com.fasterxml.jackson.core" % "jackson-core" % "2.6.7",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.6.7.3",
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.6.7.1",
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-yaml" % "2.6.7",
"com.fasterxml.jackson.core" % "jackson-core" % "2.15.2",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.15.2",
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.15.2",
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-yaml" % "2.15.2",
"org.json4s" %% "json4s-jackson" % "3.5.3" excludeAll(
ExclusionRule("com.fasterxml.jackson.core"),
ExclusionRule("com.fasterxml.jackson.module")
),
"com.linecorp.armeria" %% "armeria-scalapb" % "1.6.0" excludeAll(
"com.linecorp.armeria" %% "armeria-scalapb" % "1.9.2" excludeAll(
ExclusionRule("com.fasterxml.jackson.core"),
ExclusionRule("com.fasterxml.jackson.module"),
ExclusionRule("org.json4s")
Expand Down Expand Up @@ -245,7 +245,9 @@ lazy val server = (project in file("server")) enablePlugins(JavaAppPackaging) se
"org.slf4j" % "slf4j-simple" % "1.6.1",
"net.sourceforge.argparse4j" % "argparse4j" % "0.9.0",

"org.scalatest" %% "scalatest" % "3.0.5" % "test",
"org.scalatest" %% "scalatest" % "3.2.19" % "test",
"dev.zio" %% "zio-test" % "2.0.19" % "test",
"dev.zio" %% "zio-test-sbt" % "2.0.19" % "test",
"org.bouncycastle" % "bcprov-jdk15on" % "1.70" % "test",
"org.bouncycastle" % "bcpkix-jdk15on" % "1.70" % "test"
),
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
# limitations under the License.
#

sbt.version=1.5.0
sbt.version=1.10.7
2 changes: 2 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.16")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")

libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.11.12"

addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.14.2")
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package io.delta.sharing.server

import java.io.{ByteArrayOutputStream, File, FileNotFoundException}
import java.lang.reflect.{Field, Modifier}
import java.nio.charset.StandardCharsets.UTF_8
import java.nio.file.AccessDeniedException
import java.security.MessageDigest
Expand Down Expand Up @@ -678,6 +679,15 @@ object DeltaSharingService {
val defaultJsonPrinterField =
Class.forName("com.linecorp.armeria.server.scalapb.ScalaPbConverterUtil$")
.getDeclaredField("defaultJsonPrinter")

// Remove the final modifier
val modifiersField = classOf[Field].getDeclaredField("modifiers")
modifiersField.setAccessible(true)
modifiersField.setInt(
defaultJsonPrinterField,
defaultJsonPrinterField.getModifiers & ~Modifier.FINAL
)

defaultJsonPrinterField.setAccessible(true)
defaultJsonPrinterField.set(module, new Printer())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import java.nio.charset.StandardCharsets.UTF_8
import java.util.Base64

import scala.collection.JavaConverters._
import scala.collection.mutable.ListBuffer
import scala.util.control.NonFatal

import com.google.cloud.hadoop.fs.gcs.GoogleHadoopFileSystem
import com.google.common.hash.Hashing
Expand All @@ -36,8 +38,6 @@ import org.apache.hadoop.fs.azure.NativeAzureFileSystem
import org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem
import org.apache.hadoop.fs.s3a.S3AFileSystem
import org.apache.spark.sql.types.{DataType, MetadataBuilder, StructType}
import scala.collection.mutable.ListBuffer
import scala.util.control.NonFatal
import scalapb.{GeneratedMessage, GeneratedMessageCompanion}

import io.delta.sharing.server.{model, DeltaSharedTableProtocol, DeltaSharingIllegalArgumentException, DeltaSharingUnsupportedOperationException, ErrorStrings, QueryResult}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ package io.delta.standalone.internal

import java.sql.Timestamp

import scala.collection.JavaConverters._
import scala.collection.mutable.ListBuffer
import scala.util.control.NonFatal

import io.delta.standalone.DeltaLog
import io.delta.standalone.internal.actions.{
Action,
Expand All @@ -31,9 +35,6 @@ import io.delta.standalone.internal.actions.{
import io.delta.standalone.internal.exception.DeltaErrors
import io.delta.standalone.internal.util.ConversionUtils
import org.apache.hadoop.conf.Configuration
import scala.collection.JavaConverters._
import scala.collection.mutable.ListBuffer
import scala.util.control.NonFatal

/**
* This is a special CDCReader that is optimized for delta sharing server usage.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ import java.time.OffsetDateTime
import java.time.ZoneOffset
import java.time.format.DateTimeFormatter

import scala.collection.JavaConverters._

import io.delta.standalone.internal.actions.CommitMarker
import io.delta.standalone.internal.util.FileNames
import io.delta.storage.LogStore
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.Path
import scala.collection.JavaConverters._

object DeltaSharingHistoryManager {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
package io.delta.sharing.server

import org.apache.hadoop.fs.Path
import org.scalatest.FunSuite
import org.scalatest.funsuite.AnyFunSuite

import io.delta.sharing.server.common.GCSFileSigner

class CloudFileSignerSuite extends FunSuite {
class CloudFileSignerSuite extends AnyFunSuite {

test("GCSFileSigner.getBucketAndObjectNames") {
assert(GCSFileSigner.getBucketAndObjectNames(new Path("gs://delta-sharing-test/foo"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import scala.collection.mutable.ArrayBuffer
import com.linecorp.armeria.server.Server
import io.delta.standalone.internal.DeltaSharedTable.{RESPONSE_FORMAT_DELTA, RESPONSE_FORMAT_PARQUET}
import org.apache.commons.io.IOUtils
import org.scalatest.{BeforeAndAfterAll, FunSuite}
import org.scalatest.BeforeAndAfterAll
import org.scalatest.funsuite.AnyFunSuite
import scalapb.json4s.JsonFormat

import io.delta.sharing.server.DeltaSharingService.DELTA_SHARING_INCLUDE_END_STREAM_ACTION
Expand All @@ -39,7 +40,7 @@ import io.delta.sharing.server.model._
import io.delta.sharing.server.protocol._

// scalastyle:off maxLineLength
class DeltaSharingServiceSuite extends FunSuite with BeforeAndAfterAll {
class DeltaSharingServiceSuite extends AnyFunSuite with BeforeAndAfterAll {

def shouldRunIntegrationTest: Boolean = {
sys.env.get("AWS_ACCESS_KEY_ID").exists(_.length > 0) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import java.util.{Arrays, Collections}
import scala.collection.JavaConverters._
import scala.collection.mutable.ArrayBuffer

import org.scalatest.FunSuite
import org.scalatest.funsuite.AnyFunSuite

import io.delta.sharing.server.config.{SchemaConfig, ServerConfig, ShareConfig, TableConfig}
import io.delta.sharing.server.protocol.{Schema, Share, Table}

class SharedTableManagerSuite extends FunSuite {
class SharedTableManagerSuite extends AnyFunSuite {

test("list shares") {
val serverConfig = new ServerConfig()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import java.nio.file.Files
import java.util.Arrays

import org.apache.commons.io.FileUtils
import org.scalatest.FunSuite
import org.scalatest.funsuite.AnyFunSuite

class ServerConfigSuite extends FunSuite {
class ServerConfigSuite extends AnyFunSuite {

def testConfig(content: String, serverConfig: ServerConfig): Unit = {
val tempFile = Files.createTempFile("delta-sharing-server", ".yaml").toFile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

package io.delta.standalone.internal

import org.scalatest.FunSuite
import org.scalatest.funsuite.AnyFunSuite

import io.delta.sharing.server.common.TimestampUtils

class ColumnRangeSuite extends FunSuite {
class ColumnRangeSuite extends AnyFunSuite {

test("invalid column range test") {
assert(intercept[IllegalArgumentException] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

package io.delta.standalone.internal

import org.scalatest.FunSuite
import org.scalatest.funsuite.AnyFunSuite

import io.delta.sharing.server.common.{AndOp, BaseOp, ColumnOp, EqualOp, EvalContext, GreaterThanOp, GreaterThanOrEqualOp, IsNullOp, LessThanOp, LessThanOrEqualOp, LiteralOp, NotOp, OrOp}

class JsonPredicateEvaluatorV2Suite extends FunSuite {
class JsonPredicateEvaluatorV2Suite extends AnyFunSuite {

// A wrapper around op evaluation in the specified context (data file).
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
package io.delta.standalone.internal

import io.delta.standalone.internal.actions.AddFile
import org.scalatest.FunSuite
import org.scalatest.funsuite.AnyFunSuite

class JsonPredicateFilterUtilsSuite extends FunSuite {
class JsonPredicateFilterUtilsSuite extends AnyFunSuite {

import JsonPredicateFilterUtils._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

package io.delta.standalone.internal

import org.scalatest.FunSuite
import org.scalatest.funsuite.AnyFunSuite

import io.delta.sharing.server.common.{AndOp, BaseOp, ColumnOp, EqualOp, EvalContext, GreaterThanOp, IsNullOp, JsonUtils, LessThanOp, LiteralOp, NonLeafOp, NotOp, OrOp}

class JsonPredicateSuite extends FunSuite {
class JsonPredicateSuite extends AnyFunSuite {

/**
* A wrapper around op evaluation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package io.delta.standalone.internal

import io.delta.standalone.internal.actions.AddFile
import org.apache.spark.sql.types.{IntegerType, StructField, StructType}
import org.scalatest.FunSuite
import org.scalatest.funsuite.AnyFunSuite

class PartitionFilterUtilsSuite extends FunSuite {
class PartitionFilterUtilsSuite extends AnyFunSuite {

import PartitionFilterUtils._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

package io.delta.standalone.internal

import org.scalatest.FunSuite
import org.scalatest.funsuite.AnyFunSuite

import io.delta.sharing.server.common.TimestampUtils

class TimestampUtilsSuite extends FunSuite {
class TimestampUtilsSuite extends AnyFunSuite {
test("basic test") {
// Only ISO 8601 is supported.
TimestampUtils.parse("2023-06-10T00:00:00.000Z")
Expand Down