Skip to content

Commit 437bfdc

Browse files
update testSuggestedCast as date and date_nanos are cast to date_nanos in EsRelation
1 parent 131ab6c commit 437bfdc

File tree

1 file changed

+5
-0
lines changed
  • x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node

1 file changed

+5
-0
lines changed

x-pack/plugin/esql/qa/server/single-node/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/RestEsqlIT.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import static org.elasticsearch.test.ListMatcher.matchesList;
5656
import static org.elasticsearch.test.MapMatcher.assertMap;
5757
import static org.elasticsearch.test.MapMatcher.matchesMap;
58+
import static org.elasticsearch.xpack.esql.core.type.DataType.isMillisOrNanos;
5859
import static org.elasticsearch.xpack.esql.qa.rest.RestEsqlTestCase.Mode.SYNC;
5960
import static org.elasticsearch.xpack.esql.tools.ProfileParser.parseProfile;
6061
import static org.elasticsearch.xpack.esql.tools.ProfileParser.readProfileFromResponse;
@@ -724,6 +725,10 @@ public void testSuggestedCast() throws IOException {
724725

725726
for (int i = 0; i < listOfTypes.size(); i++) {
726727
for (int j = i + 1; j < listOfTypes.size(); j++) {
728+
if (isMillisOrNanos(listOfTypes.get(i)) && isMillisOrNanos(listOfTypes.get(j))) {
729+
// datetime and date_nanos are casted to date_nanos implicitly
730+
continue;
731+
}
727732
String query = String.format(Locale.ROOT, """
728733
{
729734
"query": "FROM index-%s,index-%s | LIMIT 100 | KEEP my_field"

0 commit comments

Comments
 (0)