-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support DECIMAL and remove DOUBLE in TPCH Connector #11166
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,17 @@ | |
<parent> | ||
<groupId>io.airlift</groupId> | ||
<artifactId>airbase</artifactId> | ||
<version>80</version> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it looks like you depends on other PR which is in progress, it should be a separate commit (cherry-picked) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please see: It is hard for me to locally separate out this commit, and my local testing needs these changes. Hence I raised this as part of the PR, will revert before merging. Please ignore any changes to this file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please see: It is hard for me to locally separate out this commit, and my local testing needs these changes. Hence I raised this as part of the PR, will revert before merging. Please ignore any changes to this file |
||
<version>82</version> | ||
</parent> | ||
|
||
<repositories> | ||
<repository> | ||
<id>atri-local</id> | ||
<name>Local AirLift Repo</name> | ||
<url>/Users/atrisharma/tpch/target</url> | ||
</repository> | ||
</repositories> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
<groupId>com.facebook.presto</groupId> | ||
<artifactId>presto-root</artifactId> | ||
<version>0.204-SNAPSHOT</version> | ||
|
@@ -122,6 +130,11 @@ | |
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.airlift.tpch</groupId> | ||
<artifactId>tpch</artifactId> | ||
<version>0.10-SNAPSHOT</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.facebook.presto</groupId> | ||
<artifactId>presto-spi</artifactId> | ||
|
@@ -598,12 +611,6 @@ | |
<version>${dep.drift.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.airlift.tpch</groupId> | ||
<artifactId>tpch</artifactId> | ||
<version>0.9</version> | ||
</dependency> | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do not move There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
<dependency> | ||
<groupId>com.teradata.tpcds</groupId> | ||
<artifactId>tpcds</artifactId> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ public abstract class DecimalType | |
{ | ||
public static final int DEFAULT_SCALE = 0; | ||
public static final int DEFAULT_PRECISION = MAX_PRECISION; | ||
public static final DecimalType DECIMAL = createDecimalType(12, 2); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please undo There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Types usually have a static created type (e.g. DOUBLE etc), hence I created one for DECIMAL. I will use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was following the usual pattern of types having a static instance which can be returned. I will use |
||
|
||
public static DecimalType createDecimalType(int precision, int scale) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,7 @@ | |
|
||
import static com.facebook.presto.spi.type.BigintType.BIGINT; | ||
import static com.facebook.presto.spi.type.DateType.DATE; | ||
import static com.facebook.presto.spi.type.DecimalType.DECIMAL; | ||
import static com.facebook.presto.spi.type.DoubleType.DOUBLE; | ||
import static com.facebook.presto.spi.type.IntegerType.INTEGER; | ||
import static com.facebook.presto.spi.type.VarcharType.createVarcharType; | ||
|
@@ -386,7 +387,10 @@ private Object toPrestoValue(Object tpchValue, Type columnType) | |
if (columnType instanceof VarcharType) { | ||
return Slices.utf8Slice((String) tpchValue); | ||
} | ||
if (columnType.equals(BIGINT) || columnType.equals(INTEGER) || columnType.equals(DATE)) { | ||
if (columnType.equals(BIGINT) | ||
|| columnType.equals(INTEGER) | ||
|| columnType.equals(DATE) | ||
|| columnType.equals(DECIMAL)) { | ||
return ((Number) tpchValue).longValue(); | ||
} | ||
if (columnType.equals(DOUBLE)) { | ||
|
@@ -487,8 +491,8 @@ public static Type getPrestoType(TpchColumn<?> column) | |
return INTEGER; | ||
case DATE: | ||
return DATE; | ||
case DOUBLE: | ||
return DOUBLE; | ||
case DECIMAL: | ||
return DECIMAL; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you should return DECIMAL(12,2), use com.facebook.presto.spi.type.DecimalType#createDecimalType(int, int) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ack |
||
case VARCHAR: | ||
return createVarcharType((int) (long) tpchType.getPrecision().get()); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,8 +72,8 @@ private <E extends TpchEntity> Comparable<?> getTpchValue(E row, TpchColumn<E> c | |
return column.getInteger(row); | ||
case DATE: | ||
return column.getDate(row); | ||
case DOUBLE: | ||
return column.getDouble(row); | ||
case DECIMAL: | ||
return column.getIdentifier(row); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did you mean There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
case VARCHAR: | ||
return column.getString(row); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes made to this file will be reverted prior to merging. Please ignore these changes