Skip to content

Commit 8984d97

Browse files
committed
fix style
1 parent d695e75 commit 8984d97

File tree

3 files changed

+135
-142
lines changed

3 files changed

+135
-142
lines changed

api/src/main/java/org/apache/gravitino/stats/StatisticValue.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@
2020

2121
import org.apache.gravitino.rel.types.Type;
2222

23-
/**
24-
* An interface representing a statistic value.
25-
*/
23+
/** An interface representing a statistic value. */
2624
public interface StatisticValue<T> {
2725

28-
/**
29-
* Returns the value of the statistic.
30-
* @return the value of the statistic
31-
*/
32-
T value();
26+
/**
27+
* Returns the value of the statistic.
28+
*
29+
* @return the value of the statistic
30+
*/
31+
T value();
3332

34-
/**
35-
* Returns the data type of the statistic value.
36-
* @return the data type of the statistic value
37-
*/
38-
Type dataType();
33+
/**
34+
* Returns the data type of the statistic value.
35+
*
36+
* @return the data type of the statistic value
37+
*/
38+
Type dataType();
3939
}

api/src/main/java/org/apache/gravitino/stats/StatisticValues.java

Lines changed: 116 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -19,164 +19,156 @@
1919
package org.apache.gravitino.stats;
2020

2121
import com.google.common.base.Preconditions;
22-
import org.apache.gravitino.rel.types.Type;
23-
import org.apache.gravitino.rel.types.Types;
24-
2522
import java.util.List;
2623
import java.util.Map;
24+
import org.apache.gravitino.rel.types.Type;
25+
import org.apache.gravitino.rel.types.Types;
2726

28-
/**
29-
* A class representing a collection of statistic values.
30-
*/
27+
/** A class representing a collection of statistic values. */
3128
public class StatisticValues {
3229

33-
/**
34-
* A statistic value that holds a Boolean value.
35-
*/
36-
public static class BooleanValue implements StatisticValue<Boolean> {
37-
private final Boolean value;
30+
/** A statistic value that holds a Boolean value. */
31+
public static class BooleanValue implements StatisticValue<Boolean> {
32+
private final Boolean value;
3833

39-
public BooleanValue(Boolean value) {
40-
this.value = value;
41-
}
34+
public BooleanValue(Boolean value) {
35+
this.value = value;
36+
}
4237

43-
@Override
44-
public Boolean value() {
45-
return value;
46-
}
38+
@Override
39+
public Boolean value() {
40+
return value;
41+
}
4742

48-
@Override
49-
public Type dataType() {
50-
return Types.BooleanType.get();
51-
}
43+
@Override
44+
public Type dataType() {
45+
return Types.BooleanType.get();
5246
}
47+
}
5348

54-
/**
55-
* A statistic value that holds a Long value.
56-
*/
57-
public static class LongValue implements StatisticValue<Long> {
58-
private final Long value;
49+
/** A statistic value that holds a Long value. */
50+
public static class LongValue implements StatisticValue<Long> {
51+
private final Long value;
5952

60-
public LongValue(Long value) {
61-
this.value = value;
62-
}
53+
public LongValue(Long value) {
54+
this.value = value;
55+
}
6356

64-
@Override
65-
public Long value() {
66-
return value;
67-
}
57+
@Override
58+
public Long value() {
59+
return value;
60+
}
6861

69-
@Override
70-
public Type dataType() {
71-
return Types.LongType.get();
72-
}
62+
@Override
63+
public Type dataType() {
64+
return Types.LongType.get();
7365
}
66+
}
67+
68+
/** A statistic value that holds a Double value. */
69+
public static class DoubleValue implements StatisticValue<Double> {
70+
private final Double value;
7471

7572
/**
76-
* A statistic value that holds a Double value.
73+
* Creates a DoubleValue with the given double value.
74+
*
75+
* @param value The double value to be held by this statistic value.
7776
*/
78-
public static class DoubleValue implements StatisticValue<Double> {
79-
private final Double value;
80-
81-
/**
82-
* Creates a DoubleValue with the given double value.
83-
* @param value The double value to be held by this statistic value.
84-
*/
85-
public DoubleValue(Double value) {
86-
this.value = value;
87-
}
77+
public DoubleValue(Double value) {
78+
this.value = value;
79+
}
8880

89-
@Override
90-
public Double value() {
91-
return value;
92-
}
81+
@Override
82+
public Double value() {
83+
return value;
84+
}
9385

94-
@Override
95-
public Type dataType() {
96-
return Types.DoubleType.get();
97-
}
86+
@Override
87+
public Type dataType() {
88+
return Types.DoubleType.get();
9889
}
90+
}
91+
92+
/** A statistic value that holds a String value. */
93+
public static class StringValue implements StatisticValue<String> {
94+
private final String value;
9995

10096
/**
101-
* A statistic value that holds a String value.
97+
* Creates a StringValue with the given string value.
98+
*
99+
* @param value The string value to be held by this statistic value.
102100
*/
103-
public static class StringValue implements StatisticValue<String> {
104-
private final String value;
105-
106-
/**
107-
* Creates a StringValue with the given string value.
108-
* @param value The string value to be held by this statistic value.
109-
*/
110-
public StringValue(String value) {
111-
this.value = value;
112-
}
101+
public StringValue(String value) {
102+
this.value = value;
103+
}
113104

114-
@Override
115-
public String value() {
116-
return value;
117-
}
105+
@Override
106+
public String value() {
107+
return value;
108+
}
118109

119-
@Override
120-
public Type dataType() {
121-
return Types.StringType.get();
122-
}
110+
@Override
111+
public Type dataType() {
112+
return Types.StringType.get();
123113
}
114+
}
115+
116+
/** A statistic value that holds a List of other statistic values. */
117+
public static class ListValue implements StatisticValue<List<StatisticValue>> {
118+
private final List<StatisticValue> values;
124119

125120
/**
126-
* A statistic value that holds a List of other statistic values.
121+
* Creates a ListValue with the given list of statistic values.
122+
*
123+
* @param values A list of StatisticValue instances.
127124
*/
128-
public static class ListValue implements StatisticValue<List<StatisticValue>> {
129-
private final List<StatisticValue> values;
130-
131-
/**
132-
* Creates a ListValue with the given list of statistic values.
133-
* @param values A list of StatisticValue instances.
134-
*/
135-
public ListValue(List<StatisticValue> values) {
136-
Preconditions.checkArgument(values != null && values.isEmpty(), "Values cannot be null or empty");
137-
this.values = values;
138-
}
125+
public ListValue(List<StatisticValue> values) {
126+
Preconditions.checkArgument(
127+
values != null && values.isEmpty(), "Values cannot be null or empty");
128+
this.values = values;
129+
}
139130

140-
@Override
141-
public List<StatisticValue> value() {
142-
return values;
143-
}
131+
@Override
132+
public List<StatisticValue> value() {
133+
return values;
134+
}
144135

145-
@Override
146-
public Type dataType() {
147-
return Types.ListType.notNull(values.get(0).dataType());
148-
}
136+
@Override
137+
public Type dataType() {
138+
return Types.ListType.notNull(values.get(0).dataType());
149139
}
140+
}
141+
142+
/** A statistic value that holds a Map of String keys to other statistic values. */
143+
public static class ObjectValue implements StatisticValue<Map<String, StatisticValue>> {
144+
private final Map<String, StatisticValue> values;
150145

151146
/**
152-
* A statistic value that holds a Map of String keys to other statistic values.
147+
* Creates an ObjectValue with the given map of statistic values.
148+
*
149+
* @param values A map where keys are String identifiers and values are StatisticValue
150+
* instances.
153151
*/
154-
public static class ObjectValue implements StatisticValue<Map<String, StatisticValue>> {
155-
private final Map<String, StatisticValue> values;
156-
157-
/**
158-
* Creates an ObjectValue with the given map of statistic values.
159-
* @param values A map where keys are String identifiers and values are StatisticValue instances.
160-
*/
161-
public ObjectValue(Map<String, StatisticValue> values) {
162-
Preconditions.checkArgument(values != null && !values.isEmpty(), "Values cannot be null or empty");
163-
this.values = values;
164-
}
165-
166-
@Override
167-
public Map<String, StatisticValue> value() {
168-
return values;
169-
}
170-
171-
@Override
172-
public Type dataType() {
173-
return Types.StructType.of(
174-
values.entrySet().stream()
175-
.map(
176-
entry ->
177-
Types.StructType.Field.nullableField(
178-
entry.getKey(), entry.getValue().dataType()))
179-
.toArray(Types.StructType.Field[]::new));
180-
}
152+
public ObjectValue(Map<String, StatisticValue> values) {
153+
Preconditions.checkArgument(
154+
values != null && !values.isEmpty(), "Values cannot be null or empty");
155+
this.values = values;
156+
}
157+
158+
@Override
159+
public Map<String, StatisticValue> value() {
160+
return values;
161+
}
162+
163+
@Override
164+
public Type dataType() {
165+
return Types.StructType.of(
166+
values.entrySet().stream()
167+
.map(
168+
entry ->
169+
Types.StructType.Field.nullableField(
170+
entry.getKey(), entry.getValue().dataType()))
171+
.toArray(Types.StructType.Field[]::new));
181172
}
173+
}
182174
}

api/src/main/java/org/apache/gravitino/stats/SupportsStatistics.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.apache.gravitino.annotation.Evolving;
2424
import org.apache.gravitino.exceptions.IllegalStatisticNameException;
2525
import org.apache.gravitino.exceptions.UnmodifiableStatisticException;
26-
import org.apache.gravitino.rel.expressions.literals.Literal;
2726

2827
/**
2928
* SupportsStatistics provides methods to list and update statistics. A table, a partition or a
@@ -41,9 +40,9 @@ public interface SupportsStatistics {
4140

4241
/**
4342
* Updates statistics with the provided values. If the statistic exists, it will be updated with
44-
* the new value. If the statistic does not exist, it will be created. If
45-
* the statistic is unmodifiable, it will throw an UnmodifiableStatisticException. If the
46-
* statistic name is illegal, it will throw an IllegalStatisticNameException.
43+
* the new value. If the statistic does not exist, it will be created. If the statistic is
44+
* unmodifiable, it will throw an UnmodifiableStatisticException. If the statistic name is
45+
* illegal, it will throw an IllegalStatisticNameException.
4746
*
4847
* @param statistics a map of statistic names to their values
4948
* @return a list of updated statistics
@@ -52,7 +51,9 @@ List<Statistic> updateStatistics(Map<String, StatisticValue> statistics)
5251
throws UnmodifiableStatisticException, IllegalStatisticNameException;
5352

5453
/**
55-
* Drop statistics by their names. If the statistic is unmodifiable, it will throw an UnmodifiableStatisticException.
54+
* Drop statistics by their names. If the statistic is unmodifiable, it will throw an
55+
* UnmodifiableStatisticException.
56+
*
5657
* @param statistics a list of statistic names to be dropped
5758
* @return true if the statistics were successfully dropped, false if no statistics were dropped
5859
* @throws UnmodifiableStatisticException if any of the statistics to be dropped are unmodifiable

0 commit comments

Comments
 (0)