Skip to content

Return a better error message when Timestamp is renamed in TS queries#136231

Merged
not-napoleon merged 34 commits intoelastic:mainfrom
not-napoleon:rename-ts-error-message
Oct 24, 2025
Merged

Return a better error message when Timestamp is renamed in TS queries#136231
not-napoleon merged 34 commits intoelastic:mainfrom
not-napoleon:rename-ts-error-message

Conversation

@not-napoleon
Copy link
Member

@not-napoleon not-napoleon commented Oct 8, 2025

Resolves #134994

After discussing this more on #136062, we have decided queries that rename the @timestamp field should fail with a clear error message.

This relates to #136772

@not-napoleon not-napoleon added >bug auto-backport Automatically create backport pull requests when merged v9.2.0 :StorageEngine/ES|QL Timeseries / metrics / PromQL / logsdb capabilities in ES|QL v9.3.0 labels Oct 8, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @not-napoleon, I've created a changelog YAML for you.

not-napoleon and others added 12 commits October 16, 2025 10:22
This isn't going to work because the objects get recreated
arbitrarially.
 Conflicts:
	x-pack/plugin/esql/qa/testFixtures/src/main/resources/k8s-timeseries.csv-spec
	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/VerifierTests.java
	x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/40_tsdb.yml
@not-napoleon not-napoleon marked this pull request as ready for review October 21, 2025 20:29
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some nits, but this looks good. Can you also change to UnresolvedTimestamp for LastOverTime, FirstOverTime, Increase, Irate, Delta, and IDelta? Thank you, Mark!

rx:
type: integer
time_series_metric: counter
index: test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this: nit: can we avoid reformatting this file?

protected static Analyzer sampleDataIndexAnalyzer;

protected static EnrichResolution enrichResolution;
public static EnrichResolution enrichResolution;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we don't need this change?

required_capability: ts_command_v0

TS k8s METADATA _tsid
| RENAME _tsid AS newTsid
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I think these queries should fail. You don't have to handle them in this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we need to open a few follow up issues. There's also the case of shadowing timestamp in an eval that should fail.


@Override
public UnresolvedTimestamp withUnresolvedMessage(String unresolvedMessage) {
return new UnresolvedTimestamp(source(), qualifier(), name(), id(), unresolvedMessage, resolutionMetadata(), errorMessage);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't want to override String unresolvedMessage(), you can override unresolvedMessage here instead. Either approach is good.

 Conflicts:
	x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/UnresolvedAttribute.java
	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/VerifierTests.java
 Conflicts:
	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/VerifierTests.java
@not-napoleon not-napoleon enabled auto-merge (squash) October 22, 2025 18:16
@not-napoleon
Copy link
Member Author

@elasticmachine run elasticsearch-ci/part-3

@not-napoleon not-napoleon merged commit ef9199d into elastic:main Oct 24, 2025
34 checks passed
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
9.2 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 136231

not-napoleon added a commit to not-napoleon/elasticsearch that referenced this pull request Oct 24, 2025
…elastic#136231)

Resolves elastic#134994

After discussing this more on elastic#136062, we have decided queries that rename the @timestamp field should fail with a clear error message.

This relates to elastic#136772

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
 Conflicts:
	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/VerifierTests.java
elasticsearchmachine pushed a commit that referenced this pull request Oct 24, 2025
…ueries (#136231) (#137112)

* Return a better error message when Timestamp is renamed in TS queries (#136231)

Resolves #134994

After discussing this more on #136062, we have decided queries that rename the @timestamp field should fail with a clear error message.

This relates to #136772

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
 Conflicts:
	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/VerifierTests.java

* creating test analyzers is fragile apparently

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
@not-napoleon
Copy link
Member Author

manual backport PR: #137112

fzowl pushed a commit to voyage-ai/elasticsearch that referenced this pull request Nov 3, 2025
…elastic#136231)

Resolves elastic#134994

After discussing this more on elastic#136062, we have decided queries that rename the @timestamp field should fail with a clear error message.

This relates to elastic#136772

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged >bug :StorageEngine/ES|QL Timeseries / metrics / PromQL / logsdb capabilities in ES|QL Team:StorageEngine v9.2.1 v9.3.0

3 participants