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 @@ -87,6 +87,7 @@ public class TestCassandraConnector
new CassandraSessionProperties(new CassandraClientConfig()).getSessionProperties(),
ImmutableMap.of(),
true,
Optional.empty(),
Optional.empty());
protected String database;
protected SchemaTableName table;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,12 @@ public <T> T getProperty(String name, Class<T> type)

return session.getProperty(name, type);
}

@Override
public Optional<String> getSchema()
{
return Optional.empty();
}
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ public <T> T getProperty(String propertyName, Class<T> type)
return sessionPropertyManager.decodeCatalogPropertyValue(connectorId, catalog, propertyName, properties.get(propertyName), type);
}

@Override
public Optional<String> getSchema()
{
return session.getSchema();
}

@Override
public String toString()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@ public class TestingConnectorSession
private final Map<String, Object> propertyValues;
private final Optional<String> clientInfo;
private final SqlFunctionProperties sqlFunctionProperties;
private final Optional<String> schema;

public TestingConnectorSession(List<PropertyMetadata<?>> properties)
{
this("user", Optional.of("test"), Optional.empty(), UTC_KEY, ENGLISH, System.currentTimeMillis(), properties, ImmutableMap.of(), new FeaturesConfig().isLegacyTimestamp(), Optional.empty());
this("user", Optional.of("test"), Optional.empty(), UTC_KEY, ENGLISH, System.currentTimeMillis(), properties, ImmutableMap.of(), new FeaturesConfig().isLegacyTimestamp(), Optional.empty(), Optional.empty());
}

public TestingConnectorSession(List<PropertyMetadata<?>> properties, Optional<String> schema)
{
this("user", Optional.of("test"), Optional.empty(), UTC_KEY, ENGLISH, System.currentTimeMillis(), properties, ImmutableMap.of(), new FeaturesConfig().isLegacyTimestamp(), Optional.empty(), schema);
}

public TestingConnectorSession(
Expand All @@ -68,7 +74,8 @@ public TestingConnectorSession(
List<PropertyMetadata<?>> propertyMetadatas,
Map<String, Object> propertyValues,
boolean isLegacyTimestamp,
Optional<String> clientInfo)
Optional<String> clientInfo,
Optional<String> schema)
{
this.queryId = queryIdGenerator.createNextQueryId().toString();
this.identity = new ConnectorIdentity(requireNonNull(user, "user is null"), Optional.empty(), Optional.empty());
Expand All @@ -86,6 +93,7 @@ public TestingConnectorSession(
.setSessionLocale(locale)
.setSessionUser(user)
.build();
this.schema = requireNonNull(schema, "schema is null");
}

@Override
Expand Down Expand Up @@ -150,6 +158,12 @@ public <T> T getProperty(String name, Class<T> type)
return type.cast(metadata.decode(value));
}

@Override
public Optional<String> getSchema()
{
return schema;
}

@Override
public String toString()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,19 @@ public void testCurrentDateTimezone()
private void assertCurrentDateAtInstant(TimeZoneKey timeZoneKey, long instant)
{
long expectedDays = epochDaysInZone(timeZoneKey, instant);
long dateTimeCalculation = currentDate(new TestingConnectorSession("test", Optional.empty(), Optional.empty(), timeZoneKey, US, instant, ImmutableList.of(), ImmutableMap.of(), isLegacyTimestamp(session), Optional.empty()).getSqlFunctionProperties());
long dateTimeCalculation = currentDate(
new TestingConnectorSession(
"test",
Optional.empty(),
Optional.empty(),
timeZoneKey,
US,
instant,
ImmutableList.of(),
ImmutableMap.of(),
isLegacyTimestamp(session),
Optional.empty(),
Optional.empty()).getSqlFunctionProperties());
assertEquals(dateTimeCalculation, expectedDays);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ public static ConnectorSession createSessionWithNumSplits(int numSegmentsPerSpli
PinotSessionProperties.FORBID_SEGMENT_QUERIES,
forbidSegmentQueries),
new FeaturesConfig().isLegacyTimestamp(),
Optional.empty(),
Optional.empty());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ private void assertSplitShard(Type temporalType, String min, String max, String
new RaptorSessionProperties(new StorageManagerConfig()).getSessionProperties(),
ImmutableMap.of(),
true,
Optional.empty(),
Optional.empty());

ConnectorTransactionHandle transaction = connector.beginTransaction(READ_COMMITTED, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ default String getUser()
SqlFunctionProperties getSqlFunctionProperties();

<T> T getProperty(String name, Class<T> type);

Optional<String> getSchema();
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ public <T> T getProperty(String name, Class<T> type)
{
throw new PrestoException(INVALID_SESSION_PROPERTY, "Unknown session property " + name);
}

@Override
public Optional<String> getSchema()
{
return Optional.empty();
}
};

private TestingSession() {}
Expand Down