Skip to content

Commit

Permalink
cleanup: remove deprecated derivation property of collection spec
Browse files Browse the repository at this point in the history
It's been deprecated a while now, and no specs in production use it any
longer.
  • Loading branch information
jgraettinger committed Sep 12, 2023
1 parent bc64105 commit aa94b7b
Show file tree
Hide file tree
Showing 16 changed files with 5 additions and 147 deletions.
2 changes: 1 addition & 1 deletion crates/agent-sql/src/publications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ pub async fn find_tenant_quotas(
where
live_specs.spec_type = 'capture' or
live_specs.spec_type = 'materialization' or
live_specs.spec_type = 'collection' and live_specs.spec->'derivation' is not null
live_specs.spec_type = 'collection' and live_specs.spec->'derive' is not null
))::integer as tasks_used,
(count(live_specs.catalog_name) filter (
where live_specs.spec_type = 'collection'
Expand Down
2 changes: 1 addition & 1 deletion crates/agent-sql/tests/publications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ async fn test_tenant_usage_quotas() {
('1000000000000000', 'usageA/CollectionA', '1', 'collection', 'bbbbbbbbbbbbbbbb', 'bbbbbbbbbbbbbbbb'),
('2000000000000000', 'usageA/CaptureA', '1', 'capture', 'bbbbbbbbbbbbbbbb', 'bbbbbbbbbbbbbbbb'),
('3000000000000000', 'usageA/MaterializationA', '1', 'materialization', 'bbbbbbbbbbbbbbbb', 'bbbbbbbbbbbbbbbb'),
('5000000000000000', 'usageA/DerivationA', '{"derivation": {}}'::json, 'collection', 'bbbbbbbbbbbbbbbb', 'bbbbbbbbbbbbbbbb'),
('5000000000000000', 'usageA/DerivationA', '{"derive": {}}'::json, 'collection', 'bbbbbbbbbbbbbbbb', 'bbbbbbbbbbbbbbbb'),
('6000000000000000', 'usageB/CaptureA', '1', 'capture', 'bbbbbbbbbbbbbbbb', 'bbbbbbbbbbbbbbbb'),
('7000000000000000', 'usageB/CaptureB', '1', 'capture', 'bbbbbbbbbbbbbbbb', 'bbbbbbbbbbbbbbbb'),
('8000000000000000', 'usageB/CaptureC', '1', 'capture', 'bbbbbbbbbbbbbbbb', 'bbbbbbbbbbbbbbbb'),
Expand Down
1 change: 0 additions & 1 deletion crates/agent/src/discovers/specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ pub fn merge_collections(
projections: Default::default(),
journals: Default::default(),
derive: None,
derivation: None,
});

if collection.read_schema.is_some() {
Expand Down
2 changes: 1 addition & 1 deletion crates/agent/src/publications/specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,7 @@ mod test {
),
p5 as (
insert into draft_specs (id, draft_id, catalog_name, spec, spec_type) values
('1112000000000000', '1120000000000000', 'usageB/DerivationA', '{"schema": {}, "key": ["foo"], "derivation": {"transform":{"key": {"source": {"name": "usageB/CollectionA"}}}}}'::json, 'collection')
('1112000000000000', '1120000000000000', 'usageB/DerivationA', '{"schema": {}, "key": ["foo"], "derive": {"using": {"sqlite": {}}, "transforms":[{"name": "a-transform", "source": "usageB/CollectionA"}]}}'::json, 'collection')
),
p6 as (
insert into publications (id, job_status, user_id, draft_id) values
Expand Down
1 change: 0 additions & 1 deletion crates/assemble/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ pub fn collection_spec(
key,
projections: _,
journals,
derivation: _,
derive: _,
},
} = collection;
Expand Down
1 change: 0 additions & 1 deletion crates/flowctl/src/raw/discover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ pub async fn do_discover(
.collect::<Vec<JsonPointer>>(),
),
derive: None,
derivation: None,
projections: Default::default(),
journals: Default::default(),
},
Expand Down
7 changes: 1 addition & 6 deletions crates/models/src/collections.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::{CompositeKey, Derivation, Field, JournalTemplate, JsonPointer, RawValue, Schema};
use super::{CompositeKey, Derivation, Field, JournalTemplate, JsonPointer, Schema};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use serde_json::{from_value, json};
Expand Down Expand Up @@ -38,10 +38,6 @@ pub struct CollectionDef {
// # Derivation which builds this collection as transformations of other collections.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub derive: Option<Derivation>,
// TODO(johnny): Remove after cut-over.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[schemars(skip)]
pub derivation: Option<RawValue>,
}

impl CollectionDef {
Expand All @@ -54,7 +50,6 @@ impl CollectionDef {
projections: BTreeMap::new(),
journals: JournalTemplate::default(),
derive: None,
derivation: None,
}
}
}
Expand Down
1 change: 0 additions & 1 deletion crates/sources/src/indirect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ fn indirect_collection(
projections: _,
journals: _,
derive,
derivation: _,
},
} = collection;
let base = base_name(collection);
Expand Down
1 change: 0 additions & 1 deletion crates/sources/src/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ fn inline_collection(
projections: _,
journals: _,
derive,
derivation: _,
},
} = collection;

Expand Down
1 change: 0 additions & 1 deletion crates/validation/src/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ fn walk_collection(
projections,
journals: _,
derive: _,
derivation: _,
},
} = collection;
let scope = Scope::new(scope);
Expand Down
18 changes: 0 additions & 18 deletions examples/derive-patterns/join-one-sided.flow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,6 @@ collections:
INSERT INTO join_state (key, rhs) VALUES ($Key, JSON_ARRAY($String))
ON CONFLICT (key) DO UPDATE SET rhs = JSON_INSERT(COALESCE(rhs, '[]'), '$[#]', $String);
derivation:
register:
schema: schema.yaml#Join
initial: { RHS: [] }

transform:
publishLHS:
source: { name: patterns/ints }
shuffle: { key: [/Key] }
publish: { lambda: typescript }

updateRHS:
source: { name: patterns/strings }
shuffle: { key: [/Key] }
update: { lambda: typescript }
typescript:
module: join-one-sided.flow.ts

tests:
patterns/test/one-sided-join:
- ingest:
Expand Down
38 changes: 0 additions & 38 deletions go/bindings/testdata/inc-reset-publish.flow.yaml

This file was deleted.

36 changes: 0 additions & 36 deletions go/bindings/testdata/inc-reset-publish.schema.yaml

This file was deleted.

29 changes: 0 additions & 29 deletions go/bindings/testdata/inc-reset-publish.ts

This file was deleted.

10 changes: 0 additions & 10 deletions go/bindings/testdata/int-strings.flow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,3 @@ collections:
projections:
part_a: /s/1
part_b: /i
derivation:
typescript:
module: |
import stuff;
doOtherStuff();
transform:
appendStrings:
source:
name: int-string
publish: { lambda: typescript }
2 changes: 1 addition & 1 deletion site/docs/concepts/collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ collections:
# Derivation that builds this collection from others through transformations.
# See the "Derivations" concept page to learn more.
# Optional, type: object
derivation:
derive: ~
```
## Schemas
Expand Down

0 comments on commit aa94b7b

Please sign in to comment.