Skip to content

Commit 14a5854

Browse files
committed
Remove namespaceAvailableAfter
1 parent 5a6cbb3 commit 14a5854

File tree

2 files changed

+2
-34
lines changed

2 files changed

+2
-34
lines changed

Sources/DataTransferObjects/Query/CustomQuery+CompileDown.swift

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public extension CustomQuery {
1717
/// @see compileToRunnableQuery
1818
func precompile(
1919
namespace: String? = nil,
20-
namespaceAvailableAfter: Date? = nil,
2120
organizationAppIDs: [UUID],
2221
isSuperOrg: Bool
2322
) throws -> CustomQuery {
@@ -75,7 +74,6 @@ public extension CustomQuery {
7574
// Apply base filters and data source
7675
query = try Self.applyBaseFilters(
7776
namespace: namespace,
78-
namespaceAvailableAfter: namespaceAvailableAfter,
7977
query: query,
8078
organizationAppIDs: organizationAppIDs,
8179
isSuperOrg: isSuperOrg
@@ -181,7 +179,6 @@ public extension CustomQuery {
181179
extension CustomQuery {
182180
static func applyBaseFilters(
183181
namespace: String?,
184-
namespaceAvailableAfter: Date?,
185182
query: CustomQuery,
186183
organizationAppIDs: [UUID]?,
187184
isSuperOrg: Bool
@@ -218,22 +215,11 @@ extension CustomQuery {
218215

219216
let allowedDataSourceNames = [
220217
"telemetry-signals",
221-
"com.telemetrydeck.all",
222-
"com.telemetrydeck.compacted"
218+
"com.telemetrydeck.all"
223219
]
224220

225-
// Calculate earliest interval date, to compare against namespaceAvailableAfter
226-
var earliestIntervalDate = Date.distantFuture
227-
for interval in query.intervals ?? [] {
228-
earliestIntervalDate = min(interval.beginningDate, earliestIntervalDate)
229-
}
230-
for relativeInterval in query.relativeIntervals ?? [] {
231-
let interval = QueryTimeInterval.from(relativeTimeInterval: relativeInterval)
232-
earliestIntervalDate = min(interval.beginningDate, earliestIntervalDate)
233-
}
234-
235221
// Decide the data source based on the data source property and namespaces
236-
if let namespace, (namespaceAvailableAfter ?? Date.distantPast) < earliestIntervalDate {
222+
if let namespace {
237223
// If a namespace is available, use the namespace, even if another data source is specified.
238224
// This allows us to specify com.telemetrydeck.all for global queries and still use the customer's
239225
// name space if they have one.

Tests/QueryGenerationTests/CompileDownTests.swift

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -290,31 +290,13 @@ final class CompileDownTests: XCTestCase {
290290
query.dataSource = nil
291291
let precompiledQuery = try query.precompile(
292292
namespace: "some-unknown-namespace",
293-
namespaceAvailableAfter: Date(iso8601String: "2024-12-01T00:00:00.000Z")!,
294293
organizationAppIDs: [appID1, appID2],
295294
isSuperOrg: false
296295
)
297296
let compiledQuery = try precompiledQuery.compileToRunnableQuery()
298297
XCTAssertEqual(compiledQuery.dataSource?.name, "telemetry-signals")
299298
}
300299

301-
func testNamespaceWithAvailabilityDateInThePast() throws {
302-
let intervals: [QueryTimeInterval] = [
303-
.init(beginningDate: Date(iso8601String: "2023-04-01T00:00:00.000Z")!, endDate: Date(iso8601String: "2023-05-31T00:00:00.000Z")!),
304-
]
305-
306-
var query = CustomQuery(queryType: .timeseries, intervals: intervals, granularity: .day)
307-
query.dataSource = nil
308-
let precompiledQuery = try query.precompile(
309-
namespace: "some-unknown-namespace",
310-
namespaceAvailableAfter: Date(iso8601String: "2022-12-01T00:00:00.000Z")!,
311-
organizationAppIDs: [appID1, appID2],
312-
isSuperOrg: false
313-
)
314-
let compiledQuery = try precompiledQuery.compileToRunnableQuery()
315-
XCTAssertEqual(compiledQuery.dataSource?.name, "some-unknown-namespace")
316-
}
317-
318300
func testAllowsHourlyGranularityForTimeseries() throws {
319301
let intervals: [QueryTimeInterval] = [
320302
.init(beginningDate: Date(iso8601String: "2023-04-01T00:00:00.000Z")!, endDate: Date(iso8601String: "2023-05-31T00:00:00.000Z")!),

0 commit comments

Comments
 (0)