-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dynamically support Spark native engine in Iceberg
- Loading branch information
Huaxin Gao
committed
Feb 13, 2024
1 parent
50fb400
commit be8c23c
Showing
17 changed files
with
472 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
parquet/src/main/java/org/apache/iceberg/parquet/BaseBatchReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.iceberg.parquet; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import org.apache.parquet.column.page.PageReadStore; | ||
import org.apache.parquet.hadoop.metadata.ColumnChunkMetaData; | ||
import org.apache.parquet.hadoop.metadata.ColumnPath; | ||
|
||
/** A base BatchReader class that contains common functionality */ | ||
@SuppressWarnings("checkstyle:VisibilityModifier") | ||
public abstract class BaseBatchReader<T> implements VectorizedReader<T> { | ||
protected VectorizedReader[] readers; | ||
|
||
public BaseBatchReader() {} | ||
|
||
public void initialize(List<VectorizedReader<?>> readerList) {} | ||
|
||
@Override | ||
public void setRowGroupInfo( | ||
PageReadStore pageStore, Map<ColumnPath, ColumnChunkMetaData> metaData, long rowPosition) { | ||
for (VectorizedReader reader : readers) { | ||
if (reader != null) { | ||
reader.setRowGroupInfo(pageStore, metaData, rowPosition); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void close() { | ||
for (VectorizedReader<?> reader : readers) { | ||
if (reader != null) { | ||
reader.close(); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void setBatchSize(int batchSize) { | ||
for (VectorizedReader reader : readers) { | ||
if (reader != null) { | ||
reader.setBatchSize(batchSize); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...spark/src/main/java/org/apache/iceberg/spark/data/vectorized/BaseColumnarBatchReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.iceberg.spark.data.vectorized; | ||
|
||
import java.util.List; | ||
import java.util.Properties; | ||
import org.apache.iceberg.Schema; | ||
import org.apache.iceberg.data.DeleteFilter; | ||
import org.apache.iceberg.parquet.BaseBatchReader; | ||
import org.apache.iceberg.parquet.VectorizedReader; | ||
import org.apache.spark.sql.catalyst.InternalRow; | ||
|
||
/** A base ColumnBatchReader class that contains common functionality */ | ||
@SuppressWarnings("checkstyle:VisibilityModifier") | ||
public abstract class BaseColumnarBatchReader<T> extends BaseBatchReader<T> { | ||
protected boolean hasIsDeletedColumn; | ||
protected DeleteFilter<InternalRow> deletes = null; | ||
protected long rowStartPosInBatch = 0; | ||
|
||
protected Schema schema; | ||
|
||
public BaseColumnarBatchReader() {} | ||
|
||
public void initialize( | ||
List<VectorizedReader<?>> readers, Schema schema1, Properties properties) {} | ||
|
||
public void setDeleteFilter(DeleteFilter<InternalRow> deleteFilter) { | ||
this.deletes = deleteFilter; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.