-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Views, Spark: Add support for Materialized Views; Integrate with Spark SQL #9830
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
base: main
Are you sure you want to change the base?
Changes from all commits
f09dcb0
9b3faa7
e0deb0b
e32a021
1fb1e92
cc3bff4
e6a5abe
7033883
70021d4
5a97c32
aa58212
60bd84c
4af2a89
345e12e
e3928de
3a7cb53
ec12d45
2141f0d
84dfefd
9a2643b
4df4eb5
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 |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ | |
| import java.util.List; | ||
| import java.util.Map; | ||
| import org.apache.iceberg.catalog.Namespace; | ||
| import org.apache.iceberg.catalog.TableIdentifier; | ||
|
|
||
| /** | ||
| * A version of the view at a point in time. | ||
|
|
@@ -78,4 +79,15 @@ default String defaultCatalog() { | |
|
|
||
| /** The default namespace to use when the SQL does not contain a namespace. */ | ||
| Namespace defaultNamespace(); | ||
|
|
||
|
wmoustafa marked this conversation as resolved.
|
||
| /** | ||
| * The storage table identifier for materialized views. | ||
| * | ||
| * <p>When null, the entity is a regular view. When set, the entity is a materialized view and | ||
| * this identifies the storage table that holds the precomputed data. The storage table must be in | ||
| * the same catalog as the materialized view. | ||
| */ | ||
| default TableIdentifier storageTable() { | ||
|
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. Instead of exposing the storage table in the metastore, this could be
Contributor
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. As discussed in the other comment, the spec treats the storage table as a first class object. I think we should keep the abstraction as |
||
| return null; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /* | ||
| * 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.view; | ||
|
|
||
| import java.util.List; | ||
| import org.apache.iceberg.relocated.com.google.common.base.Preconditions; | ||
|
|
||
| /** | ||
| * Captures the state of source tables and views at the time of a materialized view refresh | ||
| * operation. Stored as a JSON-encoded string in the storage table's snapshot summary under the | ||
| * {@code refresh-state} key. | ||
| */ | ||
| public class RefreshState { | ||
| public static final String REFRESH_STATE_SUMMARY_KEY = "refresh-state"; | ||
|
|
||
| /** Recorded as the snapshot id of a source table that had no snapshot when it was read. */ | ||
| public static final long NO_SNAPSHOT_ID = -1L; | ||
|
|
||
| private final int viewVersionId; | ||
| private final List<SourceState> sourceStates; | ||
| private final long refreshStartTimestampMs; | ||
|
|
||
| public RefreshState( | ||
| int viewVersionId, List<SourceState> sourceStates, long refreshStartTimestampMs) { | ||
| Preconditions.checkArgument(sourceStates != null, "Source states list is required"); | ||
| this.viewVersionId = viewVersionId; | ||
| this.sourceStates = sourceStates; | ||
| this.refreshStartTimestampMs = refreshStartTimestampMs; | ||
| } | ||
|
|
||
| public int viewVersionId() { | ||
| return viewVersionId; | ||
| } | ||
|
|
||
| public List<SourceState> sourceStates() { | ||
| return sourceStates; | ||
| } | ||
|
|
||
| public long refreshStartTimestampMs() { | ||
| return refreshStartTimestampMs; | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.