-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce IcebergPageSource and IcebergColumnHandle
This commit simplifies logic and fixing bugs in case of Iceberg Partition Spec evolution.
- Loading branch information
Showing
23 changed files
with
649 additions
and
261 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
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
98 changes: 98 additions & 0 deletions
98
presto-iceberg/src/main/java/io/prestosql/plugin/iceberg/IcebergColumnHandle.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,98 @@ | ||
/* | ||
* Licensed 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 io.prestosql.plugin.iceberg; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import io.prestosql.spi.connector.ColumnHandle; | ||
import io.prestosql.spi.type.Type; | ||
|
||
import java.util.Objects; | ||
import java.util.Optional; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
public class IcebergColumnHandle | ||
implements ColumnHandle | ||
{ | ||
private final int id; | ||
private final String name; | ||
private final Type type; | ||
private final Optional<String> comment; | ||
|
||
@JsonCreator | ||
public IcebergColumnHandle( | ||
@JsonProperty("id") int id, | ||
@JsonProperty("name") String name, | ||
@JsonProperty("type") Type type, | ||
@JsonProperty("comment") Optional<String> comment) | ||
{ | ||
this.id = id; | ||
this.name = requireNonNull(name, "name is null"); | ||
this.type = requireNonNull(type, "type is null"); | ||
this.comment = requireNonNull(comment, "comment is null"); | ||
} | ||
|
||
@JsonProperty | ||
public int getId() | ||
{ | ||
return id; | ||
} | ||
|
||
@JsonProperty | ||
public String getName() | ||
{ | ||
return name; | ||
} | ||
|
||
@JsonProperty | ||
public Type getType() | ||
{ | ||
return type; | ||
} | ||
|
||
@JsonProperty | ||
public Optional<String> getComment() | ||
{ | ||
return comment; | ||
} | ||
|
||
@Override | ||
public int hashCode() | ||
{ | ||
return Objects.hash(id, name, type, comment); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) | ||
{ | ||
if (this == obj) { | ||
return true; | ||
} | ||
if (obj == null || getClass() != obj.getClass()) { | ||
return false; | ||
} | ||
IcebergColumnHandle other = (IcebergColumnHandle) obj; | ||
return this.id == other.id && | ||
Objects.equals(this.name, other.name) && | ||
Objects.equals(this.type, other.type) && | ||
Objects.equals(this.comment, other.comment); | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return id + ":" + name + ":" + type.getDisplayName(); | ||
} | ||
} |
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
Oops, something went wrong.