Skip to content

Commit 4919848

Browse files
committed
fix checkstyle violations
1 parent ba9147c commit 4919848

File tree

8 files changed

+52
-11
lines changed

8 files changed

+52
-11
lines changed

fluss-client/src/main/java/org/apache/fluss/client/converter/ConverterCommons.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.fluss.client.converter;
1819

1920
import org.apache.fluss.row.BinaryString;

fluss-client/src/main/java/org/apache/fluss/client/converter/PojoConverters.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.fluss.client.converter;
1819

1920
import org.apache.fluss.types.RowType;

fluss-client/src/main/java/org/apache/fluss/client/converter/PojoToRowConverter.java

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.fluss.client.converter;
1819

1920
import org.apache.fluss.row.Decimal;
@@ -123,14 +124,18 @@ private static FieldToRow createFieldConverter(PojoType.Property prop, DataType
123124
case STRING:
124125
return (obj) -> {
125126
Object v = prop.read(obj);
126-
if (v == null) return null;
127+
if (v == null) {
128+
return null;
129+
}
127130
return ConverterCommons.toBinaryStringForText(
128131
v, prop.name, fieldType.getTypeRoot());
129132
};
130133
case DECIMAL:
131134
return (obj) -> {
132135
Object v = prop.read(obj);
133-
if (v == null) return null;
136+
if (v == null) {
137+
return null;
138+
}
134139
if (!(v instanceof BigDecimal)) {
135140
throw new IllegalArgumentException(
136141
String.format(
@@ -144,7 +149,9 @@ private static FieldToRow createFieldConverter(PojoType.Property prop, DataType
144149
case DATE:
145150
return (obj) -> {
146151
Object v = prop.read(obj);
147-
if (v == null) return null;
152+
if (v == null) {
153+
return null;
154+
}
148155
if (!(v instanceof LocalDate)) {
149156
throw new IllegalArgumentException(
150157
String.format(
@@ -156,7 +163,9 @@ private static FieldToRow createFieldConverter(PojoType.Property prop, DataType
156163
case TIME_WITHOUT_TIME_ZONE:
157164
return (obj) -> {
158165
Object v = prop.read(obj);
159-
if (v == null) return null;
166+
if (v == null) {
167+
return null;
168+
}
160169
if (!(v instanceof LocalTime)) {
161170
throw new IllegalArgumentException(
162171
String.format(
@@ -169,7 +178,9 @@ private static FieldToRow createFieldConverter(PojoType.Property prop, DataType
169178
case TIMESTAMP_WITHOUT_TIME_ZONE:
170179
return (obj) -> {
171180
Object v = prop.read(obj);
172-
if (v == null) return null;
181+
if (v == null) {
182+
return null;
183+
}
173184
if (!(v instanceof LocalDateTime)) {
174185
throw new IllegalArgumentException(
175186
String.format(
@@ -181,7 +192,9 @@ private static FieldToRow createFieldConverter(PojoType.Property prop, DataType
181192
case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
182193
return (obj) -> {
183194
Object v = prop.read(obj);
184-
if (v == null) return null;
195+
if (v == null) {
196+
return null;
197+
}
185198
if (v instanceof Instant) {
186199
return TimestampLtz.fromInstant((Instant) v);
187200
} else if (v instanceof OffsetDateTime) {

fluss-client/src/main/java/org/apache/fluss/client/converter/PojoType.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.fluss.client.converter;
1819

1920
import javax.annotation.Nullable;
@@ -169,12 +170,16 @@ private static Map<String, Method> discoverSetters(Class<?> clazz) {
169170
}
170171

171172
private static String capitalize(String s) {
172-
if (s == null || s.isEmpty()) return s;
173+
if (s == null || s.isEmpty()) {
174+
return s;
175+
}
173176
return s.substring(0, 1).toUpperCase(Locale.ROOT) + s.substring(1);
174177
}
175178

176179
private static String decapitalize(String s) {
177-
if (s == null || s.isEmpty()) return s;
180+
if (s == null || s.isEmpty()) {
181+
return s;
182+
}
178183
return s.substring(0, 1).toLowerCase(Locale.ROOT) + s.substring(1);
179184
}
180185

fluss-client/src/main/java/org/apache/fluss/client/converter/RowToPojoConverter.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.fluss.client.converter;
1819

1920
import org.apache.fluss.row.BinaryString;
@@ -62,7 +63,9 @@ public static <T> RowToPojoConverter<T> of(
6263
}
6364

6465
public T fromRow(@Nullable InternalRow row) {
65-
if (row == null) return null;
66+
if (row == null) {
67+
return null;
68+
}
6669
try {
6770
T pojo = pojoType.getDefaultConstructor().newInstance();
6871
for (int i = 0; i < rowReaders.length; i++) {

fluss-client/src/test/java/org/apache/fluss/client/converter/ConvertersTestFixtures.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.fluss.client.converter;
1819

1920
import org.apache.fluss.types.DataTypes;
@@ -56,6 +57,7 @@ public static RowType fullSchema() {
5657
}
5758

5859
// ----------------------- Helper POJOs -----------------------
60+
/** Test POJO used for end-to-end converter tests. */
5961
public static class TestPojo {
6062
public Boolean booleanField;
6163
public Byte byteField;
@@ -129,8 +131,12 @@ public static TestPojo sample() {
129131

130132
@Override
131133
public boolean equals(Object o) {
132-
if (this == o) return true;
133-
if (o == null || getClass() != o.getClass()) return false;
134+
if (this == o) {
135+
return true;
136+
}
137+
if (o == null || getClass() != o.getClass()) {
138+
return false;
139+
}
134140
TestPojo testPojo = (TestPojo) o;
135141
return Objects.equals(booleanField, testPojo.booleanField)
136142
&& Objects.equals(byteField, testPojo.byteField)
@@ -172,6 +178,7 @@ public int hashCode() {
172178
}
173179
}
174180

181+
/** A minimal POJO with a subset of fields for projection tests. */
175182
public static class PartialTestPojo {
176183
public Boolean booleanField;
177184
public Integer intField;
@@ -180,6 +187,7 @@ public static class PartialTestPojo {
180187
public PartialTestPojo() {}
181188
}
182189

190+
/** POJO without public default constructor, used for validation tests. */
183191
public static class NoDefaultConstructorPojo {
184192
public Integer intField;
185193

@@ -188,6 +196,7 @@ public NoDefaultConstructorPojo(int v) {
188196
}
189197
}
190198

199+
/** POJO whose default constructor throws, used to test instantiation error handling. */
191200
public static class ThrowingCtorPojo {
192201
public Integer intField;
193202

@@ -196,42 +205,49 @@ public ThrowingCtorPojo() {
196205
}
197206
}
198207

208+
/** POJO with wrong Java type for DECIMAL field, used for negative tests. */
199209
public static class DecimalWrongTypePojo {
200210
public String decimalField;
201211

202212
public DecimalWrongTypePojo() {}
203213
}
204214

215+
/** POJO with wrong Java type for DATE field, used for negative tests. */
205216
public static class DateWrongTypePojo {
206217
public String dateField;
207218

208219
public DateWrongTypePojo() {}
209220
}
210221

222+
/** POJO with wrong Java type for TIME field, used for negative tests. */
211223
public static class TimeWrongTypePojo {
212224
public String timeField;
213225

214226
public TimeWrongTypePojo() {}
215227
}
216228

229+
/** POJO with wrong Java type for TIMESTAMP_NTZ field, used for negative tests. */
217230
public static class TimestampWrongTypePojo {
218231
public String timestampField;
219232

220233
public TimestampWrongTypePojo() {}
221234
}
222235

236+
/** POJO with wrong Java type for TIMESTAMP_LTZ field, used for negative tests. */
223237
public static class TimestampLtzWrongTypePojo {
224238
public String timestampLtzField;
225239

226240
public TimestampLtzWrongTypePojo() {}
227241
}
228242

243+
/** POJO with unsupported Map field, used for negative tests. */
229244
public static class MapPojo {
230245
public Map<String, Integer> mapField;
231246

232247
public MapPojo() {}
233248
}
234249

250+
/** POJO with Character field for CHAR/STRING handling tests. */
235251
public static class CharacterFieldPojo {
236252
public Character charField;
237253

fluss-client/src/test/java/org/apache/fluss/client/converter/PojoToRowConverterTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.fluss.client.converter;
1819

1920
import org.apache.fluss.row.GenericRow;

fluss-client/src/test/java/org/apache/fluss/client/converter/RowToPojoConverterTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.fluss.client.converter;
1819

1920
import org.apache.fluss.row.GenericRow;

0 commit comments

Comments
 (0)