Repository: reata/sqllineage

Issue:
Empty Statement return
take the following sql as example

```sql
SELECT 1;

-- SELECT 2;
```

the parsing result says that it contains two statements, instead of one.

Discussion:
codecov-io: # [Codecov](https://codecov.io/gh/reata/sqllineage/pull/26?src=pr&el=h1) Report
> Merging [#26](https://codecov.io/gh/reata/sqllineage/pull/26?src=pr&el=desc) into [master](https://codecov.io/gh/reata/sqllineage/commit/c7ea5d861359fe49692e2036b9e382af73ba8069?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/reata/sqllineage/pull/26/graphs/tree.svg?width=650&token=latkaw2Lx6&height=150&src=pr)](https://codecov.io/gh/reata/sqllineage/pull/26?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master      #26   +/-   ##
=======================================
  Coverage   79.79%   79.79%           
=======================================
  Files           1        1           
  Lines          99       99           
=======================================
  Hits           79       79           
  Misses         20       20
```


| [Impacted Files](https://codecov.io/gh/reata/sqllineage/pull/26?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [sqllineage/core.py](https://codecov.io/gh/reata/sqllineage/pull/26/diff?src=pr&el=tree#diff-c3FsbGluZWFnZS9jb3JlLnB5) | `79.79% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/reata/sqllineage/pull/26?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/reata/sqllineage/pull/26?src=pr&el=footer). Last update [c7ea5d8...70bae50](https://codecov.io/gh/reata/sqllineage/pull/26?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/sqllineage/core.py b/sqllineage/core.py
index 2faa914..fbfff54 100644
--- a/sqllineage/core.py
+++ b/sqllineage/core.py
@@ -18,7 +18,7 @@ class LineageParser(object):
         self._encoding = encoding
         self._source_tables = set()
         self._target_tables = set()
-        self._stmt = sqlparse.parse(sql.strip(), self._encoding)
+        self._stmt = [s for s in sqlparse.parse(sql.strip(), self._encoding) if s.get_type() != "UNKNOWN"]
         for stmt in self._stmt:
             if stmt.get_type() == "DROP":
                 self._target_tables -= {t.get_real_name() for t in stmt.tokens if isinstance(t, Identifier)}


Test patch:
diff --git a/tests/test_others.py b/tests/test_others.py
index 7e0a287..9a0b89f 100644
--- a/tests/test_others.py
+++ b/tests/test_others.py
@@ -43,3 +43,10 @@ def test_split_statements():
 def test_split_statements_with_heading_and_ending_new_line():
     sql = "\nSELECT * FROM tab1;\nSELECT * FROM tab2;\n"
     assert len(LineageParser(sql).statements) == 2
+
+
+def test_split_statements_with_comment():
+    sql = """SELECT 1;
+
+-- SELECT 2;"""
+    assert len(LineageParser(sql).statements) == 1