Skip to content

Commit

Permalink
Merge pull request #4 from aerospike/develop
Browse files Browse the repository at this point in the history
v1.3.0
  • Loading branch information
reugn authored Jun 13, 2021
2 parents e5a6267 + 8fc2264 commit 9e46f17
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 36 deletions.
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<name>aerospike-jdbc</name>
<description>A JDBC driver for the Aerospike database</description>
<url>https://github.com/aerospike/aerospike-jdbc</url>
<version>1.2.0</version>
<version>1.3.0</version>

<properties>
<skipTests>true</skipTests>
Expand All @@ -25,10 +25,10 @@
<maven-gpg-plugin.version>1.5</maven-gpg-plugin.version>
<maven-shade-plugin.version>3.1.1</maven-shade-plugin.version>

<aerospike-client.version>5.1.0</aerospike-client.version>
<netty.version>4.1.63.Final</netty.version>
<aerospike-client.version>5.1.3</aerospike-client.version>
<netty.version>4.1.65.Final</netty.version>
<jackson.version>2.12.3</jackson.version>
<presto-parser.version>347</presto-parser.version>
<trino-parser.version>358</trino-parser.version>
</properties>

<licenses>
Expand Down Expand Up @@ -94,9 +94,9 @@
</dependency>

<dependency>
<groupId>io.prestosql</groupId>
<artifactId>presto-parser</artifactId>
<version>${presto-parser.version}</version>
<groupId>io.trino</groupId>
<artifactId>trino-parser</artifactId>
<version>${trino-parser.version}</version>
</dependency>

<!-- for testing -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.aerospike.jdbc.sql.type.ByteArrayBlob;
import com.aerospike.jdbc.sql.type.StringClob;
import com.aerospike.jdbc.util.IOUtils;
import io.prestosql.sql.parser.ParsingOptions;
import io.trino.sql.parser.ParsingOptions;

import java.io.DataInputStream;
import java.io.EOFException;
Expand All @@ -29,7 +29,7 @@
import java.util.logging.Logger;

import static com.aerospike.jdbc.util.PreparedStatement.parseParameters;
import static io.prestosql.sql.parser.ParsingOptions.DecimalLiteralTreatment.AS_DOUBLE;
import static io.trino.sql.parser.ParsingOptions.DecimalLiteralTreatment.AS_DOUBLE;
import static java.lang.String.format;

public class AerospikePreparedStatement extends AerospikeStatement implements PreparedStatement {
Expand All @@ -48,7 +48,7 @@ public AerospikePreparedStatement(IAerospikeClient client, Connection connection
parameterValues = new Object[n];
Arrays.fill(parameterValues, Optional.empty());
ParsingOptions parsingOptions = new ParsingOptions(AS_DOUBLE);
io.prestosql.sql.tree.Statement statement = SQL_PARSER.createStatement(sql, parsingOptions);
io.trino.sql.tree.Statement statement = SQL_PARSER.createStatement(sql, parsingOptions);
query = AerospikeQueryParser.parseSql(statement);
columns = AerospikeSchemaBuilder.getSchema(query.getSchemaTable(), client);
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/aerospike/jdbc/AerospikeStatement.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import com.aerospike.jdbc.query.QueryPerformer;
import com.aerospike.jdbc.sql.SimpleWrapper;
import com.aerospike.jdbc.util.AuxStatementParser;
import io.prestosql.sql.parser.ParsingOptions;
import io.prestosql.sql.parser.SqlParser;
import io.trino.sql.parser.ParsingOptions;
import io.trino.sql.parser.SqlParser;

import java.sql.Connection;
import java.sql.ResultSet;
Expand All @@ -18,7 +18,7 @@
import java.sql.Statement;
import java.util.logging.Logger;

import static io.prestosql.sql.parser.ParsingOptions.DecimalLiteralTreatment.AS_DOUBLE;
import static io.trino.sql.parser.ParsingOptions.DecimalLiteralTreatment.AS_DOUBLE;
import static java.lang.String.format;
import static java.sql.ResultSet.*;

Expand Down Expand Up @@ -62,7 +62,7 @@ public ResultSet executeQuery(String sql) {
private AerospikeQuery parseQuery(String sql) {
final String sqlEscape = sql.replaceAll("\n", " ");
AerospikeQuery query = AuxStatementParser.hack(sqlEscape).orElseGet(() -> {
io.prestosql.sql.tree.Statement statement = SQL_PARSER.createStatement(sqlEscape, parsingOptions);
io.trino.sql.tree.Statement statement = SQL_PARSER.createStatement(sqlEscape, parsingOptions);
return AerospikeQueryParser.parseSql(statement);
});
if (query.getSchema() == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import io.prestosql.sql.SqlFormatter;
import io.prestosql.sql.tree.*;
import io.trino.sql.SqlFormatter;
import io.trino.sql.tree.*;

import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
Expand Down Expand Up @@ -78,7 +78,7 @@ private static boolean isAsciiPrintable(int codePoint) {

private static String formatGroupingSet(List<Expression> groupingSet) {
return String.format("(%s)", Joiner.on(", ").join(groupingSet.stream()
.map(io.prestosql.sql.ExpressionFormatter::formatExpression).iterator()));
.map(io.trino.sql.ExpressionFormatter::formatExpression).iterator()));
}

private static Function<SortItem, String> sortItemFormatterFunction() {
Expand Down Expand Up @@ -243,7 +243,7 @@ protected String visitIdentifier(Identifier node, Void context) {
}

protected String visitLambdaArgumentDeclaration(LambdaArgumentDeclaration node, Void context) {
return io.prestosql.sql.ExpressionFormatter.formatExpression(node.getName());
return io.trino.sql.ExpressionFormatter.formatExpression(node.getName());
}

protected String visitSymbolReference(SymbolReference node, Void context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.Iterables;
import io.prestosql.sql.ExpressionFormatter;
import io.prestosql.sql.tree.*;
import io.trino.sql.ExpressionFormatter;
import io.trino.sql.tree.*;

import java.util.Arrays;
import java.util.Iterator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.aerospike.jdbc.model.OpType;
import com.aerospike.jdbc.model.WhereExpression;
import io.prestosql.sql.tree.*;
import io.trino.sql.tree.*;

public class AerospikeWhereParser {

Expand Down
16 changes: 8 additions & 8 deletions src/main/java/com/aerospike/jdbc/query/ExpressionBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,18 @@ private static Pair<Exp, Exp> parseComparable(WhereExpression whereExpression) {
);
} catch (NumberFormatException ignore) {
}
// if (value.equalsIgnoreCase("true") ||
// value.equalsIgnoreCase("false")) {
// return new Pair<>(
// Exp.boolBin(whereExpression.getColumn()), // TODO will be available with the next client version
// Exp.val(Boolean.parseBoolean(value))
// );
// } else {
if (value.equalsIgnoreCase("true") ||
value.equalsIgnoreCase("false")) {
return new Pair<>(
Exp.boolBin(whereExpression.getColumn()),
Exp.val(Boolean.parseBoolean(value))
);
} else {
return new Pair<>(
Exp.stringBin(whereExpression.getColumn()),
Exp.val(value)
);
// }
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private static AerospikeQuery buildQuery(String queryString, String setString) {
columns.add(arr[0]);
values.add(arr[1]);
});
io.prestosql.sql.tree.Statement statement = SQL_PARSER.createStatement(queryString, parsingOptions);
io.trino.sql.tree.Statement statement = SQL_PARSER.createStatement(queryString, parsingOptions);
AerospikeQuery query = AerospikeQueryParser.parseSql(statement);

query.setColumns(columns);
Expand Down
12 changes: 6 additions & 6 deletions src/test/java/com/aerospike/jdbc/StatementBuilderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
import com.aerospike.jdbc.query.AerospikeQueryParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.prestosql.sql.SqlFormatter;
import io.prestosql.sql.parser.ParsingOptions;
import io.prestosql.sql.parser.SqlParser;
import io.prestosql.sql.tree.Statement;
import io.trino.sql.SqlFormatter;
import io.trino.sql.parser.ParsingOptions;
import io.trino.sql.parser.SqlParser;
import io.trino.sql.tree.Statement;
import org.testng.annotations.Test;

import static com.google.common.base.Strings.repeat;
import static io.prestosql.sql.parser.ParsingOptions.DecimalLiteralTreatment.AS_DOUBLE;
import static io.prestosql.sql.testing.TreeAssertions.assertFormattedSql;
import static io.trino.sql.parser.ParsingOptions.DecimalLiteralTreatment.AS_DOUBLE;
import static io.trino.sql.testing.TreeAssertions.assertFormattedSql;

public class StatementBuilderTest {

Expand Down

0 comments on commit 9e46f17

Please sign in to comment.