Repository: reata/sqllineage (python)

Issue:
Table/Column Lineage Mixed up For Self Dependent SQL
```sql
INSERT OVERWRITE TABLE foo
SELECT col FROM foo
WHERE flag IS NOT NULL
```

```
Statements(#): 1
Source Tables:
    <default>.foo
    <default>.foo.col
Target Tables:
    <default>.foo
    <default>.foo.col
```

Column lineage is displayed by mistake here.

Pull request description:
fix: table/column lineage mixed up for self dependent SQL
Closes #219 

Patch:
diff --git a/sqllineage/core/holders.py b/sqllineage/core/holders.py
index d9ce561..d82a013 100644
--- a/sqllineage/core/holders.py
+++ b/sqllineage/core/holders.py
@@ -215,11 +215,11 @@ class SQLLineageHolder(ColumnLineageMixin):
         intermediate_tables -= self.__retrieve_tag_tables(NodeTag.SELFLOOP)
         return intermediate_tables
 
-    def __retrieve_tag_tables(self, tag) -> Set[Table]:
+    def __retrieve_tag_tables(self, tag) -> Set[Union[Path, Table]]:
         return {
             table
             for table, attr in self.graph.nodes(data=True)
-            if attr.get(tag) is True
+            if attr.get(tag) is True and isinstance(table, DATASET_CLASSES)
         }
 
     @staticmethod


Test patch:
diff --git a/tests/test_insert.py b/tests/test_insert.py
index 1be5160..b01e1aa 100644
--- a/tests/test_insert.py
+++ b/tests/test_insert.py
@@ -56,6 +56,16 @@ def test_insert_overwrite_values():
 
 
 def test_insert_overwrite_from_self():
+    assert_table_lineage_equal(
+        """INSERT OVERWRITE TABLE foo
+SELECT col FROM foo
+WHERE flag IS NOT NULL""",
+        {"foo"},
+        {"foo"},
+    )
+
+
+def test_insert_overwrite_from_self_with_join():
     assert_table_lineage_equal(
         """INSERT OVERWRITE TABLE tab_1
 SELECT tab_2.col_a from tab_2