Skip to content

Commit

Permalink
update decimalType random
Browse files Browse the repository at this point in the history
  • Loading branch information
laglangyue committed Aug 15, 2022
1 parent 5934436 commit 1780fd3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.seatunnel.connectors.seatunnel.fake.source;

import java.time.LocalDateTime;
import org.apache.seatunnel.api.table.type.BasicType;
import org.apache.seatunnel.api.table.type.DecimalType;
import org.apache.seatunnel.api.table.type.LocalTimeType;
Expand All @@ -29,6 +28,7 @@
import org.apache.commons.lang3.RandomUtils;

import java.math.BigDecimal;
import java.time.LocalDateTime;

public class FakeData {

Expand Down Expand Up @@ -77,7 +77,7 @@ public static SeaTunnelRow generateRow() {
RandomUtils.nextFloat(Float.MIN_VALUE, Float.MAX_VALUE),
RandomUtils.nextDouble(Float.MAX_VALUE, Double.MAX_VALUE),
RandomStringUtils.randomAlphabetic(10),
BigDecimal.valueOf(RandomUtils.nextLong(Integer.MAX_VALUE,Long.MAX_VALUE),18),
BigDecimal.valueOf(RandomUtils.nextLong(Integer.MAX_VALUE, Long.MAX_VALUE), 18),
LocalDateTime.now(),
LocalDateTime.now().toLocalDate(),
LocalDateTime.now().toLocalTime(),
Expand All @@ -88,8 +88,4 @@ public static SeaTunnelRow generateRow() {
}
return new SeaTunnelRow(columnValue);
}

public static void main(String[] args) {
System.out.println(BigDecimal.valueOf(RandomUtils.nextDouble(0, Long.MAX_VALUE)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.seatunnel.translation.spark.common.serialization;

import java.math.BigDecimal;
import org.apache.seatunnel.api.table.type.MapType;
import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
import org.apache.seatunnel.api.table.type.SeaTunnelRow;
Expand All @@ -36,7 +35,6 @@
import org.apache.spark.sql.catalyst.expressions.MutableShort;
import org.apache.spark.sql.catalyst.expressions.MutableValue;
import org.apache.spark.sql.catalyst.expressions.SpecificInternalRow;
import org.apache.spark.sql.types.Decimal;
import org.apache.spark.unsafe.types.UTF8String;

import java.io.IOException;
Expand Down Expand Up @@ -83,8 +81,6 @@ private static Object convert(Object field, SeaTunnelDataType<?> dataType) {
return convertMap((Map<?, ?>) field, (MapType<?, ?>) dataType, InternalRowConverter::convert);
case STRING:
return UTF8String.fromString((String) field);
case DECIMAL:
return Decimal.apply((BigDecimal) field);
default:
return field;
}
Expand Down

0 comments on commit 1780fd3

Please sign in to comment.