Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spline #1349 ArangoDB: Replace deprecated VPack serialization with Jackson #1350

Merged
merged 1 commit into from
Jul 8, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@ case class Attribute(
dataType: Option[Any],
extra: Map[String, Any],
name: String,
) extends Vertex {
def this() = this(null, null, null, null, null)
}
) extends Vertex
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,4 @@ package za.co.absa.spline.persistence.model
case class Schema(
override val _key: ArangoDocument.Key,
override val _belongsTo: Option[ArangoDocument.Id]
) extends Vertex {
def this() = this(null, null)
}
) extends Vertex
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ case class Edge(
index: Option[Edge.Index],
path: Option[Edge.FromPath],
override val _key: ArangoDocument.Key = null // NOSONAR
) extends ArangoDocument {
def this() = this(null, null, null, null, null, null) // NOSONAR
}
) extends ArangoDocument

object Edge {
type Index = Int // 0-based number reflecting the position among sibling edges of the same type sharing the same {{_from}}
Expand All @@ -61,9 +59,7 @@ object Edge {
case class DBVersion(
version: String,
status: String
) extends ArangoDocument with RootEntity {
def this() = this(null, null) // NOSONAR
}
) extends ArangoDocument with RootEntity

object DBVersion {
def apply(version: String, status: Status.Type): DBVersion = DBVersion(version, status.toString)
Expand All @@ -79,9 +75,7 @@ object DBVersion {

}

case class Counter(override val _key: String, curVal: Long) extends ArangoDocument with RootEntity {
def this() = this(null, Long.MinValue) // NOSONAR
}
case class Counter(override val _key: String, curVal: Long) extends ArangoDocument with RootEntity

/**
* Represents a named location WHERE data can be read from or written to.
Expand All @@ -95,7 +89,6 @@ case class DataSource(
) extends Vertex with RootEntity {
override val _key: DataSource.Key = null // NOSONAR

def this() = this(null, null, null) // NOSONAR
}

object DataSource {
Expand Down Expand Up @@ -150,7 +143,7 @@ case class Progress(
) extends Vertex with RootEntity

object Progress {
type JobDurationInNanos = Long
type JobDurationInNanos = java.lang.Long
}

/**
Expand All @@ -165,6 +158,4 @@ case class ExecPlanDetails(
dataSourceType: String,
labels: Map[String, Seq[String]],
append: Boolean
) {
def this() = this(null, null, null, null, null, null, null, false) // NOSONAR
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ case class FunctionalExpression(
arity: Int,
params: Map[String, Any],
) extends Expression {
def this() = this(null, null, null, null, null, -1, null)

val `type`: String = "Func"
}

Expand All @@ -43,7 +41,5 @@ case class LiteralExpression(
override val extra: Map[String, Any],
value: Any,
) extends Expression {
def this() = this(null, null, null, null, null)

val `type`: String = "Lit"
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ case class Read(
override val _key: ArangoDocument.Key,
override val _belongsTo: Option[ArangoDocument.Id]
) extends Operation {
def this() = this(null, null, null, null, null, null)

override val `type`: Operation.Type = OperationTypes.Read
}

Expand All @@ -58,8 +56,6 @@ case class Write(
override val _key: ArangoDocument.Key,
override val _belongsTo: Option[ArangoDocument.Id]
) extends Operation {
def this() = this(null, false, null, null, null, null, null)

override val `type`: Operation.Type = OperationTypes.Write
}

Expand All @@ -70,7 +66,5 @@ case class Transformation(
override val _key: ArangoDocument.Key,
override val _belongsTo: Option[ArangoDocument.Id]
) extends Operation {
def this() = this(null, null, null, null, null)

override val `type`: Operation.Type = OperationTypes.Transformation
}
6 changes: 3 additions & 3 deletions arangodb-foxx-services/src/main/services/commons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function getStartDataSourceFromExecutionEvent(startEvent: Progress): DataSource
LIMIT 1
RETURN {
"_id": ds._key,
"_class": "za.co.absa.spline.consumer.service.model.DataSourceNode",
"_type": "DataSourceNode",
"name": ds.uri
}
`).next()
Expand All @@ -86,12 +86,12 @@ function getPartialGraphForEvent(event: Progress) {
RETURN vertType == "dataSource"
? {
"_id": vert._key,
"_class": "za.co.absa.spline.consumer.service.model.DataSourceNode",
"_type": "DataSourceNode",
"name": vert.uri
}
: MERGE(KEEP(vert, ["systemInfo", "agentInfo"]), {
"_id": vert._key,
"_class": "za.co.absa.spline.consumer.service.model.ExecutionNode",
"_type": "ExecutionNode",
"name": vert.name || ""
})
)
Expand Down
47 changes: 14 additions & 33 deletions build/parent-pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -341,40 +341,13 @@
<!-- Jackson -->

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-modules-base</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-paranamer</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-scala_${scala.compat.version}</artifactId>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<version>${jackson.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>

<dependency>
<groupId>com.twitter</groupId>
<artifactId>finatra-jackson_${scala.compat.version}</artifactId>
Expand Down Expand Up @@ -527,13 +500,21 @@
<version>${logback.version}</version>
</dependency>

<!-- others -->
<!-- ArangoDB -->

<dependency>
<groupId>com.arangodb</groupId>
<artifactId>arangodb-java-driver</artifactId>
<version>6.25.0</version>
</dependency>
<dependency>
<groupId>com.arangodb</groupId>
<artifactId>jackson-dataformat-velocypack</artifactId>
<version>4.3.0</version>
</dependency>

<!-- others -->

<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ class OperationDetailsController @Autowired()
}

uses.foldLeft(opProps) { (z, u) =>
val relPath = u.path.stripPrefix("$['params']")
val relPath = u.path
.getOrElse(throw new IllegalArgumentException("'path' is missing in the 'uses' type of edge."))
.stripPrefix("$['params']")
val jsonPath = JsonPath.parse(relPath)
val nodeId = u.target
val node = nodeById(nodeId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ package za.co.absa.spline.consumer.service.model
case class Attribute(
id: String,
name: String,
dataTypeId: String) {
def this() = this(null, null, null)
}
dataTypeId: String)

object Attribute {
type Id = String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,5 @@ case class AttributeEdge
@ApiModelProperty(value = "Target Node")
target: AttributeNode.Id
) extends Graph.Edge {
def this() = this(null, null)

override type JointId = AttributeNode.Id
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,4 @@ case class AttributeGraph(
) extends Graph {
override type Node = AttributeNode
override type Edge = AttributeEdge

def this() = this(null, null)
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ case class AttributeNode
transOpIds: Seq[Operation.Id]

) extends Graph.Node {
def this() = this(null, null, null, null)

override type Id = AttributeNode.Id
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,4 @@ case class DataSourceInfo
sourceType: String,
@ApiModelProperty(value = "Uri of the dataSource")
source: String
) {
def this() = this(null, null)
}
)

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,45 +20,46 @@ import za.co.absa.spline.persistence.model.Progress

import java.{util => ju}

case class WriteEventInfo
case class ExecutionEventInfo
(
@ApiModelProperty(value = "Id of the execution event")
executionEventId: WriteEventInfo.Id,
@ApiModelProperty(value = "Id of the execution plan")
executionPlanId: ExecutionPlanInfo.Id,
@ApiModelProperty(value = "Name of the framework that triggered this execution event")
frameworkName: String,
@ApiModelProperty(value = "Name of the application/job")
applicationName: String,
@ApiModelProperty(value = "Id of the application/job")
applicationId: String,
@ApiModelProperty(value = "When the execution was triggered")
timestamp: WriteEventInfo.Timestamp,
@ApiModelProperty(value = "Duration of execution in nanoseconds (for successful executions)")
durationNs: Option[WriteEventInfo.DurationNs],
durationNs: Option[ExecutionEventInfo.DurationNs],
@ApiModelProperty(value = "Error (for failed executions)")
error: Option[WriteEventInfo.Error],
error: Option[Any],
@ApiModelProperty(value = "Output data source name")
dataSourceName: String,
@ApiModelProperty(value = "Output data source URI")
dataSourceUri: String,

// these properties are only applicable for the WRITE execution events,
// therefore they are nullable to avoid deserialization issues of the READ events.

@ApiModelProperty(value = "Id of the execution event")
executionEventId: ExecutionEventInfo.Id = null,
@ApiModelProperty(value = "Id of the execution plan")
executionPlanId: ExecutionPlanInfo.Id = null,
@ApiModelProperty(value = "Name of the framework that triggered this execution event")
frameworkName: String = null,
@ApiModelProperty(value = "Name of the application/job")
applicationName: String = null,
@ApiModelProperty(value = "Id of the application/job")
applicationId: String = null,
@ApiModelProperty(value = "When the execution was triggered")
timestamp: ExecutionEventInfo.Timestamp = null,
@ApiModelProperty(value = "Output data source (or data) type")
dataSourceType: String,
dataSourceType: String = null,
@ApiModelProperty(value = "Write mode - (true=Append; false=Override)")
append: WriteEventInfo.Append,
append: ExecutionEventInfo.Append = null,
@ApiModelProperty(value = "Other extra info")
extra: Map[String, Any],
extra: Map[String, Any] = null,
@ApiModelProperty(value = "Execution event labels")
labels: Option[Map[Label.Name, ju.List[Label.Value]]],
) {
def this() = this(null, null, null, null, null, null, null, null, null, null, null, null, null, null)
}
labels: Map[Label.Name, ju.List[Label.Value]] = null,
)

object WriteEventInfo {
object ExecutionEventInfo {
type Id = String
type Timestamp = java.lang.Long
type DurationNs = Progress.JobDurationInNanos
type Error = Any
type Append = java.lang.Boolean
}

Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ case class ExecutionPlanInfo
inputs: Array[DataSourceInfo],
@ApiModelProperty(value = "Write destination")
output: DataSourceInfo
) {
def this() = this(null, null, null, null, null, null, null)
}
)

object ExecutionPlanInfo {
type Id = UUID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ case class ExpressionEdge
`type`: ExpressionEdgeType,

@ApiModelProperty(value = "JSONPath of inside 'source' entity where this edge is logically attached to (if applicable)")
path: Edge.FromPath,
path: Option[Edge.FromPath],

@ApiModelProperty(value = "0-based order (if applicable)")
index: Int
) extends Graph.Edge {
def this() = this(null, null, null, null, -1)
index: Option[Int]

) extends Graph.Edge {
override type JointId = ExpressionNode.Id
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ case class ExpressionGraph(
) extends Graph {
override type Node = ExpressionNode
override type Edge = ExpressionEdge

def this() = this(null, null)
}


Loading
Loading