Skip to content

Commit 5e94ed5

Browse files
beneschstainless-app[bot]
authored andcommitted
fix build
1 parent e0b8d23 commit 5e94ed5

File tree

1 file changed

+15
-111
lines changed
  • turbopuffer-java-core/src/main/kotlin/com/turbopuffer/models/namespaces

1 file changed

+15
-111
lines changed

turbopuffer-java-core/src/main/kotlin/com/turbopuffer/models/namespaces/Query.kt

Lines changed: 15 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ private constructor(
415415
fun limit(integer: Long) = limit(Limit.ofInteger(integer))
416416

417417
/** Alias for calling [Builder.limit] with `Limit.ofLimit(limit)`. */
418-
fun limit(limit: Limit) = limit(Limit.ofLimit(limit))
418+
fun limit(limit: com.turbopuffer.models.namespaces.Limit) = limit(Limit.ofLimit(limit))
419419

420420
/** How to rank the documents in the namespace. */
421421
fun rankBy(rankBy: RankBy) = rankBy(JsonField.of(rankBy))
@@ -520,120 +520,20 @@ private constructor(
520520
(if (rankBy.asKnown().isPresent()) 1 else 0) +
521521
(if (topK.asKnown().isPresent) 1 else 0)
522522

523-
/** Aggregations to compute over all documents in the namespace that match the filters. */
524-
class AggregateBy
525-
@JsonCreator
526-
private constructor(
527-
@com.fasterxml.jackson.annotation.JsonValue
528-
private val additionalProperties: Map<String, JsonValue>
529-
) {
530-
531-
@JsonAnyGetter
532-
@ExcludeMissing
533-
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
534-
535-
fun toBuilder() = Builder().from(this)
536-
537-
companion object {
538-
539-
/** Returns a mutable builder for constructing an instance of [AggregateBy]. */
540-
@JvmStatic fun builder() = Builder()
541-
}
542-
543-
/** A builder for [AggregateBy]. */
544-
class Builder internal constructor() {
545-
546-
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
547-
548-
@JvmSynthetic
549-
internal fun from(aggregateBy: AggregateBy) = apply {
550-
additionalProperties = aggregateBy.additionalProperties.toMutableMap()
551-
}
552-
553-
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
554-
this.additionalProperties.clear()
555-
putAllAdditionalProperties(additionalProperties)
556-
}
557-
558-
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
559-
additionalProperties.put(key, value)
560-
}
561-
562-
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
563-
this.additionalProperties.putAll(additionalProperties)
564-
}
565-
566-
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
567-
568-
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
569-
keys.forEach(::removeAdditionalProperty)
570-
}
571-
572-
/**
573-
* Returns an immutable instance of [AggregateBy].
574-
*
575-
* Further updates to this [Builder] will not mutate the returned instance.
576-
*/
577-
fun build(): AggregateBy = AggregateBy(additionalProperties.toImmutable())
578-
}
579-
580-
private var validated: Boolean = false
581-
582-
fun validate(): AggregateBy = apply {
583-
if (validated) {
584-
return@apply
585-
}
586-
587-
validated = true
588-
}
589-
590-
fun isValid(): Boolean =
591-
try {
592-
validate()
593-
true
594-
} catch (e: TurbopufferInvalidDataException) {
595-
false
596-
}
597-
598-
/**
599-
* Returns a score indicating how many valid values are contained in this object
600-
* recursively.
601-
*
602-
* Used for best match union deserialization.
603-
*/
604-
@JvmSynthetic
605-
internal fun validity(): Int =
606-
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
607-
608-
override fun equals(other: Any?): Boolean {
609-
if (this === other) {
610-
return true
611-
}
612-
613-
return other is AggregateBy && additionalProperties == other.additionalProperties
614-
}
615-
616-
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
617-
618-
override fun hashCode(): Int = hashCode
619-
620-
override fun toString() = "AggregateBy{additionalProperties=$additionalProperties}"
621-
}
622-
623523
/** Limits the documents returned by a query. */
624524
@JsonDeserialize(using = Limit.Deserializer::class)
625525
@JsonSerialize(using = Limit.Serializer::class)
626526
class Limit
627527
private constructor(
628528
private val integer: Long? = null,
629-
private val limit: Limit? = null,
529+
private val limit: com.turbopuffer.models.namespaces.Limit? = null,
630530
private val _json: JsonValue? = null,
631531
) {
632532

633533
fun integer(): Optional<Long> = Optional.ofNullable(integer)
634534

635535
/** Limits the documents returned by a query. */
636-
fun limit(): Optional<Limit> = Optional.ofNullable(limit)
536+
fun limit(): Optional<com.turbopuffer.models.namespaces.Limit> = Optional.ofNullable(limit)
637537

638538
fun isInteger(): Boolean = integer != null
639539

@@ -642,7 +542,7 @@ private constructor(
642542
fun asInteger(): Long = integer.getOrThrow("integer")
643543

644544
/** Limits the documents returned by a query. */
645-
fun asLimit(): Limit = limit.getOrThrow("limit")
545+
fun asLimit(): com.turbopuffer.models.namespaces.Limit = limit.getOrThrow("limit")
646546

647547
fun _json(): Optional<JsonValue> = Optional.ofNullable(_json)
648548

@@ -664,7 +564,7 @@ private constructor(
664564
object : Visitor<Unit> {
665565
override fun visitInteger(integer: Long) {}
666566

667-
override fun visitLimit(limit: Limit) {
567+
override fun visitLimit(limit: com.turbopuffer.models.namespaces.Limit) {
668568
limit.validate()
669569
}
670570
}
@@ -692,7 +592,8 @@ private constructor(
692592
object : Visitor<Int> {
693593
override fun visitInteger(integer: Long) = 1
694594

695-
override fun visitLimit(limit: Limit) = limit.validity()
595+
override fun visitLimit(limit: com.turbopuffer.models.namespaces.Limit) =
596+
limit.validity()
696597

697598
override fun unknown(json: JsonValue?) = 0
698599
}
@@ -721,7 +622,8 @@ private constructor(
721622
@JvmStatic fun ofInteger(integer: Long) = Limit(integer = integer)
722623

723624
/** Limits the documents returned by a query. */
724-
@JvmStatic fun ofLimit(limit: Limit) = Limit(limit = limit)
625+
@JvmStatic
626+
fun ofLimit(limit: com.turbopuffer.models.namespaces.Limit) = Limit(limit = limit)
725627
}
726628

727629
/** An interface that defines how to map each variant of [Limit] to a value of type [T]. */
@@ -730,7 +632,7 @@ private constructor(
730632
fun visitInteger(integer: Long): T
731633

732634
/** Limits the documents returned by a query. */
733-
fun visitLimit(limit: Limit): T
635+
fun visitLimit(limit: com.turbopuffer.models.namespaces.Limit): T
734636

735637
/**
736638
* Maps an unknown variant of [Limit] to a value of type [T].
@@ -754,9 +656,11 @@ private constructor(
754656

755657
val bestMatches =
756658
sequenceOf(
757-
tryDeserialize(node, jacksonTypeRef<Limit>())?.let {
758-
Limit(limit = it, _json = json)
759-
},
659+
tryDeserialize(
660+
node,
661+
jacksonTypeRef<com.turbopuffer.models.namespaces.Limit>(),
662+
)
663+
?.let { Limit(limit = it, _json = json) },
760664
tryDeserialize(node, jacksonTypeRef<Long>())?.let {
761665
Limit(integer = it, _json = json)
762666
},

0 commit comments

Comments
 (0)