Skip to content

Commit

Permalink
spline #671 Addressing PR comments: Rename Schemas to Expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
wajda committed May 26, 2020
1 parent 768d36f commit 70b608e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ case class ExecutionPlan(
id: UUID = UUID.randomUUID(),

operations: Operations,
schemas: Option[Schemas],
expressions: Option[Expressions],

// Information about a data framework in use (e.g. Spark, StreamSets etc)
systemInfo: NameAndVersion,
Expand All @@ -40,13 +40,13 @@ case class Operations(
def all: Seq[OperationLike] = reads ++ other :+ write
}

case class Schemas(
case class Expressions(
attributes: Seq[Attribute],
functions: Seq[FunctionalExpression],
constants: Seq[Literal],
mapping: Map[OperationLike.Id, Array[ExpressionLike.Id]]
mappingByOperation: Map[OperationLike.Id, Array[ExpressionLike.Id]]
) {
def allExpressions: Seq[ExpressionLike] = attributes ++ functions ++ constants
def all: Seq[ExpressionLike] = attributes ++ functions ++ constants
}

case class NameAndVersion(name: String, version: String)
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ class ExecutionPlansController @Autowired()(
]
},
// Attribute/Schema level lineage info
schemas: {
// Attribute level lineage info
expressions: {
// Attribute definitions
attributes: [
Expand Down Expand Up @@ -150,8 +150,9 @@ class ExecutionPlansController @Autowired()(
}
},
// Operation output schema definitions (array of attribute IDs by operation ID)
mapping: {
// Operation output definitions.
// Maps operation IDs to arrays of attribute IDs that form the corresponding operation output.
mappingByOperation: {
<string>: [<string>],
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ object ModelMapperV1 extends ModelMapper {
extra = dop1.extra
))

val maybeSchemas = Some(Schemas(
mapping = schemaByOpIds,
val maybeExpressions = Some(Expressions(
mappingByOperation = schemaByOpIds,
attributes = Nil, // Fixme in SPLINE-677
functions = Nil, // Fixme in SPLINE-677
constants = Nil, // Fixme in SPLINE-677
Expand All @@ -73,7 +73,7 @@ object ModelMapperV1 extends ModelMapper {
reads = rops,
other = dops
),
schemas = maybeSchemas,
expressions = maybeExpressions,
systemInfo = NameAndVersion(plan1.systemInfo.name, plan1.systemInfo.version),
agentInfo = plan1.agentInfo.map(ai => NameAndVersion(ai.name, ai.version)),
extraInfo = plan1.extraInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,16 @@ object ExecutionProducerRepositoryImpl {

private def createOperations(executionPlan: apiModel.ExecutionPlan): Seq[dbModel.Operation] = {
val allOperations = executionPlan.operations.all
val maybeSchemaFinder = executionPlan.schemas.map(attrs =>
new RecursiveSchemaFinder(allOperations, attrs.mapping))
val maybeSchemaFinder = executionPlan.expressions.map(attrs =>
new RecursiveSchemaFinder(allOperations, attrs.mappingByOperation))

allOperations.map {
case r: apiModel.ReadOperation =>
dbModel.Read(
inputSources = r.inputSources,
params = r.params,
extra = r.extra,
outputSchema = executionPlan.schemas.flatMap(_.mapping.get(r.id)),
outputSchema = executionPlan.expressions.flatMap(_.mappingByOperation.get(r.id)),
_key = s"${executionPlan.id}:${r.id.toString}"
)
case w: apiModel.WriteOperation =>
Expand Down

0 comments on commit 70b608e

Please sign in to comment.