From 1ad3156e151f8132f10caaa22df2862cb971c28f Mon Sep 17 00:00:00 2001 From: Jia-Xuan Liu Date: Mon, 16 May 2022 17:11:13 +0800 Subject: [PATCH] Enable CI and fix enforce rules (#3) * fix enforce rules * add build and check * fix error prone * disable error prone check --- core/cml-main/pom.xml | 5 --- .../src/main/java/io/cml/type/DateType.java | 17 ---------- .../src/main/java/io/cml/type/PGTypes.java | 2 -- .../main/java/io/cml/type/TimestampType.java | 27 --------------- .../cml/type/TimestampWithTimeZoneType.java | 11 ------ core/cml-server/pom.xml | 34 +++++++++++++++++++ pom.xml | 6 ++++ 7 files changed, 40 insertions(+), 62 deletions(-) diff --git a/core/cml-main/pom.xml b/core/cml-main/pom.xml index 67720209f..423e92389 100644 --- a/core/cml-main/pom.xml +++ b/core/cml-main/pom.xml @@ -64,11 +64,6 @@ google-cloud-bigquery - - com.google.cloud - google-cloud-core - - com.google.code.findbugs jsr305 diff --git a/core/cml-main/src/main/java/io/cml/type/DateType.java b/core/cml-main/src/main/java/io/cml/type/DateType.java index 1d1b0e4d6..241ca273a 100644 --- a/core/cml-main/src/main/java/io/cml/type/DateType.java +++ b/core/cml-main/src/main/java/io/cml/type/DateType.java @@ -19,13 +19,6 @@ import io.netty.buffer.ByteBuf; import javax.annotation.Nonnull; -import java.time.format.DateTimeFormatter; -import java.time.format.DateTimeFormatterBuilder; -import java.time.format.ResolverStyle; -import java.util.Locale; - -import static java.time.format.DateTimeFormatter.ISO_LOCAL_DATE; - public class DateType extends PGType { @@ -36,16 +29,6 @@ public class DateType private static final int TYPE_LEN = 4; private static final int TYPE_MOD = -1; - private static final DateTimeFormatter ISO_FORMATTER = new DateTimeFormatterBuilder() - .parseCaseInsensitive() - .append(ISO_LOCAL_DATE) - .toFormatter(Locale.ENGLISH).withResolverStyle(ResolverStyle.STRICT); - - private static final DateTimeFormatter ISO_FORMATTER_AD = new DateTimeFormatterBuilder() - .parseCaseInsensitive() - .appendPattern("yyyy-MM-dd") - .toFormatter(Locale.ENGLISH).withResolverStyle(ResolverStyle.STRICT); - private DateType() { super(OID, TYPE_LEN, TYPE_MOD, NAME); diff --git a/core/cml-main/src/main/java/io/cml/type/PGTypes.java b/core/cml-main/src/main/java/io/cml/type/PGTypes.java index de27f716c..bd6da4a77 100644 --- a/core/cml-main/src/main/java/io/cml/type/PGTypes.java +++ b/core/cml-main/src/main/java/io/cml/type/PGTypes.java @@ -52,7 +52,6 @@ public final class PGTypes private PGTypes() {} private static final Map> TYPE_TABLE = new HashMap<>(); - private static final Map INNER_OID_TO_PGARRAY; private static final Set> TYPES; static { @@ -89,7 +88,6 @@ public final class PGTypes TYPE_TABLE.put(array.oid(), array); innerToPgTypeBuilder.put(innerType.oid(), array); }); - INNER_OID_TO_PGARRAY = innerToPgTypeBuilder.build(); TYPES = new HashSet<>(TYPE_TABLE.values()); // the following polymorphic types are added manually, diff --git a/core/cml-main/src/main/java/io/cml/type/TimestampType.java b/core/cml-main/src/main/java/io/cml/type/TimestampType.java index e12f1b2bf..be0c32f03 100644 --- a/core/cml-main/src/main/java/io/cml/type/TimestampType.java +++ b/core/cml-main/src/main/java/io/cml/type/TimestampType.java @@ -19,15 +19,6 @@ import io.netty.buffer.ByteBuf; import javax.annotation.Nonnull; -import java.time.format.DateTimeFormatter; -import java.time.format.DateTimeFormatterBuilder; -import java.time.format.ResolverStyle; -import java.util.Locale; - -import static java.time.format.DateTimeFormatter.ISO_LOCAL_DATE; -import static java.time.format.DateTimeFormatter.ISO_LOCAL_TIME; -import static java.util.Locale.ENGLISH; - public class TimestampType extends BaseTimestampType { @@ -36,24 +27,6 @@ public class TimestampType private static final int OID = 1114; private static final String NAME = "timestamp"; - private static final DateTimeFormatter PG_TIMESTAMP = new DateTimeFormatterBuilder() - .parseCaseInsensitive() - .appendPattern("yyyy-MM-dd HH:mm:ss.SSS") - .toFormatter(ENGLISH).withResolverStyle(ResolverStyle.STRICT); - - private static final DateTimeFormatter PARSER_WITH_OPTIONAL_ERA = new DateTimeFormatterBuilder() - .parseCaseInsensitive() - .append(ISO_LOCAL_DATE) - .optionalStart() - .appendLiteral(' ') - .append(ISO_LOCAL_TIME) - .optionalStart() - .appendPattern("[VV][x][xx][xxx]") - .optionalStart() - .appendLiteral(' ') - .appendPattern("G") - .toFormatter(Locale.ENGLISH).withResolverStyle(ResolverStyle.STRICT); - private TimestampType() { super(OID, TYPE_LEN, TYPE_MOD, NAME); diff --git a/core/cml-main/src/main/java/io/cml/type/TimestampWithTimeZoneType.java b/core/cml-main/src/main/java/io/cml/type/TimestampWithTimeZoneType.java index 79793ad2e..bcff7055d 100644 --- a/core/cml-main/src/main/java/io/cml/type/TimestampWithTimeZoneType.java +++ b/core/cml-main/src/main/java/io/cml/type/TimestampWithTimeZoneType.java @@ -16,14 +16,9 @@ package io.cml.type; import io.cml.spi.type.PGType; import io.netty.buffer.ByteBuf; -import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.DateTimeFormatter; import javax.annotation.Nonnull; -import java.time.format.DateTimeFormatterBuilder; -import java.util.Locale; - public class TimestampWithTimeZoneType extends BaseTimestampType { @@ -31,12 +26,6 @@ public class TimestampWithTimeZoneType private static final int OID = 1184; private static final String NAME = "timestamptz"; - private static final java.time.format.DateTimeFormatter ISO_OFFSET_DATE_TIME = new DateTimeFormatterBuilder() - .appendPattern("yyyy-MM-dd HH:mm:ss.SSSx").toFormatter(); - - // For Golang if date is AD (after Christ), era abbreviation is not parsed. - private static final DateTimeFormatter ISO_FORMATTER = - DateTimeFormat.forPattern("YYYY-MM-dd HH:mm:ss.SSS+00").withZoneUTC().withLocale(Locale.ENGLISH); private TimestampWithTimeZoneType() { diff --git a/core/cml-server/pom.xml b/core/cml-server/pom.xml index c43f76e02..0609a450f 100644 --- a/core/cml-server/pom.xml +++ b/core/cml-server/pom.xml @@ -17,6 +17,32 @@ + + io.airlift + configuration + + + + com.google.api + gax + + + com.google.auth + google-auth-library-credentials + + + com.google.auth + google-auth-library-oauth2-http + + + + com.google.cloud + google-cloud-bigquery + + + com.google.cloud + google-cloud-core + com.google.guava guava @@ -33,5 +59,13 @@ io.cml cml-postgres-wire-protocol + + io.cml + cml-spi + + + io.cml + trino-parser + diff --git a/pom.xml b/pom.xml index 87d7bc389..3776e12e7 100644 --- a/pom.xml +++ b/pom.xml @@ -1201,6 +1201,12 @@ import + + org.threeten + threetenbp + 1.6.0 + + org.xerial.snappy snappy-java