提交 2f6921ae authored 作者: Owner's avatar Owner

Removed debug statements

上级 920722fc
...@@ -1094,29 +1094,11 @@ public class Parser { ...@@ -1094,29 +1094,11 @@ public class Parser {
} }
return command; return command;
} }
/*
* TODO finish writing this MergeUsing
MERGE INTO targetTableName [[AS] t_alias] USING table_reference [[AS} s_alias] ON ( condition ,...)
WHEN MATCHED THEN
[UPDATE SET column1 = value1 [, column2 = value2 ... WHERE ...]
[DELETE WHERE ...]
WHEN NOT MATCHED THEN
INSERT (column1 [, column2 ...]) VALUES (value1 [, value2 ...]);
table_reference ::= table | view | ( sub-query )
The current implementation (for comparison) uses this syntax:
MERGE INTO tablename [(columnName1,...)]
[KEY (keyColumnName1,...)]
[ VALUES (expression1,...) | SELECT ...]
*/
/* TODO: Finish coding parseMergeUsing */
private MergeUsing parseMergeUsing(Merge oldCommand, int start) { private MergeUsing parseMergeUsing(Merge oldCommand, int start) {
/* TODO: not sure why schema name is reset to null */
if(schemaName==null){ if(schemaName==null){
schemaName = session.getCurrentSchemaName(); schemaName = session.getCurrentSchemaName();
System.out.println("schemaName="+schemaName);
} }
Schema schema = getSchema(); Schema schema = getSchema();
...@@ -1125,29 +1107,25 @@ public class Parser { ...@@ -1125,29 +1107,25 @@ public class Parser {
currentPrepared = command; currentPrepared = command;
if (readIf("(")) { if (readIf("(")) {
System.out.println("pre select schema="+getSchema()+",schemaName="+schemaName); /* a select query is supplied */
if (isSelect()) { if (isSelect()) {
command.setQuery(parseSelect()); command.setQuery(parseSelect());
System.out.println("post select schema="+getSchema()+",schemaName="+schemaName);
schemaName = savedSchemaName; schemaName = savedSchemaName;
System.out.println("post2 select schema="+getSchema()+",schemaName="+schemaName);
read(")"); read(")");
} }
command.setQueryAlias(readFromAlias(null, Arrays.asList("ON"))); command.setQueryAlias(readFromAlias(null, Arrays.asList("ON")));
String[] querySQLOutput = new String[]{null}; String[] querySQLOutput = new String[]{null};
List<Column> columnTemplateList = createQueryColumnTemplateList(null, command.getQuery(), querySQLOutput); List<Column> columnTemplateList = createQueryColumnTemplateList(null, command.getQuery(), querySQLOutput);
System.out.println("pre:alias="+command.getQueryAlias()+",sql="+querySQLOutput[0]+",ctlist="+columnTemplateList+",schema="+getSchema()+",schemaName="+schemaName);
TableView temporarySourceTableView = createTemporarySessionView(command.getQueryAlias(), querySQLOutput[0], columnTemplateList, false, false); TableView temporarySourceTableView = createTemporarySessionView(command.getQueryAlias(), querySQLOutput[0], columnTemplateList, false, false);
command.setTemporaryTableView(temporarySourceTableView); command.setTemporaryTableView(temporarySourceTableView);
System.out.println("sourceTableFilter with tableOrView="+temporarySourceTableView);
System.out.println("sourceTableFilter rightsChecked="+rightsChecked);
TableFilter sourceTableFilter = new TableFilter(session, temporarySourceTableView, command.getQueryAlias(), rightsChecked, TableFilter sourceTableFilter = new TableFilter(session, temporarySourceTableView, command.getQueryAlias(), rightsChecked,
(Select) command.getQuery(), 0, null); (Select) command.getQuery(), 0, null);
command.setSourceTableFilter(sourceTableFilter); command.setSourceTableFilter(sourceTableFilter);
} }
else{ else{
/* Its a table name, simulate a query by building a select query for the table */
List<String> excludeIdentifiers = Arrays.asList("ON"); List<String> excludeIdentifiers = Arrays.asList("ON");
TableFilter sourceTableFilter = readSimpleTableFilterWithAliasExcludes(0,excludeIdentifiers); TableFilter sourceTableFilter = readSimpleTableFilterWithAliasExcludes(0,excludeIdentifiers);
command.setSourceTableFilter(sourceTableFilter); command.setSourceTableFilter(sourceTableFilter);
...@@ -1157,9 +1135,7 @@ public class Parser { ...@@ -1157,9 +1135,7 @@ public class Parser {
if(sourceTableFilter.getTableAlias()!=null){ if(sourceTableFilter.getTableAlias()!=null){
buff.append(" AS "+sourceTableFilter.getTableAlias()); buff.append(" AS "+sourceTableFilter.getTableAlias());
} }
//ArrayList<Value> paramValues = New.arrayList();
Prepared preparedQuery = prepare(session, buff.toString(), null/*paramValues*/); Prepared preparedQuery = prepare(session, buff.toString(), null/*paramValues*/);
System.out.println("class="+preparedQuery.getClass());
command.setQuery((Select)preparedQuery); command.setQuery((Select)preparedQuery);
} }
...@@ -1197,14 +1173,6 @@ public class Parser { ...@@ -1197,14 +1173,6 @@ public class Parser {
} }
} }
if(command.getQueryAlias()!=null){
if(schema==null){
System.out.println("Why oh why is the schema null???");
System.out.println("schemaName="+schemaName);
throw DbException.getUnsupportedException("unexpected null schema");
}
}
setSQL(command, "MERGE", start); setSQL(command, "MERGE", start);
return command; return command;
} }
...@@ -5198,7 +5166,6 @@ public class Parser { ...@@ -5198,7 +5166,6 @@ public class Parser {
withQuery.prepare(); withQuery.prepare();
querySQLOutput[0] = StringUtils.cache(withQuery.getPlanSQL()); querySQLOutput[0] = StringUtils.cache(withQuery.getPlanSQL());
ArrayList<Expression> withExpressions = withQuery.getExpressions(); ArrayList<Expression> withExpressions = withQuery.getExpressions();
System.out.println("withExpressions="+withExpressions);
for (int i = 0; i < withExpressions.size(); ++i) { for (int i = 0; i < withExpressions.size(); ++i) {
Expression columnExp = withExpressions.get(i); Expression columnExp = withExpressions.get(i);
// use the passed in column name if supplied, otherwise use alias (if used) otherwise use column name // use the passed in column name if supplied, otherwise use alias (if used) otherwise use column name
...@@ -5225,7 +5192,6 @@ public class Parser { ...@@ -5225,7 +5192,6 @@ public class Parser {
// No easy way to determine if this is a recursive query up front, so we just compile // No easy way to determine if this is a recursive query up front, so we just compile
// it twice - once without the flag set, and if we didn't see a recursive term, // it twice - once without the flag set, and if we didn't see a recursive term,
// then we just compile it again. // then we just compile it again.
System.out.println("createTemporarySessionView="+tempViewName);
TableView view = new TableView(schema, id, tempViewName, querySQL, TableView view = new TableView(schema, id, tempViewName, querySQL,
parameters, columnTemplateList.toArray(new Column[0]), session, parameters, columnTemplateList.toArray(new Column[0]), session,
allowRecursiveQueryDetection/* recursive */, false); allowRecursiveQueryDetection/* recursive */, false);
......
...@@ -492,10 +492,8 @@ public class Comparison extends Condition { ...@@ -492,10 +492,8 @@ public class Comparison extends Condition {
@Override @Override
public void mapColumns(ColumnResolver resolver, int level) { public void mapColumns(ColumnResolver resolver, int level) {
System.out.println("Checking left:"+left+" against "+resolver);
left.mapColumns(resolver, level); left.mapColumns(resolver, level);
if (right != null) { if (right != null) {
System.out.println("Checking right:"+right+" against "+resolver);
right.mapColumns(resolver, level); right.mapColumns(resolver, level);
} }
} }
......
...@@ -117,11 +117,9 @@ public class ExpressionColumn extends Expression { ...@@ -117,11 +117,9 @@ public class ExpressionColumn extends Expression {
queryLevel = level; queryLevel = level;
column = col; column = col;
this.columnResolver = resolver; this.columnResolver = resolver;
System.out.println("mapColumn: Setting resolver:"+col+"@"+System.identityHashCode(col)+" by resolver "+resolver+"-"+resolver.getClass());
} else if (queryLevel == level && this.columnResolver != resolver) { } else if (queryLevel == level && this.columnResolver != resolver) {
if (resolver instanceof SelectListColumnResolver) { if (resolver instanceof SelectListColumnResolver) {
// ignore - already mapped, that's ok // ignore - already mapped, that's ok
System.out.println("mapColumn: Already mapped:"+col+"@"+System.identityHashCode(col)+" by resolver "+resolver+"-"+resolver.getClass());
} else { } else {
throw DbException.get(ErrorCode.AMBIGUOUS_COLUMN_NAME_1, columnName); throw DbException.get(ErrorCode.AMBIGUOUS_COLUMN_NAME_1, columnName);
} }
......
...@@ -85,9 +85,6 @@ public abstract class Table extends SchemaObjectBase { ...@@ -85,9 +85,6 @@ public abstract class Table extends SchemaObjectBase {
public Table(Schema schema, int id, String name, boolean persistIndexes, public Table(Schema schema, int id, String name, boolean persistIndexes,
boolean persistData) { boolean persistData) {
System.out.println("newTable:schema="+schema);
System.out.println("newTable:name="+name);
System.out.println("newTable:schema="+schema+",database="+schema.getDatabase());
columnMap = schema.getDatabase().newStringMap(); columnMap = schema.getDatabase().newStringMap();
initSchemaObjectBase(schema, id, name, Trace.TABLE); initSchemaObjectBase(schema, id, name, Trace.TABLE);
this.persistIndexes = persistIndexes; this.persistIndexes = persistIndexes;
......
...@@ -567,8 +567,6 @@ public class TableFilter implements ColumnResolver { ...@@ -567,8 +567,6 @@ public class TableFilter implements ColumnResolver {
private void checkTimeout() { private void checkTimeout() {
session.checkCanceled(); session.checkCanceled();
// System.out.println(this.alias+ " " + table.getName() + ": " +
// scanCount);
} }
/** /**
......
...@@ -191,7 +191,6 @@ public class TestMergeUsing extends TestBase { ...@@ -191,7 +191,6 @@ public class TestMergeUsing extends TestBase {
while (rs.next()) { while (rs.next()) {
rowCount++; rowCount++;
diffBuffer.append("|"); diffBuffer.append("|");
System.out.println("rs.getMetaData().getColumnCount()="+rs.getMetaData().getColumnCount());
for(int ndx = 1; ndx <= rs.getMetaData().getColumnCount(); ndx++){ for(int ndx = 1; ndx <= rs.getMetaData().getColumnCount(); ndx++){
diffBuffer.append(rs.getObject(ndx)); diffBuffer.append(rs.getObject(ndx));
diffBuffer.append("|\n"); diffBuffer.append("|\n");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论