Repository: great-expectations/great_expectations

Issue:
Use cleaner solution for non-truncating division in python 2
Prefer `from __future__ import division` to `1.*x/y`


Discussion:
Done inline during improve_partitions push.

Resolving patch:
diff --git a/great_expectations/dataset/sqlalchemy_dataset.py b/great_expectations/dataset/sqlalchemy_dataset.py
--- a/great_expectations/dataset/sqlalchemy_dataset.py
+++ b/great_expectations/dataset/sqlalchemy_dataset.py
@@ -839,14 +839,14 @@ def _get_column_quantiles_mysql(self, column: str, quantiles: Iterable) -> list:
             [
                 sa.column(column),
                 sa.cast(
-                    sa.func.percent_rank().over(order_by=sa.column(column).desc()),
+                    sa.func.percent_rank().over(order_by=sa.column(column).asc()),
                     sa.dialects.mysql.DECIMAL(18, 15),
                 ).label("p"),
             ]
-        ).order_by(sa.column("p").desc()).select_from(self._table).cte("t")
+        ).order_by(sa.column("p").asc()).select_from(self._table).cte("t")
 
         selects: List[WithinGroup] = []
-        for idx, quantile in enumerate(reversed(quantiles)):
+        for idx, quantile in enumerate(quantiles):
             # pymysql cannot handle conversion of numpy float64 to float; convert just in case
             if np.issubdtype(type(quantile), np.float_):
                 quantile = float(quantile)
@@ -871,7 +871,7 @@ def _get_column_quantiles_mysql(self, column: str, quantiles: Iterable) -> list:
             quantiles_results: RowProxy = self.engine.execute(
                 quantiles_query
             ).fetchone()
-            return [float(quantile) for quantile in quantiles_results]
+            return list(quantiles_results)
         except ProgrammingError as pe:
             exception_message: str = "An SQL syntax Exception occurred."
             exception_traceback: str = traceback.format_exc()
diff --git a/great_expectations/profile/base.py b/great_expectations/profile/base.py
--- a/great_expectations/profile/base.py
+++ b/great_expectations/profile/base.py
@@ -60,6 +60,7 @@ class ProfilerTypeMapping:
     ]
     FLOAT_TYPE_NAMES = [
         "FLOAT",
+        "DOUBLE",
         "FLOAT4",
         "FLOAT8",
         "DOUBLE_PRECISION",
@@ -79,7 +80,15 @@ class ProfilerTypeMapping:
         "string",
         "str",
     ]
-    BOOLEAN_TYPE_NAMES = ["BOOLEAN", "boolean", "BOOL", "BIT", "bool", "BooleanType"]
+    BOOLEAN_TYPE_NAMES = [
+        "BOOLEAN",
+        "boolean",
+        "BOOL",
+        "TINYINT",
+        "BIT",
+        "bool",
+        "BooleanType",
+    ]
     DATETIME_TYPE_NAMES = [
         "DATETIME",
         "DATE",


Test patch:
diff --git a/tests/conftest.py b/tests/conftest.py
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1259,7 +1259,7 @@ def numeric_high_card_dataset(test_backend, numeric_high_card_dict):
             "norm_0_1": "NUMERIC",
         },
         "sqlite": {"norm_0_1": "FLOAT",},
-        "mysql": {"norm_0_1": "FLOAT",},
+        "mysql": {"norm_0_1": "DOUBLE",},
         "mssql": {"norm_0_1": "FLOAT",},
         "spark": {"norm_0_1": "FloatType",},
     }
@@ -1869,7 +1869,7 @@ def dataset_sample_data(test_backend):
             "naturals": "NUMERIC",
         },
         "sqlite": {"infinities": "FLOAT", "nulls": "FLOAT", "naturals": "FLOAT"},
-        "mysql": {"nulls": "FLOAT", "naturals": "FLOAT"},
+        "mysql": {"nulls": "DOUBLE", "naturals": "DOUBLE"},
         "mssql": {"infinities": "FLOAT", "nulls": "FLOAT", "naturals": "FLOAT"},
         "spark": {
             "infinities": "FloatType",
diff --git a/tests/test_dataset_implementations/test_dataset_implementations.json b/tests/test_dataset_implementations/test_dataset_implementations.json
--- a/tests/test_dataset_implementations/test_dataset_implementations.json
+++ b/tests/test_dataset_implementations/test_dataset_implementations.json
@@ -16,12 +16,19 @@
                   "n": "IntegerType",
                   "b": "BooleanType"
                 },
-                "mssql": {
-                  "x": "FLOAT",
+                "mysql": {
+                  "x": "DOUBLE",
                   "y": "INTEGER",
                   "z": "INTEGER",
                   "n": "INTEGER",
-                  "b": "BIT"
+                  "b": "TINYINT"
+                },
+                "mssql": {
+                    "x": "FLOAT",
+                    "y": "INTEGER",
+                    "z": "INTEGER",
+                    "n": "INTEGER",
+                    "b": "BIT"
                 }
             }
         },
@@ -39,6 +46,12 @@
                   "c": "StringType",
                   "d": "StringType"
                 },
+                "mysql": {
+                    "a": "INTEGER",
+                    "b": "VARCHAR",
+                    "c": "VARCHAR",
+                    "d": "VARCHAR"
+                },
                 "mssql": {
                     "a": "INTEGER",
                     "b": "VARCHAR",
@@ -59,6 +72,11 @@
                     "b": "StringType",
                     "c": "IntegerType"
                 },
+                "mysql": {
+                    "a": "INTEGER",
+                    "b": "VARCHAR",
+                    "c": "INTEGER"
+                },
                 "mssql": {
                     "a": "INTEGER",
                     "b": "VARCHAR",
@@ -483,7 +501,7 @@
             "kwargs": {
                 "column": "a"
             },
-            "expected": [ 1.0, 1.9, 2.8, 3.7, 4.6, 5.5, 6.4, 7.3, 8.2, 9.1, 10.0],
+            "expected": [1.0, 1.9, 2.8, 3.7, 4.6, 5.5, 6.4, 7.3, 8.2, 9.1, 10.0],
             "suppress_test_for": ["sqlite"],
             "tolerance": 0.0001,
             "_note": "we use the default arguments here"
diff --git a/tests/test_dataset_implementations/test_dataset_implementations.py b/tests/test_dataset_implementations/test_dataset_implementations.py
--- a/tests/test_dataset_implementations/test_dataset_implementations.py
+++ b/tests/test_dataset_implementations/test_dataset_implementations.py
@@ -74,6 +74,13 @@ def test_get_column_value_counts(test_backend):
             "n": "IntegerType",
             "b": "BooleanType",
         },
+        "mysql": {
+            "x": "DOUBLE",
+            "y": "INTEGER",
+            "z": "INTEGER",
+            "n": "INTEGER",
+            "b": "TINYINT",
+        },
         "mssql": {
             "x": "FLOAT",
             "y": "INTEGER",