9191import org .hypertrace .core .documentstore .expression .impl .AliasedIdentifierExpression ;
9292import org .hypertrace .core .documentstore .expression .impl .ArrayIdentifierExpression ;
9393import org .hypertrace .core .documentstore .expression .impl .ArrayRelationalFilterExpression ;
94- import org .hypertrace .core .documentstore .expression .impl .ArrayType ;
9594import org .hypertrace .core .documentstore .expression .impl .ConstantExpression ;
9695import org .hypertrace .core .documentstore .expression .impl .FunctionExpression ;
9796import org .hypertrace .core .documentstore .expression .impl .IdentifierExpression ;
@@ -4384,7 +4383,7 @@ void testInStringArray(String dataStoreName) throws JsonProcessingException {
43844383 .addSelection (ArrayIdentifierExpression .of ("tags" ))
43854384 .setFilter (
43864385 RelationalExpression .of (
4387- ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ),
4386+ ArrayIdentifierExpression .ofStrings ("tags" ),
43884387 IN ,
43894388 ConstantExpression .ofStrings (List .of ("hygiene" , "grooming" ))))
43904389 .build ();
@@ -4436,7 +4435,7 @@ void testNotInStringArray(String dataStoreName) throws JsonProcessingException {
44364435 .addSelection (ArrayIdentifierExpression .of ("tags" ))
44374436 .setFilter (
44384437 RelationalExpression .of (
4439- ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ),
4438+ ArrayIdentifierExpression .ofStrings ("tags" ),
44404439 NOT_IN ,
44414440 ConstantExpression .ofStrings (List .of ("premium" , "hygiene" ))))
44424441 .build ();
@@ -4484,7 +4483,7 @@ void testInIntArray(String dataStoreName) throws JsonProcessingException {
44844483 .addSelection (ArrayIdentifierExpression .of ("numbers" ))
44854484 .setFilter (
44864485 RelationalExpression .of (
4487- ArrayIdentifierExpression .of ("numbers" , ArrayType . INTEGER ),
4486+ ArrayIdentifierExpression .ofInts ("numbers" ),
44884487 IN ,
44894488 ConstantExpression .ofNumbers (List .of (1 , 10 , 20 ))))
44904489 .build ();
@@ -4531,7 +4530,7 @@ void testInDoubleArray(String dataStoreName) throws JsonProcessingException {
45314530 .addSelection (ArrayIdentifierExpression .of ("scores" ))
45324531 .setFilter (
45334532 RelationalExpression .of (
4534- ArrayIdentifierExpression .of ("scores" , ArrayType . DOUBLE_PRECISION ),
4533+ ArrayIdentifierExpression .ofDoubles ("scores" ),
45354534 IN ,
45364535 ConstantExpression .ofNumbers (List .of (3.14 , 5.0 ))))
45374536 .build ();
@@ -4578,12 +4577,11 @@ void testInWithUnnest(String dataStoreName) {
45784577 .addSelection (ArrayIdentifierExpression .of ("tags" ))
45794578 .addFromClause (
45804579 UnnestExpression .of (
4581- ArrayIdentifierExpression .of ("tags" , ArrayType .TEXT ),
4582- preserveNullAndEmptyArrays ))
4580+ ArrayIdentifierExpression .ofStrings ("tags" ), preserveNullAndEmptyArrays ))
45834581 // Should return unnested tag elements that match 'hygiene' OR 'grooming'
45844582 .setFilter (
45854583 RelationalExpression .of (
4586- ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ),
4584+ ArrayIdentifierExpression .ofStrings ("tags" ),
45874585 IN ,
45884586 ConstantExpression .ofStrings (List .of ("hygiene" , "grooming" ))))
45894587 .build ();
@@ -4616,11 +4614,10 @@ void testNotInWithUnnest(String dataStoreName) {
46164614 .addSelection (ArrayIdentifierExpression .of ("tags" ))
46174615 .addFromClause (
46184616 UnnestExpression .of (
4619- ArrayIdentifierExpression .of ("tags" , ArrayType .TEXT ),
4620- preserveNullAndEmptyArrays ))
4617+ ArrayIdentifierExpression .ofStrings ("tags" ), preserveNullAndEmptyArrays ))
46214618 .setFilter (
46224619 RelationalExpression .of (
4623- ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ),
4620+ ArrayIdentifierExpression .ofStrings ("tags" ),
46244621 NOT_IN ,
46254622 ConstantExpression .ofStrings (List .of ("hygiene" , "grooming" ))))
46264623 .build ();
@@ -4652,16 +4649,15 @@ void testEmptyWithUnnest(String dataStoreName) {
46524649 Query .builder ()
46534650 .addSelection (IdentifierExpression .of ("item" ))
46544651 .addSelection (ArrayIdentifierExpression .of ("tags" ))
4655- .addFromClause (
4656- UnnestExpression .of (ArrayIdentifierExpression .of ("tags" , ArrayType .TEXT ), true ))
4652+ .addFromClause (UnnestExpression .of (ArrayIdentifierExpression .ofStrings ("tags" ), true ))
46574653 // Only include tags[] that are either NULL or empty (we have one row with NULL tag
46584654 // and one with empty tag. Unnest will result in two rows with NULL for
46594655 // "tags_unnested"). Note that this behavior will change with
46604656 // preserveNulLAndEmptyArrays = false. This is because unnest won't preserve those
46614657 // rows for which the unnested column is NULL then.
46624658 .setFilter (
46634659 RelationalExpression .of (
4664- ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ),
4660+ ArrayIdentifierExpression .ofStrings ("tags" ),
46654661 NOT_EXISTS ,
46664662 ConstantExpression .of ("null" )))
46674663 .build ();
@@ -4687,13 +4683,12 @@ void testNotEmptyWithUnnest(String dataStoreName) {
46874683 Query .builder ()
46884684 .addSelection (IdentifierExpression .of ("item" ))
46894685 .addSelection (ArrayIdentifierExpression .of ("tags" ))
4690- .addFromClause (
4691- UnnestExpression .of (ArrayIdentifierExpression .of ("tags" , ArrayType .TEXT ), true ))
4686+ .addFromClause (UnnestExpression .of (ArrayIdentifierExpression .ofStrings ("tags" ), true ))
46924687 // Only include tags[] that have at least 1 element, all rows with NULL or empty tags
46934688 // should be excluded.
46944689 .setFilter (
46954690 RelationalExpression .of (
4696- ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ),
4691+ ArrayIdentifierExpression .ofStrings ("tags" ),
46974692 EXISTS ,
46984693 ConstantExpression .of ("null" )))
46994694 .build ();
@@ -4718,11 +4713,10 @@ void testContainsStrArrayWithUnnest(String dataStoreName) {
47184713 Query query =
47194714 Query .builder ()
47204715 .addSelection (IdentifierExpression .of ("item" ))
4721- .addFromClause (
4722- UnnestExpression .of (ArrayIdentifierExpression .of ("tags" , ArrayType .TEXT ), true ))
4716+ .addFromClause (UnnestExpression .of (ArrayIdentifierExpression .ofStrings ("tags" ), true ))
47234717 .setFilter (
47244718 RelationalExpression .of (
4725- ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ),
4719+ ArrayIdentifierExpression .ofStrings ("tags" ),
47264720 CONTAINS ,
47274721 ConstantExpression .ofStrings (List .of ("hygiene" , "premium" ))))
47284722 .build ();
@@ -4745,10 +4739,10 @@ void testContainsStrArray(String dataStoreName) throws JsonProcessingException {
47454739 Query query =
47464740 Query .builder ()
47474741 .addSelection (IdentifierExpression .of ("item" ))
4748- .addSelection (ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ))
4742+ .addSelection (ArrayIdentifierExpression .ofStrings ("tags" ))
47494743 .setFilter (
47504744 RelationalExpression .of (
4751- ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ),
4745+ ArrayIdentifierExpression .ofStrings ("tags" ),
47524746 CONTAINS ,
47534747 ConstantExpression .ofStrings (List .of ("hygiene" , "personal-care" ))))
47544748 .build ();
@@ -4797,7 +4791,7 @@ void testNotContainsStrArray(String dataStoreName) throws JsonProcessingExceptio
47974791 .addSelection (ArrayIdentifierExpression .of ("tags" ))
47984792 .setFilter (
47994793 RelationalExpression .of (
4800- ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ),
4794+ ArrayIdentifierExpression .ofStrings ("tags" ),
48014795 NOT_CONTAINS ,
48024796 ConstantExpression .ofStrings (List .of ("hair-care" , "personal-care" ))))
48034797 .build ();
@@ -4841,10 +4835,10 @@ void testContainsOnIntArray(String dataStoreName) throws JsonProcessingException
48414835 Query query =
48424836 Query .builder ()
48434837 .addSelection (IdentifierExpression .of ("item" ))
4844- .addSelection (ArrayIdentifierExpression .of ("numbers" , ArrayType . INTEGER ))
4838+ .addSelection (ArrayIdentifierExpression .ofInts ("numbers" ))
48454839 .setFilter (
48464840 RelationalExpression .of (
4847- ArrayIdentifierExpression .of ("numbers" , ArrayType . INTEGER ),
4841+ ArrayIdentifierExpression .ofInts ("numbers" ),
48484842 CONTAINS ,
48494843 ConstantExpression .ofNumbers (List .of (1 , 2 ))))
48504844 .build ();
@@ -4888,10 +4882,10 @@ void testNotContainsOnIntArray(String dataStoreName) throws JsonProcessingExcept
48884882 Query query =
48894883 Query .builder ()
48904884 .addSelection (IdentifierExpression .of ("item" ))
4891- .addSelection (ArrayIdentifierExpression .of ("numbers" , ArrayType . INTEGER ))
4885+ .addSelection (ArrayIdentifierExpression .ofInts ("numbers" ))
48924886 .setFilter (
48934887 RelationalExpression .of (
4894- ArrayIdentifierExpression .of ("numbers" , ArrayType . INTEGER ),
4888+ ArrayIdentifierExpression .ofInts ("numbers" ),
48954889 NOT_CONTAINS ,
48964890 ConstantExpression .ofNumbers (List .of (10 , 20 ))))
48974891 .build ();
@@ -4937,10 +4931,10 @@ void testContainsOnDoubleArray(String dataStoreName) throws JsonProcessingExcept
49374931 Query query =
49384932 Query .builder ()
49394933 .addSelection (IdentifierExpression .of ("item" ))
4940- .addSelection (ArrayIdentifierExpression .of ("scores" , ArrayType . DOUBLE_PRECISION ))
4934+ .addSelection (ArrayIdentifierExpression .ofDoubles ("scores" ))
49414935 .setFilter (
49424936 RelationalExpression .of (
4943- ArrayIdentifierExpression .of ("scores" , ArrayType . DOUBLE_PRECISION ),
4937+ ArrayIdentifierExpression .ofDoubles ("scores" ),
49444938 CONTAINS ,
49454939 ConstantExpression .ofNumbers (List .of (3.14 , 2.71 ))))
49464940 .build ();
0 commit comments