Skip to content

Commit

Permalink
fix the convertion of local timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
hffariel committed Oct 21, 2021
1 parent 5f26e90 commit 979ce73
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ limitations under the License.
<modelVersion>4.0.0</modelVersion>
<groupId>com.starrocks</groupId>
<artifactId>flink-connector-starrocks</artifactId>
<version>1.1.9_flink-1.11</version>
<version>1.1.10_flink-1.11</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.table.api.TableSchema;
import org.apache.flink.table.data.RowData;
import org.apache.flink.table.data.TimestampData;
import org.apache.flink.table.types.DataType;
import org.apache.flink.table.types.logical.DecimalType;
import org.apache.flink.table.types.logical.LogicalType;
Expand Down Expand Up @@ -98,12 +97,7 @@ private Object typeConvertion(LogicalType type, RowData record, int pos) {
case TIMESTAMP_WITHOUT_TIME_ZONE:
case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
final int timestampPrecision =((TimestampType) type).getPrecision();
final TimestampData ts = record.getTimestamp(pos, timestampPrecision);
final String msDt = dateTimeFormatterMs.format(ts.getMillisecond());
if (0 == ts.getNanoOfMillisecond() || timestampPrecision <= 3) {
return msDt;
}
return String.format("%s%03d", msDt, Math.floorDiv(ts.getNanoOfMillisecond(), 1000));
return record.getTimestamp(pos, timestampPrecision).toLocalDateTime().toString();
case DECIMAL: // for both largeint and decimal
final int decimalPrecision = ((DecimalType) type).getPrecision();
final int decimalScale = ((DecimalType) type).getScale();
Expand Down

0 comments on commit 979ce73

Please sign in to comment.