Skip to content

Commit b3766dc

Browse files
delete unused constructor
1 parent 7058bb6 commit b3766dc

File tree

2 files changed

+10
-21
lines changed

2 files changed

+10
-21
lines changed

table/src/main/java/tech/ydb/table/description/TableColumn.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,15 @@ public class TableColumn {
1515
private final Type type;
1616
@Nullable
1717
private final String family;
18-
private final boolean hasDefaultValue;
1918
@Nullable
2019
private final PrimitiveValue literalDefaultValue;
2120
@Nullable
2221
private final SequenceDescription sequenceDescription;
2322

24-
public TableColumn(String name, Type type, String family, boolean hasDefaultValue) {
25-
this.name = name;
26-
this.type = type;
27-
this.family = family;
28-
this.hasDefaultValue = hasDefaultValue;
29-
this.literalDefaultValue = null;
30-
this.sequenceDescription = null;
31-
}
32-
3323
public TableColumn(String name, Type type, @Nullable String family, PrimitiveValue literalDefaultValue) {
3424
this.name = name;
3525
this.type = type;
3626
this.family = family;
37-
this.hasDefaultValue = true;
3827
this.literalDefaultValue = literalDefaultValue;
3928
this.sequenceDescription = null;
4029
}
@@ -43,13 +32,12 @@ public TableColumn(String name, Type type, @Nullable String family, SequenceDesc
4332
this.name = name;
4433
this.type = type;
4534
this.family = family;
46-
this.hasDefaultValue = true;
4735
this.literalDefaultValue = null;
4836
this.sequenceDescription = sequenceDescription;
4937
}
5038

5139
public TableColumn(String name, Type type, String family) {
52-
this(name, type, family, false);
40+
this(name, type, family, (PrimitiveValue) null);
5341
}
5442

5543
public TableColumn(String name, Type type) {
@@ -65,7 +53,7 @@ public Type getType() {
6553
}
6654

6755
public boolean hasDefaultValue() {
68-
return hasDefaultValue;
56+
return literalDefaultValue != null && sequenceDescription != null;
6957
}
7058

7159
@Nullable

table/src/main/java/tech/ydb/table/impl/BaseSession.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -839,11 +839,7 @@ private static Result<TableDescription> mapDescribeTable(Result<YdbTable.Describ
839839
YdbTable.ColumnMeta column = desc.getColumns(i);
840840
Type type = ProtoType.fromPb(column.getType());
841841

842-
if (column.hasFromLiteral()) {
843-
PrimitiveValue primitiveValue = (PrimitiveValue)
844-
ProtoValue.fromPb(type, column.getFromLiteral().getValue());
845-
description.addColumn(new TableColumn(column.getName(), type, column.getFamily(), primitiveValue));
846-
} else if (column.hasFromSequence()) {
842+
if (column.hasFromSequence()) {
847843
YdbTable.SequenceDescription pbSeq = column.getFromSequence();
848844
SequenceDescription.Builder sequenceDescriptionBuilder = new SequenceDescription.Builder();
849845

@@ -871,9 +867,14 @@ private static Result<TableDescription> mapDescribeTable(Result<YdbTable.Describ
871867

872868
description.addColumn(new TableColumn(column.getName(), type, column.getFamily(),
873869
sequenceDescriptionBuilder.build()));
874-
} else {
875-
description.addColumn(new TableColumn(column.getName(), type, column.getFamily(), false));
870+
871+
continue;
876872
}
873+
874+
description.addColumn(new TableColumn(column.getName(), type, column.getFamily(),
875+
column.hasFromLiteral() ? (PrimitiveValue)
876+
ProtoValue.fromPb(type, column.getFromLiteral().getValue()) : null)
877+
);
877878
}
878879
description.setPrimaryKeys(desc.getPrimaryKeyList());
879880
for (int i = 0; i < desc.getIndexesCount(); i++) {

0 commit comments

Comments
 (0)