Xiao-zhen-Liu commented on code in PR #5967: URL: https://github.com/apache/texera/pull/5967#discussion_r3500244523
########## sql/updates/26.sql: ########## @@ -0,0 +1,55 @@ +-- 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. + +-- ============================================ +-- 1. Connect to the texera_db database +-- ============================================ +\c texera_db + +SET search_path TO texera_db; + +-- ============================================ +-- 2. Add the operator_port_cache table +-- ============================================ +BEGIN; + +-- Caches a materialized output port result so it can be reused across executions. +-- A row is identified by (workflow_id, global_port_id, cache_key), where cache_key is a +-- SHA-256 hash of the upstream sub-DAG that produces the port (its operators, their +-- parameters and exec info, schemas, and wiring). cache_key is the lookup key; +-- cache_key_json is the JSON the hash was computed from, kept so a hash match can be +-- confirmed against the full content (collision safety). A different upstream computation +-- (for example an operator parameter or version change) produces a different cache_key and +-- therefore a new row, so existing entries are never overwritten: each row is the result of +-- one specific computation of one port. tuple_count is the result's row count, kept so the +-- coordinator can report a reused region's output stats without a second query to the +-- Iceberg catalog. +CREATE TABLE IF NOT EXISTS operator_port_cache +( + workflow_id INT NOT NULL, + global_port_id VARCHAR(200) NOT NULL, + cache_key CHAR(64) NOT NULL, Review Comment: Done — renamed `cache_key` to `cache_key_hash` (column, primary key, and the comments). `cache_key_json` stays as the JSON it was computed from. ########## sql/updates/26.sql: ########## @@ -0,0 +1,55 @@ +-- 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. + +-- ============================================ +-- 1. Connect to the texera_db database +-- ============================================ +\c texera_db + +SET search_path TO texera_db; + +-- ============================================ +-- 2. Add the operator_port_cache table +-- ============================================ +BEGIN; + +-- Caches a materialized output port result so it can be reused across executions. +-- A row is identified by (workflow_id, global_port_id, cache_key), where cache_key is a +-- SHA-256 hash of the upstream sub-DAG that produces the port (its operators, their +-- parameters and exec info, schemas, and wiring). cache_key is the lookup key; +-- cache_key_json is the JSON the hash was computed from, kept so a hash match can be +-- confirmed against the full content (collision safety). A different upstream computation +-- (for example an operator parameter or version change) produces a different cache_key and +-- therefore a new row, so existing entries are never overwritten: each row is the result of +-- one specific computation of one port. tuple_count is the result's row count, kept so the +-- coordinator can report a reused region's output stats without a second query to the +-- Iceberg catalog. +CREATE TABLE IF NOT EXISTS operator_port_cache +( + workflow_id INT NOT NULL, + global_port_id VARCHAR(200) NOT NULL, + cache_key CHAR(64) NOT NULL, Review Comment: Done — renamed `cache_key` to `cache_key_hash` (column, primary key, and the comments). `cache_key_json` stays as the JSON it was computed from. ########## sql/updates/26.sql: ########## @@ -0,0 +1,47 @@ +-- 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. + +-- ============================================ +-- 1. Connect to the texera_db database +-- ============================================ +\c texera_db + +SET search_path TO texera_db; + +-- ============================================ +-- 2. Add the operator_port_cache table +-- ============================================ +BEGIN; + +-- Caches a materialized output port result across executions, keyed by the cache +-- key (a SHA-256 hash of the upstream sub-DAG). cache_key_json holds the JSON +-- the cache key is computed from. +CREATE TABLE IF NOT EXISTS operator_port_cache +( + workflow_id INT NOT NULL, + global_port_id VARCHAR(200) NOT NULL, + cache_key CHAR(64) NOT NULL, + cache_key_json TEXT NOT NULL, Review Comment: Renamed `cache_key` to `cache_key_hash` as suggested, so the hash column and the `cache_key_json` column read clearly. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
