Skip to content

Mutable objects used for immutable values #772 #1596

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import jakarta.persistence.Table;
import jakarta.persistence.Version;
import org.apache.polaris.core.entity.PolarisBaseEntity;
import org.apache.polaris.core.entity.PolarisEntitySubType;
import org.apache.polaris.core.entity.PolarisEntityType;

/**
* Entity model representing all attributes of a Polaris Entity. This is used to exchange full
Expand Down Expand Up @@ -262,24 +260,23 @@ public static PolarisBaseEntity toEntity(ModelEntity model) {
return null;
}

var entity =
new PolarisBaseEntity(
model.getCatalogId(),
model.getId(),
PolarisEntityType.fromCode(model.getTypeCode()),
PolarisEntitySubType.fromCode(model.getSubTypeCode()),
model.getParentId(),
model.getName());
entity.setEntityVersion(model.getEntityVersion());
entity.setCreateTimestamp(model.getCreateTimestamp());
entity.setDropTimestamp(model.getDropTimestamp());
entity.setPurgeTimestamp(model.getPurgeTimestamp());
entity.setToPurgeTimestamp(model.getToPurgeTimestamp());
entity.setLastUpdateTimestamp(model.getLastUpdateTimestamp());
entity.setProperties(model.getProperties());
entity.setInternalProperties(model.getInternalProperties());
entity.setGrantRecordsVersion(model.getGrantRecordsVersion());
return entity;
return new PolarisBaseEntity.Builder()
.catalogId(model.getCatalogId())
.id(model.getId())
.typeCode(model.getTypeCode())
.subTypeCode(model.getSubTypeCode())
.parentId(model.getParentId())
.name(model.getName())
.entityVersion(model.getEntityVersion())
.createTimestamp(model.getCreateTimestamp())
.dropTimestamp(model.getDropTimestamp())
.purgeTimestamp(model.getPurgeTimestamp())
.toPurgeTimestamp(model.getToPurgeTimestamp())
.lastUpdateTimestamp(model.getLastUpdateTimestamp())
.properties(model.getProperties())
.internalProperties(model.getInternalProperties())
.grantRecordsVersion(model.getGrantRecordsVersion())
.build();
}

public void update(PolarisBaseEntity entity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,23 +334,22 @@ public static PolarisBaseEntity toEntity(ModelEntity model) {
throw new IllegalArgumentException("Invalid entity subtype: " + model.getSubTypeCode());
}

var entity =
new PolarisBaseEntity(
model.getCatalogId(),
model.getId(),
entityType,
subType,
model.getParentId(),
model.getName());
entity.setEntityVersion(model.getEntityVersion());
entity.setCreateTimestamp(model.getCreateTimestamp());
entity.setDropTimestamp(model.getDropTimestamp());
entity.setPurgeTimestamp(model.getPurgeTimestamp());
entity.setToPurgeTimestamp(model.getToPurgeTimestamp());
entity.setLastUpdateTimestamp(model.getLastUpdateTimestamp());
entity.setProperties(model.getProperties());
entity.setInternalProperties(model.getInternalProperties());
entity.setGrantRecordsVersion(model.getGrantRecordsVersion());
return entity;
return new PolarisBaseEntity.Builder()
.catalogId(model.getCatalogId())
.id(model.getId())
.typeCode(model.getTypeCode())
.subTypeCode(model.getSubTypeCode())
.parentId(model.getParentId())
.name(model.getName())
.entityVersion(model.getEntityVersion())
.createTimestamp(model.getCreateTimestamp())
.dropTimestamp(model.getDropTimestamp())
.purgeTimestamp(model.getPurgeTimestamp())
.toPurgeTimestamp(model.getToPurgeTimestamp())
.lastUpdateTimestamp(model.getLastUpdateTimestamp())
.properties(model.getProperties())
.internalProperties(model.getInternalProperties())
.grantRecordsVersion(model.getGrantRecordsVersion())
.build();
}
}
2 changes: 1 addition & 1 deletion plugins/spark/v3.5/spark/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -480,4 +480,4 @@ file:
| * License: Apache License v2.0
| * Homepage: https://spring.io/projects/spring-framework

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Loading