-
Notifications
You must be signed in to change notification settings - Fork 25.6k
ESQL: Support for _index metadata field in CsvTests #121261
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
Changes from 1 commit
961532a
f5951e9
10267f3
157381f
41acedd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,6 +58,7 @@ | |
| import org.elasticsearch.xpack.esql.plan.physical.FieldExtractExec; | ||
| import org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.LocalExecutionPlannerContext; | ||
| import org.elasticsearch.xpack.esql.planner.LocalExecutionPlanner.PhysicalOperation; | ||
| import org.elasticsearch.xpack.esql.session.IndexResolver; | ||
| import org.elasticsearch.xpack.ml.MachineLearning; | ||
|
|
||
| import java.io.IOException; | ||
|
|
@@ -292,6 +293,10 @@ private Block getBlockForMultiType(DocBlock indexDoc, MultiTypeEsField multiType | |
| private Block extractBlockForSingleDoc(DocBlock docBlock, String columnName, TestBlockCopier blockCopier) { | ||
| var indexId = docBlock.asVector().shards().getInt(0); | ||
| var indexPage = indexPages.get(indexId); | ||
| if (IndexResolver.INDEX_METADATA_FIELD.contains(columnName)) { | ||
|
||
| return docBlock.blockFactory() | ||
| .newConstantBytesRefBlockWith(new BytesRef(indexPage.index), blockCopier.docIndices.getPositionCount()); | ||
| } | ||
| int columnIndex = indexPage.columnIndex(columnName) | ||
| .orElseThrow(() -> new EsqlIllegalArgumentException("Cannot find column named [{}] in {}", columnName, indexPage.columnNames)); | ||
| var originalData = indexPage.page.getBlock(columnIndex); | ||
|
|
@@ -410,8 +415,9 @@ private Block extractBlockForColumn( | |
| ) { | ||
| foreachIndexDoc(docBlock, indexDoc -> { | ||
| TestBlockCopier blockCopier = blockCopier(dataType, extractPreference, indexDoc.asVector().docs()); | ||
| Block blockForIndex = extractBlock.apply(indexDoc, blockCopier); | ||
| blockBuilder.copyFrom(blockForIndex, 0, blockForIndex.getPositionCount()); | ||
| try (Block blockForIndex = extractBlock.apply(indexDoc, blockCopier)) { | ||
| blockBuilder.copyFrom(blockForIndex, 0, blockForIndex.getPositionCount()); | ||
| } | ||
| }); | ||
| var result = blockBuilder.build(); | ||
| assert result.getPositionCount() == docBlock.getPositionCount() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.