Skip to content

Commit

Permalink
[apache#1918] improvement(catalog): Add annotation `@EqualsAndHashCod…
Browse files Browse the repository at this point in the history
…e` of `IcebergColumn` and `JdbcColumn` (apache#2351)

### What changes were proposed in this pull request?

Add annotation `@EqualsAndHashCode` of `IcebergColumn` and `JdbcColumn`.

### Why are the changes needed?

As `HiveColumn` has annotation `@EqualsAndHashCode` to support `equals`
and `hashCode` method at present, `IcebergColumn` and `JdbcColumn` shoud
be added the annotation `@EqualsAndHashCode`.

Fix: apache#1918

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

No.
  • Loading branch information
SteNicholas authored Feb 27, 2024
1 parent ac2f12b commit 989ad92
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
package com.datastrato.gravitino.catalog.jdbc;

import com.datastrato.gravitino.catalog.rel.BaseColumn;
import lombok.EqualsAndHashCode;

/** Represents a column in the Jdbc column. */
@EqualsAndHashCode(callSuper = true)
public class JdbcColumn extends BaseColumn {

private JdbcColumn() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,17 @@
package com.datastrato.gravitino.catalog.lakehouse.iceberg;

import com.datastrato.gravitino.catalog.rel.BaseColumn;
import lombok.EqualsAndHashCode;

/** Represents a column in the Iceberg column. */
@EqualsAndHashCode(callSuper = true)
public class IcebergColumn extends BaseColumn {

private int id;

private IcebergColumn() {}

public int getId() {
return id;
}

/** A builder class for constructing IcebergColumn instances. */
public static class Builder extends BaseColumnBuilder<Builder, IcebergColumn> {

/** The ID of this field. */
private int id;

public Builder withId(int id) {
this.id = id;
return this;
}

/**
* Internal method to build a IcebergColumn instance using the provided values.
*
Expand All @@ -36,7 +24,6 @@ public Builder withId(int id) {
@Override
protected IcebergColumn internalBuild() {
IcebergColumn icebergColumn = new IcebergColumn();
icebergColumn.id = id;
icebergColumn.name = name;
icebergColumn.comment = comment;
icebergColumn.dataType = dataType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public static com.datastrato.gravitino.rel.types.Type formIcebergType(Type type)
*/
public static IcebergColumn fromNestedField(Types.NestedField nestedField) {
return new IcebergColumn.Builder()
.withId(nestedField.fieldId())
.withName(nestedField.name())
.withNullable(nestedField.isOptional())
.withComment(nestedField.doc())
Expand Down

0 comments on commit 989ad92

Please sign in to comment.