Skip to content

Commit fcf2d9b

Browse files
authored
Code formatting and import organization only change. Includes no functional changes. (#296)
1 parent 4073b87 commit fcf2d9b

File tree

106 files changed

+4249
-3794
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+4249
-3794
lines changed

RELEASE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Release Notes
22
## [4.3.7] - 2024-09-03
33
- Added property `spark.cdm.transform.custom.ttl` to allow a custom constant value to be set for TTL instead of using the values from `origin` rows.
4+
- Repo wide code formating & imports organization
45

56
## [4.3.6] - 2024-08-29
67
- Added `overwrite` option to conditionally check or skip `Validation` when it has a non-null value in `target` for the `spark.cdm.feature.extractJson` feature.

pom.xml

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
24
<modelVersion>4.0.0</modelVersion>
35

46
<groupId>datastax.cdm</groupId>
@@ -288,7 +290,7 @@
288290
<limit>
289291
<counter>LINE</counter>
290292
<value>MISSEDCOUNT</value>
291-
<maximum>1400</maximum>
293+
<maximum>1500</maximum>
292294
</limit>
293295
</limits>
294296
</rule>
@@ -313,6 +315,39 @@
313315
</execution>
314316
</executions>
315317
</plugin>
318+
<plugin>
319+
<groupId>net.revelc.code</groupId>
320+
<artifactId>impsort-maven-plugin</artifactId>
321+
<version>1.9.0</version>
322+
<configuration>
323+
<groups>java.,javax.,org.,com.</groups>
324+
<staticGroups>java,*</staticGroups>
325+
</configuration>
326+
<executions>
327+
<execution>
328+
<goals>
329+
<goal>sort</goal>
330+
</goals>
331+
</execution>
332+
</executions>
333+
</plugin>
334+
<plugin>
335+
<groupId>net.revelc.code.formatter</groupId>
336+
<artifactId>formatter-maven-plugin</artifactId>
337+
<version>2.23.0</version>
338+
<configuration>
339+
<compilerSource>11</compilerSource>
340+
<compilerCompliance>11</compilerCompliance>
341+
<compilerTargetPlatform>11</compilerTargetPlatform>
342+
</configuration>
343+
<executions>
344+
<execution>
345+
<goals>
346+
<goal>format</goal>
347+
</goals>
348+
</execution>
349+
</executions>
350+
</plugin>
316351
</plugins>
317352
</build>
318353
</project>

src/main/java/com/datastax/cdm/cql/EnhancedSession.java

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,24 @@
1515
*/
1616
package com.datastax.cdm.cql;
1717

18+
import java.util.List;
19+
20+
import org.slf4j.Logger;
21+
import org.slf4j.LoggerFactory;
22+
23+
import com.datastax.cdm.cql.codec.CodecFactory;
24+
import com.datastax.cdm.cql.codec.Codecset;
1825
import com.datastax.cdm.cql.statement.*;
26+
import com.datastax.cdm.data.PKFactory;
27+
import com.datastax.cdm.properties.KnownProperties;
28+
import com.datastax.cdm.properties.PropertyHelper;
1929
import com.datastax.cdm.schema.CqlTable;
2030
import com.datastax.oss.driver.api.core.CqlSession;
2131
import com.datastax.oss.driver.api.core.type.DataType;
2232
import com.datastax.oss.driver.api.core.type.codec.CodecNotFoundException;
2333
import com.datastax.oss.driver.api.core.type.codec.TypeCodec;
2434
import com.datastax.oss.driver.api.core.type.codec.registry.MutableCodecRegistry;
2535
import com.datastax.oss.driver.api.core.type.reflect.GenericType;
26-
import com.datastax.cdm.cql.codec.CodecFactory;
27-
import com.datastax.cdm.cql.codec.Codecset;
28-
import com.datastax.cdm.data.PKFactory;
29-
import com.datastax.cdm.properties.KnownProperties;
30-
import com.datastax.cdm.properties.PropertyHelper;
31-
import org.slf4j.Logger;
32-
import org.slf4j.LoggerFactory;
33-
34-
import java.util.List;
3536

3637
public class EnhancedSession {
3738
public Logger logger = LoggerFactory.getLogger(this.getClass().getName());
@@ -54,32 +55,40 @@ public EnhancedSession(PropertyHelper propertyHelper, CqlSession cqlSession, boo
5455
public void setPKFactory(PKFactory pkFactory) {
5556
this.pkFactory = pkFactory;
5657
}
57-
public PKFactory getPKFactory() { return this.pkFactory; }
58+
59+
public PKFactory getPKFactory() {
60+
return this.pkFactory;
61+
}
5862

5963
public CqlSession getCqlSession() {
6064
return cqlSession;
6165
}
66+
6267
public CqlTable getCqlTable() {
6368
return cqlTable;
6469
}
6570

6671
public OriginSelectByPartitionRangeStatement getOriginSelectByPartitionRangeStatement() {
67-
if (!isOrigin) throw new RuntimeException("This is not an origin session");
72+
if (!isOrigin)
73+
throw new RuntimeException("This is not an origin session");
6874
return new OriginSelectByPartitionRangeStatement(propertyHelper, this);
6975
}
7076

7177
public OriginSelectByPKStatement getOriginSelectByPKStatement() {
72-
if (!isOrigin) throw new RuntimeException("This is not an origin session");
78+
if (!isOrigin)
79+
throw new RuntimeException("This is not an origin session");
7380
return new OriginSelectByPKStatement(propertyHelper, this);
7481
}
7582

7683
public TargetSelectByPKStatement getTargetSelectByPKStatement() {
77-
if (isOrigin) throw new RuntimeException("This is not a target session");
84+
if (isOrigin)
85+
throw new RuntimeException("This is not a target session");
7886
return new TargetSelectByPKStatement(propertyHelper, this);
7987
}
8088

8189
public TargetUpsertStatement getTargetUpsertStatement() {
82-
if (isOrigin) throw new RuntimeException("This is not a target session");
90+
if (isOrigin)
91+
throw new RuntimeException("This is not a target session");
8392
if (cqlTable.isCounterTable())
8493
return new TargetUpdateStatement(propertyHelper, this);
8594
else
@@ -88,15 +97,17 @@ public TargetUpsertStatement getTargetUpsertStatement() {
8897

8998
private CqlSession initSession(PropertyHelper propertyHelper, CqlSession session) {
9099
List<String> codecList = propertyHelper.getStringList(KnownProperties.TRANSFORM_CODECS);
91-
if (null!=codecList && !codecList.isEmpty()) {
100+
if (null != codecList && !codecList.isEmpty()) {
92101
MutableCodecRegistry registry = (MutableCodecRegistry) session.getContext().getCodecRegistry();
93102

94103
for (String codecString : codecList) {
95104
Codecset codecEnum = Codecset.valueOf(codecString);
96105
for (TypeCodec<?> codec : CodecFactory.getCodecPair(propertyHelper, codecEnum)) {
97106
DataType dataType = codec.getCqlType();
98107
GenericType<?> javaType = codec.getJavaType();
99-
if (logDebug) logger.debug("Registering Codec {} for CQL type {} and Java type {}", codec.getClass().getSimpleName(), dataType, javaType);
108+
if (logDebug)
109+
logger.debug("Registering Codec {} for CQL type {} and Java type {}",
110+
codec.getClass().getSimpleName(), dataType, javaType);
100111
try {
101112
registry.codecFor(dataType, javaType);
102113
} catch (CodecNotFoundException e) {
@@ -108,6 +119,4 @@ private CqlSession initSession(PropertyHelper propertyHelper, CqlSession session
108119
return session;
109120
}
110121

111-
112-
113122
}

src/main/java/com/datastax/cdm/cql/codec/BIGINT_StringCodec.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@
1515
*/
1616
package com.datastax.cdm.cql.codec;
1717

18+
import java.nio.ByteBuffer;
19+
20+
import org.jetbrains.annotations.NotNull;
21+
22+
import com.datastax.cdm.properties.PropertyHelper;
1823
import com.datastax.oss.driver.api.core.ProtocolVersion;
1924
import com.datastax.oss.driver.api.core.type.DataType;
2025
import com.datastax.oss.driver.api.core.type.DataTypes;
2126
import com.datastax.oss.driver.api.core.type.codec.TypeCodecs;
2227
import com.datastax.oss.driver.api.core.type.reflect.GenericType;
23-
import com.datastax.cdm.properties.PropertyHelper;
24-
import org.jetbrains.annotations.NotNull;
25-
26-
import java.nio.ByteBuffer;
2728

2829
public class BIGINT_StringCodec extends AbstractBaseCodec<String> {
2930

@@ -70,4 +71,3 @@ public String parse(String value) {
7071
}
7172

7273
}
73-

src/main/java/com/datastax/cdm/cql/codec/CodecFactory.java

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,44 @@
1515
*/
1616
package com.datastax.cdm.cql.codec;
1717

18+
import java.util.Arrays;
19+
import java.util.List;
20+
1821
import com.datastax.cdm.properties.PropertyHelper;
1922
import com.datastax.dse.driver.internal.core.type.codec.geometry.LineStringCodec;
2023
import com.datastax.dse.driver.internal.core.type.codec.geometry.PointCodec;
2124
import com.datastax.dse.driver.internal.core.type.codec.geometry.PolygonCodec;
2225
import com.datastax.dse.driver.internal.core.type.codec.time.DateRangeCodec;
2326
import com.datastax.oss.driver.api.core.type.codec.TypeCodec;
2427

25-
import java.util.Arrays;
26-
import java.util.List;
27-
2828
public class CodecFactory {
2929
public static List<TypeCodec<?>> getCodecPair(PropertyHelper propertyHelper, Codecset codec) {
3030
switch (codec) {
31-
case INT_STRING: return Arrays.asList(new INT_StringCodec(propertyHelper), new TEXT_IntegerCodec(propertyHelper));
32-
case DOUBLE_STRING: return Arrays.asList(new DOUBLE_StringCodec(propertyHelper), new TEXT_DoubleCodec(propertyHelper));
33-
case BIGINT_STRING: return Arrays.asList(new BIGINT_StringCodec(propertyHelper), new TEXT_LongCodec(propertyHelper));
34-
case DECIMAL_STRING: return Arrays.asList(new DECIMAL_StringCodec(propertyHelper), new TEXT_BigDecimalCodec(propertyHelper));
35-
case TIMESTAMP_STRING_MILLIS: return Arrays.asList(new TIMESTAMP_StringMillisCodec(propertyHelper), new TEXTMillis_InstantCodec(propertyHelper));
36-
case TIMESTAMP_STRING_FORMAT: return Arrays.asList(new TIMESTAMP_StringFormatCodec(propertyHelper), new TEXTFormat_InstantCodec(propertyHelper));
37-
case POLYGON_TYPE: return Arrays.asList(new PolygonCodec());
38-
case POINT_TYPE: return Arrays.asList(new PointCodec());
39-
case DATE_RANGE: return Arrays.asList(new DateRangeCodec());
40-
case LINE_STRING: return Arrays.asList(new LineStringCodec());
31+
case INT_STRING:
32+
return Arrays.asList(new INT_StringCodec(propertyHelper), new TEXT_IntegerCodec(propertyHelper));
33+
case DOUBLE_STRING:
34+
return Arrays.asList(new DOUBLE_StringCodec(propertyHelper), new TEXT_DoubleCodec(propertyHelper));
35+
case BIGINT_STRING:
36+
return Arrays.asList(new BIGINT_StringCodec(propertyHelper), new TEXT_LongCodec(propertyHelper));
37+
case DECIMAL_STRING:
38+
return Arrays.asList(new DECIMAL_StringCodec(propertyHelper), new TEXT_BigDecimalCodec(propertyHelper));
39+
case TIMESTAMP_STRING_MILLIS:
40+
return Arrays.asList(new TIMESTAMP_StringMillisCodec(propertyHelper),
41+
new TEXTMillis_InstantCodec(propertyHelper));
42+
case TIMESTAMP_STRING_FORMAT:
43+
return Arrays.asList(new TIMESTAMP_StringFormatCodec(propertyHelper),
44+
new TEXTFormat_InstantCodec(propertyHelper));
45+
case POLYGON_TYPE:
46+
return Arrays.asList(new PolygonCodec());
47+
case POINT_TYPE:
48+
return Arrays.asList(new PointCodec());
49+
case DATE_RANGE:
50+
return Arrays.asList(new DateRangeCodec());
51+
case LINE_STRING:
52+
return Arrays.asList(new LineStringCodec());
4153

42-
default:
43-
throw new IllegalArgumentException("Unknown codec: " + codec);
54+
default:
55+
throw new IllegalArgumentException("Unknown codec: " + codec);
4456
}
4557
}
4658
}

src/main/java/com/datastax/cdm/cql/codec/Codecset.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@
1616
package com.datastax.cdm.cql.codec;
1717

1818
public enum Codecset {
19-
INT_STRING,
20-
DOUBLE_STRING,
21-
BIGINT_STRING,
22-
DECIMAL_STRING,
23-
TIMESTAMP_STRING_MILLIS,
24-
TIMESTAMP_STRING_FORMAT,
25-
POINT_TYPE,
26-
POLYGON_TYPE,
27-
DATE_RANGE,
28-
LINE_STRING
19+
INT_STRING, DOUBLE_STRING, BIGINT_STRING, DECIMAL_STRING, TIMESTAMP_STRING_MILLIS, TIMESTAMP_STRING_FORMAT,
20+
POINT_TYPE, POLYGON_TYPE, DATE_RANGE, LINE_STRING
2921
}

src/main/java/com/datastax/cdm/cql/codec/DECIMAL_StringCodec.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@
1515
*/
1616
package com.datastax.cdm.cql.codec;
1717

18+
import java.math.BigDecimal;
19+
import java.nio.ByteBuffer;
20+
21+
import org.jetbrains.annotations.NotNull;
22+
1823
import com.datastax.cdm.properties.PropertyHelper;
1924
import com.datastax.oss.driver.api.core.ProtocolVersion;
2025
import com.datastax.oss.driver.api.core.type.DataType;
2126
import com.datastax.oss.driver.api.core.type.DataTypes;
2227
import com.datastax.oss.driver.api.core.type.codec.TypeCodecs;
2328
import com.datastax.oss.driver.api.core.type.reflect.GenericType;
24-
import org.jetbrains.annotations.NotNull;
25-
26-
import java.math.BigDecimal;
27-
import java.nio.ByteBuffer;
2829

2930
public class DECIMAL_StringCodec extends AbstractBaseCodec<String> {
3031

@@ -70,4 +71,3 @@ public String parse(String value) {
7071
return decimalValue == null ? null : decimalValue.toString();
7172
}
7273
}
73-

src/main/java/com/datastax/cdm/cql/codec/DOUBLE_StringCodec.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,18 @@
1515
*/
1616
package com.datastax.cdm.cql.codec;
1717

18+
import java.math.RoundingMode;
19+
import java.nio.ByteBuffer;
20+
import java.text.DecimalFormat;
21+
22+
import org.jetbrains.annotations.NotNull;
23+
1824
import com.datastax.cdm.properties.PropertyHelper;
1925
import com.datastax.oss.driver.api.core.ProtocolVersion;
2026
import com.datastax.oss.driver.api.core.type.DataType;
2127
import com.datastax.oss.driver.api.core.type.DataTypes;
2228
import com.datastax.oss.driver.api.core.type.codec.TypeCodecs;
2329
import com.datastax.oss.driver.api.core.type.reflect.GenericType;
24-
import org.jetbrains.annotations.NotNull;
25-
26-
import java.math.RoundingMode;
27-
import java.nio.ByteBuffer;
28-
import java.text.DecimalFormat;
2930

3031
// This works with decimal-formatted doubles in strings, but not
3132
// with the default scientific notation. A separate codec is needed

src/main/java/com/datastax/cdm/cql/codec/INT_StringCodec.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@
1515
*/
1616
package com.datastax.cdm.cql.codec;
1717

18+
import java.nio.ByteBuffer;
19+
20+
import org.jetbrains.annotations.NotNull;
21+
1822
import com.datastax.cdm.properties.PropertyHelper;
1923
import com.datastax.oss.driver.api.core.ProtocolVersion;
24+
import com.datastax.oss.driver.api.core.type.DataType;
2025
import com.datastax.oss.driver.api.core.type.DataTypes;
2126
import com.datastax.oss.driver.api.core.type.codec.TypeCodecs;
22-
import com.datastax.oss.driver.api.core.type.DataType;
2327
import com.datastax.oss.driver.api.core.type.reflect.GenericType;
24-
import org.jetbrains.annotations.NotNull;
25-
26-
import java.nio.ByteBuffer;
2728

2829
public class INT_StringCodec extends AbstractBaseCodec<String> {
2930

@@ -69,4 +70,3 @@ public String parse(String value) {
6970
return intValue == null ? null : intValue.toString();
7071
}
7172
}
72-

0 commit comments

Comments
 (0)