File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,6 +127,21 @@ def test_synthetic_key_marker():
127127 assert [c .name for c in relations .keys ] == ["id" ]
128128
129129
130+ def test_synthetic_key_with_unary_keyless_relation ():
131+ # A synthetic key with a single relation that has no value columns: the
132+ # relation holds just the (synthetic) key.
133+ fragment = (
134+ '(fragment :f (csv_data (csv_locator (paths "x.csv")) (csv_config {}) '
135+ "(relations (keys synthetic) (relation :keys)) "
136+ '(asof "2025-01-01T00:00:00Z")))'
137+ )
138+ relations = _relations_of (fragment )
139+ assert relations .synthetic_key is True
140+ assert list (relations .keys ) == []
141+ assert len (relations .plain .targets ) == 1
142+ assert list (relations .plain .targets [0 ].values ) == []
143+
144+
130145def test_synthetic_key_rejects_unknown_marker ():
131146 # Only the `synthetic` marker is accepted; anything else is a hard error.
132147 with pytest .raises (ParseError ):
Original file line number Diff line number Diff line change 1+
2+ �
3+ �
4+ �
5+ �
6+
7+ f1e"ca
8+
9+ s3://bucket/keys.csv",*"2"J.Rutf-8"2025-06-01T00:00:00Z*
10+
11+ #�yS�ӶDC�<'۳��
12+ #�yS�ӶDC�<'۳��keys
13+ keys #�yS�ӶDC�<'۳��
Original file line number Diff line number Diff line change 1+ (transaction
2+ (epoch
3+ (writes
4+ (define
5+ (fragment :f1
6+ ;; Generalized CSV loading with a synthetic (loader-generated) key and a single
7+ ;; unary relation that carries no value columns — the relation holds just the key.
8+ (csv_data
9+ (csv_locator
10+ (paths "s3://bucket/keys.csv"))
11+ (csv_config {})
12+ (relations
13+ (keys synthetic)
14+ (relation :keys))
15+ (asof "2025-06-01T00:00:00Z")))))
16+
17+ (reads
18+ (output :keys :keys))))
Original file line number Diff line number Diff line change 1+ (transaction
2+ (configure { :ivm.maintenance_level "off" :semantics_version 0})
3+ (epoch
4+ (writes
5+ (define
6+ (fragment
7+ :f1
8+ (csv_data
9+ (csv_locator (paths "s3://bucket/keys.csv"))
10+ (csv_config
11+ {
12+ :csv_compression ""
13+ :csv_decimal_separator "."
14+ :csv_delimiter ","
15+ :csv_encoding "utf-8"
16+ :csv_escapechar "\""
17+ :csv_header_row 1i32
18+ :csv_quotechar "\""
19+ :csv_skip 0})
20+ (relations (keys synthetic) (relation :keys))
21+ (asof "2025-06-01T00:00:00Z")))))
22+ (reads (output :keys :keys))))
Original file line number Diff line number Diff line change 1+ (transaction
2+ (configure { :ivm.maintenance_level "off" :semantics_version 0})
3+ (epoch
4+ (writes
5+ (define
6+ (fragment
7+ :f1
8+ (csv_data
9+ (csv_locator (paths "s3://bucket/keys.csv"))
10+ (csv_config
11+ {
12+ :csv_compression ""
13+ :csv_decimal_separator "."
14+ :csv_delimiter ","
15+ :csv_encoding "utf-8"
16+ :csv_escapechar "\""
17+ :csv_header_row 1i32
18+ :csv_quotechar "\""
19+ :csv_skip 0})
20+ (relations (keys synthetic) (relation 0xd382b3db273cff4344b6d39d5379c923))
21+ (asof "2025-06-01T00:00:00Z")))))
22+ (reads (output :keys 0xd382b3db273cff4344b6d39d5379c923))))
23+
24+ ;; Debug information
25+ ;; -----------------------
26+ ;; Original names
27+ ;; ID `0xd382b3db273cff4344b6d39d5379c923` -> `keys`
You can’t perform that action at this time.
0 commit comments