Skip to content

Commit a9a038e

Browse files
committed
Remove backward compat tests
1 parent e67f181 commit a9a038e

File tree

6 files changed

+18
-33
lines changed

6 files changed

+18
-33
lines changed

document-store/src/integrationTest/java/org/hypertrace/core/documentstore/DocStoreQueryV1Test.java

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,7 @@ public Stream<Arguments> provideArguments(final ExtensionContext context) {
306306
* Provides arguments for testing array operations with different expression types. Returns:
307307
* (datastoreName, expressionType) - "WITH_TYPE": ArrayIdentifierExpression WITH ArrayType
308308
* (optimized, type-aware casting) - "WITHOUT_TYPE": ArrayIdentifierExpression WITHOUT ArrayType
309-
* (fallback, text[] casting) - "IDENTIFIER": IdentifierExpression (backward compatibility, text[]
310-
* casting)
309+
* (fallback, text[] casting)
311310
*/
312311
private static class PostgresArrayTypeProvider implements ArgumentsProvider {
313312

@@ -316,8 +315,7 @@ public Stream<Arguments> provideArguments(final ExtensionContext context) {
316315
return Stream.of(
317316
Arguments.of(POSTGRES_STORE, "WITH_TYPE"), // ArrayIdentifierExpression WITH ArrayType
318317
Arguments.of(
319-
POSTGRES_STORE, "WITHOUT_TYPE"), // ArrayIdentifierExpression WITHOUT ArrayType
320-
Arguments.of(POSTGRES_STORE, "IDENTIFIER") // IdentifierExpression (backward compat)
318+
POSTGRES_STORE, "WITHOUT_TYPE") // ArrayIdentifierExpression WITHOUT ArrayType
321319
);
322320
}
323321
}
@@ -3416,9 +3414,7 @@ void testFlatPostgresCollectionInAndNotInOperatorsForArrays(
34163414
String typeDesc =
34173415
expressionType.equals("WITH_TYPE")
34183416
? "WITH ArrayType (optimized)"
3419-
: expressionType.equals("WITHOUT_TYPE")
3420-
? "WITHOUT ArrayType (fallback)"
3421-
: "IdentifierExpression (backward compat)";
3417+
: "WITHOUT ArrayType (fallback)";
34223418

34233419
// Test 1: IN operator on tags array field (string array)
34243420
// Find documents where tags contains "hygiene" OR "grooming"
@@ -3429,9 +3425,7 @@ void testFlatPostgresCollectionInAndNotInOperatorsForArrays(
34293425
RelationalExpression.of(
34303426
expressionType.equals("WITH_TYPE")
34313427
? ArrayIdentifierExpression.of("tags", ArrayType.TEXT)
3432-
: expressionType.equals("WITHOUT_TYPE")
3433-
? ArrayIdentifierExpression.of("tags")
3434-
: IdentifierExpression.of("tags"),
3428+
: ArrayIdentifierExpression.of("tags"),
34353429
IN,
34363430
ConstantExpression.ofStrings(List.of("hygiene", "grooming"))))
34373431
.build();
@@ -3453,9 +3447,7 @@ void testFlatPostgresCollectionInAndNotInOperatorsForArrays(
34533447
RelationalExpression.of(
34543448
expressionType.equals("WITH_TYPE")
34553449
? ArrayIdentifierExpression.of("numbers", ArrayType.INTEGER)
3456-
: expressionType.equals("WITHOUT_TYPE")
3457-
? ArrayIdentifierExpression.of("numbers")
3458-
: IdentifierExpression.of("numbers"),
3450+
: ArrayIdentifierExpression.of("numbers"),
34593451
IN,
34603452
ConstantExpression.ofNumbers(List.of(1, 10))))
34613453
.build();
@@ -3476,9 +3468,7 @@ void testFlatPostgresCollectionInAndNotInOperatorsForArrays(
34763468
RelationalExpression.of(
34773469
expressionType.equals("WITH_TYPE")
34783470
? ArrayIdentifierExpression.of("tags", ArrayType.TEXT)
3479-
: expressionType.equals("WITHOUT_TYPE")
3480-
? ArrayIdentifierExpression.of("tags")
3481-
: IdentifierExpression.of("tags"),
3471+
: ArrayIdentifierExpression.of("tags"),
34823472
NOT_IN,
34833473
ConstantExpression.ofStrings(List.of("hygiene"))))
34843474
.build();
@@ -3503,9 +3493,7 @@ void testFlatPostgresCollectionInAndNotInOperatorsForArrays(
35033493
RelationalExpression.of(
35043494
expressionType.equals("WITH_TYPE")
35053495
? ArrayIdentifierExpression.of("tags", ArrayType.TEXT)
3506-
: expressionType.equals("WITHOUT_TYPE")
3507-
? ArrayIdentifierExpression.of("tags")
3508-
: IdentifierExpression.of("tags"),
3496+
: ArrayIdentifierExpression.of("tags"),
35093497
IN,
35103498
ConstantExpression.ofStrings(List.of("premium"))))
35113499
.operand(

document-store/src/main/java/org/hypertrace/core/documentstore/postgres/query/v1/parser/filter/PostgresInParserSelector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
import org.hypertrace.core.documentstore.expression.impl.JsonIdentifierExpression;
1111
import org.hypertrace.core.documentstore.parser.SelectTypeExpressionVisitor;
1212
import org.hypertrace.core.documentstore.postgres.query.v1.parser.filter.nonjson.field.PostgresInRelationalFilterParserArrayField;
13-
import org.hypertrace.core.documentstore.postgres.query.v1.parser.filter.nonjson.field.PostgresInRelationalFilterParserNonJsonField;
13+
import org.hypertrace.core.documentstore.postgres.query.v1.parser.filter.nonjson.field.PostgresInRelationalFilterParserScalarField;
1414

1515
class PostgresInParserSelector implements SelectTypeExpressionVisitor {
1616

1717
private static final PostgresInRelationalFilterParserInterface jsonFieldInFilterParser =
1818
new PostgresInRelationalFilterParser();
1919
private static final PostgresInRelationalFilterParserInterface scalarFieldInFilterParser =
20-
new PostgresInRelationalFilterParserNonJsonField();
20+
new PostgresInRelationalFilterParserScalarField();
2121
private static final PostgresInRelationalFilterParserInterface arrayFieldInFilterParser =
2222
new PostgresInRelationalFilterParserArrayField();
2323

document-store/src/main/java/org/hypertrace/core/documentstore/postgres/query/v1/parser/filter/PostgresNotInParserSelector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
import org.hypertrace.core.documentstore.expression.impl.JsonIdentifierExpression;
1111
import org.hypertrace.core.documentstore.parser.SelectTypeExpressionVisitor;
1212
import org.hypertrace.core.documentstore.postgres.query.v1.parser.filter.nonjson.field.PostgresInRelationalFilterParserArrayField;
13-
import org.hypertrace.core.documentstore.postgres.query.v1.parser.filter.nonjson.field.PostgresInRelationalFilterParserNonJsonField;
13+
import org.hypertrace.core.documentstore.postgres.query.v1.parser.filter.nonjson.field.PostgresInRelationalFilterParserScalarField;
1414

1515
class PostgresNotInParserSelector implements SelectTypeExpressionVisitor {
1616

1717
private static final PostgresInRelationalFilterParserInterface jsonFieldInFilterParser =
1818
new PostgresInRelationalFilterParser();
1919
private static final PostgresInRelationalFilterParserInterface scalarFieldInFilterParser =
20-
new PostgresInRelationalFilterParserNonJsonField();
20+
new PostgresInRelationalFilterParserScalarField();
2121
private static final PostgresInRelationalFilterParserInterface arrayFieldInFilterParser =
2222
new PostgresInRelationalFilterParserArrayField();
2323

document-store/src/main/java/org/hypertrace/core/documentstore/postgres/query/v1/parser/filter/nonjson/field/PostgresInRelationalFilterParserNonJsonField.java renamed to document-store/src/main/java/org/hypertrace/core/documentstore/postgres/query/v1/parser/filter/nonjson/field/PostgresInRelationalFilterParserScalarField.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99

1010
/**
1111
* Implementation of PostgresInRelationalFilterParserInterface for handling IN operations on
12-
* first-class fields (non-JSON columns). Uses array overlap operator with text[] casting for
13-
* backward compatibility with existing clients.
12+
* first-class fields (non-JSON columns), using the standard IN clause syntax.
1413
*/
15-
public class PostgresInRelationalFilterParserNonJsonField
14+
public class PostgresInRelationalFilterParserScalarField
1615
implements PostgresInRelationalFilterParserInterface {
1716

1817
@Override
@@ -39,8 +38,6 @@ private String prepareFilterStringForInOperator(
3938
})
4039
.collect(Collectors.joining(", "));
4140

42-
// Use array overlap with text[] casting for backward compatibility
43-
// This works for both scalar and array fields
44-
return String.format("ARRAY[%s]::text[] && ARRAY[%s]::text[]", parsedLhs, placeholders);
41+
return String.format("%s IN (%s)", parsedLhs, placeholders);
4542
}
4643
}

document-store/src/test/java/org/hypertrace/core/documentstore/postgres/query/v1/parser/filter/PostgresInParserSelectorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import org.hypertrace.core.documentstore.expression.operators.AggregationOperator;
1515
import org.hypertrace.core.documentstore.expression.operators.FunctionOperator;
1616
import org.hypertrace.core.documentstore.postgres.query.v1.parser.filter.nonjson.field.PostgresInRelationalFilterParserArrayField;
17-
import org.hypertrace.core.documentstore.postgres.query.v1.parser.filter.nonjson.field.PostgresInRelationalFilterParserNonJsonField;
17+
import org.hypertrace.core.documentstore.postgres.query.v1.parser.filter.nonjson.field.PostgresInRelationalFilterParserScalarField;
1818
import org.junit.jupiter.api.Test;
1919

2020
class PostgresInParserSelectorTest {
@@ -52,7 +52,7 @@ void testVisitIdentifierExpression_flatCollection() {
5252
IdentifierExpression expr = IdentifierExpression.of("item");
5353
PostgresInRelationalFilterParserInterface result = selector.visit(expr);
5454
assertNotNull(result);
55-
assertInstanceOf(PostgresInRelationalFilterParserNonJsonField.class, result);
55+
assertInstanceOf(PostgresInRelationalFilterParserScalarField.class, result);
5656
}
5757

5858
@Test

document-store/src/test/java/org/hypertrace/core/documentstore/postgres/query/v1/parser/filter/PostgresNotInParserSelectorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import org.hypertrace.core.documentstore.expression.operators.AggregationOperator;
1515
import org.hypertrace.core.documentstore.expression.operators.FunctionOperator;
1616
import org.hypertrace.core.documentstore.postgres.query.v1.parser.filter.nonjson.field.PostgresInRelationalFilterParserArrayField;
17-
import org.hypertrace.core.documentstore.postgres.query.v1.parser.filter.nonjson.field.PostgresInRelationalFilterParserNonJsonField;
17+
import org.hypertrace.core.documentstore.postgres.query.v1.parser.filter.nonjson.field.PostgresInRelationalFilterParserScalarField;
1818
import org.junit.jupiter.api.Test;
1919

2020
class PostgresNotInParserSelectorTest {
@@ -52,7 +52,7 @@ void testVisitIdentifierExpression_flatCollection() {
5252
IdentifierExpression expr = IdentifierExpression.of("item");
5353
PostgresInRelationalFilterParserInterface result = selector.visit(expr);
5454
assertNotNull(result);
55-
assertInstanceOf(PostgresInRelationalFilterParserNonJsonField.class, result);
55+
assertInstanceOf(PostgresInRelationalFilterParserScalarField.class, result);
5656
}
5757

5858
@Test

0 commit comments

Comments
 (0)