-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESQL: Read from the BlockFactory
#100231
ESQL: Read from the BlockFactory
#100231
Conversation
This links the `BlockFactory` into the `Block` serialization code. With this blocks that are deserialized from over the wire are tracked.
Pinging @elastic/es-ql (Team:QL) |
Pinging @elastic/elasticsearch-esql (:Query Languages/ES|QL) |
@@ -68,6 +68,7 @@ public ElementType elementType() { | |||
|
|||
@Override | |||
public Block filter(int... positions) { | |||
close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so weird. Usually filter
preserves a reference to the underlying block. But it doesn't for ConstantNullBlock
and that's fine and good. But we presume that it does. This "simulates" that. I hate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. this finds sucks. It's ok for now.
x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/Page.java
Show resolved
Hide resolved
@@ -861,6 +861,7 @@ public void testFromStatsLimit() { | |||
} | |||
} | |||
|
|||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/99826") | |||
public void testFromLimit() { | |||
try (EsqlQueryResponse results = run("from test | keep data | limit 2")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's something funky going on with LimitOperator
and I tried to track it down - you can see the tests I added. But I ultimately gave up. I think the problem here is that we finish
the Operator
and something on the exchange doesn't close. I'm not sure though.
@@ -52,6 +53,7 @@ | |||
|
|||
import static org.hamcrest.Matchers.equalTo; | |||
|
|||
@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/99826") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate disabling this. ENRICH
seems to work, but the IT isn't. It could be that we simply don't test the enrich path I'm breaking with this PR though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can leave it muted. I will integrate BlockFactory to the enrich operator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. I was digging around and learning a lot. But it wasn't quick.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. I've left a comment regarding the passing of the BlockFactory.
* to BigArrays, which we need to build the BlockFactory | ||
* up front. | ||
*/ | ||
blockFactoryHolder.blockFactory = blockFactory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we create a custom StreamInput, such as PlanStreamInput, and then create and pass a BlockFactory whenever we deserialize a Page? Currently, we only deserialize Pages in two places: ExchangeResponse and LookupResponse for enrich.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have a look. I figured it'd amount to the same thing though because we have to figure out how to do that passing. But maybe it's later. I'll look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it! I do like this better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is mostly very good. I think there is just a couple of outstanding comments.
x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/Page.java
Show resolved
Hide resolved
|
||
if (lastInput != null) { | ||
lastInput.releaseBlocks(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
...lugin/esql/compute/src/test/java/org/elasticsearch/compute/data/BlockSerializationTests.java
Outdated
Show resolved
Hide resolved
assertThat(getValuesList(resp), hasSize(0)); | ||
assertThat(queriedIndices, empty()); | ||
queriedIndices.clear(); | ||
try (EsqlQueryResponse resp = run("from events_*", randomPragmas(), new RangeQueryBuilder("@timestamp").gte("2023-01-01"))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm.. I updated these tests to close the response, so created a merge conflict here. Sorry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge conflicts are life.
* to BigArrays, which we need to build the BlockFactory | ||
* up front. | ||
*/ | ||
blockFactoryHolder.blockFactory = blockFactory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
@dnhatn and @ChrisHegarty, could you have another look? I've moved the |
The part 2 failure looks real. I'll look! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a comment, but LGTM.
builder.beginPositionEntry(); | ||
for (int valueIndex = 0; valueIndex < valueCount; valueIndex++) { | ||
builder.append$Type$(in.read$Type$()); | ||
try ($Type$Block.Builder builder = ((BlockStreamInput) in).blockFactory().new$Type$BlockBuilder(positions)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we prefer not to have a type cast here, but it should not block this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll grab that in a followup.
This links the `BlockFactory` into the `Block` serialization code. With this blocks that are deserialized from over the wire are tracked. Co-authored-by: Nhat Nguyen <[email protected]>
💚 Backport successful
|
This links the `BlockFactory` into the `Block` serialization code. With this blocks that are deserialized from over the wire are tracked. Co-authored-by: Nhat Nguyen <[email protected]>
This links the
BlockFactory
into theBlock
serialization code. With this blocks that are deserialized from over the wire are tracked.