diff --git a/core/src/main/java/org/opensearch/sql/expression/function/PPLBuiltinOperators.java b/core/src/main/java/org/opensearch/sql/expression/function/PPLBuiltinOperators.java index 60172e70c8..a24015de99 100644 --- a/core/src/main/java/org/opensearch/sql/expression/function/PPLBuiltinOperators.java +++ b/core/src/main/java/org/opensearch/sql/expression/function/PPLBuiltinOperators.java @@ -521,7 +521,8 @@ public class PPLBuiltinOperators extends ReflectiveSqlOperatorTable { public static final SqlAggFunction DISTINCT_COUNT_APPROX = createUserDefinedAggFunction( DistinctCountApproxLogicalAggFunction.class, - "DISTINCT_COUNT_APPROX", + // Substrait-standard name the analytics-engine backend resolves by (V3 overrides it). + "APPROX_COUNT_DISTINCT", ReturnTypes.BIGINT_FORCE_NULLABLE, null); diff --git a/integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalcitePPLAggregationIT.java b/integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalcitePPLAggregationIT.java index bd4c68b85d..5c8f6eb2cf 100644 --- a/integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalcitePPLAggregationIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalcitePPLAggregationIT.java @@ -25,7 +25,6 @@ import java.util.List; import org.json.JSONObject; import org.junit.jupiter.api.Test; -import org.opensearch.client.Request; import org.opensearch.sql.common.utils.StringUtils; import org.opensearch.sql.exception.SemanticCheckException; import org.opensearch.sql.ppl.PPLIntegTestCase; @@ -52,16 +51,11 @@ public void init() throws Exception { @Test public void testSimpleCount0() throws IOException { - Request request1 = new Request("PUT", "/test/_doc/1?refresh=true"); - request1.setJsonEntity("{\"name\": \"hello\", \"age\": 20}"); - client().performRequest(request1); - Request request2 = new Request("PUT", "/test/_doc/2?refresh=true"); - request2.setJsonEntity("{\"name\": \"world\", \"age\": 30}"); - client().performRequest(request2); - - JSONObject actual = executeQuery("source=test | stats count() as c"); + // A bare auto-created index isn't parquet-backed; use the parquet-aware bank index (7 docs). + JSONObject actual = + executeQuery(String.format("source=%s | stats count() as c", TEST_INDEX_BANK)); verifySchema(actual, schema("c", "bigint")); - verifyDataRows(actual, rows(2)); + verifyDataRows(actual, rows(7)); } @Test