diff --git a/java/com/metabase/macaw/ASTWalker.java b/java/com/metabase/macaw/ASTWalker.java
index 0e7991c..68d3dc8 100644
--- a/java/com/metabase/macaw/ASTWalker.java
+++ b/java/com/metabase/macaw/ASTWalker.java
@@ -173,12 +173,12 @@
import net.sf.jsqlparser.statement.upsert.Upsert;
/**
- * Walks the AST, using JSqlParser's `visit()` methods. Each `visit()` method additionally calls an applicable callback method provided in the `callbacks` map.
- * Supported callbacks have a corresponding key string (see below).
+ * Walks the AST, using JSqlParser's `visit()` methods. Each `visit()` method additionally calls an applicable callback
+ * method provided in the `callbacks` map. Supported callbacks have a corresponding key string (see below).
*
* Why this class? Why the callbacks?
*
- * Clojure is not good at working with Java Visitors. They require overriding various overloaded
+ * Clojure is not good at working with Java visitors. They require overriding various overloaded
* methods and, in the case of walking a tree (exactly what we want to do here) we of course need to call `visit()`
* recursively.
*
diff --git a/src/macaw/core.clj b/src/macaw/core.clj
index 6479cc3..89037b1 100644
--- a/src/macaw/core.clj
+++ b/src/macaw/core.clj
@@ -15,17 +15,17 @@
(defn query->components
"Given a parsed query (i.e., a [subclass of] `Statement`) return a map with the `:tables` and `:columns` found within it.
- (Specifically, it returns their fully-qualified names as strings, where 'fully-qualified' means 'as found in the query'.)"
+ (Specifically, it returns their fully-qualified names as strings, where 'fully-qualified' means 'as referred to in the query'; this function doesn't do additional inference work to find out a table's schema.)"
[^Statement parsed-query]
- (let [column-names (transient #{})
- table-names (transient #{})
+ (let [column-names (atom #{})
+ table-names (atom #{})
ast-walker (ASTWalker. {:column (fn [^Column column]
- (conj! column-names (.getColumnName column)))
+ (swap! column-names conj (.getColumnName column)))
:table (fn [^Table table]
- (conj! table-names (.getFullyQualifiedName table)))})]
+ (swap! table-names conj (.getFullyQualifiedName table)))})]
(.walk ast-walker parsed-query)
- {:columns (persistent! column-names)
- :tables (persistent! table-names)}))
+ {:columns @column-names
+ :tables @table-names}))
(defn parsed-query
"Main entry point: takes a string query and returns a `Statement` object that can be handled by the other functions."