Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@
import org.apache.paimon.data.InternalArray;
import org.apache.paimon.data.InternalMap;
import org.apache.paimon.data.InternalRow;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.List;

public class PaimonColumnValue implements ColumnValue {
private static final Logger LOG = LoggerFactory.getLogger(PaimonColumnValue.class);
private int idx;
private DataGetters record;
private ColumnType dorisType;
Expand Down Expand Up @@ -118,13 +119,12 @@ public byte[] getStringAsBytes() {

@Override
public LocalDate getDate() {
return LocalDate.ofEpochDay(record.getLong(idx));
return LocalDate.ofEpochDay(record.getInt(idx));
}

@Override
public LocalDateTime getDateTime() {
return Instant.ofEpochMilli(record.getTimestamp(idx, 3)
.getMillisecond()).atZone(ZoneOffset.ofHours(0)).toLocalDateTime();
return record.getTimestamp(idx, dorisType.getPrecision()).toLocalDateTime();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,16 @@ public PaimonColumnType visit(VarBinaryType varBinaryType) {

@Override
public PaimonColumnType visit(DecimalType decimalType) {
return new PaimonColumnType(Type.DECIMAL128, decimalType.getPrecision(), decimalType.getScale());
int precision = decimalType.getPrecision();
Type type;
if (precision <= ColumnType.MAX_DECIMAL32_PRECISION) {
type = Type.DECIMAL32;
} else if (precision <= ColumnType.MAX_DECIMAL64_PRECISION) {
type = Type.DECIMAL64;
} else {
type = Type.DECIMAL128;
}
return new PaimonColumnType(type, decimalType.getPrecision(), decimalType.getScale());
}

@Override
Expand Down
Loading