Skip to content

Commit

Permalink
XX
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe-Abraham committed Oct 9, 2024
1 parent b287058 commit ad8da3e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.logging.Logger;
Expand Down Expand Up @@ -102,6 +102,7 @@ public ContainerQueryRunner(int coordinatorPort, String catalog, String schema,
try {
Connection connection = DriverManager.getConnection(url, "test", null);
statement = connection.createStatement();
statement.execute("set session remote_functions_enabled=true");
}
catch (Exception e) {
e.printStackTrace();
Expand Down Expand Up @@ -286,9 +287,9 @@ public Session getDefaultSession()
public MaterializedResult execute(Session session, String sql)
{
try {
ResultSet resultSet = statement.executeQuery(sql);
return ContainerQueryRunnerUtils
.toMaterializedResult(
statement.executeQuery(sql));
.toMaterializedResult(resultSet);
}
catch (SQLException e) {
throw new RuntimeException("Error executing query: " + sql, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,10 @@ private static Type mapSqlTypeToType(int sqlType)
case java.sql.Types.VARCHAR:
return VarcharType.VARCHAR;
case java.sql.Types.DOUBLE:
case java.sql.Types.FLOAT:
return DoubleType.DOUBLE;
case java.sql.Types.BOOLEAN:
return BooleanType.BOOLEAN;
case java.sql.Types.FLOAT:
return DoubleType.DOUBLE;
case java.sql.Types.TIMESTAMP:
return TimestampType.TIMESTAMP;
case java.sql.Types.DATE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.testng.annotations.Test;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;

public class TestPrestoContainerRemoteFunction
extends AbstractTestQueryFramework
Expand All @@ -35,17 +34,6 @@ protected ContainerQueryRunner createQueryRunner()
@Test
public void testPresenceAndBasicFunctionality()
{
assertTrue(
computeActual("SHOW catalogs").toString().contains("tpch"),
"tpch catalog is not present.");
System.out.println(computeActual("set session remote_functions_enabled=true").toString());
assertEquals(computeActual("select remote.default.abs(-10)").toString(),"10");
}

@Test
public void testPresenceAndBasicFunctionality1()
{
System.out.println(computeActual("SHOW catalogs").toString());
assertEquals(computeActual("select remote.default.abs(-10)").getMaterializedRows().toString(),"10");
assertEquals(computeActual("select remote.default.abs(-10)").getMaterializedRows().get(0).getField(0).toString(), "10");
}
}

0 comments on commit ad8da3e

Please sign in to comment.