tarun11Mavani commented on code in PR #19040:
URL: https://github.com/apache/pinot/pull/19040#discussion_r3682635432
##########
pinot-core/src/main/java/org/apache/pinot/core/operator/blocks/ProjectionBlock.java:
##########
@@ -59,15 +63,37 @@ public BlockValSet getBlockValueSet(ExpressionContext
expression) {
@Override
public BlockValSet getBlockValueSet(String column) {
- return new ProjectionBlockValSet(_dataBlockCache, column,
_dataSourceMap.get(column));
+ DataSource dataSource = _dataSourceMap.get(column);
+ // An OPEN_STRUCT parent is only a handle for per-key resolution — it has
no forward index, so DataFetcher does
+ // not register it and it cannot be read as a column. Reject it here
rather than letting the missing
+ // ColumnValueReader surface as an NPE.
+ if (dataSource instanceof OpenStructDataSource) {
+ throw new BadQueryRequestException(
+ "OPEN_STRUCT column: " + column + " cannot be selected directly; use
" + column + "['key']");
+ }
+ return new ProjectionBlockValSet(_dataBlockCache, column, dataSource);
}
@Override
public BlockValSet getBlockValueSet(String[] paths) {
// TODO: only support one level of path for now, e.g. `map.key`
assert paths.length == 2;
- MapDataSource mapDataSource = (MapDataSource) _dataSourceMap.get(paths[0]);
- DataSource keyDataSource = mapDataSource.getDataSource(paths[1]);
+ DataSource columnDataSource = _dataSourceMap.get(paths[0]);
+ DataSource keyDataSource;
+ if (columnDataSource instanceof MapDataSource) {
+ keyDataSource = ((MapDataSource)
columnDataSource).getDataSource(paths[1]);
+ if (keyDataSource == null) {
+ keyDataSource = new NullDataSource(paths[1]);
+ }
+ } else if (columnDataSource instanceof OpenStructDataSource) {
+ OpenStructDataSource osDs = (OpenStructDataSource) columnDataSource;
+ keyDataSource = osDs.getDataSource(paths[1]);
+ if (keyDataSource == null) {
+ keyDataSource = OpenStructNullDataSource.forAbsentKey(osDs, paths[1]);
Review Comment:
this PR scope if Materialized-only.
I am planning to support for sparse key query including json_index for those
keys in upcoming PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]