use of io.prestosql.spi.session.SessionPropertyConfigurationManager in project hetu-core by openlookeng.
the class SessionPropertyDefaults method setConfigurationManager.
@VisibleForTesting
public void setConfigurationManager(String name, Map<String, String> properties) {
SessionPropertyConfigurationManagerFactory factory = factories.get(name);
checkState(factory != null, "Session property configuration manager %s is not registered", name);
SessionPropertyConfigurationManager manager = factory.create(properties, configurationManagerContext);
checkState(delegate.compareAndSet(null, manager), "sessionPropertyConfigurationManager is already set");
}
use of io.prestosql.spi.session.SessionPropertyConfigurationManager in project hetu-core by openlookeng.
the class TestFileSessionPropertyManager method assertProperties.
private static void assertProperties(Map<String, String> properties, SessionMatchSpec... spec) throws IOException {
try (TempFile tempFile = new TempFile()) {
Path configurationFile = tempFile.path();
Files.write(configurationFile, CODEC.toJsonBytes(Arrays.asList(spec)));
SessionPropertyConfigurationManager manager = new FileSessionPropertyManager(new FileSessionPropertyManagerConfig().setConfigFile(configurationFile.toFile()));
assertEquals(manager.getSystemSessionProperties(CONTEXT), properties);
}
}
use of io.prestosql.spi.session.SessionPropertyConfigurationManager in project hetu-core by openlookeng.
the class SessionPropertyDefaults method newSessionWithDefaultProperties.
public Session newSessionWithDefaultProperties(Session session, Optional<String> queryType, ResourceGroupId resourceGroupId) {
SessionPropertyConfigurationManager configurationManager = delegate.get();
if (configurationManager == null) {
return session;
}
SessionConfigurationContext context = new SessionConfigurationContext(session.getIdentity().getUser(), session.getSource(), session.getClientTags(), queryType, resourceGroupId);
Map<String, String> systemPropertyOverrides = configurationManager.getSystemSessionProperties(context);
Map<String, Map<String, String>> catalogPropertyOverrides = configurationManager.getCatalogSessionProperties(context);
return session.withDefaultProperties(systemPropertyOverrides, catalogPropertyOverrides);
}
Aggregations