Skip to content

Commit

Permalink
upgrade fugue (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
goodwanghan authored Feb 4, 2021
1 parent 15c9d59 commit 84ba621
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Fugue for Kaggle users

## Release History

### 0.1.8

* Upgrade fugue dependency, handle breaking changes

### 0.1.7

* Refactor fuggle based on fugue_notebook
Expand Down
10 changes: 4 additions & 6 deletions fuggle/execution_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,9 @@ class KaggleNativeExecutionEngine(NativeExecutionEngine):
def __init__(self, conf: Any = None, use_sqlite: bool = False):
super().__init__(conf)
if not use_sqlite:
self._default_sql_engine = KaggleSQLEngineWrapper(
self, QPDPandasEngine(self)
)
self.set_sql_engine(KaggleSQLEngineWrapper(self, QPDPandasEngine(self)))
else: # pragma: no cover
self._default_sql_engine = KaggleSQLEngineWrapper(self, SqliteEngine(self))
self.set_sql_engine(KaggleSQLEngineWrapper(self, SqliteEngine(self)))


class KaggleSparkExecutionEngine(SparkExecutionEngine):
Expand All @@ -94,15 +92,15 @@ def __init__(self, spark_session: Optional[SparkSession] = None, conf: Any = Non
builder = builder.config(k, v)
spark_session = builder.getOrCreate()
super().__init__(spark_session=spark_session, conf=configs)
self._default_sql_engine = KaggleSQLEngineWrapper(self, SparkSQLEngine(self))
self.set_sql_engine(KaggleSQLEngineWrapper(self, SparkSQLEngine(self)))


class KaggleDaskExecutionEngine(DaskExecutionEngine):
def __init__(self, conf: Any = None):
configs = {FUGUE_DASK_CONF_DATAFRAME_DEFAULT_PARTITIONS: 16}
configs.update(ParamDict(conf))
super().__init__(conf=configs)
self._default_sql_engine = KaggleSQLEngineWrapper(self, QPDDaskEngine(self))
self.set_sql_engine(KaggleSQLEngineWrapper(self, QPDDaskEngine(self)))


class KaggleNotebookSetup(NotebookSetup):
Expand Down
8 changes: 4 additions & 4 deletions fuggle/outputters.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from matplotlib.figure import Figure
import matplotlib.pyplot as plt
from fugue import DataFrames, Outputter, DataFrame
from fugue.collections.partition import _parse_presort_exp
from fugue.collections.partition import parse_presort_exp
import pandas as pd
from triad.utils.assertion import assert_or_throw

Expand All @@ -21,7 +21,7 @@ def validate_on_compile(self) -> None:
else:
assert_or_throw("kind" not in self.params, f"can't reset kind {self.kind}")
self.params.get("top_n", 0)
_parse_presort_exp(self.params.get("order_by", "a"))
parse_presort_exp(self.params.get("order_by", "a"))
self.params.get_or_throw("x", str)
y = self.params.get_or_none("y", object)
gp = self.params.get_or_none("group", object)
Expand All @@ -43,7 +43,7 @@ def process(self, dfs: DataFrames) -> None:
top_n = self.params.get("top_n", 0)
df = self._select_top(dfs[0], top_n).as_pandas()
if "order_by" in self.params:
order_by: Any = _parse_presort_exp(
order_by: Any = parse_presort_exp(
self.params.get_or_throw("order_by", object)
)
else:
Expand Down Expand Up @@ -84,7 +84,7 @@ def _select_top(self, df: DataFrame, top_n: int):
else:
order_expr = ""
if "order_by" in self.params:
order_by = _parse_presort_exp(
order_by = parse_presort_exp(
self.params.get_or_throw("order_by", object)
)
if len(order_by) > 0:
Expand Down
2 changes: 1 addition & 1 deletion fuggle_version/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.7"
__version__ = "0.1.8"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
keywords="fugue kaggle sql spark dask pandas",
url="http://github.com/fugue-project/fuggle",
install_requires=[
"fugue[spark,dask,sql]==0.5.1.dev3",
"fugue[spark,dask,sql]==0.5.1.dev6",
"notebook",
"kaggle",
"matplotlib",
Expand Down

0 comments on commit 84ba621

Please sign in to comment.