You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2025/08/27 17:48:55 UTC
(shardingsphere) branch master updated: Refactor DateTimeFormatterFactory (#36420)
This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 64a809d3ef5 Refactor DateTimeFormatterFactory (#36420)
64a809d3ef5 is described below
commit 64a809d3ef5e98092572e592ab3c16c927f2dbe0
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Thu Aug 28 01:48:48 2025 +0800
Refactor DateTimeFormatterFactory (#36420)
---
.../time/MySQLTimestampBinlogProtocolValue.java | 2 +-
.../query/text/MySQLTextResultSetRowPacket.java | 2 +-
.../MySQLTimestampBinlogProtocolValueTest.java | 2 +-
.../datetime/AutoIntervalShardingAlgorithm.java | 4 +-
.../datetime/IntervalShardingAlgorithmTest.java | 6 +--
.../util/datetime/DateTimeFormatterFactory.java | 60 +++++++++++-----------
.../datetime/DateTimeFormatterFactoryTest.java | 24 ++++-----
.../execute/AbstractPipelineLifecycleRunnable.java | 2 +-
.../service/PipelineJobConfigurationManager.java | 4 +-
.../core/job/service/PipelineJobManager.java | 2 +-
.../data/pipeline/cdc/api/CDCJobAPI.java | 2 +-
.../api/ConsistencyCheckJobAPI.java | 6 +--
.../test/e2e/cases/value/SQLValue.java | 18 +++----
.../test/e2e/it/sql/dml/BaseDMLE2EIT.java | 2 +-
.../test/e2e/it/sql/dql/BaseDQLE2EIT.java | 4 +-
15 files changed, 70 insertions(+), 70 deletions(-)
diff --git a/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValue.java b/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValue.java
index 872e7b8ff4b..b7b2e8fdad2 100644
--- a/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValue.java
+++ b/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValue.java
@@ -36,6 +36,6 @@ public final class MySQLTimestampBinlogProtocolValue implements MySQLBinlogProto
@Override
public Serializable read(final MySQLBinlogColumnDef columnDef, final MySQLPacketPayload payload) {
int seconds = payload.readInt4();
- return 0 == seconds ? MySQLTimeValueUtils.DATETIME_OF_ZERO : DateTimeFormatterFactory.getStandardFormatter().format(new Timestamp(seconds * 1000L).toLocalDateTime());
+ return 0 == seconds ? MySQLTimeValueUtils.DATETIME_OF_ZERO : DateTimeFormatterFactory.getDatetimeFormatter().format(new Timestamp(seconds * 1000L).toLocalDateTime());
}
}
diff --git a/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacket.java b/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacket.java
index 6bae6ef889b..11fd151632a 100644
--- a/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacket.java
+++ b/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacket.java
@@ -70,7 +70,7 @@ public final class MySQLTextResultSetRowPacket extends MySQLPacket {
} else if (data instanceof Boolean) {
payload.writeBytesLenenc((boolean) data ? new byte[]{1} : new byte[]{0});
} else if (data instanceof LocalDateTime) {
- payload.writeStringLenenc(DateTimeFormatterFactory.getStandardFormatter().format((LocalDateTime) data));
+ payload.writeStringLenenc(DateTimeFormatterFactory.getDatetimeFormatter().format((LocalDateTime) data));
} else {
payload.writeStringLenenc(data.toString());
}
diff --git a/database/protocol/dialect/mysql/src/test/java/org/apache/shardingsphere/database/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java b/database/protocol/dialect/mysql/src/test/java/org/apache/shardingsphere/database/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java
index 3513bd117d9..2b4e7f2a88d 100644
--- a/database/protocol/dialect/mysql/src/test/java/org/apache/shardingsphere/database/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java
+++ b/database/protocol/dialect/mysql/src/test/java/org/apache/shardingsphere/database/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java
@@ -45,7 +45,7 @@ class MySQLTimestampBinlogProtocolValueTest {
int currentSeconds = (int) (System.currentTimeMillis() / 1000L);
when(payload.readInt4()).thenReturn(currentSeconds);
assertThat(new MySQLTimestampBinlogProtocolValue().read(columnDef, payload),
- is(DateTimeFormatterFactory.getStandardFormatter().format(new Timestamp(currentSeconds * 1000L).toLocalDateTime())));
+ is(DateTimeFormatterFactory.getDatetimeFormatter().format(new Timestamp(currentSeconds * 1000L).toLocalDateTime())));
}
@Test
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/AutoIntervalShardingAlgorithm.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/AutoIntervalShardingAlgorithm.java
index c9c3168cd13..0f8c0078f65 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/AutoIntervalShardingAlgorithm.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/AutoIntervalShardingAlgorithm.java
@@ -68,7 +68,7 @@ public final class AutoIntervalShardingAlgorithm implements StandardShardingAlgo
String value = props.getProperty(DATE_TIME_LOWER_KEY);
ShardingSpherePreconditions.checkNotNull(value, () -> new AlgorithmInitializationException(this, String.format("%s cannot be null.", DATE_TIME_LOWER_KEY)));
try {
- return LocalDateTime.parse(value, DateTimeFormatterFactory.getStandardFormatter());
+ return LocalDateTime.parse(value, DateTimeFormatterFactory.getDatetimeFormatter());
} catch (final DateTimeParseException ignored) {
throw new InvalidDatetimeFormatException(DATE_TIME_LOWER_KEY, value, "yyyy-MM-dd HH:mm:ss");
}
@@ -112,7 +112,7 @@ public final class AutoIntervalShardingAlgorithm implements StandardShardingAlgo
}
private long parseDate(final Comparable<?> shardingValue) {
- LocalDateTime dateValue = LocalDateTime.from(DateTimeFormatterFactory.getStandardFormatter().parse(shardingValue.toString(), new ParsePosition(0)));
+ LocalDateTime dateValue = LocalDateTime.from(DateTimeFormatterFactory.getDatetimeFormatter().parse(shardingValue.toString(), new ParsePosition(0)));
return Duration.between(dateTimeLower, dateValue).toMillis() / 1000L;
}
diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithmTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithmTest.java
index 00100fb074e..c75d5e73b2e 100644
--- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithmTest.java
+++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithmTest.java
@@ -235,8 +235,8 @@ class IntervalShardingAlgorithmTest {
.doSharding(availableTargetNames, shardingValueAsSqlDate).size(),
is(expectSize));
final RangeShardingValue<Comparable<?>> shardingValueAsString = createShardingValue(
- DateTimeFormatterFactory.getStandardFormatter().format(lower),
- DateTimeFormatterFactory.getStandardFormatter().format(upper));
+ DateTimeFormatterFactory.getDatetimeFormatter().format(lower),
+ DateTimeFormatterFactory.getDatetimeFormatter().format(upper));
assertThat(algorithm.doSharding(availableTargetNames, shardingValueAsString).size(), is(expectSize));
assertThat(shardingAlgorithmByDay.doSharding(availableTablesForDayDataSources, shardingValueAsString).size(), is(expectSize));
}
@@ -329,7 +329,7 @@ class IntervalShardingAlgorithmTest {
new Property("sharding-suffix-pattern", shardingSuffixPattern),
new Property("datetime-interval-amount", Integer.toString(datetimeIntervalAmount)));
if (null != datetimeIntervalUnit) {
- props.put("datetime-interval-unit", datetimeIntervalUnit);
+ props.setProperty("datetime-interval-unit", datetimeIntervalUnit);
}
return (IntervalShardingAlgorithm) TypedSPILoader.getService(ShardingAlgorithm.class, "INTERVAL", props);
}
diff --git a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/datetime/DateTimeFormatterFactory.java b/infra/util/src/main/java/org/apache/shardingsphere/infra/util/datetime/DateTimeFormatterFactory.java
index 5aff0522102..13b1cd2a046 100644
--- a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/datetime/DateTimeFormatterFactory.java
+++ b/infra/util/src/main/java/org/apache/shardingsphere/infra/util/datetime/DateTimeFormatterFactory.java
@@ -28,29 +28,29 @@ import java.time.format.DateTimeFormatter;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class DateTimeFormatterFactory {
- private static final DateTimeFormatter STANDARD = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+ private static final DateTimeFormatter DATETIME = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
private static final DateTimeFormatter DATE = DateTimeFormatter.ofPattern("yyyy-MM-dd");
private static final DateTimeFormatter TIME = DateTimeFormatter.ofPattern("HH:mm:ss");
- private static final DateTimeFormatter FULL_TIME = DateTimeFormatter.ofPattern("HH:mm:ss.SSSSSS");
+ private static final DateTimeFormatter SHORT_MILLIS_DATETIME = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.S");
- private static final DateTimeFormatter SHORT_MILLIS = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.S");
+ private static final DateTimeFormatter DOUBLE_MILLIS_DATETIME = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SS");
- private static final DateTimeFormatter DOUBLE_MILLIS = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SS");
+ private static final DateTimeFormatter LONG_MILLIS_DATETIME = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
- private static final DateTimeFormatter LONG_MILLIS = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
+ private static final DateTimeFormatter FULL_MILLIS_DATETIME = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS");
- private static final DateTimeFormatter FULL_MILLIS = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS");
+ private static final DateTimeFormatter FULL_MILLIS_TIME = DateTimeFormatter.ofPattern("HH:mm:ss.SSSSSS");
/**
- * Get standard date time formatter.
+ * Get datetime formatter.
*
- * @return standard date time formatter
+ * @return datetime formatter
*/
- public static DateTimeFormatter getStandardFormatter() {
- return STANDARD;
+ public static DateTimeFormatter getDatetimeFormatter() {
+ return DATETIME;
}
/**
@@ -72,47 +72,47 @@ public final class DateTimeFormatterFactory {
}
/**
- * Get full time formatter.
+ * Get short millis datetime formatter.
*
- * @return full time formatter
+ * @return short millis datetime formatter
*/
- public static DateTimeFormatter getFullTimeFormatter() {
- return FULL_TIME;
+ public static DateTimeFormatter getShortMillisDatetimeFormatter() {
+ return SHORT_MILLIS_DATETIME;
}
/**
- * Get short millis date time formatter.
+ * Get double millis datetime formatter.
*
- * @return short millis date time formatter
+ * @return double millis formatter
*/
- public static DateTimeFormatter getShortMillisFormatter() {
- return SHORT_MILLIS;
+ public static DateTimeFormatter getDoubleMillisDatetimeFormatter() {
+ return DOUBLE_MILLIS_DATETIME;
}
/**
- * Get double millis date time formatter.
+ * Get long millis datetime formatter.
*
- * @return double millis date time formatter
+ * @return long millis date time formatter
*/
- public static DateTimeFormatter getDoubleMillisFormatter() {
- return DOUBLE_MILLIS;
+ public static DateTimeFormatter getLongMillisDatetimeFormatter() {
+ return LONG_MILLIS_DATETIME;
}
/**
- * Get long millis date time formatter.
+ * Get full millis datetime formatter.
*
- * @return long millis date time formatter
+ * @return full millis datetime formatter
*/
- public static DateTimeFormatter getLongMillisFormatter() {
- return LONG_MILLIS;
+ public static DateTimeFormatter getFullMillisDatetimeFormatter() {
+ return FULL_MILLIS_DATETIME;
}
/**
- * Get full millis date time formatter.
+ * Get full time formatter.
*
- * @return full millis date time formatter
+ * @return full time formatter
*/
- public static DateTimeFormatter getFullMillisFormatter() {
- return FULL_MILLIS;
+ public static DateTimeFormatter getFullTimeFormatter() {
+ return FULL_MILLIS_TIME;
}
}
diff --git a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/datetime/DateTimeFormatterFactoryTest.java b/infra/util/src/test/java/org/apache/shardingsphere/infra/util/datetime/DateTimeFormatterFactoryTest.java
index 86cc9ef86eb..dfd69ed5858 100644
--- a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/datetime/DateTimeFormatterFactoryTest.java
+++ b/infra/util/src/test/java/org/apache/shardingsphere/infra/util/datetime/DateTimeFormatterFactoryTest.java
@@ -25,8 +25,8 @@ import static org.hamcrest.MatcherAssert.assertThat;
class DateTimeFormatterFactoryTest {
@Test
- void assertGetStandardFormatter() {
- assertThat(DateTimeFormatterFactory.getStandardFormatter().parse("1970-01-01 00:00:00").toString(), is("{},ISO resolved to 1970-01-01T00:00"));
+ void assertGetDatetimeFormatter() {
+ assertThat(DateTimeFormatterFactory.getDatetimeFormatter().parse("1970-01-01 00:00:00").toString(), is("{},ISO resolved to 1970-01-01T00:00"));
}
@Test
@@ -40,27 +40,27 @@ class DateTimeFormatterFactoryTest {
}
@Test
- void assertGetFullTimeFormatter() {
- assertThat(DateTimeFormatterFactory.getFullTimeFormatter().parse("00:00:00.000001").toString(), is("{},ISO resolved to 00:00:00.000001"));
+ void assertGetShortMillisDatetimeFormatter() {
+ assertThat(DateTimeFormatterFactory.getShortMillisDatetimeFormatter().parse("1970-01-01 00:00:00.0").toString(), is("{},ISO resolved to 1970-01-01T00:00"));
}
@Test
- void assertGetShortMillisFormatter() {
- assertThat(DateTimeFormatterFactory.getShortMillisFormatter().parse("1970-01-01 00:00:00.0").toString(), is("{},ISO resolved to 1970-01-01T00:00"));
+ void assertGetDoubleMillisDatetimeFormatter() {
+ assertThat(DateTimeFormatterFactory.getDoubleMillisDatetimeFormatter().parse("1970-01-01 00:00:00.01").toString(), is("{},ISO resolved to 1970-01-01T00:00:00.010"));
}
@Test
- void assertGetDoubleMillisFormatter() {
- assertThat(DateTimeFormatterFactory.getDoubleMillisFormatter().parse("1970-01-01 00:00:00.01").toString(), is("{},ISO resolved to 1970-01-01T00:00:00.010"));
+ void assertGetLongMillisDatetimeFormatter() {
+ assertThat(DateTimeFormatterFactory.getLongMillisDatetimeFormatter().parse("1970-01-01 00:00:00.000").toString(), is("{},ISO resolved to 1970-01-01T00:00"));
}
@Test
- void assertGetLongMillisFormatter() {
- assertThat(DateTimeFormatterFactory.getLongMillisFormatter().parse("1970-01-01 00:00:00.000").toString(), is("{},ISO resolved to 1970-01-01T00:00"));
+ void assertGetFullMillisDatetimeFormatter() {
+ assertThat(DateTimeFormatterFactory.getFullMillisDatetimeFormatter().parse("1970-01-01 00:00:00.000001").toString(), is("{},ISO resolved to 1970-01-01T00:00:00.000001"));
}
@Test
- void assertGetFullMillisFormatter() {
- assertThat(DateTimeFormatterFactory.getFullMillisFormatter().parse("1970-01-01 00:00:00.000001").toString(), is("{},ISO resolved to 1970-01-01T00:00:00.000001"));
+ void assertGetFullTimeFormatter() {
+ assertThat(DateTimeFormatterFactory.getFullTimeFormatter().parse("00:00:00.000001").toString(), is("{},ISO resolved to 00:00:00.000001"));
}
}
diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/execute/AbstractPipelineLifecycleRunnable.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/execute/AbstractPipelineLifecycleRunnable.java
index b3dbb6c983e..7985848e5da 100644
--- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/execute/AbstractPipelineLifecycleRunnable.java
+++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/execute/AbstractPipelineLifecycleRunnable.java
@@ -63,7 +63,7 @@ public abstract class AbstractPipelineLifecycleRunnable implements PipelineLifec
return;
}
LocalDateTime startTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(startTimeMillis), ZoneId.systemDefault());
- log.info("stop lifecycle executor {}, startTime={}, cost {} ms", this, startTime.format(DateTimeFormatterFactory.getStandardFormatter()), System.currentTimeMillis() - startTimeMillis);
+ log.info("stop lifecycle executor {}, startTime={}, cost {} ms", this, startTime.format(DateTimeFormatterFactory.getDatetimeFormatter()), System.currentTimeMillis() - startTimeMillis);
try {
doStop();
// CHECKSTYLE:OFF
diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/service/PipelineJobConfigurationManager.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/service/PipelineJobConfigurationManager.java
index a8b6a3c822d..e7963d54b4f 100644
--- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/service/PipelineJobConfigurationManager.java
+++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/service/PipelineJobConfigurationManager.java
@@ -20,9 +20,9 @@ package org.apache.shardingsphere.data.pipeline.core.job.service;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.data.pipeline.core.execute.ShardingTotalCountUsageJobExecutorServiceHandler;
import org.apache.shardingsphere.data.pipeline.core.job.config.PipelineJobConfiguration;
+import org.apache.shardingsphere.data.pipeline.core.job.id.PipelineJobIdUtils;
import org.apache.shardingsphere.data.pipeline.core.job.type.PipelineJobType;
import org.apache.shardingsphere.data.pipeline.core.listener.PipelineElasticJobListener;
-import org.apache.shardingsphere.data.pipeline.core.job.id.PipelineJobIdUtils;
import org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO;
import org.apache.shardingsphere.infra.util.datetime.DateTimeFormatterFactory;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
@@ -61,7 +61,7 @@ public final class PipelineJobConfigurationManager {
result.setJobName(jobConfig.getJobId());
result.setShardingTotalCount(jobType.isForceNoShardingWhenConvertToJobConfigurationPOJO() ? 1 : jobConfig.getJobShardingCount());
result.setJobParameter(YamlEngine.marshal(jobType.getYamlJobConfigurationSwapper().swapToYamlConfiguration(jobConfig)));
- String createTimeFormat = LocalDateTime.now().format(DateTimeFormatterFactory.getStandardFormatter());
+ String createTimeFormat = LocalDateTime.now().format(DateTimeFormatterFactory.getDatetimeFormatter());
result.getProps().setProperty("create_time", createTimeFormat);
result.getProps().setProperty("start_time_millis", String.valueOf(System.currentTimeMillis()));
result.getProps().setProperty("run_count", "1");
diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/service/PipelineJobManager.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/service/PipelineJobManager.java
index b24ce504f9e..9633d062526 100644
--- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/service/PipelineJobManager.java
+++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/service/PipelineJobManager.java
@@ -142,7 +142,7 @@ public final class PipelineJobManager {
pipelineDistributedBarrier.unregister(PipelineMetaDataNode.getJobBarrierEnablePath(jobId));
JobConfigurationPOJO jobConfigPOJO = PipelineJobIdUtils.getElasticJobConfigurationPOJO(jobId);
jobConfigPOJO.setDisabled(true);
- jobConfigPOJO.getProps().setProperty("stop_time", LocalDateTime.now().format(DateTimeFormatterFactory.getStandardFormatter()));
+ jobConfigPOJO.getProps().setProperty("stop_time", LocalDateTime.now().format(DateTimeFormatterFactory.getDatetimeFormatter()));
String barrierPath = PipelineMetaDataNode.getJobBarrierDisablePath(jobId);
pipelineDistributedBarrier.register(barrierPath, jobConfigPOJO.getShardingTotalCount());
PipelineAPIFactory.getJobConfigurationAPI(PipelineJobIdUtils.parseContextKey(jobId)).updateJobConfiguration(jobConfigPOJO);
diff --git a/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/api/CDCJobAPI.java b/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/api/CDCJobAPI.java
index 7802cb14fbb..fe49f869bf0 100644
--- a/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/api/CDCJobAPI.java
+++ b/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/api/CDCJobAPI.java
@@ -249,7 +249,7 @@ public final class CDCJobAPI implements TransmissionJobAPI {
public void disable(final String jobId) {
JobConfigurationPOJO jobConfigPOJO = PipelineJobIdUtils.getElasticJobConfigurationPOJO(jobId);
jobConfigPOJO.setDisabled(true);
- jobConfigPOJO.getProps().setProperty("stop_time", LocalDateTime.now().format(DateTimeFormatterFactory.getStandardFormatter()));
+ jobConfigPOJO.getProps().setProperty("stop_time", LocalDateTime.now().format(DateTimeFormatterFactory.getDatetimeFormatter()));
PipelineAPIFactory.getJobConfigurationAPI(PipelineJobIdUtils.parseContextKey(jobConfigPOJO.getJobName())).updateJobConfiguration(jobConfigPOJO);
}
diff --git a/kernel/data-pipeline/scenario/consistency-check/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/api/ConsistencyCheckJobAPI.java b/kernel/data-pipeline/scenario/consistency-check/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/api/ConsistencyCheckJobAPI.java
index 33a3837cc33..082d8d31767 100644
--- a/kernel/data-pipeline/scenario/consistency-check/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/api/ConsistencyCheckJobAPI.java
+++ b/kernel/data-pipeline/scenario/consistency-check/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/api/ConsistencyCheckJobAPI.java
@@ -198,17 +198,17 @@ public final class ConsistencyCheckJobAPI {
long recordsCount = jobItemProgress.getRecordsCount();
long checkedRecordsCount = Math.min(jobItemProgress.getCheckedRecordsCount(), recordsCount);
LocalDateTime checkBeginTime = new Timestamp(jobItemProgress.getCheckBeginTimeMillis()).toLocalDateTime();
- result.setCheckBeginTime(DateTimeFormatterFactory.getLongMillisFormatter().format(checkBeginTime));
+ result.setCheckBeginTime(DateTimeFormatterFactory.getLongMillisDatetimeFormatter().format(checkBeginTime));
if (JobStatus.FINISHED == jobItemProgress.getStatus()) {
result.setInventoryFinishedPercentage(100);
LocalDateTime checkEndTime = new Timestamp(jobItemProgress.getCheckEndTimeMillis()).toLocalDateTime();
Duration duration = Duration.between(checkBeginTime, checkEndTime);
result.setDurationSeconds(duration.getSeconds());
- result.setCheckEndTime(DateTimeFormatterFactory.getLongMillisFormatter().format(checkEndTime));
+ result.setCheckEndTime(DateTimeFormatterFactory.getLongMillisDatetimeFormatter().format(checkEndTime));
result.setInventoryRemainingSeconds(0L);
} else if (0L != recordsCount && 0L != checkedRecordsCount) {
result.setInventoryFinishedPercentage((int) (checkedRecordsCount * 100L / recordsCount));
- LocalDateTime stopTime = jobConfigPOJO.isDisabled() ? LocalDateTime.from(DateTimeFormatterFactory.getStandardFormatter().parse(jobConfigPOJO.getProps().getProperty("stop_time")))
+ LocalDateTime stopTime = jobConfigPOJO.isDisabled() ? LocalDateTime.from(DateTimeFormatterFactory.getDatetimeFormatter().parse(jobConfigPOJO.getProps().getProperty("stop_time")))
: null;
long durationMillis = (null != stopTime ? Timestamp.valueOf(stopTime).getTime() : System.currentTimeMillis()) - jobItemProgress.getCheckBeginTimeMillis();
result.setDurationSeconds(TimeUnit.MILLISECONDS.toSeconds(durationMillis));
diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/value/SQLValue.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/value/SQLValue.java
index 796abcbb38f..6cb2eb925c5 100644
--- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/value/SQLValue.java
+++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/value/SQLValue.java
@@ -101,12 +101,12 @@ public final class SQLValue {
return Date.valueOf(LocalDate.parse(value, DateTimeFormatterFactory.getDateFormatter()));
case "datetime":
if (26 == value.length()) {
- return Date.valueOf(LocalDate.parse(value, DateTimeFormatterFactory.getFullMillisFormatter()));
+ return Date.valueOf(LocalDate.parse(value, DateTimeFormatterFactory.getFullMillisDatetimeFormatter()));
}
if (10 == value.length()) {
return Date.valueOf(LocalDate.parse(value, DateTimeFormatterFactory.getDateFormatter()));
}
- return Date.valueOf(LocalDate.parse(value, DateTimeFormatterFactory.getStandardFormatter()));
+ return Date.valueOf(LocalDate.parse(value, DateTimeFormatterFactory.getDatetimeFormatter()));
case "time":
if (value.length() > 8) {
return Time.valueOf(LocalTime.parse(value, DateTimeFormatterFactory.getFullTimeFormatter()));
@@ -114,21 +114,21 @@ public final class SQLValue {
return Time.valueOf(LocalTime.parse(value, DateTimeFormatterFactory.getTimeFormatter()));
case "timestamp":
if (26 == value.length()) {
- return Timestamp.valueOf(LocalDateTime.parse(value, DateTimeFormatterFactory.getFullMillisFormatter()));
+ return Timestamp.valueOf(LocalDateTime.parse(value, DateTimeFormatterFactory.getFullMillisDatetimeFormatter()));
}
if (19 == value.length()) {
- return Timestamp.valueOf(LocalDateTime.parse(value, DateTimeFormatterFactory.getStandardFormatter()));
+ return Timestamp.valueOf(LocalDateTime.parse(value, DateTimeFormatterFactory.getDatetimeFormatter()));
}
if (21 == value.length()) {
- return Timestamp.valueOf(LocalDateTime.parse(value, DateTimeFormatterFactory.getShortMillisFormatter()));
+ return Timestamp.valueOf(LocalDateTime.parse(value, DateTimeFormatterFactory.getShortMillisDatetimeFormatter()));
}
if (22 == value.length()) {
- return Timestamp.valueOf(LocalDateTime.parse(value, DateTimeFormatterFactory.getDoubleMillisFormatter()));
+ return Timestamp.valueOf(LocalDateTime.parse(value, DateTimeFormatterFactory.getDoubleMillisDatetimeFormatter()));
}
if (23 == value.length()) {
- return Timestamp.valueOf(LocalDateTime.parse(value, DateTimeFormatterFactory.getLongMillisFormatter()));
+ return Timestamp.valueOf(LocalDateTime.parse(value, DateTimeFormatterFactory.getLongMillisDatetimeFormatter()));
}
- return Timestamp.valueOf(LocalDateTime.parse(value, DateTimeFormatterFactory.getStandardFormatter()));
+ return Timestamp.valueOf(LocalDateTime.parse(value, DateTimeFormatterFactory.getDatetimeFormatter()));
case "tinyblob":
case "blob":
case "longblob":
@@ -160,7 +160,7 @@ public final class SQLValue {
return formatString(DateTimeFormatterFactory.getTimeFormatter().format(((Time) value).toLocalTime()));
}
if (value instanceof Timestamp) {
- return formatString(DateTimeFormatterFactory.getLongMillisFormatter().format(((Timestamp) value).toLocalDateTime()));
+ return formatString(DateTimeFormatterFactory.getLongMillisDatetimeFormatter().format(((Timestamp) value).toLocalDateTime()));
}
if (value instanceof byte[]) {
return formatString(new String((byte[]) value, StandardCharsets.UTF_8));
diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/it/sql/dml/BaseDMLE2EIT.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/it/sql/dml/BaseDMLE2EIT.java
index bc415c6cc0a..37948304932 100644
--- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/it/sql/dml/BaseDMLE2EIT.java
+++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/it/sql/dml/BaseDMLE2EIT.java
@@ -308,7 +308,7 @@ public abstract class BaseDMLE2EIT implements SQLE2EIT {
assertNull(actual.getTimestamp(columnIndex));
return;
}
- assertThat(DateTimeFormatterFactory.getShortMillisFormatter().format(actual.getTimestamp(columnIndex).toLocalDateTime()), is(expected));
+ assertThat(DateTimeFormatterFactory.getShortMillisDatetimeFormatter().format(actual.getTimestamp(columnIndex).toLocalDateTime()), is(expected));
}
private boolean isNullValue(final String value) {
diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/it/sql/dql/BaseDQLE2EIT.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/it/sql/dql/BaseDQLE2EIT.java
index 31f7b653624..bfc8c4f49e1 100644
--- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/it/sql/dql/BaseDQLE2EIT.java
+++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/it/sql/dql/BaseDQLE2EIT.java
@@ -187,10 +187,10 @@ public abstract class BaseDQLE2EIT implements SQLE2EIT {
assertThat(((Timestamp) actualValue).toLocalDateTime(), is(expectedValue));
} else if (Types.TIMESTAMP == actualMetaData.getColumnType(i + 1) || Types.TIMESTAMP == expectedMetaData.getColumnType(i + 1)) {
Object convertedActualValue = Types.TIMESTAMP == actualMetaData.getColumnType(i + 1)
- ? actualResultSet.getTimestamp(i + 1).toLocalDateTime().format(DateTimeFormatterFactory.getStandardFormatter())
+ ? actualResultSet.getTimestamp(i + 1).toLocalDateTime().format(DateTimeFormatterFactory.getDatetimeFormatter())
: actualValue;
Object convertedExpectedValue = Types.TIMESTAMP == expectedMetaData.getColumnType(i + 1)
- ? expectedResultSet.getTimestamp(i + 1).toLocalDateTime().format(DateTimeFormatterFactory.getStandardFormatter())
+ ? expectedResultSet.getTimestamp(i + 1).toLocalDateTime().format(DateTimeFormatterFactory.getDatetimeFormatter())
: actualValue;
assertThat(String.valueOf(convertedActualValue), is(String.valueOf(convertedExpectedValue)));
} else if (expectedValue instanceof Clob) {