Repository navigation
feat(amber): record each result port's output mode and row count #9049
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -413,6 +413,26 @@ object WorkflowExecutionsResource { | |
| .execute() | ||
| } | ||
|
|
||
| /** | ||
| * Updates the row count stored for this port's result in operator_port_executions. | ||
| * | ||
| * @param eid Execution ID associated with the result. | ||
| * @param globalPortId Global port identifier for the operator output. | ||
| * @param count Number of rows in the result. | ||
| */ | ||
| def updateResultCount( | ||
| eid: ExecutionIdentity, | ||
| globalPortId: GlobalPortIdentity, | ||
| count: Long | ||
| ): Unit = { | ||
| context | ||
| .update(OPERATOR_PORT_EXECUTIONS) | ||
| .set(OPERATOR_PORT_EXECUTIONS.RESULT_COUNT, java.lang.Long.valueOf(count)) | ||
| .where(OPERATOR_PORT_EXECUTIONS.WORKFLOW_EXECUTION_ID.eq(eid.id.toInt)) | ||
| .and(OPERATOR_PORT_EXECUTIONS.GLOBAL_PORT_ID.eq(globalPortId.serializeAsString)) | ||
| .execute() | ||
| } | ||
|
Comment on lines
+423
to
+434
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keeping
Comment on lines
+423
to
+434
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This and |
||
|
|
||
| /** | ||
| * Updates the size of the runtime statistics stored via Iceberg document. | ||
| * | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,7 @@ import org.apache.texera.amber.core.storage.{DocumentFactory, VFSURIFactory} | |
| import org.apache.texera.amber.core.tuple.{AttributeType, Tuple, TupleUtils} | ||
| import org.apache.texera.amber.util.serde.GlobalPortIdentitySerde.SerdeOps | ||
| import org.apache.texera.dao.SqlServer | ||
| import org.apache.texera.dao.jooq.generated.enums.OutputModeEnum | ||
| import org.apache.texera.dao.jooq.generated.tables.daos.OperatorPortExecutionsDao | ||
| import org.apache.texera.dao.jooq.generated.tables.pojos.OperatorPortExecutions | ||
| import org.apache.texera.amber.core.virtualidentity.{ | ||
|
|
@@ -92,11 +93,24 @@ object ExecutionResultService { | |
| pojo.setWorkflowExecutionId(executionId.id.toInt) | ||
| pojo.setGlobalPortId(evt.globalPortId.serializeAsString) | ||
| pojo.setResultUri(evt.uri.toString) | ||
| pojo.setOutputMode(toOutputModeEnum(evt.mode).orNull) | ||
| new OperatorPortExecutionsDao( | ||
| SqlServer.getInstance().createDSLContext().configuration() | ||
| ).insert(pojo) | ||
| } | ||
|
|
||
| /** | ||
| * The stored form of a port's output mode. Recorded with the URI so that a finished | ||
| * execution's results can be listed without the engine's physical plan (#8994). | ||
| */ | ||
| private[service] def toOutputModeEnum(mode: OutputMode): Option[OutputModeEnum] = | ||
| mode match { | ||
| case OutputMode.SET_SNAPSHOT => Some(OutputModeEnum.SET_SNAPSHOT) | ||
| case OutputMode.SET_DELTA => Some(OutputModeEnum.SET_DELTA) | ||
| case OutputMode.SINGLE_SNAPSHOT => Some(OutputModeEnum.SINGLE_SNAPSHOT) | ||
| case OutputMode.Unrecognized(_) => None | ||
| } | ||
|
|
||
| private val defaultPageSize: Int = 5 | ||
| private val binaryPreviewLeadingBits: Int = 10 | ||
| private val binaryPreviewTrailingBits: Int = 3 | ||
|
|
@@ -447,6 +461,11 @@ class ExecutionResultService( | |
| globalPortIdOption.get, | ||
| opStorage.getTotalFileSize | ||
| ) | ||
| WorkflowExecutionsResource.updateResultCount( | ||
| executionId, | ||
| globalPortIdOption.get, | ||
| info.tupleCount | ||
| ) | ||
|
Comment on lines
+464
to
+468
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| WorkflowExecutionsResource.updateRuntimeStatsSize(executionId) | ||
| WorkflowExecutionsResource.updateConsoleMessageSize(executionId, opId) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| -- Names are schema-qualified because the two runners disagree about the search path: the | ||
| -- liquibase runner in sql/docker-compose.yml strips `SET search_path` out of these files before | ||
| -- applying them, while bin/local-dev.sh keeps it. | ||
|
|
||
| \c texera_db | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keeping it for consistency: 51 of the 52 scripts in |
||
|
|
||
| SET search_path TO texera_db; | ||
|
mengw15 marked this conversation as resolved.
|
||
|
|
||
| BEGIN; | ||
|
|
||
| DO $$ | ||
| BEGIN | ||
| IF NOT EXISTS ( | ||
| SELECT 1 | ||
| FROM pg_type t | ||
| JOIN pg_namespace n ON n.oid = t.typnamespace | ||
| WHERE t.typname = 'output_mode_enum' AND n.nspname = 'texera_db' | ||
| ) THEN | ||
| CREATE TYPE texera_db.output_mode_enum AS ENUM ('SET_SNAPSHOT', 'SET_DELTA', 'SINGLE_SNAPSHOT'); | ||
| END IF; | ||
| END $$; | ||
|
|
||
| -- The port's declared output mode and row count, so a finished execution's results | ||
| -- can be listed without the engine's physical plan or opening each table (#8994). | ||
| -- Rows written before this change keep both columns null. | ||
| ALTER TABLE texera_db.operator_port_executions | ||
| ADD COLUMN IF NOT EXISTS output_mode texera_db.output_mode_enum DEFAULT NULL, | ||
| ADD COLUMN IF NOT EXISTS result_count BIGINT DEFAULT NULL; | ||
|
|
||
| COMMIT; | ||
Uh oh!
There was an error while loading. Please reload this page.