Skip to content

Commit

Permalink
fix(ChatData):pyspark lazy load (#633)
Browse files Browse the repository at this point in the history
1.fix: pyspark lazy load
2.fix: chromadb version
  • Loading branch information
fangyinc authored Sep 27, 2023
2 parents 6843fc7 + 92c25fe commit 20bddde
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions pilot/connections/conn_spark.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from typing import Optional, Any
from pyspark.sql import SparkSession, DataFrame
from sqlalchemy import text

from pilot.connections.base import BaseConnect

Expand All @@ -23,13 +21,15 @@ class SparkConnect(BaseConnect):
def __init__(
self,
file_path: str,
spark_session: Optional[SparkSession] = None,
spark_session: Optional = None,
engine_args: Optional[dict] = None,
**kwargs: Any,
) -> None:
"""Initialize the Spark DataFrame from Datasource path
return: Spark DataFrame
"""
from pyspark.sql import SparkSession

self.spark_session = (
spark_session or SparkSession.builder.appName("dbgpt_spark").getOrCreate()
)
Expand All @@ -47,7 +47,7 @@ def from_file_path(
except Exception as e:
print("load spark datasource error" + str(e))

def create_df(self, path) -> DataFrame:
def create_df(self, path):
"""Create a Spark DataFrame from Datasource path(now support parquet, jdbc, orc, libsvm, csv, text, json.).
return: Spark DataFrame
reference:https://spark.apache.org/docs/latest/sql-data-sources-load-save-functions.html
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def core_requires():
"importlib-resources==5.12.0",
"psutil==5.9.4",
"python-dotenv==1.0.0",
"colorama==0.4.10",
"colorama==0.4.6",
"prettytable",
"cachetools",
]
Expand Down Expand Up @@ -312,7 +312,7 @@ def knowledge_requires():
setup_spec.extras["knowledge"] = [
"spacy==3.5.3",
# "chromadb==0.3.22",
"chromadb",
"chromadb==0.4.10",
"markdown",
"bs4",
"python-pptx",
Expand Down

0 comments on commit 20bddde

Please sign in to comment.