[ 
https://issues.apache.org/jira/browse/SPARK-37980?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17482845#comment-17482845
 ] 

Prakhar Jain edited comment on SPARK-37980 at 1/27/22, 2:55 AM:
----------------------------------------------------------------

[~cloud_fan] I did some more investigation on this. Looks like [Spark 
uses|https://github.com/apache/spark/blob/6e64e9252a821651a8984babfaccccc79a9ea433/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/SpecificParquetRecordReaderBase.java#L245]
 the underlying "ParquetFileReader" from parquet-mr to do RowGroup filtering:
{noformat}
public PageReadStore readNextRowGroup() throws IOException {
  return reader.readNextFilteredRowGroup();
}{noformat}
This uses the RowGroup filtering and column index filtering from within the 
parquet-mr and returns only the filtered rowgroups. There is no way to identify 
what particular row group is returned from parquet-mr and so we can't adjust 
the row position offsets just from Spark.

We might need to rewrite the logic of of rowgroup filtering in Spark instead of 
relying on parquet-mr to do this for us? What do you suggest?


was (Author: prakharjain09):
[~cloud_fan] I did some more investigation on this. Looks like [Spark 
uses|https://github.com/apache/spark/blob/6e64e9252a821651a8984babfaccccc79a9ea433/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/SpecificParquetRecordReaderBase.java#L245]
 the underlying "ParquetFileReader" from parquet-mr to do RowGroup filtering:
{noformat}
public PageReadStore readNextRowGroup() throws IOException {
return reader.readNextFilteredRowGroup();
}{noformat}
This uses the RowGroup filtering and column index filtering from within the 
parquet-mr and returns only the filtered rowgroups. There is no way to identify 
what particular row group is returned from parquet-mr and so we can't adjust 
the row position offsets just from Spark.

We might need to rewrite the logic of of rowgroup filtering in Spark instead of 
relying on parquet-mr to do this for us? What do you suggest?

> Extend METADATA column to support row indices for file based data sources
> -------------------------------------------------------------------------
>
>                 Key: SPARK-37980
>                 URL: https://issues.apache.org/jira/browse/SPARK-37980
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 3.3
>            Reporter: Prakhar Jain
>            Priority: Major
>
> Spark recently added hidden metadata column support for File based 
> datasources as part of  SPARK-37273.
> We should extend it to support ROW_INDEX/ROW_POSITION also.
>  
> Meaning of  ROW_POSITION:
> ROW_INDEX/ROW_POSITION is basically an index of a row within a file. E.g. 5th 
> row in the file will have ROW_INDEX 5.
>  
> Use cases: 
> Row Indexes can be used in a variety of ways. A (fileName, rowIndex) tuple 
> uniquely identifies row in a table. This information can be used to mark rows 
> e.g. this can be used by indexer etc.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to