You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2024/07/09 11:00:50 UTC
(doris) branch master updated: [fix](trino-connector) Fix the problem of reading the `DATE` type from Trino too slowly (#37266)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 6100f91f32e [fix](trino-connector) Fix the problem of reading the `DATE` type from Trino too slowly (#37266)
6100f91f32e is described below
commit 6100f91f32ee22d56932675122aaf2a05e570e54
Author: Tiewei Fang <43...@users.noreply.github.com>
AuthorDate: Tue Jul 9 19:00:44 2024 +0800
[fix](trino-connector) Fix the problem of reading the `DATE` type from Trino too slowly (#37266)
Previously, we use
`LocalDate.parse(DateTimeUtils.printDate(block.getInt(position, 0)),
DateTimeFormatter.ISO_DATE)` to handle DATE type from Trino.
Now, we use `LocalDate.ofEpochDay(block.getInt(position, 0))` to handle
DATE type from Trino.
This will result in a 20-fold speed improvement.
---
.../org/apache/doris/trinoconnector/TrinoConnectorColumnValue.java | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/fe/be-java-extensions/trino-connector-scanner/src/main/java/org/apache/doris/trinoconnector/TrinoConnectorColumnValue.java b/fe/be-java-extensions/trino-connector-scanner/src/main/java/org/apache/doris/trinoconnector/TrinoConnectorColumnValue.java
index c38e14ea553..35a2308ea00 100644
--- a/fe/be-java-extensions/trino-connector-scanner/src/main/java/org/apache/doris/trinoconnector/TrinoConnectorColumnValue.java
+++ b/fe/be-java-extensions/trino-connector-scanner/src/main/java/org/apache/doris/trinoconnector/TrinoConnectorColumnValue.java
@@ -36,7 +36,6 @@ import io.trino.spi.type.SqlTimestamp;
import io.trino.spi.type.SqlTimestampWithTimeZone;
import io.trino.spi.type.TimeType;
import io.trino.spi.type.Type;
-import io.trino.util.DateTimeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,7 +43,6 @@ import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
import java.util.List;
public class TrinoConnectorColumnValue implements ColumnValue {
@@ -155,7 +153,7 @@ public class TrinoConnectorColumnValue implements ColumnValue {
// block is IntArrayBlock
@Override
public LocalDate getDate() {
- return LocalDate.parse(DateTimeUtils.printDate(block.getInt(position, 0)), DateTimeFormatter.ISO_DATE);
+ return LocalDate.ofEpochDay(block.getInt(position, 0));
}
// block is LongArrayBlock
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org