[ES|QL] remove chrono literals (#186536)

## Summary

The "chrono-literals" can be replaced with the simpler system of
`literalOptions`. This is better because it moves us toward having _one_
way to do things and removing Kibana-specific types which don't actually
exist in ES|QL and, therefore, can be confusing.
This commit is contained in:
Drew Tate 2024-07-10 09:22:59 -06:00 committed by GitHub
parent 46b21546aa
commit a0b018b12c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 94 additions and 35 deletions

View file

@ -15,7 +15,7 @@ import { statsAggregationFunctionDefinitions } from '../src/definitions/aggs';
import { evalFunctionDefinitions } from '../src/definitions/functions';
import { groupingFunctionDefinitions } from '../src/definitions/grouping';
import { getFunctionSignatures } from '../src/definitions/helpers';
import { timeUnits, chronoLiterals } from '../src/definitions/literals';
import { timeUnits } from '../src/definitions/literals';
import { nonNullable } from '../src/shared/helpers';
import {
SupportedFieldType,
@ -1045,14 +1045,10 @@ function getFieldName(
}
const literals = {
chrono_literal: chronoLiterals[0].name,
time_literal: timeUnits[0],
};
function getLiteralType(typeString: 'chrono_literal' | 'time_literal') {
if (typeString === 'chrono_literal') {
return literals[typeString];
}
function getLiteralType(typeString: 'time_literal') {
return `1 ${literals[typeString]}`;
}
@ -1116,7 +1112,7 @@ function getFieldMapping(
}
if (/literal$/.test(typeString) && useLiterals) {
return {
name: getLiteralType(typeString as 'chrono_literal' | 'time_literal'),
name: getLiteralType(typeString as 'time_literal'),
type,
...rest,
};