Skip to content

Commit

Permalink
Use identity map to link nodes to resolved names and output schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
martint committed Oct 18, 2012
1 parent 4fb6361 commit 69788c7
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/main/java/com/facebook/presto/sql/tree/TreePrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,24 @@
import com.facebook.presto.sql.compiler.Schema;
import com.google.common.base.Joiner;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;

import java.io.PrintStream;
import java.util.Map;
import java.util.IdentityHashMap;

public class TreePrinter
{
private static final String INDENT = " ";

private final Map<QualifiedNameReference, QualifiedName> resolvedNameReferences;
private final ImmutableMap<Node, Schema> outputSchemas;
private final IdentityHashMap<QualifiedNameReference, QualifiedName> resolvedNameReferences;
private final IdentityHashMap<Node, Schema> outputSchemas;
private final PrintStream out;

public TreePrinter(Map<QualifiedNameReference, QualifiedName> resolvedNameReferences,
Map<Node, Schema> outputSchemas,
public TreePrinter(IdentityHashMap<QualifiedNameReference, QualifiedName> resolvedNameReferences,
IdentityHashMap<Node, Schema> outputSchemas,
PrintStream out)
{
this.resolvedNameReferences = ImmutableMap.copyOf(resolvedNameReferences);
this.outputSchemas = ImmutableMap.copyOf(outputSchemas);
this.resolvedNameReferences = new IdentityHashMap<>(resolvedNameReferences);
this.outputSchemas = new IdentityHashMap<>(outputSchemas);
this.out = out;
}

Expand Down

0 comments on commit 69788c7

Please sign in to comment.