-
Notifications
You must be signed in to change notification settings - Fork 3k
Add a Parallelized Spark Job Planning Path #1421
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 all commits
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 |
|---|---|---|
|
|
@@ -100,6 +100,10 @@ public PartitionData copy() { | |
| found = true; | ||
| fromProjectionPos[i] = j; | ||
| } | ||
| if (fields.get(i).fieldId() == ManifestFile.SPEC_ID.fieldId()) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These modifications allow BaseFile to translate into a SparkRow with the specID as a column |
||
| found = true; | ||
| fromProjectionPos[i] = 14; | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not related to your PR but while we're here: once we find the projected value and
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't, but I don't think it's that much of a time sink |
||
| } | ||
|
|
||
| if (!found) { | ||
|
|
@@ -255,6 +259,9 @@ public void put(int i, Object value) { | |
| case 13: | ||
| this.equalityIds = ArrayUtil.toIntArray((List<Integer>) value); | ||
| return; | ||
| case 14: | ||
| this.partitionSpecId = (value != null) ? (Integer) value : -1; | ||
| return; | ||
| default: | ||
| // ignore the object, it must be from a newer version of the format | ||
| } | ||
|
|
@@ -301,6 +308,8 @@ public Object get(int i) { | |
| return splitOffsets(); | ||
| case 13: | ||
| return equalityFieldIds(); | ||
| case 14: | ||
| return partitionSpecId; | ||
| default: | ||
| throw new UnsupportedOperationException("Unknown field ordinal: " + pos); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,10 +19,6 @@ | |
|
|
||
| package org.apache.iceberg; | ||
|
|
||
| import java.time.Instant; | ||
| import java.time.LocalDateTime; | ||
| import java.time.ZoneId; | ||
| import java.time.format.DateTimeFormatter; | ||
| import java.util.Collection; | ||
| import java.util.Collections; | ||
| import java.util.Map; | ||
|
|
@@ -47,7 +43,6 @@ | |
| abstract class BaseTableScan implements TableScan { | ||
| private static final Logger LOG = LoggerFactory.getLogger(TableScan.class); | ||
|
|
||
| private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"); | ||
|
|
||
| private final TableOperations ops; | ||
| private final Table table; | ||
|
|
@@ -65,6 +60,10 @@ protected BaseTableScan(TableOperations ops, Table table, Schema schema, TableSc | |
| this.context = context; | ||
| } | ||
|
|
||
| protected TableScanContext tableScanContext() { | ||
| return context; | ||
| } | ||
|
|
||
| protected TableOperations tableOps() { | ||
| return ops; | ||
| } | ||
|
|
@@ -85,7 +84,7 @@ protected Collection<String> selectedColumns() { | |
| return context.selectedColumns(); | ||
| } | ||
|
|
||
| protected Map<String, String> options() { | ||
| public Map<String, String> options() { | ||
| return context.options(); | ||
| } | ||
|
|
||
|
|
@@ -105,6 +104,14 @@ protected abstract CloseableIterable<FileScanTask> planFiles( | |
| TableOperations ops, Snapshot snapshot, Expression rowFilter, | ||
| boolean ignoreResiduals, boolean caseSensitive, boolean colStats); | ||
|
|
||
| public Long fromSnapshotId() { | ||
| return context().fromSnapshotId(); | ||
| } | ||
|
|
||
| public Long toSnapshotId() { | ||
| return context.toSnapshotId(); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
|
||
| @Override | ||
| public Table table() { | ||
| return table; | ||
|
|
@@ -145,7 +152,7 @@ public TableScan asOfTime(long timestampMillis) { | |
| // the snapshot ID could be null if no entries were older than the requested time. in that case, | ||
| // there is no valid snapshot to read. | ||
| Preconditions.checkArgument(lastSnapshotId != null, | ||
| "Cannot find a snapshot older than %s", formatTimestampMillis(timestampMillis)); | ||
| "Cannot find a snapshot older than %s", TableScanUtil.formatTimestampMillis(timestampMillis)); | ||
|
|
||
| return useSnapshot(lastSnapshotId); | ||
| } | ||
|
|
@@ -202,7 +209,7 @@ public CloseableIterable<FileScanTask> planFiles() { | |
| Snapshot snapshot = snapshot(); | ||
| if (snapshot != null) { | ||
| LOG.info("Scanning table {} snapshot {} created at {} with filter {}", table, | ||
| snapshot.snapshotId(), formatTimestampMillis(snapshot.timestampMillis()), | ||
| snapshot.snapshotId(), TableScanUtil.formatTimestampMillis(snapshot.timestampMillis()), | ||
| context.rowFilter()); | ||
|
|
||
| Listeners.notifyAll( | ||
|
|
@@ -307,8 +314,4 @@ private Schema lazyColumnProjection() { | |
|
|
||
| return schema; | ||
| } | ||
|
|
||
| private static String formatTimestampMillis(long millis) { | ||
| return DATE_FORMAT.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(millis), ZoneId.systemDefault())); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* | ||
| * 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; | ||
|
|
||
| import org.apache.iceberg.expressions.ResidualEvaluator; | ||
|
|
||
| public class ScanTasks { | ||
|
|
||
| /** | ||
| * Utilty class no public constructor | ||
| */ | ||
| private ScanTasks() { | ||
| } | ||
|
|
||
| public static BaseFileScanTask createBaseFileScanTask(DataFile file, DeleteFile[] deletes, String schemaString, | ||
| String specString, ResidualEvaluator residuals) { | ||
| return new BaseFileScanTask(file, deletes, schemaString, specString, residuals); | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.