@@ -794,28 +794,88 @@ abstract class Expr internal constructor() {
794
794
fun notEqAny (fieldName : String , arrayExpression : Expr ): BooleanExpr =
795
795
BooleanExpr (" not_eq_any" , fieldName, arrayExpression)
796
796
797
- /* * @return A new [Expr] representing the isNan operation. */
797
+ /* *
798
+ * Creates an expression that returns true if a value is absent. Otherwise, returns false even
799
+ * if the value is null.
800
+ *
801
+ * @param value The expression to check.
802
+ * @return A new [BooleanExpr] representing the isAbsent operation.
803
+ */
804
+ @JvmStatic fun isAbsent (value : Expr ): BooleanExpr = BooleanExpr (" is_absent" , value)
805
+
806
+ /* *
807
+ * Creates an expression that returns true if a field is absent. Otherwise, returns false even
808
+ * if the field value is null.
809
+ *
810
+ * @param fieldName The field to check.
811
+ * @return A new [BooleanExpr] representing the isAbsent operation.
812
+ */
813
+ @JvmStatic fun isAbsent (fieldName : String ): BooleanExpr = BooleanExpr (" is_absent" , fieldName)
814
+
815
+ /* *
816
+ * Creates an expression that checks if an expression evaluates to 'NaN' (Not a Number).
817
+ *
818
+ * @param expr The expression to check.
819
+ * @return A new [BooleanExpr] representing the isNan operation.
820
+ */
798
821
@JvmStatic fun isNan (expr : Expr ): BooleanExpr = BooleanExpr (" is_nan" , expr)
799
822
800
- /* * @return A new [Expr] representing the isNan operation. */
823
+ /* *
824
+ * Creates an expression that checks if [expr] evaluates to 'NaN' (Not a Number).
825
+ *
826
+ * @param fieldName The field to check.
827
+ * @return A new [BooleanExpr] representing the isNan operation.
828
+ */
801
829
@JvmStatic fun isNan (fieldName : String ): BooleanExpr = BooleanExpr (" is_nan" , fieldName)
802
830
803
- /* * @return A new [Expr] representing the isNotNan operation. */
831
+ /* *
832
+ * Creates an expression that checks if the results of [expr] is NOT 'NaN' (Not a
833
+ * Number).
834
+ *
835
+ * @param expr The expression to check.
836
+ * @return A new [BooleanExpr] representing the isNotNan operation.
837
+ */
804
838
@JvmStatic fun isNotNan (expr : Expr ): BooleanExpr = BooleanExpr (" is_not_nan" , expr)
805
839
806
- /* * @return A new [Expr] representing the isNotNan operation. */
840
+ /* *
841
+ * Creates an expression that checks if the results of this expression is NOT 'NaN' (Not a
842
+ * Number).
843
+ *
844
+ * @param fieldName The field to check.
845
+ * @return A new [BooleanExpr] representing the isNotNan operation.
846
+ */
807
847
@JvmStatic fun isNotNan (fieldName : String ): BooleanExpr = BooleanExpr (" is_not_nan" , fieldName)
808
848
809
- /* * @return A new [Expr] representing the isNull operation. */
849
+ /* *
850
+ * Creates an expression that checks if tbe result of [expr] is null.
851
+ *
852
+ * @param expr The expression to check.
853
+ * @return A new [BooleanExpr] representing the isNull operation.
854
+ */
810
855
@JvmStatic fun isNull (expr : Expr ): BooleanExpr = BooleanExpr (" is_null" , expr)
811
856
812
- /* * @return A new [Expr] representing the isNull operation. */
857
+ /* *
858
+ * Creates an expression that checks if tbe value of a field is null.
859
+ *
860
+ * @param fieldName The field to check.
861
+ * @return A new [BooleanExpr] representing the isNull operation.
862
+ */
813
863
@JvmStatic fun isNull (fieldName : String ): BooleanExpr = BooleanExpr (" is_null" , fieldName)
814
864
815
- /* * @return A new [Expr] representing the isNotNull operation. */
865
+ /* *
866
+ * Creates an expression that checks if tbe result of [expr] is not null.
867
+ *
868
+ * @param expr The expression to check.
869
+ * @return A new [BooleanExpr] representing the isNotNull operation.
870
+ */
816
871
@JvmStatic fun isNotNull (expr : Expr ): BooleanExpr = BooleanExpr (" is_not_null" , expr)
817
872
818
- /* * @return A new [Expr] representing the isNotNull operation. */
873
+ /* *
874
+ * Creates an expression that checks if tbe value of a field is not null.
875
+ *
876
+ * @param fieldName The field to check.
877
+ * @return A new [BooleanExpr] representing the isNotNull operation.
878
+ */
819
879
@JvmStatic fun isNotNull (fieldName : String ): BooleanExpr = BooleanExpr (" is_not_null" , fieldName)
820
880
821
881
/* * @return A new [Expr] representing the replaceFirst operation. */
@@ -2031,20 +2091,20 @@ abstract class Expr internal constructor() {
2031
2091
@JvmStatic fun exists (fieldName : String ): BooleanExpr = BooleanExpr (" exists" , fieldName)
2032
2092
2033
2093
/* *
2034
- * Creates an expression that returns the [catchExpr] argument if there is an
2035
- * error, else return the result of the [tryExpr] argument evaluation.
2094
+ * Creates an expression that returns the [catchExpr] argument if there is an error, else return
2095
+ * the result of the [tryExpr] argument evaluation.
2036
2096
*
2037
2097
* @param tryExpr The try expression.
2038
- * @param catchExpr The catch expression that will be evaluated and
2039
- * returned if the [tryExpr] produces an error.
2098
+ * @param catchExpr The catch expression that will be evaluated and returned if the [tryExpr]
2099
+ * produces an error.
2040
2100
* @return A new [Expr] representing the ifError operation.
2041
2101
*/
2042
2102
@JvmStatic
2043
2103
fun ifError (tryExpr : Expr , catchExpr : Expr ): Expr = FunctionExpr (" if_error" , tryExpr, catchExpr)
2044
2104
2045
2105
/* *
2046
- * Creates an expression that returns the [catchValue] argument if there is an
2047
- * error, else return the result of the [tryExpr] argument evaluation.
2106
+ * Creates an expression that returns the [catchValue] argument if there is an error, else
2107
+ * return the result of the [tryExpr] argument evaluation.
2048
2108
*
2049
2109
* @param tryExpr The try expression.
2050
2110
* @param catchValue The value that will be returned if the [tryExpr] produces an error.
@@ -2250,7 +2310,7 @@ abstract class Expr internal constructor() {
2250
2310
* @param values The values to check against.
2251
2311
* @return A new [BooleanExpr] representing the 'IN' comparison.
2252
2312
*/
2253
- fun eqAny (values : List <Any >) = Companion .eqAny(this , values)
2313
+ fun eqAny (values : List <Any >): BooleanExpr = Companion .eqAny(this , values)
2254
2314
2255
2315
/* *
2256
2316
* Creates an expression that checks if this expression, when evaluated, is equal to any of the
@@ -2260,7 +2320,7 @@ abstract class Expr internal constructor() {
2260
2320
* equality to the input.
2261
2321
* @return A new [BooleanExpr] representing the 'IN' comparison.
2262
2322
*/
2263
- fun eqAny (arrayExpression : Expr ) = Companion .eqAny(this , arrayExpression)
2323
+ fun eqAny (arrayExpression : Expr ): BooleanExpr = Companion .eqAny(this , arrayExpression)
2264
2324
2265
2325
/* *
2266
2326
* Creates an expression that checks if this expression, when evaluated, is not equal to all the
@@ -2269,7 +2329,7 @@ abstract class Expr internal constructor() {
2269
2329
* @param values The values to check against.
2270
2330
* @return A new [BooleanExpr] representing the 'NOT IN' comparison.
2271
2331
*/
2272
- fun notEqAny (values : List <Any >) = Companion .notEqAny(this , values)
2332
+ fun notEqAny (values : List <Any >): BooleanExpr = Companion .notEqAny(this , values)
2273
2333
2274
2334
/* *
2275
2335
* Creates an expression that checks if this expression, when evaluated, is not equal to all the
@@ -2279,23 +2339,36 @@ abstract class Expr internal constructor() {
2279
2339
* equality to the input.
2280
2340
* @return A new [BooleanExpr] representing the 'NOT IN' comparison.
2281
2341
*/
2282
- fun notEqAny (arrayExpression : Expr ) = Companion .notEqAny(this , arrayExpression)
2342
+ fun notEqAny (arrayExpression : Expr ): BooleanExpr = Companion .notEqAny(this , arrayExpression)
2283
2343
2284
2344
/* *
2345
+ * Creates an expression that checks if this expression evaluates to 'NaN' (Not a Number).
2346
+ *
2347
+ * @return A new [BooleanExpr] representing the isNan operation.
2285
2348
*/
2286
- fun isNan () = Companion .isNan(this )
2349
+ fun isNan (): BooleanExpr = Companion .isNan(this )
2287
2350
2288
2351
/* *
2352
+ * Creates an expression that checks if the results of this expression is NOT 'NaN' (Not a
2353
+ * Number).
2354
+ *
2355
+ * @return A new [BooleanExpr] representing the isNotNan operation.
2289
2356
*/
2290
- fun isNotNan () = Companion .isNotNan(this )
2357
+ fun isNotNan (): BooleanExpr = Companion .isNotNan(this )
2291
2358
2292
2359
/* *
2360
+ * Creates an expression that checks if tbe result of this expression is null.
2361
+ *
2362
+ * @return A new [BooleanExpr] representing the isNull operation.
2293
2363
*/
2294
- fun isNull () = Companion .isNull(this )
2364
+ fun isNull (): BooleanExpr = Companion .isNull(this )
2295
2365
2296
2366
/* *
2367
+ * Creates an expression that checks if tbe result of this expression is not null.
2368
+ *
2369
+ * @return A new [BooleanExpr] representing the isNotNull operation.
2297
2370
*/
2298
- fun isNotNull () = Companion .isNotNull(this )
2371
+ fun isNotNull (): BooleanExpr = Companion .isNotNull(this )
2299
2372
2300
2373
/* *
2301
2374
*/
@@ -2463,67 +2536,71 @@ abstract class Expr internal constructor() {
2463
2536
* @param vector The other vector (represented as an Expr) to compare against.
2464
2537
* @return A new [Expr] representing the cosine distance between the two vectors.
2465
2538
*/
2466
- fun cosineDistance (vector : Expr ) = Companion .cosineDistance(this , vector)
2539
+ fun cosineDistance (vector : Expr ): Expr = Companion .cosineDistance(this , vector)
2467
2540
2468
2541
/* *
2469
2542
* Calculates the Cosine distance between this vector expression and a vector literal.
2470
2543
*
2471
2544
* @param vector The other vector (as an array of doubles) to compare against.
2472
2545
* @return A new [Expr] representing the cosine distance between the two vectors.
2473
2546
*/
2474
- fun cosineDistance (vector : DoubleArray ) = Companion .cosineDistance(this , vector)
2547
+ fun cosineDistance (vector : DoubleArray ): Expr = Companion .cosineDistance(this , vector)
2475
2548
2476
2549
/* *
2477
2550
* Calculates the Cosine distance between this vector expression and a vector literal.
2478
2551
*
2479
2552
* @param vector The other vector (represented as an [VectorValue]) to compare against.
2480
2553
* @return A new [Expr] representing the cosine distance between the two vectors.
2481
2554
*/
2482
- fun cosineDistance (vector : VectorValue ) = Companion .cosineDistance(this , vector)
2555
+ fun cosineDistance (vector : VectorValue ): Expr = Companion .cosineDistance(this , vector)
2483
2556
2484
2557
/* *
2485
2558
* Calculates the dot product distance between this and another vector expression.
2486
2559
*
2487
2560
* @param vector The other vector (represented as an Expr) to compare against.
2488
2561
* @return A new [Expr] representing the dot product distance between the two vectors.
2489
2562
*/
2490
- fun dotProduct (vector : Expr ) = Companion .dotProduct(this , vector)
2563
+ fun dotProduct (vector : Expr ): Expr = Companion .dotProduct(this , vector)
2491
2564
2492
2565
/* *
2493
2566
* Calculates the dot product distance between this vector expression and a vector literal.
2494
2567
*
2495
2568
* @param vector The other vector (as an array of doubles) to compare against.
2496
2569
* @return A new [Expr] representing the dot product distance between the two vectors.
2497
2570
*/
2498
- fun dotProduct (vector : DoubleArray ) = Companion .dotProduct(this , vector)
2571
+ fun dotProduct (vector : DoubleArray ): Expr = Companion .dotProduct(this , vector)
2499
2572
2500
2573
/* *
2501
2574
* Calculates the dot product distance between this vector expression and a vector literal.
2502
2575
*
2503
2576
* @param vector The other vector (represented as an [VectorValue]) to compare against.
2504
2577
* @return A new [Expr] representing the dot product distance between the two vectors.
2505
2578
*/
2506
- fun dotProduct (vector : VectorValue ) = Companion .dotProduct(this , vector)
2579
+ fun dotProduct (vector : VectorValue ): Expr = Companion .dotProduct(this , vector)
2507
2580
2508
2581
/* *
2509
2582
* Calculates the Euclidean distance between this and another vector expression.
2510
2583
*
2511
2584
* @param vector The other vector (represented as an Expr) to compare against.
2512
2585
* @return A new [Expr] representing the Euclidean distance between the two vectors.
2513
2586
*/
2514
- fun euclideanDistance (vector : Expr ) = Companion .euclideanDistance(this , vector)
2587
+ fun euclideanDistance (vector : Expr ): Expr = Companion .euclideanDistance(this , vector)
2515
2588
2516
2589
/* *
2517
2590
* Calculates the Euclidean distance between this vector expression and a vector literal.
2518
2591
*
2519
2592
* @param vector The other vector (as an array of doubles) to compare against.
2520
2593
* @return A new [Expr] representing the Euclidean distance between the two vectors.
2521
2594
*/
2522
- fun euclideanDistance (vector : DoubleArray ) = Companion .euclideanDistance(this , vector)
2595
+ fun euclideanDistance (vector : DoubleArray ): Expr = Companion .euclideanDistance(this , vector)
2523
2596
2524
2597
/* *
2598
+ * Calculates the Euclidean distance between this vector expression and a vector literal.
2599
+ *
2600
+ * @param vector The other vector (represented as an [VectorValue]) to compare against.
2601
+ * @return A new [Expr] representing the Euclidean distance between the two vectors.
2525
2602
*/
2526
- fun euclideanDistance (vector : VectorValue ) = Companion .euclideanDistance(this , vector)
2603
+ fun euclideanDistance (vector : VectorValue ): Expr = Companion .euclideanDistance(this , vector)
2527
2604
2528
2605
/* *
2529
2606
*/
@@ -2834,18 +2911,18 @@ abstract class Expr internal constructor() {
2834
2911
fun exists (): BooleanExpr = Companion .exists(this )
2835
2912
2836
2913
/* *
2837
- * Creates an expression that returns the [catchExpr] argument if there is an
2838
- * error, else return the result of this expression.
2914
+ * Creates an expression that returns the [catchExpr] argument if there is an error, else return
2915
+ * the result of this expression.
2839
2916
*
2840
- * @param catchExpr The catch expression that will be evaluated and
2841
- * returned if the this expression produces an error.
2917
+ * @param catchExpr The catch expression that will be evaluated and returned if the this
2918
+ * expression produces an error.
2842
2919
* @return A new [Expr] representing the ifError operation.
2843
2920
*/
2844
2921
fun ifError (catchExpr : Expr ): Expr = Companion .ifError(this , catchExpr)
2845
2922
2846
2923
/* *
2847
- * Creates an expression that returns the [catchValue] argument if there is an
2848
- * error, else return the result of this expression.
2924
+ * Creates an expression that returns the [catchValue] argument if there is an error, else return
2925
+ * the result of this expression.
2849
2926
*
2850
2927
* @param catchValue The value that will be returned if this expression produces an error.
2851
2928
* @return A new [Expr] representing the ifError operation.
@@ -2966,10 +3043,7 @@ internal constructor(
2966
3043
/* * A class that represents a filter condition. */
2967
3044
open class BooleanExpr internal constructor(name : String , params : Array <out Expr >) :
2968
3045
FunctionExpr (name, params, InternalOptions .EMPTY ) {
2969
- internal constructor (
2970
- name: String ,
2971
- param: Expr
2972
- ) : this (name, arrayOf(param))
3046
+ internal constructor (name: String , param: Expr ) : this (name, arrayOf(param))
2973
3047
internal constructor (
2974
3048
name: String ,
2975
3049
param: Expr ,
@@ -2980,10 +3054,7 @@ open class BooleanExpr internal constructor(name: String, params: Array<out Expr
2980
3054
param1: Expr ,
2981
3055
param2: Expr
2982
3056
) : this (name, arrayOf(param1, param2))
2983
- internal constructor (
2984
- name: String ,
2985
- fieldName: String
2986
- ) : this (name, arrayOf(field(fieldName)))
3057
+ internal constructor (name: String , fieldName: String ) : this (name, arrayOf(field(fieldName)))
2987
3058
internal constructor (
2988
3059
name: String ,
2989
3060
fieldName: String ,
0 commit comments