Skip to content
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

Update Presto to Trino in base-jdbc #12446

Merged
merged 1 commit into from
May 19, 2022
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 @@ -22,74 +22,74 @@

public final class ColumnMapping
{
public static ColumnMapping booleanMapping(Type prestoType, BooleanReadFunction readFunction, BooleanWriteFunction writeFunction)
public static ColumnMapping booleanMapping(Type trinoType, BooleanReadFunction readFunction, BooleanWriteFunction writeFunction)
{
return booleanMapping(prestoType, readFunction, writeFunction, FULL_PUSHDOWN);
return booleanMapping(trinoType, readFunction, writeFunction, FULL_PUSHDOWN);
}

public static ColumnMapping booleanMapping(
Type prestoType,
Type trinoType,
BooleanReadFunction readFunction,
BooleanWriteFunction writeFunction,
PredicatePushdownController predicatePushdownController)
{
return new ColumnMapping(prestoType, readFunction, writeFunction, predicatePushdownController);
return new ColumnMapping(trinoType, readFunction, writeFunction, predicatePushdownController);
}

public static ColumnMapping longMapping(Type prestoType, LongReadFunction readFunction, LongWriteFunction writeFunction)
public static ColumnMapping longMapping(Type trinoType, LongReadFunction readFunction, LongWriteFunction writeFunction)
{
return longMapping(prestoType, readFunction, writeFunction, FULL_PUSHDOWN);
return longMapping(trinoType, readFunction, writeFunction, FULL_PUSHDOWN);
}

public static ColumnMapping longMapping(
Type prestoType,
Type trinoType,
LongReadFunction readFunction,
LongWriteFunction writeFunction,
PredicatePushdownController predicatePushdownController)
{
return new ColumnMapping(prestoType, readFunction, writeFunction, predicatePushdownController);
return new ColumnMapping(trinoType, readFunction, writeFunction, predicatePushdownController);
}

public static ColumnMapping doubleMapping(Type prestoType, DoubleReadFunction readFunction, DoubleWriteFunction writeFunction)
public static ColumnMapping doubleMapping(Type trinoType, DoubleReadFunction readFunction, DoubleWriteFunction writeFunction)
{
return doubleMapping(prestoType, readFunction, writeFunction, FULL_PUSHDOWN);
return doubleMapping(trinoType, readFunction, writeFunction, FULL_PUSHDOWN);
}

public static ColumnMapping doubleMapping(
Type prestoType,
Type trinoType,
DoubleReadFunction readFunction,
DoubleWriteFunction writeFunction,
PredicatePushdownController predicatePushdownController)
{
return new ColumnMapping(prestoType, readFunction, writeFunction, predicatePushdownController);
return new ColumnMapping(trinoType, readFunction, writeFunction, predicatePushdownController);
}

public static ColumnMapping sliceMapping(Type prestoType, SliceReadFunction readFunction, SliceWriteFunction writeFunction)
public static ColumnMapping sliceMapping(Type trinoType, SliceReadFunction readFunction, SliceWriteFunction writeFunction)
{
return sliceMapping(prestoType, readFunction, writeFunction, FULL_PUSHDOWN);
return sliceMapping(trinoType, readFunction, writeFunction, FULL_PUSHDOWN);
}

public static ColumnMapping sliceMapping(
Type prestoType,
Type trinoType,
SliceReadFunction readFunction,
SliceWriteFunction writeFunction,
PredicatePushdownController predicatePushdownController)
{
return new ColumnMapping(prestoType, readFunction, writeFunction, predicatePushdownController);
return new ColumnMapping(trinoType, readFunction, writeFunction, predicatePushdownController);
}

public static <T> ColumnMapping objectMapping(Type prestoType, ObjectReadFunction readFunction, ObjectWriteFunction writeFunction)
public static <T> ColumnMapping objectMapping(Type trinoType, ObjectReadFunction readFunction, ObjectWriteFunction writeFunction)
{
return objectMapping(prestoType, readFunction, writeFunction, FULL_PUSHDOWN);
return objectMapping(trinoType, readFunction, writeFunction, FULL_PUSHDOWN);
}

public static <T> ColumnMapping objectMapping(
Type prestoType,
Type trinoType,
ObjectReadFunction readFunction,
ObjectWriteFunction writeFunction,
PredicatePushdownController predicatePushdownController)
{
return new ColumnMapping(prestoType, readFunction, writeFunction, predicatePushdownController);
return new ColumnMapping(trinoType, readFunction, writeFunction, predicatePushdownController);
}

private final Type type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public final class JdbcClientStats
private final JdbcApiStats setTableProperties = new JdbcApiStats();
private final JdbcApiStats rollbackCreateTable = new JdbcApiStats();
private final JdbcApiStats schemaExists = new JdbcApiStats();
private final JdbcApiStats toPrestoType = new JdbcApiStats();
private final JdbcApiStats toTrinoType = new JdbcApiStats();
private final JdbcApiStats getColumnMappings = new JdbcApiStats();
private final JdbcApiStats toWriteMapping = new JdbcApiStats();
private final JdbcApiStats implementAggregation = new JdbcApiStats();
Expand Down Expand Up @@ -293,9 +293,9 @@ public JdbcApiStats getSchemaExists()

@Managed
@Nested
public JdbcApiStats getToPrestoType()
public JdbcApiStats getToTrinoType()
{
return toPrestoType;
return toTrinoType;
}

@Managed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public List<JdbcColumnHandle> getColumns(ConnectorSession session, JdbcTableHand
@Override
public Optional<ColumnMapping> toColumnMapping(ConnectorSession session, Connection connection, JdbcTypeHandle typeHandle)
{
return stats.getToPrestoType().wrap(() -> delegate().toColumnMapping(session, connection, typeHandle));
return stats.getToTrinoType().wrap(() -> delegate().toColumnMapping(session, connection, typeHandle));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,9 @@ public void testBuildSqlWithTimestamp()
TupleDomain<ColumnHandle> tupleDomain = TupleDomain.withColumnDomains(ImmutableMap.of(
columns.get(6), Domain.create(SortedRangeSet.copyOf(TIMESTAMP_MILLIS,
ImmutableList.of(
Range.equal(TIMESTAMP_MILLIS, toPrestoTimestamp(2016, 6, 3, 0, 23, 37)),
Range.equal(TIMESTAMP_MILLIS, toPrestoTimestamp(2016, 10, 19, 16, 23, 37)),
Range.range(TIMESTAMP_MILLIS, toPrestoTimestamp(2016, 6, 7, 8, 23, 37), false, toPrestoTimestamp(2016, 6, 9, 12, 23, 37), true))),
Range.equal(TIMESTAMP_MILLIS, toTrinoTimestamp(2016, 6, 3, 0, 23, 37)),
Range.equal(TIMESTAMP_MILLIS, toTrinoTimestamp(2016, 10, 19, 16, 23, 37)),
Range.range(TIMESTAMP_MILLIS, toTrinoTimestamp(2016, 6, 7, 8, 23, 37), false, toTrinoTimestamp(2016, 6, 9, 12, 23, 37), true))),
false)));

Connection connection = database.getConnection();
Expand Down Expand Up @@ -654,7 +654,7 @@ public void testAggregationWithFilter()
}
}

private static long toPrestoTimestamp(int year, int month, int day, int hour, int minute, int second)
private static long toTrinoTimestamp(int year, int month, int day, int hour, int minute, int second)
{
return sqlTimestampOf(3, year, month, day, hour, minute, second, 0).getMillis() * MICROSECONDS_PER_MILLISECOND;
}
Expand Down