Skip to content

Commit

Permalink
Revert "add Keysets to to table dto / info (Netflix#452)"
Browse files Browse the repository at this point in the history
This reverts commit 6bb1a68.
  • Loading branch information
ajoymajumdar committed Sep 17, 2021
1 parent 2046449 commit 387deb8
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 409 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public class TableInfo extends BaseInfo {
private List<FieldInfo> fields;
private StorageInfo serde;
private ViewInfo view;
private KeySetInfo keys;

/**
* Constructor.
Expand All @@ -58,35 +57,11 @@ private TableInfo(
final Map<String, String> metadata,
final List<FieldInfo> fields,
final StorageInfo serde,
final ViewInfo view,
final KeySetInfo keys
final ViewInfo view
) {
super(name, auditInfo, metadata);
this.fields = fields;
this.serde = serde;
this.view = view;
this.keys = keys;
}

/**
* builds key set info from the fields.
*
* @return key set
*/
public KeySetInfo getKeys() {
if (this.keys != null) {
return keys;
}
keys = KeySetInfo.buildKeySet(this.fields);
return keys;
}

/**
* sets the keyset.
*
* @param keys keyset to be set
*/
public void setKeys(final KeySetInfo keys) {
this.keys = keys;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import com.netflix.metacat.common.dto.DatabaseDto;
import com.netflix.metacat.common.dto.FieldDto;
import com.netflix.metacat.common.dto.GetPartitionsRequestDto;
import com.netflix.metacat.common.dto.KeyDto;
import com.netflix.metacat.common.dto.KeySetDto;
import com.netflix.metacat.common.dto.ViewDto;
import com.netflix.metacat.common.dto.Pageable;
import com.netflix.metacat.common.dto.PartitionDto;
Expand All @@ -41,8 +39,6 @@
import com.netflix.metacat.common.server.connectors.model.ClusterInfo;
import com.netflix.metacat.common.server.connectors.model.DatabaseInfo;
import com.netflix.metacat.common.server.connectors.model.FieldInfo;
import com.netflix.metacat.common.server.connectors.model.KeyInfo;
import com.netflix.metacat.common.server.connectors.model.KeySetInfo;
import com.netflix.metacat.common.server.connectors.model.ViewInfo;
import com.netflix.metacat.common.server.connectors.model.PartitionInfo;
import com.netflix.metacat.common.server.connectors.model.PartitionListRequest;
Expand Down Expand Up @@ -105,8 +101,6 @@ protected void configure() {
mapping(AuditDto.class, AuditInfo.class);
mapping(ViewDto.class, ViewInfo.class);
mapping(StorageDto.class, StorageInfo.class);
mapping(KeySetDto.class, KeySetInfo.class);
mapping(KeyDto.class, KeyInfo.class);
}
};
dozerBeanMapper.addMapping(builder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,8 @@ class ConverterUtilSpec extends Specification {
given:
def dto = new TableDto(name: QualifiedName.ofTable('prodhive', 'amajumdar', 'part'),
audit: new AuditDto('test', new Date(), 'test', new Date()),
fields: [FieldDto.builder().name('esn').type('string').source_type('string')
.jsonType(new TextNode('string')).pos(0).build()] ,
serde: new StorageDto(owner: 'test'),
keys: KeySetDto.builder()
.partition(Arrays.asList(KeyDto.builder().name('partition').fields(Arrays.asList('esn')).build()))
.build()
)
fields: [FieldDto.builder().name('esn').type('string').source_type('string').jsonType(new TextNode('string')).pos(0).build()] ,
serde: new StorageDto(owner: 'test'))
when:
def info = converter.fromTableDto(dto)
def resultDto = converter.toTableDto(info)
Expand All @@ -70,11 +65,7 @@ class ConverterUtilSpec extends Specification {
audit: new AuditDto('test', new Date(), 'test', new Date()),
fields: [FieldDto.builder().name('esn').type('string').source_type('string').jsonType(new TextNode('string')).pos(0).build()],
serde: new StorageDto(owner: 'test'),
view: new ViewDto("select test", "select test2"),
keys: KeySetDto.builder()
.partition(Arrays.asList(KeyDto.builder().name('partition').fields(Arrays.asList('esn')).build()))
.build()
)
view: new ViewDto("select test", "select test2"))
when:
def info = converter.fromTableDto(dto)
def resultDto = converter.toTableDto(info)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
/*
*
* Copyright 2016 Netflix, Inc.
*
* 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:https://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 com.netflix.metacat.common.dto;

import io.swagger.annotations.ApiModel;
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ public class TableDto extends BaseDto implements HasDataMetadata, HasDefinitionM
//Naming as view required by dozer mapping
private ViewDto view;

@ApiModelProperty(value = "keys defined in the table")
@JsonProperty
private KeySetDto keys;

@Nonnull
@Override
@JsonIgnore
Expand All @@ -101,25 +97,19 @@ public QualifiedName getDefinitionName() {
@JsonProperty
@SuppressWarnings("checkstyle:methodname")
public List<String> getPartition_keys() {
if (this.keys == null) {
if (fields == null) {
return null;
} else if (fields.isEmpty()) {
return Collections.emptyList();
}
if (fields == null) {
return null;
} else if (fields.isEmpty()) {
return Collections.emptyList();
}

final List<String> partitionKeys = new LinkedList<>();
for (FieldDto field : fields) {
if (field.isPartition_key()) {
partitionKeys.add(field.getName());
}
final List<String> keys = new LinkedList<>();
for (FieldDto field : fields) {
if (field.isPartition_key()) {
keys.add(field.getName());
}
return partitionKeys;
}

return this.keys.getPartition().isEmpty()
? Collections.EMPTY_LIST
: this.keys.getPartition().get(0).getFields();
return keys;
}

/**
Expand All @@ -130,19 +120,6 @@ public List<String> getPartition_keys() {
public void setPartition_keys(final List<String> ignored) {
}

@JsonIgnore
public KeySetDto getKeys() {
return keys;
}

/**
* Sets the keyset.
* @param keys keyset
*/
public void setKeys(final KeySetDto keys) {
this.keys = keys;
}

@Override
@JsonProperty
public boolean isDataExternal() {
Expand Down
Loading

0 comments on commit 387deb8

Please sign in to comment.