|
27 | 27 | import org.elasticsearch.xcontent.XContentBuilder; |
28 | 28 | import org.elasticsearch.xcontent.XContentType; |
29 | 29 | import org.elasticsearch.xcontent.json.JsonXContent; |
| 30 | +import org.elasticsearch.xpack.esql.core.plugin.EsqlCorePlugin; |
30 | 31 | import org.elasticsearch.xpack.esql.core.type.DataType; |
31 | 32 | import org.elasticsearch.xpack.esql.qa.rest.RestEsqlTestCase; |
32 | 33 | import org.elasticsearch.xpack.esql.tools.ProfileParser; |
|
42 | 43 | import java.util.ArrayList; |
43 | 44 | import java.util.Arrays; |
44 | 45 | import java.util.Comparator; |
| 46 | +import java.util.HashMap; |
45 | 47 | import java.util.HashSet; |
46 | 48 | import java.util.List; |
47 | 49 | import java.util.Locale; |
@@ -672,19 +674,25 @@ public void testSuggestedCast() throws IOException { |
672 | 674 | "type": "Point", |
673 | 675 | "coordinates": [-77.03653, 38.897676] |
674 | 676 | } |
675 | | - """), |
676 | | - Map.entry(DataType.AGGREGATE_METRIC_DOUBLE, """ |
| 677 | + """) |
| 678 | + ); |
| 679 | + if (EsqlCorePlugin.AGGREGATE_METRIC_DOUBLE_FEATURE_FLAG.isEnabled()) { |
| 680 | + typesAndValues = new HashMap<>(typesAndValues); |
| 681 | + typesAndValues.put(DataType.AGGREGATE_METRIC_DOUBLE, """ |
677 | 682 | { |
678 | 683 | "max": 14983.1 |
679 | 684 | } |
680 | | - """) |
681 | | - ); |
| 685 | + """); |
| 686 | + } |
682 | 687 | Set<DataType> shouldBeSupported = Stream.of(DataType.values()).filter(DataType::isRepresentable).collect(Collectors.toSet()); |
683 | 688 | shouldBeSupported.remove(DataType.CARTESIAN_POINT); |
684 | 689 | shouldBeSupported.remove(DataType.CARTESIAN_SHAPE); |
685 | 690 | shouldBeSupported.remove(DataType.NULL); |
686 | 691 | shouldBeSupported.remove(DataType.DOC_DATA_TYPE); |
687 | 692 | shouldBeSupported.remove(DataType.TSID_DATA_TYPE); |
| 693 | + if (EsqlCorePlugin.AGGREGATE_METRIC_DOUBLE_FEATURE_FLAG.isEnabled() == false) { |
| 694 | + shouldBeSupported.remove(DataType.AGGREGATE_METRIC_DOUBLE); |
| 695 | + } |
688 | 696 | for (DataType type : shouldBeSupported) { |
689 | 697 | assertTrue(typesAndValues.containsKey(type)); |
690 | 698 | } |
|
0 commit comments