9090import org .hypertrace .core .documentstore .expression .impl .AliasedIdentifierExpression ;
9191import org .hypertrace .core .documentstore .expression .impl .ArrayIdentifierExpression ;
9292import org .hypertrace .core .documentstore .expression .impl .ArrayRelationalFilterExpression ;
93- import org .hypertrace .core .documentstore .expression .impl .ArrayType ;
9493import org .hypertrace .core .documentstore .expression .impl .ConstantExpression ;
9594import org .hypertrace .core .documentstore .expression .impl .FunctionExpression ;
9695import org .hypertrace .core .documentstore .expression .impl .IdentifierExpression ;
@@ -4171,7 +4170,7 @@ void testInStringArray(String dataStoreName) throws JsonProcessingException {
41714170 .addSelection (ArrayIdentifierExpression .of ("tags" ))
41724171 .setFilter (
41734172 RelationalExpression .of (
4174- ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ),
4173+ ArrayIdentifierExpression .ofStrings ("tags" ),
41754174 IN ,
41764175 ConstantExpression .ofStrings (List .of ("hygiene" , "grooming" ))))
41774176 .build ();
@@ -4223,7 +4222,7 @@ void testNotInStringArray(String dataStoreName) throws JsonProcessingException {
42234222 .addSelection (ArrayIdentifierExpression .of ("tags" ))
42244223 .setFilter (
42254224 RelationalExpression .of (
4226- ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ),
4225+ ArrayIdentifierExpression .ofStrings ("tags" ),
42274226 NOT_IN ,
42284227 ConstantExpression .ofStrings (List .of ("premium" , "hygiene" ))))
42294228 .build ();
@@ -4271,7 +4270,7 @@ void testInIntArray(String dataStoreName) throws JsonProcessingException {
42714270 .addSelection (ArrayIdentifierExpression .of ("numbers" ))
42724271 .setFilter (
42734272 RelationalExpression .of (
4274- ArrayIdentifierExpression .of ("numbers" , ArrayType . INTEGER ),
4273+ ArrayIdentifierExpression .ofInts ("numbers" ),
42754274 IN ,
42764275 ConstantExpression .ofNumbers (List .of (1 , 10 , 20 ))))
42774276 .build ();
@@ -4318,7 +4317,7 @@ void testInDoubleArray(String dataStoreName) throws JsonProcessingException {
43184317 .addSelection (ArrayIdentifierExpression .of ("scores" ))
43194318 .setFilter (
43204319 RelationalExpression .of (
4321- ArrayIdentifierExpression .of ("scores" , ArrayType . DOUBLE_PRECISION ),
4320+ ArrayIdentifierExpression .ofDoubles ("scores" ),
43224321 IN ,
43234322 ConstantExpression .ofNumbers (List .of (3.14 , 5.0 ))))
43244323 .build ();
@@ -4365,12 +4364,11 @@ void testInWithUnnest(String dataStoreName) {
43654364 .addSelection (ArrayIdentifierExpression .of ("tags" ))
43664365 .addFromClause (
43674366 UnnestExpression .of (
4368- ArrayIdentifierExpression .of ("tags" , ArrayType .TEXT ),
4369- preserveNullAndEmptyArrays ))
4367+ ArrayIdentifierExpression .ofStrings ("tags" ), preserveNullAndEmptyArrays ))
43704368 // Should return unnested tag elements that match 'hygiene' OR 'grooming'
43714369 .setFilter (
43724370 RelationalExpression .of (
4373- ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ),
4371+ ArrayIdentifierExpression .ofStrings ("tags" ),
43744372 IN ,
43754373 ConstantExpression .ofStrings (List .of ("hygiene" , "grooming" ))))
43764374 .build ();
@@ -4403,11 +4401,10 @@ void testNotInWithUnnest(String dataStoreName) {
44034401 .addSelection (ArrayIdentifierExpression .of ("tags" ))
44044402 .addFromClause (
44054403 UnnestExpression .of (
4406- ArrayIdentifierExpression .of ("tags" , ArrayType .TEXT ),
4407- preserveNullAndEmptyArrays ))
4404+ ArrayIdentifierExpression .ofStrings ("tags" ), preserveNullAndEmptyArrays ))
44084405 .setFilter (
44094406 RelationalExpression .of (
4410- ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ),
4407+ ArrayIdentifierExpression .ofStrings ("tags" ),
44114408 NOT_IN ,
44124409 ConstantExpression .ofStrings (List .of ("hygiene" , "grooming" ))))
44134410 .build ();
@@ -4439,16 +4436,15 @@ void testEmptyWithUnnest(String dataStoreName) {
44394436 Query .builder ()
44404437 .addSelection (IdentifierExpression .of ("item" ))
44414438 .addSelection (ArrayIdentifierExpression .of ("tags" ))
4442- .addFromClause (
4443- UnnestExpression .of (ArrayIdentifierExpression .of ("tags" , ArrayType .TEXT ), true ))
4439+ .addFromClause (UnnestExpression .of (ArrayIdentifierExpression .ofStrings ("tags" ), true ))
44444440 // Only include tags[] that are either NULL or empty (we have one row with NULL tag
44454441 // and one with empty tag. Unnest will result in two rows with NULL for
44464442 // "tags_unnested"). Note that this behavior will change with
44474443 // preserveNulLAndEmptyArrays = false. This is because unnest won't preserve those
44484444 // rows for which the unnested column is NULL then.
44494445 .setFilter (
44504446 RelationalExpression .of (
4451- ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ),
4447+ ArrayIdentifierExpression .ofStrings ("tags" ),
44524448 NOT_EXISTS ,
44534449 ConstantExpression .of ("null" )))
44544450 .build ();
@@ -4474,13 +4470,12 @@ void testNotEmptyWithUnnest(String dataStoreName) {
44744470 Query .builder ()
44754471 .addSelection (IdentifierExpression .of ("item" ))
44764472 .addSelection (ArrayIdentifierExpression .of ("tags" ))
4477- .addFromClause (
4478- UnnestExpression .of (ArrayIdentifierExpression .of ("tags" , ArrayType .TEXT ), true ))
4473+ .addFromClause (UnnestExpression .of (ArrayIdentifierExpression .ofStrings ("tags" ), true ))
44794474 // Only include tags[] that have at least 1 element, all rows with NULL or empty tags
44804475 // should be excluded.
44814476 .setFilter (
44824477 RelationalExpression .of (
4483- ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ),
4478+ ArrayIdentifierExpression .ofStrings ("tags" ),
44844479 EXISTS ,
44854480 ConstantExpression .of ("null" )))
44864481 .build ();
@@ -4505,11 +4500,10 @@ void testContainsStrArrayWithUnnest(String dataStoreName) {
45054500 Query query =
45064501 Query .builder ()
45074502 .addSelection (IdentifierExpression .of ("item" ))
4508- .addFromClause (
4509- UnnestExpression .of (ArrayIdentifierExpression .of ("tags" , ArrayType .TEXT ), true ))
4503+ .addFromClause (UnnestExpression .of (ArrayIdentifierExpression .ofStrings ("tags" ), true ))
45104504 .setFilter (
45114505 RelationalExpression .of (
4512- ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ),
4506+ ArrayIdentifierExpression .ofStrings ("tags" ),
45134507 CONTAINS ,
45144508 ConstantExpression .ofStrings (List .of ("hygiene" , "premium" ))))
45154509 .build ();
@@ -4532,10 +4526,10 @@ void testContainsStrArray(String dataStoreName) throws JsonProcessingException {
45324526 Query query =
45334527 Query .builder ()
45344528 .addSelection (IdentifierExpression .of ("item" ))
4535- .addSelection (ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ))
4529+ .addSelection (ArrayIdentifierExpression .ofStrings ("tags" ))
45364530 .setFilter (
45374531 RelationalExpression .of (
4538- ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ),
4532+ ArrayIdentifierExpression .ofStrings ("tags" ),
45394533 CONTAINS ,
45404534 ConstantExpression .ofStrings (List .of ("hygiene" , "personal-care" ))))
45414535 .build ();
@@ -4584,7 +4578,7 @@ void testNotContainsStrArray(String dataStoreName) throws JsonProcessingExceptio
45844578 .addSelection (ArrayIdentifierExpression .of ("tags" ))
45854579 .setFilter (
45864580 RelationalExpression .of (
4587- ArrayIdentifierExpression .of ("tags" , ArrayType . TEXT ),
4581+ ArrayIdentifierExpression .ofStrings ("tags" ),
45884582 NOT_CONTAINS ,
45894583 ConstantExpression .ofStrings (List .of ("hair-care" , "personal-care" ))))
45904584 .build ();
@@ -4628,10 +4622,10 @@ void testContainsOnIntArray(String dataStoreName) throws JsonProcessingException
46284622 Query query =
46294623 Query .builder ()
46304624 .addSelection (IdentifierExpression .of ("item" ))
4631- .addSelection (ArrayIdentifierExpression .of ("numbers" , ArrayType . INTEGER ))
4625+ .addSelection (ArrayIdentifierExpression .ofInts ("numbers" ))
46324626 .setFilter (
46334627 RelationalExpression .of (
4634- ArrayIdentifierExpression .of ("numbers" , ArrayType . INTEGER ),
4628+ ArrayIdentifierExpression .ofInts ("numbers" ),
46354629 CONTAINS ,
46364630 ConstantExpression .ofNumbers (List .of (1 , 2 ))))
46374631 .build ();
@@ -4675,10 +4669,10 @@ void testNotContainsOnIntArray(String dataStoreName) throws JsonProcessingExcept
46754669 Query query =
46764670 Query .builder ()
46774671 .addSelection (IdentifierExpression .of ("item" ))
4678- .addSelection (ArrayIdentifierExpression .of ("numbers" , ArrayType . INTEGER ))
4672+ .addSelection (ArrayIdentifierExpression .ofInts ("numbers" ))
46794673 .setFilter (
46804674 RelationalExpression .of (
4681- ArrayIdentifierExpression .of ("numbers" , ArrayType . INTEGER ),
4675+ ArrayIdentifierExpression .ofInts ("numbers" ),
46824676 NOT_CONTAINS ,
46834677 ConstantExpression .ofNumbers (List .of (10 , 20 ))))
46844678 .build ();
@@ -4724,10 +4718,10 @@ void testContainsOnDoubleArray(String dataStoreName) throws JsonProcessingExcept
47244718 Query query =
47254719 Query .builder ()
47264720 .addSelection (IdentifierExpression .of ("item" ))
4727- .addSelection (ArrayIdentifierExpression .of ("scores" , ArrayType . DOUBLE_PRECISION ))
4721+ .addSelection (ArrayIdentifierExpression .ofDoubles ("scores" ))
47284722 .setFilter (
47294723 RelationalExpression .of (
4730- ArrayIdentifierExpression .of ("scores" , ArrayType . DOUBLE_PRECISION ),
4724+ ArrayIdentifierExpression .ofDoubles ("scores" ),
47314725 CONTAINS ,
47324726 ConstantExpression .ofNumbers (List .of (3.14 , 2.71 ))))
47334727 .build ();
0 commit comments