mirror of https://github.com/apache/druid.git
Revert "connection supplies properties approach"
This reverts commit 2700557a55
.
This commit is contained in:
parent
2700557a55
commit
69a39a42da
|
@ -160,14 +160,4 @@ public class MSQDruidMeta extends DruidMeta
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getEngineProperties()
|
||||
{
|
||||
return ImmutableMap.<String, String>builder()
|
||||
.putAll(super.getEngineProperties())
|
||||
.put("isMSQ", "true")
|
||||
.put("isNative", "false")
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
!set isNative false
|
||||
!set isMSQ true
|
||||
!set plannerStrategy DECOUPLED
|
||||
!if (isMSQ) {
|
||||
!use druidtest://?componentSupplier=DrillWindowQueryMSQComponentSupplier
|
||||
|
|
|
@ -933,9 +933,4 @@ public class DruidMeta extends MetaImpl
|
|||
{
|
||||
return Calcites.escapeStringLiteral(toEscape) + " ESCAPE '\\'";
|
||||
}
|
||||
|
||||
public Map<String, String> getEngineProperties()
|
||||
{
|
||||
return ImmutableMap.of("isNative", "true");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,16 +120,9 @@ public class DruidAvaticaTestDriver implements Driver
|
|||
|
||||
@Provides
|
||||
@LazySingleton
|
||||
public DruidConnectionExtras getConnectionExtras(
|
||||
ObjectMapper objectMapper,
|
||||
DruidHookDispatcher druidHookDispatcher,
|
||||
DruidMeta meta)
|
||||
public DruidConnectionExtras getConnectionExtras(ObjectMapper objectMapper, DruidHookDispatcher druidHookDispatcher)
|
||||
{
|
||||
return new DruidConnectionExtras.DruidConnectionExtrasImpl(
|
||||
objectMapper,
|
||||
druidHookDispatcher,
|
||||
meta.getEngineProperties()
|
||||
);
|
||||
return new DruidConnectionExtras.DruidConnectionExtrasImpl(objectMapper, druidHookDispatcher);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
@ -151,6 +144,7 @@ public class DruidAvaticaTestDriver implements Driver
|
|||
{
|
||||
closer.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static class AvaticaJettyServer implements Closeable
|
||||
|
|
|
@ -23,7 +23,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||
import org.apache.druid.sql.hook.DruidHookDispatcher;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.util.Map;
|
||||
|
||||
public interface DruidConnectionExtras
|
||||
{
|
||||
|
@ -31,21 +30,15 @@ public interface DruidConnectionExtras
|
|||
|
||||
DruidHookDispatcher getDruidHookDispatcher();
|
||||
|
||||
Map<String, String> getEngineProperties();
|
||||
|
||||
class DruidConnectionExtrasImpl implements DruidConnectionExtras
|
||||
{
|
||||
private final ObjectMapper objectMapper;
|
||||
private final DruidHookDispatcher druidHookDispatcher;
|
||||
private final Map<String, String> engineProperties;
|
||||
|
||||
public DruidConnectionExtrasImpl(ObjectMapper objectMapper,
|
||||
DruidHookDispatcher druidHookDispatcher,
|
||||
Map<String, String> engineProperties)
|
||||
public DruidConnectionExtrasImpl(ObjectMapper objectMapper, DruidHookDispatcher druidHookDispatcher)
|
||||
{
|
||||
this.objectMapper = objectMapper;
|
||||
this.druidHookDispatcher = druidHookDispatcher;
|
||||
this.engineProperties = engineProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,12 +52,6 @@ public interface DruidConnectionExtras
|
|||
{
|
||||
return druidHookDispatcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getEngineProperties()
|
||||
{
|
||||
return engineProperties;
|
||||
}
|
||||
}
|
||||
|
||||
static DruidConnectionExtras unwrapOrThrow(Connection connection)
|
||||
|
@ -74,5 +61,4 @@ public interface DruidConnectionExtras
|
|||
}
|
||||
throw new UnsupportedOperationException("Expected DruidConnectionExtras to be implemented by connection!");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,16 +21,13 @@ package org.apache.druid.quidem;
|
|||
|
||||
import net.hydromatic.quidem.Quidem.ConnectionFactory;
|
||||
import net.hydromatic.quidem.Quidem.PropertyHandler;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
public class DruidQuidemConnectionFactory implements ConnectionFactory, PropertyHandler
|
||||
{
|
||||
private Properties props = new Properties();
|
||||
private Map<String, String> engineProperties;
|
||||
|
||||
public DruidQuidemConnectionFactory()
|
||||
{
|
||||
|
@ -42,33 +39,14 @@ public class DruidQuidemConnectionFactory implements ConnectionFactory, Property
|
|||
public Connection connect(String name, boolean reference) throws Exception
|
||||
{
|
||||
if (name.startsWith("druidtest://")) {
|
||||
Connection connection = DriverManager.getConnection(name, props);
|
||||
engineProperties = unwrapEngineProperties(connection);
|
||||
return connection;
|
||||
return DriverManager.getConnection(name, props);
|
||||
}
|
||||
throw new RuntimeException("unknown connection '" + name + "'");
|
||||
}
|
||||
|
||||
private Map<String, String> unwrapEngineProperties(Connection connection)
|
||||
{
|
||||
if(connection instanceof DruidConnectionExtras) {
|
||||
DruidConnectionExtras extras = ((DruidConnectionExtras) connection);
|
||||
return extras.getEngineProperties();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSet(String key, Object value)
|
||||
{
|
||||
props.setProperty(key, value.toString());
|
||||
}
|
||||
|
||||
public Object getEnv(String env)
|
||||
{
|
||||
if (engineProperties == null) {
|
||||
return null;
|
||||
}
|
||||
return engineProperties.get(env);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue