File tree Expand file tree Collapse file tree 4 files changed +6
-20
lines changed
SwiftAPI/Pipeline/Aggregates Expand file tree Collapse file tree 4 files changed +6
-20
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ enum Helper {
3838 }
3939 let alias = value. alias
4040 if result. keys. contains ( alias) {
41+ // TODO: Add tests to verify the behaviour.
4142 fatalError ( " Duplicate alias ' \( alias) ' found in selectables. " )
4243 }
4344 result [ alias] = value. expr
@@ -52,6 +53,7 @@ enum Helper {
5253
5354 let alias = aliasedAggregate. alias
5455 if result. keys. contains ( alias) {
56+ // TODO: Add tests to verify the behaviour.
5557 fatalError ( " Duplicate alias ' \( alias) ' found in accumulators. " )
5658 }
5759 result [ alias] = aliasedAggregate. aggregate
@@ -84,11 +86,11 @@ enum Helper {
8486 if let exprValue = value as? Expression {
8587 return exprValue. toBridge ( )
8688 } else if let aggregateFunctionValue = value as? AggregateFunction {
87- return aggregateFunctionValue. toBridge ( )
89+ return aggregateFunctionValue. bridge
8890 } else if let dictionaryValue = value as? [ String : Sendable ? ] {
8991 let mappedValue : [ String : Sendable ] = dictionaryValue. mapValues {
9092 if let aggFunc = $0 as? AggregateFunction {
91- return aggFunc. toBridge ( )
93+ return aggFunc. bridge
9294 }
9395 return sendableToExpr ( $0) . toBridge ( )
9496 }
Original file line number Diff line number Diff line change @@ -151,8 +151,8 @@ class AddFields: Stage {
151151 init ( selectables: [ Selectable ] ) {
152152 self . selectables = selectables
153153 let map = Helper . selectablesToMap ( selectables: selectables)
154- let objc_accumulators = map. mapValues { $0. toBridge ( ) }
155- bridge = AddFieldsStageBridge ( fields: objc_accumulators )
154+ let objcAccumulators = map. mapValues { $0. toBridge ( ) }
155+ bridge = AddFieldsStageBridge ( fields: objcAccumulators )
156156 }
157157}
158158
Original file line number Diff line number Diff line change 1212// See the License for the specific language governing permissions and
1313// limitations under the License.
1414
15- extension AggregateFunction {
16- func toBridge( ) -> AggregateFunctionBridge {
17- return ( self as AggregateBridgeWrapper ) . bridge
18- }
19- }
20-
2115/// Represents an aggregate function in a pipeline.
2216///
2317/// An `AggregateFunction` is a function that computes a single value from a set of input values.
Original file line number Diff line number Diff line change @@ -3243,16 +3243,6 @@ class PipelineIntegrationTests: FSTIntegrationTestCase {
32433243 }
32443244 }
32453245
3246- func testAddFieldsThrowsOnDuplicateAliases( ) async throws {
3247- let collRef = collectionRef ( withDocuments: bookDocs)
3248- let db = collRef. firestore
3249- _ = db. pipeline ( )
3250- . collection ( collRef. path)
3251- . select ( [ Field ( " title " ) , Field ( " author " ) ] )
3252- . addFields ( [ Constant ( " bar " ) . as ( " foo " ) , Constant ( " baz " ) . as ( " foo " ) ] )
3253- . sort ( [ Field ( " author " ) . ascending ( ) ] )
3254- }
3255-
32563246 func testSupportsTimestampConversions( ) async throws {
32573247 let db = firestore ( )
32583248 let randomCol = collectionRef ( ) // Unique collection for this test
You can’t perform that action at this time.
0 commit comments