Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HIVE-26694: Populate file row position information during vectorized …
…Iceberg reads (#3732) (Adam Szita, reviewed by Laszlo Pinter)
- Loading branch information
Showing
9 changed files
with
185 additions
and
14 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
...erg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/vector/HiveBatchContext.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,71 @@ | ||
/* | ||
* 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.mr.hive.vector; | ||
|
||
import java.io.IOException; | ||
import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; | ||
import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatchCtx; | ||
import org.apache.iceberg.io.CloseableIterator; | ||
|
||
/** | ||
* Wraps a Hive VRB and holds corresponding metadata information about it, such as VRB context (e.g. type infos) and | ||
* file row offset. | ||
*/ | ||
public class HiveBatchContext { | ||
|
||
private final VectorizedRowBatch batch; | ||
private final VectorizedRowBatchCtx vrbCtx; | ||
/** | ||
* File row position of the first row in this batch. Long.MIN_VALUE if unknown. | ||
*/ | ||
private final long fileRowOffset; | ||
|
||
public HiveBatchContext(VectorizedRowBatch batch, VectorizedRowBatchCtx vrbCtx, long fileRowOffset) { | ||
this.batch = batch; | ||
this.vrbCtx = vrbCtx; | ||
this.fileRowOffset = fileRowOffset; | ||
} | ||
|
||
public VectorizedRowBatch getBatch() { | ||
return batch; | ||
} | ||
|
||
public RowIterator rowIterator() throws IOException { | ||
throw new UnsupportedOperationException("Not implemented yet"); | ||
} | ||
|
||
// TODO: implement row iterator | ||
class RowIterator implements CloseableIterator { | ||
|
||
@Override | ||
public void close() throws IOException { | ||
} | ||
|
||
@Override | ||
public boolean hasNext() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public Object next() { | ||
return null; | ||
} | ||
} | ||
} |
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
30 changes: 30 additions & 0 deletions
30
ql/src/java/org/apache/hadoop/hive/ql/io/RowPositionAwareVectorizedRecordReader.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,30 @@ | ||
/* | ||
* 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.hadoop.hive.ql.io; | ||
|
||
import java.io.IOException; | ||
|
||
public interface RowPositionAwareVectorizedRecordReader { | ||
/** | ||
* Returns the row position (in the file) of the first row in the last returned batch. | ||
* @return row position | ||
* @throws IOException | ||
*/ | ||
long getRowNumber() throws IOException; | ||
} |
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
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