john-bodley commented on a change in pull request #5295: [sqllab] Fix sqllab 
limit regex issue with sqlparse
URL: 
https://github.com/apache/incubator-superset/pull/5295#discussion_r200436999
 
 

 ##########
 File path: tests/db_engine_specs_test.py
 ##########
 @@ -193,11 +181,62 @@ def test_limit_expr_and_semicolon(self):
                     'LIMIT 777' AS a
                     , b
                 FROM
-                table LIMIT 1000"""),
+                table
+                LIMIT         1000            ;"""),
         )
 
     def test_get_datatype(self):
         self.assertEquals('STRING', PrestoEngineSpec.get_datatype('string'))
         self.assertEquals('TINY', MySQLEngineSpec.get_datatype(1))
         self.assertEquals('VARCHAR', MySQLEngineSpec.get_datatype(15))
         self.assertEquals('VARCHAR', BaseEngineSpec.get_datatype('VARCHAR'))
+
+    def test_limit_with_implicit_offset(self):
+        self.sql_limit_regex(
+            textwrap.dedent("""\
+                SELECT
+                    'LIMIT 777' AS a
+                    , b
+                FROM
+                table
+                LIMIT
+                99990, 999999"""),
+            textwrap.dedent("""\
+            SELECT
+                'LIMIT 777' AS a
+                , b
+            FROM
+            table
+            LIMIT
+            99990, 1000"""),
+        )
+
+    def test_limit_with_explicit_offset(self):
+        self.sql_limit_regex(
+            textwrap.dedent("""\
 
 Review comment:
   Why the need for `textwrap` and the `\` after the tripple-quotes?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to