!1357 Clean code according to the community rule
Merge pull request !1357 from zhousipei/localmaster
This commit is contained in:
commit
849e94b856
|
|
@ -58,8 +58,9 @@ public class BooleanStreamReader
|
|||
@Override
|
||||
public void putBytes(int rowId, int count, byte[] src, int srcIndex)
|
||||
{
|
||||
int srcIdx = srcIndex;
|
||||
for (int i = 0; i < count; i++) {
|
||||
type.writeBoolean(builder, src[srcIndex++] == 1);
|
||||
type.writeBoolean(builder, src[srcIdx++] == 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,8 +76,9 @@ public class DecimalSliceStreamReader
|
|||
@Override
|
||||
public void putDecimals(int rowId, int count, BigDecimal value, int precision)
|
||||
{
|
||||
int id = rowId;
|
||||
for (int i = 0; i < count; i++) {
|
||||
putDecimal(rowId++, value, precision);
|
||||
putDecimal(id++, value, precision);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,8 +58,9 @@ public class IntegerStreamReader
|
|||
@Override
|
||||
public void putInts(int rowId, int count, int value)
|
||||
{
|
||||
int id = rowId;
|
||||
for (int i = 0; i < count; i++) {
|
||||
putInt(rowId++, value);
|
||||
putInt(id++, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,11 +91,11 @@ public class HetuTestServer
|
|||
carbonProperties.putAll(properties);
|
||||
|
||||
logger.info("------------ Starting Presto Server -------------");
|
||||
DistributedQueryRunner queryRunner = createQueryRunner(hetuProperties);
|
||||
DistributedQueryRunner distributedQueryRunner = createQueryRunner(hetuProperties);
|
||||
Connection connection = createJdbcConnection(dbName);
|
||||
statement = (PrestoStatement) connection.createStatement();
|
||||
|
||||
logger.info("STARTED SERVER AT :" + queryRunner.getCoordinator().getBaseUrl());
|
||||
logger.info("STARTED SERVER AT :" + distributedQueryRunner.getCoordinator().getBaseUrl());
|
||||
}
|
||||
|
||||
public void stopServer() throws SQLException
|
||||
|
|
@ -192,7 +192,7 @@ public class HetuTestServer
|
|||
{
|
||||
try {
|
||||
queryRunner.installPlugin(new CarbondataPlugin());
|
||||
Map<String, String> carbonProperties = ImmutableMap.<String, String>builder()
|
||||
Map<String, String> carbonPropertiesMap = ImmutableMap.<String, String>builder()
|
||||
.putAll(this.carbonProperties)
|
||||
.put("carbon.unsafe.working.memory.in.mb", "512")
|
||||
.build();
|
||||
|
|
@ -203,7 +203,7 @@ public class HetuTestServer
|
|||
.build();
|
||||
|
||||
// CreateCatalog will create a catalog for CarbonData in etc/catalog.
|
||||
queryRunner.createCatalog(carbonDataCatalog, carbonDataConnector, carbonProperties);
|
||||
queryRunner.createCatalog(carbonDataCatalog, carbonDataConnector, carbonPropertiesMap);
|
||||
queryRunner.createCatalog(carbonDataCatalogLocationDisabled, carbonDataConnector, carbonPropertiesLocationDisabled);
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
|
|
|
|||
|
|
@ -345,8 +345,9 @@ public class ClickHouseClient
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renameColumn(JdbcIdentity identity, JdbcTableHandle handle, JdbcColumnHandle jdbcColumn, String newColumnName)
|
||||
public void renameColumn(JdbcIdentity identity, JdbcTableHandle handle, JdbcColumnHandle jdbcColumn, String inputNewColumnName)
|
||||
{
|
||||
String newColumnName = inputNewColumnName;
|
||||
try (Connection connection = connectionFactory.openConnection(identity)) {
|
||||
if (connection.getMetaData().storesUpperCaseIdentifiers()) {
|
||||
newColumnName = newColumnName.toUpperCase(ENGLISH);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public class ClickHouseApplyRemoteFunctionPushDown
|
|||
/**
|
||||
* rewrite the remote function to a executable function in the data source.
|
||||
*/
|
||||
@Override
|
||||
public Optional<String> rewriteRemoteFunction(CallExpression callExpression, BaseJdbcRowExpressionConverter rowExpressionConverter, JdbcConverterContext jdbcConverterContext)
|
||||
{
|
||||
if (!isConnectorSupportedRemoteFunction(callExpression)) {
|
||||
|
|
|
|||
|
|
@ -37,8 +37,9 @@ public class ClickHouseSqlStatementWriter
|
|||
}
|
||||
|
||||
@Override
|
||||
public String aggregation(String functionName, List<String> arguments, boolean isDistinct)
|
||||
public String aggregation(String inputFunctionName, List<String> arguments, boolean isDistinct)
|
||||
{
|
||||
String functionName = inputFunctionName;
|
||||
if (functionName.toUpperCase(Locale.ENGLISH).equals("VARIANCE")) {
|
||||
functionName = "varPop";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ public final class ClickHouseServerTest
|
|||
{
|
||||
String actualTable = tablePattern;
|
||||
|
||||
for (String table : tables) { //tableName + _ + UUID
|
||||
for (String table : tables) {
|
||||
int lastIndex = table.lastIndexOf("_");
|
||||
if (lastIndex == -1) {
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ public class TestTempFolder
|
|||
root = folder.getRoot();
|
||||
assertTrue(root.exists());
|
||||
File newFile = folder.newFile("aNewFile");
|
||||
assertEquals(newFile.getAbsolutePath(), folder.getRoot().getAbsolutePath() + "/aNewFile");
|
||||
assertEquals(newFile.getCanonicalPath(), folder.getRoot().getCanonicalPath() + "/aNewFile");
|
||||
File newFolder = folder.newFile("aNewFolder");
|
||||
assertEquals(newFolder.getAbsolutePath(), folder.getRoot().getAbsolutePath() + "/aNewFolder");
|
||||
assertEquals(newFolder.getCanonicalPath(), folder.getRoot().getCanonicalPath() + "/aNewFolder");
|
||||
}
|
||||
assertFalse(root.exists());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ public class CubeFilter
|
|||
|
||||
public CubeFilter(String sourceTablePredicate)
|
||||
{
|
||||
this.sourceTablePredicate = sourceTablePredicate;
|
||||
this.cubePredicate = null;
|
||||
this(sourceTablePredicate, null);
|
||||
}
|
||||
|
||||
public String getSourceTablePredicate()
|
||||
|
|
|
|||
|
|
@ -140,13 +140,13 @@ public class CubeStatement
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder groupBy(String column)
|
||||
public Builder groupByAddString(String column)
|
||||
{
|
||||
this.groupBy.add(column);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder groupBy(String... columns)
|
||||
public Builder groupByAddStringList(String... columns)
|
||||
{
|
||||
this.groupBy.addAll(Arrays.asList(columns));
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ public class TestCubeStatement
|
|||
.select("name", "address", "nationkey")
|
||||
.aggregate(AggregationSignature.count())
|
||||
.from("tpch.tiny.customer")
|
||||
.groupBy("address")
|
||||
.groupBy("name", "nationkey")
|
||||
.groupByAddString("address")
|
||||
.groupByAddStringList("name", "nationkey")
|
||||
.build();
|
||||
|
||||
assertEquals(statement.getFrom(), "tpch.tiny.customer", "incorrect from table");
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ public final class DataCenterColumnHandle
|
|||
}
|
||||
|
||||
@JsonProperty
|
||||
@Override
|
||||
public String getColumnName()
|
||||
{
|
||||
return columnName;
|
||||
|
|
|
|||
|
|
@ -56,11 +56,11 @@ public final class DataCenterTableHandle
|
|||
*/
|
||||
public DataCenterTableHandle(String catalogName, String schemaName, String tableName, OptionalLong limit)
|
||||
{
|
||||
this.catalogName = catalogName;
|
||||
this.schemaName = requireNonNull(schemaName, "schemaName is null");
|
||||
this.tableName = requireNonNull(tableName, "tableName is null");
|
||||
this.limit = requireNonNull(limit, "limit is null");
|
||||
this.pushDownSql = "";
|
||||
this(catalogName,
|
||||
requireNonNull(schemaName, "schemaName is null"),
|
||||
requireNonNull(tableName, "tableName is null"),
|
||||
requireNonNull(limit, "limit is null"),
|
||||
"");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -125,6 +125,7 @@ public final class DataCenterTableHandle
|
|||
return new SchemaTableName(schemaName, tableName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSchemaPrefixedTableName()
|
||||
{
|
||||
return catalogName + SPLIT_DOT + schemaName + SPLIT_DOT + tableName;
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ public class DataCenterPlanOptimizer
|
|||
List<RowExpression> pushable = new ArrayList<>();
|
||||
List<RowExpression> nonPushable = new ArrayList<>();
|
||||
|
||||
for (RowExpression conjunct : logicalRowExpressions.extractConjuncts(node.getPredicate())) {
|
||||
for (RowExpression conjunct : LogicalRowExpressions.extractConjuncts(node.getPredicate())) {
|
||||
try {
|
||||
conjunct.accept(queryGenerator.getConverter(), new JdbcConverterContext());
|
||||
pushable.add(conjunct);
|
||||
|
|
|
|||
|
|
@ -1392,24 +1392,24 @@ public class TestCrossRegionDynamicFilter
|
|||
hetuServer.installPlugin(new StateStoreManagerPlugin());
|
||||
hetuServer.loadStateSotre();
|
||||
|
||||
DistributedQueryRunner queryRunner = null;
|
||||
DistributedQueryRunner distributedQueryRunner = null;
|
||||
try {
|
||||
queryRunner = DistributedQueryRunner.builder(testSessionBuilder().build())
|
||||
distributedQueryRunner = DistributedQueryRunner.builder(testSessionBuilder().build())
|
||||
.setNodeCount(1)
|
||||
.build();
|
||||
|
||||
Map<String, String> connectorProperties = new HashMap<>(properties);
|
||||
connectorProperties.putIfAbsent("connection-url", hetuServer.getBaseUrl().toString());
|
||||
connectorProperties.putIfAbsent("connection-user", "root");
|
||||
queryRunner.installPlugin(new DataCenterPlugin());
|
||||
queryRunner.createDCCatalog("dc", "dc", connectorProperties);
|
||||
queryRunner.installPlugin(new TpchPlugin());
|
||||
queryRunner.createCatalog("tpch", "tpch", properties);
|
||||
distributedQueryRunner.installPlugin(new DataCenterPlugin());
|
||||
distributedQueryRunner.createDCCatalog("dc", "dc", connectorProperties);
|
||||
distributedQueryRunner.installPlugin(new TpchPlugin());
|
||||
distributedQueryRunner.createCatalog("tpch", "tpch", properties);
|
||||
|
||||
return queryRunner;
|
||||
return distributedQueryRunner;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
closeAllSuppress(e, queryRunner);
|
||||
closeAllSuppress(e, distributedQueryRunner);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,31 +212,31 @@ public class TestDataCenterClient
|
|||
@Test(expectedExceptions = RuntimeException.class)
|
||||
public void testPasswordWithoutSSL()
|
||||
{
|
||||
DataCenterConfig config = new DataCenterConfig().setConnectionUrl(this.baseUri)
|
||||
DataCenterConfig dataCenterConfig = new DataCenterConfig().setConnectionUrl(this.baseUri)
|
||||
.setConnectionUser("root")
|
||||
.setConnectionPassword("root")
|
||||
.setSsl(false);
|
||||
DataCenterStatementClientFactory.newHttpClient(config);
|
||||
DataCenterStatementClientFactory.newHttpClient(dataCenterConfig);
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = RuntimeException.class)
|
||||
public void testKerberosWithoutSSL()
|
||||
{
|
||||
DataCenterConfig config = new DataCenterConfig().setConnectionUrl(this.baseUri)
|
||||
DataCenterConfig dataCenterConfig = new DataCenterConfig().setConnectionUrl(this.baseUri)
|
||||
.setConnectionUser("root")
|
||||
.setKerberosRemoteServiceName("kerberos")
|
||||
.setSsl(false);
|
||||
DataCenterStatementClientFactory.newHttpClient(config);
|
||||
DataCenterStatementClientFactory.newHttpClient(dataCenterConfig);
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = RuntimeException.class)
|
||||
public void testAccessTokenWithoutSSL()
|
||||
{
|
||||
DataCenterConfig config = new DataCenterConfig().setConnectionUrl(this.baseUri)
|
||||
DataCenterConfig dataCenterConfig = new DataCenterConfig().setConnectionUrl(this.baseUri)
|
||||
.setConnectionUser("root")
|
||||
.setAccessToken("token")
|
||||
.setSsl(false);
|
||||
DataCenterStatementClientFactory.newHttpClient(config);
|
||||
DataCenterStatementClientFactory.newHttpClient(dataCenterConfig);
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = RuntimeException.class)
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ public class DockerizedHive
|
|||
"Please refer to READMD.md for set up guide. ##",
|
||||
testName));
|
||||
System.out.println("Error message:");
|
||||
e.printStackTrace();
|
||||
System.out.println(e.getStackTrace());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -165,8 +165,8 @@ public class DockerizedHive
|
|||
{
|
||||
// if the service is not up, this will throw an error
|
||||
this.hostPortProvider = hostPortProvider;
|
||||
FileSystem fs = getFs();
|
||||
fs.exists(new Path("/"));
|
||||
FileSystem fileSystem = getFs();
|
||||
fileSystem.exists(new Path("/"));
|
||||
}
|
||||
|
||||
private void checkHostnameResolution(String hostname)
|
||||
|
|
@ -248,9 +248,9 @@ public class DockerizedHive
|
|||
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
|
||||
Document coreXml = documentBuilder.parse(coreIs);
|
||||
coreXml.getDocumentElement().normalize();
|
||||
NodeList properties = coreXml.getElementsByTagName("property");
|
||||
for (int i = 0; i < properties.getLength(); i++) {
|
||||
Node node = properties.item(i);
|
||||
NodeList localProperties = coreXml.getElementsByTagName("property");
|
||||
for (int i = 0; i < localProperties.getLength(); i++) {
|
||||
Node node = localProperties.item(i);
|
||||
node.normalize();
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element element = (Element) node;
|
||||
|
|
|
|||
|
|
@ -89,11 +89,11 @@ public abstract class AbstractSqlInvokedFunctionNamespaceManager
|
|||
@ParametersAreNonnullByDefault
|
||||
public Collection<SqlInvokedFunction> load(QualifiedObjectName functionName)
|
||||
{
|
||||
Collection<SqlInvokedFunction> functions = fetchFunctionsDirect(functionName);
|
||||
for (SqlInvokedFunction function : functions) {
|
||||
Collection<SqlInvokedFunction> sqlInvokedFunctions = fetchFunctionsDirect(functionName);
|
||||
for (SqlInvokedFunction function : sqlInvokedFunctions) {
|
||||
metadataByHandle.put(function.getRequiredFunctionHandle(), sqlInvokedFunctionToMetadata(function));
|
||||
}
|
||||
return functions;
|
||||
return sqlInvokedFunctions;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -302,9 +302,9 @@ public abstract class AbstractSqlInvokedFunctionNamespaceManager
|
|||
|
||||
public synchronized List<SqlInvokedFunction> loadAndGetFunctionsTransactional(QualifiedObjectName functionName)
|
||||
{
|
||||
Collection<SqlInvokedFunction> functions = this.functions.computeIfAbsent(functionName, AbstractSqlInvokedFunctionNamespaceManager.this::fetchFunctions);
|
||||
functionHandles.putAll(functions.stream().collect(toImmutableMap(SqlInvokedFunction::getFunctionId, SqlInvokedFunction::getRequiredFunctionHandle)));
|
||||
return new ArrayList<>(functions);
|
||||
Collection<SqlInvokedFunction> sqlInvokedFunctions = this.functions.computeIfAbsent(functionName, AbstractSqlInvokedFunctionNamespaceManager.this::fetchFunctions);
|
||||
functionHandles.putAll(sqlInvokedFunctions.stream().collect(toImmutableMap(SqlInvokedFunction::getFunctionId, SqlInvokedFunction::getRequiredFunctionHandle)));
|
||||
return new ArrayList<>(sqlInvokedFunctions);
|
||||
}
|
||||
|
||||
public synchronized FunctionHandle getFunctionHandle(SqlFunctionId functionId)
|
||||
|
|
|
|||
|
|
@ -406,6 +406,8 @@ public class GreenPlumSqlClient
|
|||
case "timestamptz":
|
||||
// PostgreSQL's "timestamp with time zone" is reported as Types.TIMESTAMP rather than Types.TIMESTAMP_WITH_TIMEZONE
|
||||
return Optional.of(timestampWithTimeZoneColumnMapping());
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (typeHandle.getJdbcType() == Types.VARCHAR && !jdbcTypeName.equals("varchar")) {
|
||||
// This can be e.g. an ENUM
|
||||
|
|
@ -604,7 +606,7 @@ public class GreenPlumSqlClient
|
|||
byte[] in = slice.getBytes();
|
||||
SliceOutput dynamicSliceOutput = new DynamicSliceOutput(in.length);
|
||||
SORTED_MAPPER.writeValue((OutputStream) dynamicSliceOutput, SORTED_MAPPER.readValue(parser, Object.class));
|
||||
// nextToken() returns null if the input is parsed correctly,
|
||||
// the function nextToken() returns null if the input is parsed correctly,
|
||||
// but will throw an exception if there are trailing characters.
|
||||
parser.nextToken();
|
||||
return dynamicSliceOutput.slice();
|
||||
|
|
|
|||
|
|
@ -59,15 +59,15 @@ public final class GreenPlumQueryRunner
|
|||
queryRunner.installPlugin(new TpchPlugin());
|
||||
queryRunner.createCatalog("tpch", "tpch");
|
||||
|
||||
connectorProperties = new HashMap<>(ImmutableMap.copyOf(connectorProperties));
|
||||
connectorProperties.putIfAbsent("connection-url", server.getJdbcUrl());
|
||||
connectorProperties.putIfAbsent("allow-drop-table", "true");
|
||||
connectorProperties.putIfAbsent("jdbc.pushdown-enabled", "false");
|
||||
Map<String, String> connectorPropertiesMap = new HashMap<>(ImmutableMap.copyOf(connectorProperties));
|
||||
connectorPropertiesMap.putIfAbsent("connection-url", server.getJdbcUrl());
|
||||
connectorPropertiesMap.putIfAbsent("allow-drop-table", "true");
|
||||
connectorPropertiesMap.putIfAbsent("jdbc.pushdown-enabled", "false");
|
||||
|
||||
createSchema(server.getJdbcUrl(), "tpch");
|
||||
|
||||
queryRunner.installPlugin(new GreenPlumSqlPlugin());
|
||||
queryRunner.createCatalog(GREENPLUM_CONNECTOR_NAME, GREENPLUM_CONNECTOR_NAME, connectorProperties);
|
||||
queryRunner.createCatalog(GREENPLUM_CONNECTOR_NAME, GREENPLUM_CONNECTOR_NAME, connectorPropertiesMap);
|
||||
|
||||
copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables);
|
||||
|
||||
|
|
|
|||
|
|
@ -398,10 +398,10 @@ public class TestGreenPlumTypeMapping
|
|||
|
||||
private DataTypeTest arrayDateTest(Function<DataType<LocalDate>, DataType<List<LocalDate>>> arrayTypeFactory)
|
||||
{
|
||||
ZoneId jvmZone = ZoneId.systemDefault();
|
||||
checkState(jvmZone.getId().equals("America/Bahia_Banderas"), "This test assumes certain JVM time zone");
|
||||
ZoneId localJvmZone = ZoneId.systemDefault();
|
||||
checkState(localJvmZone.getId().equals("America/Bahia_Banderas"), "This test assumes certain JVM time zone");
|
||||
LocalDate dateOfLocalTimeChangeForwardAtMidnightInJvmZone = LocalDate.of(1970, 1, 1);
|
||||
checkIsGap(jvmZone, dateOfLocalTimeChangeForwardAtMidnightInJvmZone.atStartOfDay());
|
||||
checkIsGap(localJvmZone, dateOfLocalTimeChangeForwardAtMidnightInJvmZone.atStartOfDay());
|
||||
|
||||
ZoneId someZone = ZoneId.of("Europe/Vilnius");
|
||||
LocalDate dateOfLocalTimeChangeForwardAtMidnightInSomeZone = LocalDate.of(1983, 4, 1);
|
||||
|
|
@ -471,10 +471,10 @@ public class TestGreenPlumTypeMapping
|
|||
{
|
||||
// Note: there is identical test for MySQL
|
||||
|
||||
ZoneId jvmZone = ZoneId.systemDefault();
|
||||
checkState(jvmZone.getId().equals("America/Bahia_Banderas"), "This test assumes certain JVM time zone");
|
||||
ZoneId localJvmZone = ZoneId.systemDefault();
|
||||
checkState(localJvmZone.getId().equals("America/Bahia_Banderas"), "This test assumes certain JVM time zone");
|
||||
LocalDate dateOfLocalTimeChangeForwardAtMidnightInJvmZone = LocalDate.of(1970, 1, 1);
|
||||
checkIsGap(jvmZone, dateOfLocalTimeChangeForwardAtMidnightInJvmZone.atStartOfDay());
|
||||
checkIsGap(localJvmZone, dateOfLocalTimeChangeForwardAtMidnightInJvmZone.atStartOfDay());
|
||||
|
||||
ZoneId someZone = ZoneId.of("Europe/Vilnius");
|
||||
LocalDate dateOfLocalTimeChangeForwardAtMidnightInSomeZone = LocalDate.of(1983, 4, 1);
|
||||
|
|
@ -492,7 +492,7 @@ public class TestGreenPlumTypeMapping
|
|||
.addRoundTrip(dateDataType(), dateOfLocalTimeChangeForwardAtMidnightInSomeZone)
|
||||
.addRoundTrip(dateDataType(), dateOfLocalTimeChangeBackwardAtMidnightInSomeZone);
|
||||
|
||||
for (String timeZoneId : ImmutableList.of(UTC_KEY.getId(), jvmZone.getId(), someZone.getId())) {
|
||||
for (String timeZoneId : ImmutableList.of(UTC_KEY.getId(), localJvmZone.getId(), someZone.getId())) {
|
||||
Session session = Session.builder(getQueryRunner().getDefaultSession())
|
||||
.setTimeZoneKey(TimeZoneKey.getTimeZoneKey(timeZoneId))
|
||||
.build();
|
||||
|
|
@ -667,7 +667,8 @@ public class TestGreenPlumTypeMapping
|
|||
try {
|
||||
assertQuery(
|
||||
"SELECT column_name FROM information_schema.columns WHERE table_schema = 'tpch' AND table_name = 'test_unsupported_data_type'",
|
||||
"VALUES 'key'"); // no 'unsupported_column'
|
||||
"VALUES 'key'");
|
||||
// no unsupported_column
|
||||
}
|
||||
finally {
|
||||
jdbcSqlExecutor.execute("DROP TABLE tpch.test_unsupported_data_type");
|
||||
|
|
|
|||
|
|
@ -38,8 +38,9 @@ public class HanaSqlStatementWriter
|
|||
}
|
||||
|
||||
@Override
|
||||
public String aggregation(String functionName, List<String> arguments, boolean isDistinct)
|
||||
public String aggregation(String inputFunctionName, List<String> arguments, boolean isDistinct)
|
||||
{
|
||||
String functionName = inputFunctionName;
|
||||
if (functionName.toUpperCase(Locale.ENGLISH).equals("VARIANCE")) {
|
||||
functionName = "VAR";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,12 +68,12 @@ public class TestHazelcastAuthenticationDisabled
|
|||
String value2 = "bbb";
|
||||
|
||||
Config config = new Config();
|
||||
HazelcastInstance hazelcastInstance1 = Hazelcast.newHazelcastInstance(config);
|
||||
Map<Integer, String> clusterMap1 = hazelcastInstance1.getMap("MyMap");
|
||||
HazelcastInstance newHazelcastInstance1 = Hazelcast.newHazelcastInstance(config);
|
||||
Map<Integer, String> clusterMap1 = newHazelcastInstance1.getMap("MyMap");
|
||||
clusterMap1.put(1, value1);
|
||||
|
||||
HazelcastInstance hazelcastInstance2 = Hazelcast.newHazelcastInstance(config);
|
||||
Map<Integer, String> clusterMap2 = hazelcastInstance2.getMap("MyMap");
|
||||
HazelcastInstance newHazelcastInstance2 = Hazelcast.newHazelcastInstance(config);
|
||||
Map<Integer, String> clusterMap2 = newHazelcastInstance2.getMap("MyMap");
|
||||
clusterMap2.put(2, value2);
|
||||
|
||||
assertEquals(clusterMap1.get(2), value2);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ public class HBasePlugin
|
|||
@Override
|
||||
public Iterable<ConnectorFactory> getConnectorFactories()
|
||||
{
|
||||
// connector.name
|
||||
return ImmutableList.of(new HBaseConnectorFactory(this.connectorId, module, getClassLoader()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -141,6 +141,7 @@ public class HBaseColumnHandle
|
|||
*
|
||||
* @return name
|
||||
*/
|
||||
@Override
|
||||
public String getColumnName()
|
||||
{
|
||||
return name;
|
||||
|
|
|
|||
|
|
@ -679,7 +679,7 @@ public class HBaseConnection
|
|||
List<byte[]> splitKeys = new ArrayList<>();
|
||||
allRanges.forEach(range -> {
|
||||
for (char index = range.getStart(); index <= range.getEnd(); index += 1) {
|
||||
splitKeys.add(String.valueOf(index).getBytes());
|
||||
splitKeys.add(String.valueOf(index).getBytes(UTF_8));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -150,6 +150,6 @@ public class HBaseConnector
|
|||
@Override
|
||||
public List<PropertyMetadata<?>> getColumnProperties()
|
||||
{
|
||||
return hBaseColumnProperties.getColumnProperties();
|
||||
return HBaseColumnProperties.getColumnProperties();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ public class StringRowSerializer
|
|||
*
|
||||
* @param columnHandleList columnHandleList
|
||||
*/
|
||||
@Override
|
||||
public void setColumnHandleList(List<HBaseColumnHandle> columnHandleList)
|
||||
{
|
||||
this.columnHandles = columnHandleList;
|
||||
|
|
@ -108,6 +109,7 @@ public class StringRowSerializer
|
|||
* @param result Entry to deserialize
|
||||
* @param defaultValue defaultValue
|
||||
*/
|
||||
@Override
|
||||
public void deserialize(Result result, String defaultValue)
|
||||
{
|
||||
if (!columnValues.containsKey(rowIdName)) {
|
||||
|
|
@ -134,7 +136,7 @@ public class StringRowSerializer
|
|||
}
|
||||
catch (CharacterCodingException e) {
|
||||
LOG.error("bytes decode to string error, cause by %s", e.getMessage());
|
||||
e.printStackTrace();
|
||||
LOG.error("Error message: " + e.getStackTrace());
|
||||
}
|
||||
}
|
||||
columnValues.put(familyQualifierColumnMap.get(family).get(qualifer), value);
|
||||
|
|
@ -205,6 +207,7 @@ public class StringRowSerializer
|
|||
* @param <T> Type
|
||||
* @return read from HBase, set into output
|
||||
*/
|
||||
@Override
|
||||
public <T> T getBytesObject(Type type, String columnName)
|
||||
{
|
||||
String fieldValue = getFieldValue(columnName);
|
||||
|
|
|
|||
|
|
@ -342,9 +342,9 @@ public class TestHBase
|
|||
{
|
||||
HBaseConnectorId h1 = new HBaseConnectorId();
|
||||
HBaseConnectorId h2 = new HBaseConnectorId();
|
||||
h1.setConnectorId("hbase");
|
||||
h2.setConnectorId("hbase");
|
||||
assertEquals(true, h1.getConnectorId().equals(h2.getConnectorId()));
|
||||
HBaseConnectorId.setConnectorId("hbase");
|
||||
HBaseConnectorId.setConnectorId("hbase");
|
||||
assertEquals(true, HBaseConnectorId.getConnectorId().equals(HBaseConnectorId.getConnectorId()));
|
||||
assertEquals(h1.hashCode(), h2.hashCode());
|
||||
assertEquals(h1.toString(), h2.toString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
*/
|
||||
package io.hetu.core.plugin.hbase.client;
|
||||
|
||||
import io.airlift.log.Logger;
|
||||
import io.hetu.core.plugin.hbase.utils.TestSliceUtils;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
|
|
@ -70,6 +71,8 @@ public class TestHBaseConnection
|
|||
*/
|
||||
public static Table htable;
|
||||
|
||||
private static final Logger LOG = Logger.get(TestHBaseConnection.class);
|
||||
|
||||
static {
|
||||
Configuration conf = HBaseConfiguration.create();
|
||||
conf.set("hbase.client.retries.number", "1");
|
||||
|
|
@ -108,7 +111,7 @@ public class TestHBaseConnection
|
|||
Mockito.when(admin.listNamespaceDescriptors()).thenReturn(listNamespaceDescriptors());
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LOG.info("Error message: " + e.getStackTrace());
|
||||
}
|
||||
|
||||
htable = Mockito.mock(Table.class);
|
||||
|
|
@ -120,7 +123,7 @@ public class TestHBaseConnection
|
|||
}).when(htable).put(Mockito.anyListOf(Put.class));
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LOG.info("Error message: " + e.getStackTrace());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
*/
|
||||
package io.hetu.core.plugin.hbase.client;
|
||||
|
||||
import io.airlift.log.Logger;
|
||||
import io.hetu.core.plugin.hbase.connector.HBaseColumnHandle;
|
||||
import io.hetu.core.plugin.hbase.connector.HBaseTableHandle;
|
||||
import io.hetu.core.plugin.hbase.metadata.HBaseTable;
|
||||
|
|
@ -47,6 +48,8 @@ import static io.prestosql.spi.type.VarcharType.VARCHAR;
|
|||
*/
|
||||
public class TestUtils
|
||||
{
|
||||
private static final Logger LOG = Logger.get(TestUtils.class);
|
||||
|
||||
private TestUtils() {}
|
||||
|
||||
/**
|
||||
|
|
@ -266,7 +269,7 @@ public class TestUtils
|
|||
}
|
||||
}
|
||||
catch (NullPointerException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
LOG.info("Error message: " + e.getStackTrace());
|
||||
}
|
||||
return hTableMetaMemory;
|
||||
}
|
||||
|
|
@ -289,7 +292,7 @@ public class TestUtils
|
|||
}
|
||||
}
|
||||
catch (ClassNotFoundException | IllegalArgumentException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
LOG.info("Error message: " + e.getStackTrace());
|
||||
}
|
||||
|
||||
Type typeNull = null;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
*/
|
||||
package io.hetu.core.plugin.hbase.connector;
|
||||
|
||||
import io.airlift.log.Logger;
|
||||
import io.hetu.core.plugin.hbase.client.TestHBaseConnection;
|
||||
import io.hetu.core.plugin.hbase.conf.HBaseConfig;
|
||||
import io.hetu.core.plugin.hbase.metadata.HBaseMetastore;
|
||||
|
|
@ -30,6 +31,8 @@ import java.io.IOException;
|
|||
public class TestHBaseClientConnection
|
||||
extends HBaseConnection
|
||||
{
|
||||
private static final Logger LOG = Logger.get(TestHBaseClientConnection.class);
|
||||
|
||||
public TestHBaseClientConnection(HBaseConfig conf, HBaseMetastore metastore)
|
||||
{
|
||||
super(metastore, conf);
|
||||
|
|
@ -47,7 +50,7 @@ public class TestHBaseClientConnection
|
|||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LOG.info("Error message: " + e.getStackTrace());
|
||||
}
|
||||
return conn;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -390,8 +390,8 @@ public class TestHBaseConnector
|
|||
public void testhBaseConnectorIdGetConnectorId()
|
||||
{
|
||||
HBaseConnectorId hBCnnId = new HBaseConnectorId();
|
||||
hBCnnId.setConnectorId("hbase");
|
||||
assertEquals("hbase", hBCnnId.getConnectorId());
|
||||
HBaseConnectorId.setConnectorId("hbase");
|
||||
assertEquals("hbase", HBaseConnectorId.getConnectorId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -401,7 +401,7 @@ public class TestHBaseConnector
|
|||
public void testHBaseConnectorIdEquals()
|
||||
{
|
||||
HBaseConnectorId hBCnnId = new HBaseConnectorId();
|
||||
hBCnnId.setConnectorId("hbase");
|
||||
HBaseConnectorId.setConnectorId("hbase");
|
||||
assertEquals(true, hBCnnId.equals(hBCnnId));
|
||||
assertEquals(false, hBCnnId.equals(null));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -318,6 +318,8 @@ public class IndexServiceUtils
|
|||
return Serializer.BIG_DECIMAL;
|
||||
case "Date":
|
||||
return Serializer.DATE;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
throw new RuntimeException("Index is not supported for type: (" + type + ")");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -230,7 +230,6 @@ public class BitmapIndex
|
|||
ConcurrentNavigableMap<Object, byte[]> concurrentNavigableMap = null;
|
||||
|
||||
if (highBoundless && !lowBoundless) {
|
||||
// >= or >
|
||||
Object low = getActualValue(predicate.getType(), range.getLow().getValue());
|
||||
Object high = getBtreeReadOptimized().lastKey();
|
||||
boolean fromInclusive = range.getLow().getBound().equals(Marker.Bound.EXACTLY);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import java.io.OutputStream;
|
|||
import java.io.RandomAccessFile;
|
||||
import java.nio.MappedByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
|
@ -90,7 +91,7 @@ public class BloomIndex
|
|||
HashSet<Object> columnIdxValue = new HashSet<>(values.get(0).getSecond());
|
||||
for (Object value : columnIdxValue) {
|
||||
if (value != null) {
|
||||
getFilterFromMemory().add(value.toString().getBytes());
|
||||
getFilterFromMemory().add(value.toString().getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -104,12 +105,12 @@ public class BloomIndex
|
|||
Domain predicate = (Domain) expression;
|
||||
if (predicate.isSingleValue()) {
|
||||
Object value = getActualValue(predicate.getType(), predicate.getSingleValue());
|
||||
return getFilter().test(value.toString().getBytes());
|
||||
return getFilter().test(value.toString().getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
else if (expression instanceof CallExpression) {
|
||||
// test ComparisonExpression matching
|
||||
return matchCallExpEqual(expression, object -> getFilter().test(object.toString().getBytes()));
|
||||
return matchCallExpEqual(expression, object -> getFilter().test(object.toString().getBytes(StandardCharsets.UTF_8)));
|
||||
}
|
||||
throw new UnsupportedOperationException("Expression not supported by " + ID + " index.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -347,9 +347,9 @@ public class BTreeIndex
|
|||
IOUtils.copy(new SnappyInputStream(in), out);
|
||||
}
|
||||
setupDB();
|
||||
Properties properties = getProperties();
|
||||
if (properties.getProperty(PartitionIndexWriter.SYMBOL_TABLE_KEY_NAME) != null) {
|
||||
this.symbolTable = SerializationUtils.deserializeMap(properties.getProperty(PartitionIndexWriter.SYMBOL_TABLE_KEY_NAME), s -> s, s -> s);
|
||||
Properties localProperties = getProperties();
|
||||
if (localProperties.getProperty(PartitionIndexWriter.SYMBOL_TABLE_KEY_NAME) != null) {
|
||||
this.symbolTable = SerializationUtils.deserializeMap(localProperties.getProperty(PartitionIndexWriter.SYMBOL_TABLE_KEY_NAME), s -> s, s -> s);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class FunctionMetadata
|
|||
this.methodByName = new HashMap<>();
|
||||
}
|
||||
|
||||
// Return [funcName, className]
|
||||
// Return funcName and className
|
||||
public static String[] parseFunctionClassName(String metadata)
|
||||
{
|
||||
Matcher matcher = FUNCTION_METADATA_PATTERN.matcher(metadata);
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo;
|
|||
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
|
||||
import org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeInfo;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import static io.prestosql.spi.StandardErrorCode.NOT_SUPPORTED;
|
||||
import static io.prestosql.spi.type.BigintType.BIGINT;
|
||||
import static io.prestosql.spi.type.BooleanType.BOOLEAN;
|
||||
|
|
@ -186,7 +188,7 @@ public class HiveTypeTranslator
|
|||
return getVarcharTypeInfo(varcharType.getBoundedLength());
|
||||
}
|
||||
throw new PrestoException(NOT_SUPPORTED,
|
||||
String.format("Unsupported Hive type: %s. Supported VARCHAR types: VARCHAR(<=%d), VARCHAR.",
|
||||
String.format(Locale.ROOT, "Unsupported Hive type: %s. Supported VARCHAR types: VARCHAR(<=%d), VARCHAR.",
|
||||
type, HiveVarchar.MAX_VARCHAR_LENGTH));
|
||||
}
|
||||
if (type instanceof CharType) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public class EvaluateOverloadUDF
|
|||
return x;
|
||||
}
|
||||
|
||||
public int evaluate(Integer x)
|
||||
public int evaluateByInteger(Integer x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@ public class KylinClient
|
|||
}
|
||||
catch (Exception e) {
|
||||
log.debug("There is a problem %s", e.getLocalizedMessage());
|
||||
log.debug("Error message: " + e.getStackTrace());
|
||||
e.printStackTrace();
|
||||
// No need to raise an error.
|
||||
// This method is used inside applySubQuery method to extract the column types from a sub-query.
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public final class KylinKeywords
|
|||
public static String getAlias(String name)
|
||||
{
|
||||
if (getKeywords().contains(name.toLowerCase(Locale.ENGLISH))) {
|
||||
return KylinConstants.KYLIN_IDENTIFIER_QUOTE + name.toUpperCase() + KylinConstants.KYLIN_IDENTIFIER_QUOTE;
|
||||
return KylinConstants.KYLIN_IDENTIFIER_QUOTE + name.toUpperCase(Locale.ROOT) + KylinConstants.KYLIN_IDENTIFIER_QUOTE;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import java.util.Map;
|
|||
public class HetuEventListenerFactory
|
||||
implements EventListenerFactory
|
||||
{
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "hetu-listener";
|
||||
|
|
@ -35,6 +36,7 @@ public class HetuEventListenerFactory
|
|||
* @param properties properties
|
||||
* @return event listener
|
||||
*/
|
||||
@Override
|
||||
public EventListener create(Map<String, String> properties)
|
||||
{
|
||||
ConfigurationFactory configurationFactory = new ConfigurationFactory(properties);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import io.prestosql.spi.eventlistener.EventListenerFactory;
|
|||
public class HetuEventListenerPlugin
|
||||
implements Plugin
|
||||
{
|
||||
@Override
|
||||
public Iterable<EventListenerFactory> getEventListenerFactories()
|
||||
{
|
||||
return ImmutableList.of(new HetuEventListenerFactory());
|
||||
|
|
|
|||
|
|
@ -48,13 +48,13 @@ class AuditEventLogger
|
|||
|
||||
private static java.util.logging.Logger createLogger(Path filePath, int limit, int count)
|
||||
{
|
||||
java.util.logging.Logger logger = java.util.logging.Logger.getLogger(AuditEventLogger.class.getName());
|
||||
java.util.logging.Logger localLogger = java.util.logging.Logger.getLogger(AuditEventLogger.class.getName());
|
||||
try {
|
||||
FileHandler fileHandler = new FileHandler(filePath.toAbsolutePath().toString(), limit, count, true);
|
||||
fileHandler.setFormatter(new SimpleFormatter());
|
||||
logger.addHandler(fileHandler);
|
||||
logger.setUseParentHandlers(false);
|
||||
return logger;
|
||||
localLogger.addHandler(fileHandler);
|
||||
localLogger.setUseParentHandlers(false);
|
||||
return localLogger;
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new PrestoException(ListenerErrorCode.LOCAL_FILE_FILESYSTEM_ERROR,
|
||||
|
|
|
|||
|
|
@ -48,13 +48,13 @@ class QueryEventLogger
|
|||
|
||||
private static java.util.logging.Logger createLogger(Path filePath, int limit, int count)
|
||||
{
|
||||
java.util.logging.Logger logger = java.util.logging.Logger.getLogger(QueryEventLogger.class.getName());
|
||||
java.util.logging.Logger localLogger = java.util.logging.Logger.getLogger(QueryEventLogger.class.getName());
|
||||
try {
|
||||
FileHandler fileHandler = new FileHandler(filePath.toAbsolutePath().toString(), limit, count, true);
|
||||
fileHandler.setFormatter(new SimpleFormatter());
|
||||
logger.addHandler(fileHandler);
|
||||
logger.setUseParentHandlers(false);
|
||||
return logger;
|
||||
localLogger.addHandler(fileHandler);
|
||||
localLogger.setUseParentHandlers(false);
|
||||
return localLogger;
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new PrestoException(ListenerErrorCode.LOCAL_FILE_FILESYSTEM_ERROR,
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ package io.hetu.core.eventlistener.listeners;
|
|||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.inject.Key;
|
||||
import io.airlift.log.Logger;
|
||||
import io.hetu.core.eventlistener.HetuEventListenerPlugin;
|
||||
import io.prestosql.Session;
|
||||
import io.prestosql.plugin.tpch.TpchPlugin;
|
||||
|
|
@ -37,6 +38,7 @@ import static org.testng.Assert.assertTrue;
|
|||
@Test(singleThreaded = true)
|
||||
public class TestAuditEventLogger
|
||||
{
|
||||
private static final Logger LOG = Logger.get(TestAuditEventLogger.class);
|
||||
private static final Path path = Paths.get("/tmp/hetu_audit_test.log");
|
||||
|
||||
private final DistributedQueryRunner queryRunner;
|
||||
|
|
@ -91,7 +93,7 @@ public class TestAuditEventLogger
|
|||
}
|
||||
catch (RuntimeException ex) {
|
||||
// Query should fail but the listener should log the query
|
||||
ex.printStackTrace();
|
||||
LOG.info("Error message: " + ex.getStackTrace());
|
||||
assertLog("UserName", "UserIp", "queryId", "operation", "stmt={select * from tpch.tiny.fake_customer}", "status");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ package io.hetu.core.eventlistener.listeners;
|
|||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.inject.Key;
|
||||
import io.airlift.log.Logger;
|
||||
import io.hetu.core.eventlistener.HetuEventListenerPlugin;
|
||||
import io.prestosql.Session;
|
||||
import io.prestosql.plugin.tpch.TpchPlugin;
|
||||
|
|
@ -37,6 +38,7 @@ import static org.testng.Assert.assertTrue;
|
|||
@Test(singleThreaded = true)
|
||||
public class TestQueryEventLogger
|
||||
{
|
||||
private static final Logger LOG = Logger.get(TestQueryEventLogger.class);
|
||||
private static final Path path = Paths.get("/tmp/hetu_listener.log");
|
||||
|
||||
private final DistributedQueryRunner queryRunner;
|
||||
|
|
@ -86,7 +88,7 @@ public class TestQueryEventLogger
|
|||
}
|
||||
catch (RuntimeException ex) {
|
||||
// Query should fail but the listener should log the query
|
||||
ex.printStackTrace();
|
||||
LOG.info("Error message: " + ex.getStackTrace());
|
||||
assertLog("Query Created", "select * from tpch.tiny.fake_customer");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ package io.hetu.core.metastore;
|
|||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import io.airlift.log.Logger;
|
||||
import io.prestosql.spi.metastore.HetuCache;
|
||||
|
||||
import java.time.Duration;
|
||||
|
|
@ -25,6 +26,7 @@ import java.util.concurrent.ExecutionException;
|
|||
public class HetuLocalCache<K, V>
|
||||
implements HetuCache<K, V>
|
||||
{
|
||||
private static final Logger LOG = Logger.get(HetuLocalCache.class);
|
||||
private final Cache<K, V> localCache;
|
||||
|
||||
public HetuLocalCache(HetuMetastoreCacheConfig hetuMetastoreCacheConfig)
|
||||
|
|
@ -53,7 +55,7 @@ public class HetuLocalCache<K, V>
|
|||
return localCache.get(key, loader);
|
||||
}
|
||||
catch (ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
LOG.info("Error message: " + e.getStackTrace());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,8 +41,9 @@ public class JdbcHetuMetastoreFactory
|
|||
|
||||
@Override
|
||||
public HetuMetastore create(String name, Map<String, String> config, HetuFileSystemClient client,
|
||||
StateStore stateStore, String type)
|
||||
StateStore stateStore, String inputType)
|
||||
{
|
||||
String type = inputType;
|
||||
requireNonNull(config, "config is null");
|
||||
Bootstrap app;
|
||||
try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class JdbcMetastoreModule
|
|||
|
||||
public JdbcMetastoreModule(String type)
|
||||
{
|
||||
this.type = type;
|
||||
this(null, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.io.Resources;
|
||||
import com.google.inject.Injector;
|
||||
import io.airlift.bootstrap.Bootstrap;
|
||||
import io.airlift.log.Logger;
|
||||
import io.hetu.core.filesystem.HetuLocalFileSystemClient;
|
||||
import io.hetu.core.filesystem.LocalConfig;
|
||||
import io.hetu.core.metastore.hetufilesystem.HetuFsMetastoreModule;
|
||||
|
|
@ -70,6 +71,7 @@ public class TestHetuMetastoreCacheLocal
|
|||
private DatabaseEntity defaultDatabase;
|
||||
private String path = Resources.getResource("").getPath() + File.separator + "metastoreCache";
|
||||
|
||||
private static final Logger LOG = Logger.get(TestHetuMetastoreCacheLocal.class);
|
||||
private static final String TESTING_HOST = "127.0.0.1";
|
||||
private static final String TESTING_PORT = "8090";
|
||||
|
||||
|
|
@ -182,7 +184,7 @@ public class TestHetuMetastoreCacheLocal
|
|||
client.deleteRecursively(Paths.get(path));
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LOG.info("Error message: " + e.getStackTrace());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.google.common.io.Resources;
|
||||
import com.google.inject.Injector;
|
||||
import io.airlift.bootstrap.Bootstrap;
|
||||
import io.airlift.log.Logger;
|
||||
import io.hetu.core.filesystem.HetuLocalFileSystemClient;
|
||||
import io.hetu.core.filesystem.LocalConfig;
|
||||
import io.hetu.core.metastore.hetufilesystem.HetuFsMetastoreModule;
|
||||
|
|
@ -84,6 +85,7 @@ public class TestHetuMetastoreGlobalCache
|
|||
private DatabaseEntity defaultDatabase;
|
||||
private String path = Resources.getResource("").getPath() + File.separator + "metastoreCache";
|
||||
|
||||
private static final Logger LOG = Logger.get(TestHetuMetastoreGlobalCache.class);
|
||||
private static final String LOCALHOST = "127.0.0.1";
|
||||
private static final String PORT1 = "7980";
|
||||
private static final String PORT3 = "5991";
|
||||
|
|
@ -241,7 +243,7 @@ public class TestHetuMetastoreGlobalCache
|
|||
client.deleteRecursively(Paths.get(path));
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LOG.info("Error message: " + e.getStackTrace());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.google.common.io.Resources;
|
||||
import com.google.inject.Injector;
|
||||
import io.airlift.bootstrap.Bootstrap;
|
||||
import io.airlift.log.Logger;
|
||||
import io.hetu.core.filesystem.HetuLocalFileSystemClient;
|
||||
import io.hetu.core.filesystem.LocalConfig;
|
||||
import io.prestosql.plugin.base.jmx.MBeanServerModule;
|
||||
|
|
@ -67,6 +68,7 @@ import static org.testng.Assert.fail;
|
|||
|
||||
public class TestHetuFsMetastore
|
||||
{
|
||||
private static final Logger LOG = Logger.get(TestHetuFsMetastore.class);
|
||||
private HetuMetastore metastore;
|
||||
private HetuFileSystemClient client;
|
||||
private CatalogEntity defaultCatalog;
|
||||
|
|
@ -144,7 +146,7 @@ public class TestHetuFsMetastore
|
|||
client.deleteRecursively(Paths.get(path));
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LOG.info("Error message: " + e.getStackTrace());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,13 +36,13 @@ public class MongoIndex
|
|||
for (Document index : indexes) {
|
||||
// TODO: v, ns, sparse fields
|
||||
Document key = (Document) index.get("key");
|
||||
String name = index.getString("name");
|
||||
boolean unique = index.getBoolean("unique", false);
|
||||
String localName = index.getString("name");
|
||||
boolean localUnique = index.getBoolean("unique", false);
|
||||
|
||||
if (key.containsKey("_fts")) { // Full Text Search
|
||||
continue;
|
||||
}
|
||||
builder.add(new MongoIndex(name, parseKey(key), unique));
|
||||
builder.add(new MongoIndex(localName, parseKey(key), localUnique));
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ public class MongoMetadata
|
|||
}
|
||||
catch (NotFoundException e) {
|
||||
// table disappeared during listing operation
|
||||
log.debug("table disappeared during listing operation");
|
||||
}
|
||||
}
|
||||
return columns.build();
|
||||
|
|
|
|||
|
|
@ -440,6 +440,7 @@ public class OracleClient
|
|||
* @param tableName tableName
|
||||
* @param newTable newTable
|
||||
*/
|
||||
@Override
|
||||
protected void renameTable(JdbcIdentity identity, String catalogName, String schemaName, String tableName,
|
||||
SchemaTableName newTable)
|
||||
{
|
||||
|
|
@ -924,8 +925,9 @@ public class OracleClient
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renameColumn(JdbcIdentity identity, JdbcTableHandle handle, JdbcColumnHandle jdbcColumn, String newColumnName)
|
||||
public void renameColumn(JdbcIdentity identity, JdbcTableHandle handle, JdbcColumnHandle jdbcColumn, String inputNewColumnName)
|
||||
{
|
||||
String newColumnName = inputNewColumnName;
|
||||
try (Connection connection = connectionFactory.openConnection(identity)) {
|
||||
if (connection.getMetaData().storesUpperCaseIdentifiers()) {
|
||||
newColumnName = newColumnName.toUpperCase(ENGLISH);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import java.io.IOException;
|
|||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Collection;
|
||||
|
|
@ -54,7 +55,7 @@ public class FileBasedSeedStore
|
|||
private Map<String, String> config;
|
||||
// seed dir
|
||||
private String name;
|
||||
// seedFilePath = <seedDir>/<name>/seeds.txt
|
||||
|
||||
private Path seedDir;
|
||||
private Path seedFilePath;
|
||||
|
||||
|
|
@ -181,7 +182,7 @@ public class FileBasedSeedStore
|
|||
|
||||
StringBuilder content = new StringBuilder(0);
|
||||
if (fs.exists(seedFilePath)) {
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(fs.newInputStream(seedFilePath)))) {
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(fs.newInputStream(seedFilePath), StandardCharsets.UTF_8))) {
|
||||
br.lines().forEach(content::append);
|
||||
}
|
||||
}
|
||||
|
|
@ -204,7 +205,7 @@ public class FileBasedSeedStore
|
|||
throws IOException
|
||||
{
|
||||
try (OutputStream os = (overwrite) ? fs.newOutputStream(file) : fs.newOutputStream(file, CREATE_NEW)) {
|
||||
os.write(content.getBytes());
|
||||
os.write(content.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import java.io.IOException;
|
|||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Collection;
|
||||
|
|
@ -228,7 +229,7 @@ public class FileBasedSeedStoreOnYarn
|
|||
throws IOException
|
||||
{
|
||||
StringBuilder content = new StringBuilder(0);
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(fs.newInputStream(file)))) {
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(fs.newInputStream(file), StandardCharsets.UTF_8))) {
|
||||
br.lines().forEach(content::append);
|
||||
}
|
||||
return content.toString();
|
||||
|
|
|
|||
|
|
@ -2107,7 +2107,7 @@ public class HiveAstBuilder
|
|||
String fieldString = context.identifier().getText();
|
||||
Extract.Field field;
|
||||
try {
|
||||
field = Extract.Field.valueOf(fieldString.toUpperCase());
|
||||
field = Extract.Field.valueOf(fieldString.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
throw parseError("Invalid EXTRACT field: " + fieldString, context);
|
||||
|
|
|
|||
|
|
@ -1921,7 +1921,7 @@ public class ImpalaAstBuilder
|
|||
{
|
||||
String fieldString = context.identifier().getText();
|
||||
Extract.Field field;
|
||||
field = Extract.Field.valueOf(fieldString.toUpperCase());
|
||||
field = Extract.Field.valueOf(fieldString.toUpperCase(Locale.ROOT));
|
||||
return new Extract(getLocation(context), (Expression) visit(context.valueExpression()), field);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,12 +31,7 @@ public class ParserDiffs
|
|||
|
||||
public ParserDiffs(DiffType diffType, Optional<String> source, Optional<String> target, Optional<String> message)
|
||||
{
|
||||
this.diffType = diffType;
|
||||
this.source = source;
|
||||
this.sourcePosition = Optional.empty();
|
||||
this.target = target;
|
||||
this.targetPosition = Optional.empty();
|
||||
this.message = message;
|
||||
this(diffType, source, Optional.empty(), target, Optional.empty(), message);
|
||||
}
|
||||
|
||||
public ParserDiffs(DiffType diffType, Optional<String> source, Optional<String> sourcePosition, Optional<String> target, Optional<String> targetPosition, Optional<String> message)
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class SqlResultHandleUtils
|
|||
{
|
||||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||
try (InputStream is = classLoader.getResourceAsStream(HTML_TMPLATE_FILE_NAME);
|
||||
InputStreamReader isr = new InputStreamReader(is);
|
||||
InputStreamReader isr = new InputStreamReader(is, UTF_8);
|
||||
BufferedReader reader = new BufferedReader(isr);
|
||||
OutputStream out = new FileOutputStream(outputFile + ".html");
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, UTF_8), BUFFER_SIZE)) {
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ public class AggregateColumn
|
|||
}
|
||||
|
||||
@JsonIgnore
|
||||
@Override
|
||||
public String getUserFriendlyName()
|
||||
{
|
||||
return aggregateFunction + "(" + originalColumn + ")";
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ public class DimensionColumn
|
|||
}
|
||||
|
||||
@JsonIgnore
|
||||
@Override
|
||||
public String getUserFriendlyName()
|
||||
{
|
||||
return "(" + originalColumn + ")";
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ public class StarTreeMetadata
|
|||
}
|
||||
|
||||
@JsonProperty
|
||||
@Override
|
||||
public CubeFilter getCubeFilter()
|
||||
{
|
||||
return cubeFilter;
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ public class TestStarTreeMetadata
|
|||
.select("returnflag", "linestatus")
|
||||
.aggregate(avg("quantity", false))
|
||||
.from("tpch.tiny.lineitem")
|
||||
.groupBy("returnflag", "linestatus")
|
||||
.groupByAddStringList("returnflag", "linestatus")
|
||||
.build();
|
||||
assertTrue(metadata.matches(statement), "failed to match a valid cube statement");
|
||||
}
|
||||
|
|
@ -178,7 +178,7 @@ public class TestStarTreeMetadata
|
|||
.select("returnflag", "linestatus")
|
||||
.aggregate(sum("quantity", false))
|
||||
.from("tpch.tiny.lineitem2")
|
||||
.groupBy("returnflag", "linestatus")
|
||||
.groupByAddStringList("returnflag", "linestatus")
|
||||
.build();
|
||||
assertTrue(metadataWithoutAvg.matches(statement), "failed to match a valid cube statement");
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ public class TestStarTreeMetadata
|
|||
.select("returnflag", "linestatus")
|
||||
.aggregate(avg("unknown", false))
|
||||
.from("tpch.tiny.lineitem")
|
||||
.groupBy("returnflag", "linestatus")
|
||||
.groupByAddStringList("returnflag", "linestatus")
|
||||
.build();
|
||||
assertFalse(metadata.matches(statement), "failed to detect an invalid cube statement");
|
||||
}
|
||||
|
|
@ -225,7 +225,7 @@ public class TestStarTreeMetadata
|
|||
.aggregate(avg("quantity", false))
|
||||
.aggregate(avg("discount", false))
|
||||
.from("tpch.tiny.lineitem3")
|
||||
.groupBy("returnflag", "linestatus")
|
||||
.groupByAddStringList("returnflag", "linestatus")
|
||||
.build();
|
||||
assertTrue(metadataWithAvg.matches(statement), "failed to match a valid cube statement");
|
||||
}
|
||||
|
|
@ -237,7 +237,7 @@ public class TestStarTreeMetadata
|
|||
.select("returnflag", "linestatus")
|
||||
.aggregate(avg("quantity", false))
|
||||
.from("tpch.tiny.lineitem4")
|
||||
.groupBy("returnflag", "linestatus")
|
||||
.groupByAddStringList("returnflag", "linestatus")
|
||||
.build();
|
||||
assertFalse(metadataWithAvgWithoutSumCount.matches(statement), "failed to match a valid cube statement");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ public class PagesSerde
|
|||
this.spillCipher = requireNonNull(spillCipher, "spillCipher is null");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SerializedPage serialize(Page page)
|
||||
{
|
||||
if (page instanceof MarkerPage) {
|
||||
|
|
@ -68,6 +69,7 @@ public class PagesSerde
|
|||
return serializeImpl(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page deserialize(SerializedPage page)
|
||||
{
|
||||
if (page.isMarkerPage()) {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ package io.hetu.core.plugin.vdm;
|
|||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import io.airlift.log.Logger;
|
||||
import io.airlift.testing.mysql.TestingMySqlServer;
|
||||
import io.airlift.tpch.TpchTable;
|
||||
import io.hetu.core.metastore.HetuMetastorePlugin;
|
||||
|
|
@ -39,6 +40,8 @@ public final class VdmQueryRunner
|
|||
{
|
||||
protected static final SqlParserOptions DEFAULT_SQL_PARSER_OPTIONS = new SqlParserOptions();
|
||||
|
||||
private static final Logger LOG = Logger.get(VdmQueryRunner.class);
|
||||
|
||||
private VdmQueryRunner()
|
||||
{
|
||||
}
|
||||
|
|
@ -81,7 +84,7 @@ public final class VdmQueryRunner
|
|||
file2.createNewFile();
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LOG.info("Error message: " + e.getStackTrace());
|
||||
}
|
||||
}
|
||||
try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(hetumetastoreConfig))) {
|
||||
|
|
|
|||
|
|
@ -161,8 +161,10 @@ public class IntBigArrays
|
|||
|
||||
private static void vecSwap(final int[][] x, long a, long b, final long n)
|
||||
{
|
||||
for (int i = 0; i < n; i++, a++, b++) {
|
||||
swap(x, a, b);
|
||||
long tmpA = a;
|
||||
long tmpB = b;
|
||||
for (int i = 0; i < n; i++, tmpA++, tmpB++) {
|
||||
swap(x, tmpA, tmpB);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import java.io.BufferedReader;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
|
@ -113,7 +114,7 @@ public class AtopProcessFactory
|
|||
private AtopProcess(Process process, Duration readTimeout, ExecutorService executor)
|
||||
{
|
||||
this.process = requireNonNull(process, "process is null");
|
||||
underlyingReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
underlyingReader = new BufferedReader(new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8));
|
||||
TimeLimiter limiter = SimpleTimeLimiter.create(executor);
|
||||
this.reader = limiter.newProxy(underlyingReader::readLine, LineReader.class, readTimeout.toMillis(), MILLISECONDS);
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -84,18 +84,18 @@ public enum AtopTable
|
|||
|
||||
private static List<AtopColumn> baseColumnsAnd(AtopColumn... additionalColumns)
|
||||
{
|
||||
ImmutableList.Builder<AtopColumn> columns = ImmutableList.builder();
|
||||
columns.add(HOST_IP);
|
||||
ImmutableList.Builder<AtopColumn> atopColumnBuilder = ImmutableList.builder();
|
||||
atopColumnBuilder.add(HOST_IP);
|
||||
// 0th field is the label (i.e. table name)
|
||||
// 1st field is the name of the host, but isn't fully qualified
|
||||
columns.add(START_TIME);
|
||||
atopColumnBuilder.add(START_TIME);
|
||||
// 2nd field is the end timestamp as unix time
|
||||
columns.add(END_TIME);
|
||||
atopColumnBuilder.add(END_TIME);
|
||||
// 3rd field is the date, but we already have the epoch
|
||||
// 4th field is the time, but we already have the epoch
|
||||
// 5th field is the duration, and will be combined with 2 to compute start_time
|
||||
columns.addAll(Arrays.asList(additionalColumns));
|
||||
return columns.build();
|
||||
atopColumnBuilder.addAll(Arrays.asList(additionalColumns));
|
||||
return atopColumnBuilder.build();
|
||||
}
|
||||
|
||||
public String getName()
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -51,7 +52,7 @@ public class TestingAtopFactory
|
|||
private TestingAtop(InputStream dataStream, ZonedDateTime date)
|
||||
{
|
||||
this.date = date;
|
||||
this.reader = new BufferedReader(new InputStreamReader(dataStream));
|
||||
this.reader = new BufferedReader(new InputStreamReader(dataStream, StandardCharsets.UTF_8));
|
||||
try {
|
||||
line = reader.readLine();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ public class JdbcPlanOptimizer
|
|||
List<RowExpression> pushable = new ArrayList<>();
|
||||
List<RowExpression> nonPushable = new ArrayList<>();
|
||||
|
||||
for (RowExpression conjunct : logicalRowExpressions.extractConjuncts(node.getPredicate())) {
|
||||
for (RowExpression conjunct : LogicalRowExpressions.extractConjuncts(node.getPredicate())) {
|
||||
try {
|
||||
JdbcConverterContext jdbcConverterContext = new JdbcConverterContext();
|
||||
conjunct.accept(queryGenerator.get().getConverter(), jdbcConverterContext);
|
||||
|
|
|
|||
|
|
@ -93,8 +93,9 @@ public class JdbcPlanOptimizerUtils
|
|||
throw new PrestoException(JDBC_QUERY_GENERATOR_FAILURE, "unhandled type: " + type);
|
||||
}
|
||||
|
||||
public static String quote(String quote, String name)
|
||||
public static String quote(String quote, String inputName)
|
||||
{
|
||||
String name = inputName;
|
||||
name = name.replace(quote, quote + quote);
|
||||
return quote + name + quote;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ public class DefaultConnectorConfigFunctionRewriter
|
|||
* @param functionCallArgsPackage the package of SqlQueryWriter's function call methods args
|
||||
* @return result string
|
||||
*/
|
||||
@Override
|
||||
public String rewriteFunctionCall(FunctionCallArgsPackage functionCallArgsPackage)
|
||||
{
|
||||
String functionPropertyName = propertyNameBuilder.apply(functionCallArgsPackage);
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ public class MockMetadata
|
|||
return ((BuiltInFunctionHandle) delegate.getFunctionAndTypeManager().resolveFunction(Optional.empty(), QualifiedObjectName.valueOf(name.toString()), parameterTypes)).getSignature();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FunctionAndTypeManager getFunctionAndTypeManager()
|
||||
{
|
||||
return delegate.getFunctionAndTypeManager();
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public class TestingJdbcExternalFunctionHub
|
|||
{
|
||||
private CatalogSchemaName catalogSchemaName = new CatalogSchemaName("jdbc", "foo");
|
||||
|
||||
@Override
|
||||
public Set<ExternalFunctionInfo> getExternalFunctions()
|
||||
{
|
||||
return ImmutableSet.<ExternalFunctionInfo>builder().add(EXTERNAL_FUNCTION_INFO).build();
|
||||
|
|
|
|||
|
|
@ -47,6 +47,11 @@
|
|||
<artifactId>units</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.airlift</groupId>
|
||||
<artifactId>log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.airlift</groupId>
|
||||
<artifactId>log-manager</artifactId>
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ public class BenchmarkDriver
|
|||
public void run(Suite suite)
|
||||
{
|
||||
// select queries to run
|
||||
List<BenchmarkQuery> queries = suite.selectQueries(this.queries);
|
||||
if (queries.isEmpty()) {
|
||||
List<BenchmarkQuery> benchmarkQueries = suite.selectQueries(this.queries);
|
||||
if (benchmarkQueries.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ public class BenchmarkDriver
|
|||
}
|
||||
|
||||
for (BenchmarkSchema benchmarkSchema : benchmarkSchemas) {
|
||||
for (BenchmarkQuery benchmarkQuery : queries) {
|
||||
for (BenchmarkQuery benchmarkQuery : benchmarkQueries) {
|
||||
session = ClientSession.builder(session)
|
||||
.withCatalog(session.getCatalog())
|
||||
.withSchema(benchmarkSchema.getName())
|
||||
|
|
|
|||
|
|
@ -110,12 +110,12 @@ public class BenchmarkDriverOptions
|
|||
|
||||
private static URI parseServer(String server)
|
||||
{
|
||||
server = server.toLowerCase(ENGLISH);
|
||||
if (server.startsWith("http://") || server.startsWith("https://")) {
|
||||
return URI.create(server);
|
||||
String localServer = server.toLowerCase(ENGLISH);
|
||||
if (localServer.startsWith("http://") || localServer.startsWith("https://")) {
|
||||
return URI.create(localServer);
|
||||
}
|
||||
|
||||
HostAndPort host = HostAndPort.fromString(server);
|
||||
HostAndPort host = HostAndPort.fromString(localServer);
|
||||
try {
|
||||
return new URI("http", null, host.getHost(), host.getPortOrDefault(80), null, null, null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import io.airlift.http.client.HttpClientConfig;
|
|||
import io.airlift.http.client.JsonResponseHandler;
|
||||
import io.airlift.http.client.Request;
|
||||
import io.airlift.http.client.jetty.JettyHttpClient;
|
||||
import io.airlift.log.Logger;
|
||||
import io.airlift.units.Duration;
|
||||
import io.prestosql.client.ClientSession;
|
||||
import io.prestosql.client.QueryData;
|
||||
|
|
@ -58,6 +59,7 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
|||
public class BenchmarkQueryRunner
|
||||
implements Closeable
|
||||
{
|
||||
private static final Logger LOG = Logger.get(BenchmarkQueryRunner.class);
|
||||
private final int warm;
|
||||
private final int runs;
|
||||
private final boolean debug;
|
||||
|
|
@ -236,13 +238,14 @@ public class BenchmarkQueryRunner
|
|||
}
|
||||
|
||||
@SuppressWarnings("CallToPrintStackTrace")
|
||||
public void handleFailure(Exception e)
|
||||
public void handleFailure(Exception exception)
|
||||
{
|
||||
Exception e = exception;
|
||||
if (debug) {
|
||||
if (e == null) {
|
||||
e = new RuntimeException("Unknown error");
|
||||
}
|
||||
e.printStackTrace();
|
||||
LOG.debug("Error message: " + e.getStackTrace());
|
||||
}
|
||||
|
||||
failures++;
|
||||
|
|
|
|||
|
|
@ -147,11 +147,11 @@ public class Suite
|
|||
for (String q : query) {
|
||||
queryNameTemplates.add(Pattern.compile(sanitizeString(q)));
|
||||
}
|
||||
ImmutableList.Builder<RegexTemplate> schemaNameTemplates = ImmutableList.builder();
|
||||
ImmutableList.Builder<RegexTemplate> schemaNameTemplatesBuilder = ImmutableList.builder();
|
||||
for (String s : schema) {
|
||||
schemaNameTemplates.add(new RegexTemplate(sanitizeString(s)));
|
||||
schemaNameTemplatesBuilder.add(new RegexTemplate(sanitizeString(s)));
|
||||
}
|
||||
return new Suite(name, session, schemaNameTemplates.build(), queryNameTemplates.build());
|
||||
return new Suite(name, session, schemaNameTemplatesBuilder.build(), queryNameTemplates.build());
|
||||
}
|
||||
|
||||
private String sanitizeString(String name)
|
||||
|
|
|
|||
|
|
@ -123,16 +123,16 @@ public class MemoryLocalQueryRunner
|
|||
|
||||
private static LocalQueryRunner createMemoryLocalQueryRunner(Session session)
|
||||
{
|
||||
LocalQueryRunner localQueryRunner = LocalQueryRunner.queryRunnerWithInitialTransaction(session);
|
||||
LocalQueryRunner queryRunnerWithInitialTransaction = LocalQueryRunner.queryRunnerWithInitialTransaction(session);
|
||||
|
||||
// add tpch
|
||||
localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(1), ImmutableMap.of());
|
||||
localQueryRunner.createCatalog(
|
||||
queryRunnerWithInitialTransaction.createCatalog("tpch", new TpchConnectorFactory(1), ImmutableMap.of());
|
||||
queryRunnerWithInitialTransaction.createCatalog(
|
||||
"memory",
|
||||
new MemoryConnectorFactory(),
|
||||
ImmutableMap.of("memory.max-data-per-node", "4GB"));
|
||||
|
||||
return localQueryRunner;
|
||||
return queryRunnerWithInitialTransaction;
|
||||
}
|
||||
|
||||
public void dropTable(String tableName)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import org.testng.annotations.Test;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
import static io.prestosql.cli.CsvPrinter.CsvOutputFormat.NO_HEADER;
|
||||
|
|
@ -172,7 +173,7 @@ public class TestCsvPrinter
|
|||
List<String> fieldNames = ImmutableList.of("first", "last", "quantity");
|
||||
OutputPrinter printer = new CsvPrinter(fieldNames, writer, NO_HEADER);
|
||||
|
||||
printRows(printer, TestAlignedTablePrinter.row("hello".getBytes(), null, 123));
|
||||
printRows(printer, TestAlignedTablePrinter.row("hello".getBytes(StandardCharsets.UTF_8), null, 123));
|
||||
printer.finish();
|
||||
|
||||
String expected = "\"68 65 6c 6c 6f\",\"\",\"123\"\n";
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import org.testng.annotations.Test;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
import static io.prestosql.cli.TestAlignedTablePrinter.row;
|
||||
|
|
@ -72,7 +73,7 @@ public class TestJsonPrinter
|
|||
List<String> fieldNames = ImmutableList.of("first", "last", "quantity");
|
||||
OutputPrinter printer = new JsonPrinter(fieldNames, writer);
|
||||
|
||||
printer.printRows(rows(row("hello".getBytes(), null, 123)), true);
|
||||
printer.printRows(rows(row("hello".getBytes(StandardCharsets.UTF_8), null, 123)), true);
|
||||
printer.finish();
|
||||
|
||||
String expected = "{\"first\":\"68 65 6c 6c 6f\",\"last\":null,\"quantity\":123}\n";
|
||||
|
|
|
|||
|
|
@ -134,7 +134,6 @@ public class TestQueryRunner
|
|||
ImmutableList.of(new Column("_col0", BIGINT, new ClientTypeSignature(BIGINT))),
|
||||
ImmutableList.of(ImmutableList.of(123)),
|
||||
StatementStats.builder().setState("FINISHED").build(),
|
||||
//new StatementStats("FINISHED", false, true, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null),
|
||||
null,
|
||||
ImmutableList.of(),
|
||||
null,
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import org.testng.annotations.Test;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
import static io.prestosql.cli.TestAlignedTablePrinter.row;
|
||||
|
|
@ -96,7 +97,7 @@ public class TestTsvPrinter
|
|||
List<String> fieldNames = ImmutableList.of("first", "last", "quantity");
|
||||
OutputPrinter printer = new TsvPrinter(fieldNames, writer, false);
|
||||
|
||||
printer.printRows(rows(row("hello".getBytes(), null, 123)), true);
|
||||
printer.printRows(rows(row("hello".getBytes(StandardCharsets.UTF_8), null, 123)), true);
|
||||
printer.finish();
|
||||
|
||||
String expected = "68 65 6c 6c 6f\t\t123\n";
|
||||
|
|
|
|||
|
|
@ -80,8 +80,9 @@ public final class ExternalBlockEncodingSerde
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeBlock(SliceOutput output, Block block)
|
||||
public void writeBlock(SliceOutput output, Block inputBlock)
|
||||
{
|
||||
Block block = inputBlock;
|
||||
while (true) {
|
||||
// get the encoding name
|
||||
String encodingName = block.getEncodingName();
|
||||
|
|
|
|||
|
|
@ -156,15 +156,15 @@ public class ElasticsearchClient
|
|||
{
|
||||
// discover other nodes in the cluster and add them to the client
|
||||
try {
|
||||
Set<Node> nodes = fetchNodes();
|
||||
Set<Node> nodeSet = fetchNodes();
|
||||
|
||||
HttpHost[] hosts = nodes.stream()
|
||||
HttpHost[] hosts = nodeSet.stream()
|
||||
.map(Node::getAddress)
|
||||
.map(address -> HttpHost.create(format("%s://%s", tlsEnabled ? "https" : "http", address)))
|
||||
.toArray(HttpHost[]::new);
|
||||
|
||||
client.getLowLevelClient().setHosts(hosts);
|
||||
this.nodes.set(nodes);
|
||||
this.nodes.set(nodeSet);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
// Catch all exceptions here since throwing an exception from executor#scheduleWithFixedDelay method
|
||||
|
|
@ -297,6 +297,7 @@ public class ElasticsearchClient
|
|||
}
|
||||
}
|
||||
catch (IOException | GeneralSecurityException ignored) {
|
||||
// could be ignored
|
||||
}
|
||||
|
||||
try (InputStream in = new FileInputStream(trustStorePath)) {
|
||||
|
|
@ -359,7 +360,7 @@ public class ElasticsearchClient
|
|||
SearchShardsResponse shardsResponse = doRequest(format("%s/_search_shards", index), SEARCH_SHARDS_RESPONSE_CODEC::fromJson);
|
||||
|
||||
ImmutableList.Builder<Shard> shards = ImmutableList.builder();
|
||||
List<Node> nodes = ImmutableList.copyOf(nodeById.values());
|
||||
List<Node> nodeList = ImmutableList.copyOf(nodeById.values());
|
||||
|
||||
for (List<SearchShardsResponse.Shard> shardGroup : shardsResponse.getShardGroups()) {
|
||||
Stream<SearchShardsResponse.Shard> preferred = shardGroup.stream()
|
||||
|
|
@ -374,7 +375,7 @@ public class ElasticsearchClient
|
|||
if (!candidate.isPresent()) {
|
||||
// pick an arbitrary shard with and assign to an arbitrary node
|
||||
chosen = preferred.findFirst().get();
|
||||
node = nodes.get(chosen.getShard() % nodes.size());
|
||||
node = nodeList.get(chosen.getShard() % nodeList.size());
|
||||
}
|
||||
else {
|
||||
chosen = candidate.get();
|
||||
|
|
|
|||
|
|
@ -182,6 +182,8 @@ public class ElasticsearchMetadata
|
|||
return BOOLEAN;
|
||||
case "binary":
|
||||
return VARBINARY;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (type instanceof DateTimeType) {
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ public class ElasticsearchPageSource
|
|||
else if (type instanceof RowType) {
|
||||
RowType rowType = (RowType) type;
|
||||
|
||||
List<Decoder> decoders = rowType.getFields().stream()
|
||||
List<Decoder> decoderList = rowType.getFields().stream()
|
||||
.map(field -> createDecoder(appendPath(path, field.getName().get()), field.getType()))
|
||||
.collect(toImmutableList());
|
||||
|
||||
|
|
@ -318,7 +318,7 @@ public class ElasticsearchPageSource
|
|||
.map(Optional::get)
|
||||
.collect(toImmutableList());
|
||||
|
||||
return new RowDecoder(path, fieldNames, decoders);
|
||||
return new RowDecoder(path, fieldNames, decoderList);
|
||||
}
|
||||
if (type instanceof ArrayType) {
|
||||
Type elementType = ((ArrayType) type).getElementType();
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public final class ExampleColumnHandle
|
|||
}
|
||||
|
||||
@JsonProperty
|
||||
@Override
|
||||
public String getColumnName()
|
||||
{
|
||||
return columnName;
|
||||
|
|
|
|||
|
|
@ -43,11 +43,11 @@ public class ExampleTable
|
|||
this.columns = ImmutableList.copyOf(requireNonNull(columns, "columns is null"));
|
||||
this.sources = ImmutableList.copyOf(requireNonNull(sources, "sources is null"));
|
||||
|
||||
ImmutableList.Builder<ColumnMetadata> columnsMetadata = ImmutableList.builder();
|
||||
ImmutableList.Builder<ColumnMetadata> columnMetadataBuilder = ImmutableList.builder();
|
||||
for (ExampleColumn column : this.columns) {
|
||||
columnsMetadata.add(new ColumnMetadata(column.getName(), column.getType()));
|
||||
columnMetadataBuilder.add(new ColumnMetadata(column.getName(), column.getType()));
|
||||
}
|
||||
this.columnsMetadata = columnsMetadata.build();
|
||||
this.columnsMetadata = columnMetadataBuilder.build();
|
||||
}
|
||||
|
||||
@JsonProperty
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.io.Resources;
|
||||
import io.airlift.log.Logger;
|
||||
import io.prestosql.spi.PrestoException;
|
||||
import io.prestosql.spi.connector.ColumnMetadata;
|
||||
import io.prestosql.spi.connector.ConnectorTableMetadata;
|
||||
|
|
@ -40,6 +41,7 @@ import static org.testng.Assert.fail;
|
|||
@Test(singleThreaded = true)
|
||||
public class TestExampleMetadata
|
||||
{
|
||||
private static final Logger LOG = Logger.get(TestExampleMetadata.class);
|
||||
private static final ExampleTableHandle NUMBERS_TABLE_HANDLE = new ExampleTableHandle("example", "numbers");
|
||||
private ExampleMetadata metadata;
|
||||
|
||||
|
|
@ -82,12 +84,14 @@ public class TestExampleMetadata
|
|||
fail("Expected getColumnHandle of unknown table to throw a TableNotFoundException");
|
||||
}
|
||||
catch (TableNotFoundException expected) {
|
||||
LOG.info("Error message: " + expected.getMessage());
|
||||
}
|
||||
try {
|
||||
metadata.getColumnHandles(SESSION, new ExampleTableHandle("example", "unknown"));
|
||||
fail("Expected getColumnHandle of unknown table to throw a TableNotFoundException");
|
||||
}
|
||||
catch (TableNotFoundException expected) {
|
||||
LOG.info("Error message: " + expected.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -360,7 +360,6 @@ public class TestGeometryUnionGeoAggregation
|
|||
{
|
||||
List<String> wktList = Arrays.stream(wkts).map(wkt -> format("ST_GeometryFromText('%s')", wkt)).collect(toList());
|
||||
String wktArray = format("ARRAY[%s]", COMMA_JOINER.join(wktList));
|
||||
// ST_Union(ARRAY[ST_GeometryFromText('...'), ...])
|
||||
assertFunction(format("geometry_union(%s)", wktArray), GEOMETRY, expectedWkt);
|
||||
|
||||
reverse(wktList);
|
||||
|
|
|
|||
|
|
@ -201,21 +201,21 @@ public interface HiveCoercer
|
|||
requireNonNull(toHiveType, "toHiveType is null");
|
||||
List<HiveType> fromFieldTypes = extractStructFieldTypes(fromHiveType);
|
||||
List<HiveType> toFieldTypes = extractStructFieldTypes(toHiveType);
|
||||
ImmutableList.Builder<Optional<Function<Block, Block>>> coercers = ImmutableList.builder();
|
||||
ImmutableList.Builder<Optional<Function<Block, Block>>> coercersBuilder = ImmutableList.builder();
|
||||
this.nullBlocks = new Block[toFieldTypes.size()];
|
||||
for (int i = 0; i < toFieldTypes.size(); i++) {
|
||||
if (i >= fromFieldTypes.size()) {
|
||||
nullBlocks[i] = toFieldTypes.get(i).getType(typeManager).createBlockBuilder(null, 1).appendNull().build();
|
||||
coercers.add(Optional.empty());
|
||||
coercersBuilder.add(Optional.empty());
|
||||
}
|
||||
else if (!fromFieldTypes.get(i).equals(toFieldTypes.get(i))) {
|
||||
coercers.add(Optional.of(createCoercer(typeManager, fromFieldTypes.get(i), toFieldTypes.get(i))));
|
||||
coercersBuilder.add(Optional.of(createCoercer(typeManager, fromFieldTypes.get(i), toFieldTypes.get(i))));
|
||||
}
|
||||
else {
|
||||
coercers.add(Optional.empty());
|
||||
coercersBuilder.add(Optional.empty());
|
||||
}
|
||||
}
|
||||
this.coercers = coercers.build();
|
||||
this.coercers = coercersBuilder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -139,8 +139,8 @@ public class FileHiveMetastore
|
|||
{
|
||||
HiveConfig hiveConfig = new HiveConfig();
|
||||
HdfsConfiguration hdfsConfiguration = new HiveHdfsConfiguration(new HdfsConfigurationInitializer(hiveConfig), ImmutableSet.of());
|
||||
HdfsEnvironment hdfsEnvironment = new HdfsEnvironment(hdfsConfiguration, hiveConfig, new NoHdfsAuthentication());
|
||||
return new FileHiveMetastore(hdfsEnvironment, catalogDirectory.toURI().toString(), "test");
|
||||
HdfsEnvironment localHdfsEnvironment = new HdfsEnvironment(hdfsConfiguration, hiveConfig, new NoHdfsAuthentication());
|
||||
return new FileHiveMetastore(localHdfsEnvironment, catalogDirectory.toURI().toString(), "test");
|
||||
}
|
||||
|
||||
@Inject
|
||||
|
|
@ -647,6 +647,7 @@ public class FileHiveMetastore
|
|||
metadataFileSystem.delete(createdFile, false);
|
||||
}
|
||||
catch (IOException ignored) {
|
||||
// could be ignored
|
||||
}
|
||||
}
|
||||
throw e;
|
||||
|
|
|
|||
|
|
@ -399,8 +399,9 @@ public class GlueHiveMetastore
|
|||
}
|
||||
|
||||
@Override
|
||||
public void createDatabase(HiveIdentity identity, Database database)
|
||||
public void createDatabase(HiveIdentity identity, Database inputDatabase)
|
||||
{
|
||||
Database database = inputDatabase;
|
||||
if (!database.getLocation().isPresent() && defaultDir.isPresent()) {
|
||||
String databaseLocation = new Path(defaultDir.get(), database.getDatabaseName()).toString();
|
||||
database = Database.builder(database)
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue