-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
157 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
.../scala/edu/uci/ics/texera/web/model/websocket/request/EditingTimeCompilationRequest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package edu.uci.ics.texera.web.model.websocket.request | ||
|
||
import edu.uci.ics.texera.workflow.common.operators.LogicalOp | ||
import edu.uci.ics.texera.workflow.common.workflow.LogicalLink | ||
|
||
case class EditingTimeCompilationRequest( | ||
operators: List[LogicalOp], | ||
links: List[LogicalLink], | ||
opsToViewResult: List[String], | ||
opsToReuseResult: List[String] | ||
) extends TexeraWebSocketRequest { | ||
|
||
def toLogicalPlanPojo: LogicalPlanPojo = { | ||
LogicalPlanPojo(operators, links, opsToViewResult, opsToReuseResult) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
core/amber/src/main/scala/edu/uci/ics/texera/web/resource/SchemaPropagationResource.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package edu.uci.ics.texera.web.resource | ||
import com.typesafe.scalalogging.LazyLogging | ||
import edu.uci.ics.amber.engine.common.virtualidentity.WorkflowIdentity | ||
import edu.uci.ics.texera.Utils | ||
import edu.uci.ics.texera.web.auth.SessionUser | ||
import edu.uci.ics.texera.web.model.http.response.SchemaPropagationResponse | ||
import edu.uci.ics.texera.web.model.websocket.request.LogicalPlanPojo | ||
import edu.uci.ics.texera.workflow.common.WorkflowContext | ||
import edu.uci.ics.texera.workflow.common.workflow.{LogicalPlan, PhysicalPlan} | ||
import io.dropwizard.auth.Auth | ||
import org.jooq.types.UInteger | ||
|
||
import javax.annotation.security.RolesAllowed | ||
import javax.ws.rs._ | ||
import javax.ws.rs.core.MediaType | ||
|
||
/** | ||
* The SchemaPropagation functionality will be included by the standalone compiling service | ||
*/ | ||
@Deprecated | ||
@Consumes(Array(MediaType.APPLICATION_JSON)) | ||
@Produces(Array(MediaType.APPLICATION_JSON)) | ||
@Path("/queryplan") | ||
class SchemaPropagationResource extends LazyLogging { | ||
|
||
@Deprecated | ||
@POST | ||
@Path("/autocomplete/{wid}") | ||
@RolesAllowed(Array("REGULAR", "ADMIN")) | ||
def suggestAutocompleteSchema( | ||
workflowStr: String, | ||
@PathParam("wid") wid: UInteger, | ||
@Auth sessionUser: SessionUser | ||
): SchemaPropagationResponse = { | ||
|
||
val logicalPlanPojo = Utils.objectMapper.readValue(workflowStr, classOf[LogicalPlanPojo]) | ||
|
||
val context = new WorkflowContext( | ||
workflowId = WorkflowIdentity(wid.toString.toLong) | ||
) | ||
|
||
val logicalPlan = LogicalPlan(logicalPlanPojo) | ||
|
||
// the PhysicalPlan with topology expanded. | ||
val physicalPlan = PhysicalPlan(context, logicalPlan, None) | ||
|
||
// Extract physical input schemas, excluding internal ports | ||
val physicalInputSchemas = physicalPlan.operators.map { physicalOp => | ||
physicalOp.id -> physicalOp.inputPorts.values | ||
.filterNot(_._1.id.internal) | ||
.map { | ||
case (port, _, schema) => port.id -> schema.toOption | ||
} | ||
} | ||
|
||
// Group the physical input schemas by their logical operator ID and consolidate the schemas | ||
val logicalInputSchemas = physicalInputSchemas | ||
.groupBy(_._1.logicalOpId) | ||
.view | ||
.mapValues(_.flatMap(_._2).toList.sortBy(_._1.id).map(_._2)) | ||
.toMap | ||
|
||
// Prepare the response content by extracting attributes from the schemas, | ||
// ignoring errors (errors are reported through EditingTimeCompilationRequest) | ||
val responseContent = logicalInputSchemas.map { | ||
case (logicalOpId, schemas) => | ||
logicalOpId.id -> schemas.map(_.map(_.getAttributes)) | ||
} | ||
SchemaPropagationResponse(0, responseContent, null) | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters