use tableHandle.getSchemaPrefixedTableName to workaroud for tableHandle.getCatalogName is not mistake after JdbcPlanOptimizer(pushdown handle)
This commit is contained in:
parent
91b7ac12f2
commit
a6420d6103
|
|
@ -808,7 +808,7 @@ public class OracleClient
|
|||
return jdbcTableHandle;
|
||||
}
|
||||
|
||||
public void setStatement(ConnectorSession session, ConnectorTableHandle tableHandle, PreparedStatement statement, Block block, int position, int channel)
|
||||
private void setStatement(ConnectorSession session, ConnectorTableHandle tableHandle, PreparedStatement statement, Block block, int position, int channel)
|
||||
throws SQLException
|
||||
{
|
||||
JdbcTableHandle jdbcTableHandle = (JdbcTableHandle) tableHandle;
|
||||
|
|
@ -877,8 +877,7 @@ public class OracleClient
|
|||
{
|
||||
JdbcTableHandle tableHandle = (JdbcTableHandle) handle;
|
||||
return format(
|
||||
"DELETE FROM %s WHERE ROWID=%s",
|
||||
quoted(tableHandle.getCatalogName(), tableHandle.getSchemaName(), tableHandle.getTableName()), "?");
|
||||
"DELETE FROM %s WHERE ROWID=%s", tableHandle.getSchemaPrefixedTableName(), "?");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -886,7 +885,7 @@ public class OracleClient
|
|||
{
|
||||
JdbcTableHandle tableHandle = (JdbcTableHandle) handle;
|
||||
StringBuilder sqlBuilder = new StringBuilder();
|
||||
sqlBuilder.append(format("UPDATE %s SET ", quoted(tableHandle.getCatalogName(), tableHandle.getSchemaName(), tableHandle.getTableName())));
|
||||
sqlBuilder.append(format("UPDATE %s SET ", tableHandle.getSchemaPrefixedTableName()));
|
||||
for (int i = 0; i < setNum; i++) {
|
||||
sqlBuilder.append(updatedColumns.get(i));
|
||||
sqlBuilder.append(" = ? ");
|
||||
|
|
|
|||
|
|
@ -16,10 +16,6 @@ package io.hetu.core.plugin.oracle.optimization;
|
|||
|
||||
import io.prestosql.plugin.jdbc.optimization.BaseJdbcSqlStatementWriter;
|
||||
import io.prestosql.plugin.jdbc.optimization.JdbcPushDownParameter;
|
||||
import io.prestosql.spi.sql.expression.Selection;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
public class OracleSqlStatementWriter
|
||||
extends BaseJdbcSqlStatementWriter
|
||||
|
|
@ -42,32 +38,4 @@ public class OracleSqlStatementWriter
|
|||
{
|
||||
return "SELECT * FROM (" + table + ") WHERE ROWNUM <= " + count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String from(String selections, String from)
|
||||
{
|
||||
if (from.contains(")")) {
|
||||
return selections + " FROM " + from.substring(0, from.lastIndexOf(")"));
|
||||
}
|
||||
else {
|
||||
return selections + " FROM " + from;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String select(List<Selection> selections)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder("SELECT ");
|
||||
if (selections == null || selections.size() == 0) {
|
||||
builder.append("null");
|
||||
}
|
||||
else {
|
||||
StringJoiner joiner = new StringJoiner(", ");
|
||||
for (Selection selection : selections) {
|
||||
joiner.add(selection.getExpression());
|
||||
}
|
||||
builder.append(joiner);
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue