Skip to content

Commit

Permalink
try fix?
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzelin committed Nov 27, 2024
1 parent 589f869 commit adfe22b
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 14 deletions.
24 changes: 19 additions & 5 deletions pypaimon/py4j/tests/test_data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,44 @@
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################

import os
import random
import shutil
import string
import tempfile

import pyarrow as pa
import unittest

from pypaimon import Schema
from pypaimon.py4j.tests import utils
from pypaimon.py4j.util import java_utils
from pypaimon.py4j import Catalog
from pypaimon.py4j.tests.utils import _setup_hadoop_bundle_jar, _setup_bridge_jar
from pypaimon.py4j.util import java_utils, constants


class DataTypesTest(unittest.TestCase):

@classmethod
def setUpClass(cls):
cls.tempdir, cls.warehouse, cls.catalog = utils.setup_class()
os.environ[constants.PYPAIMON4J_TEST_MODE] = 'true'
cls.tempdir = tempfile.mkdtemp()

_setup_hadoop_bundle_jar(cls.tempdir)
_setup_bridge_jar(cls.tempdir)

cls.warehouse = os.path.join(cls.tempdir, 'warehouse')
cls.catalog = Catalog.create({'warehouse': cls.warehouse})
cls.catalog.create_database('default', False)

cls.simple_pa_schema = pa.schema([
('f0', pa.int32()),
('f1', pa.string())
])

@classmethod
def tearDownClass(cls):
utils.teardown_class(cls.tempdir)
shutil.rmtree(cls.tempdir, ignore_errors=True)
del os.environ[constants.PYPAIMON4J_TEST_MODE]

def test_int(self):
pa_schema = pa.schema([
Expand Down
22 changes: 18 additions & 4 deletions pypaimon/py4j/tests/test_preicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################

import os
import shutil
import tempfile
import unittest
import random
import pandas as pd
import pyarrow as pa

from pypaimon import Schema
from pypaimon.py4j.tests import utils
from pypaimon.py4j import Catalog
from pypaimon.py4j.tests.utils import _setup_hadoop_bundle_jar, _setup_bridge_jar
from pypaimon.py4j.util import constants


def _check_filtered_result(read_builder, expected_df):
Expand All @@ -42,7 +46,16 @@ class PredicateTest(unittest.TestCase):

@classmethod
def setUpClass(cls):
cls.tempdir, cls.warehouse, cls.catalog = utils.setup_class()
os.environ[constants.PYPAIMON4J_TEST_MODE] = 'true'
cls.tempdir = tempfile.mkdtemp()

_setup_hadoop_bundle_jar(cls.tempdir)
_setup_bridge_jar(cls.tempdir)

cls.warehouse = os.path.join(cls.tempdir, 'warehouse')
cls.catalog = Catalog.create({'warehouse': cls.warehouse})
cls.catalog.create_database('default', False)

pa_schema = pa.schema([
('f0', pa.int64()),
('f1', pa.string()),
Expand Down Expand Up @@ -82,7 +95,8 @@ def setUpClass(cls):

@classmethod
def tearDownClass(cls):
utils.teardown_class(cls.tempdir)
shutil.rmtree(cls.tempdir, ignore_errors=True)
del os.environ[constants.PYPAIMON4J_TEST_MODE]

def testWrongFieldName(self):
table = self.catalog.get_table('default.test_append')
Expand Down
22 changes: 17 additions & 5 deletions pypaimon/py4j/tests/test_write_and_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################

import os
import shutil
import tempfile
import unittest
import pandas as pd
import pyarrow as pa
Expand All @@ -24,23 +26,33 @@
from pypaimon import Schema
from pypaimon.py4j import Catalog
from pypaimon.py4j.java_gateway import get_gateway
from pypaimon.py4j.tests import utils
from pypaimon.py4j.util import java_utils
from pypaimon.py4j.tests.utils import _setup_hadoop_bundle_jar, _setup_bridge_jar
from pypaimon.py4j.util import java_utils, constants


class TableWriteReadTest(unittest.TestCase):

@classmethod
def setUpClass(cls):
cls.tempdir, cls.warehouse, cls.catalog = utils.setup_class()
os.environ[constants.PYPAIMON4J_TEST_MODE] = 'true'
cls.tempdir = tempfile.mkdtemp()

_setup_hadoop_bundle_jar(cls.tempdir)
_setup_bridge_jar(cls.tempdir)

cls.warehouse = os.path.join(cls.tempdir, 'warehouse')
cls.catalog = Catalog.create({'warehouse': cls.warehouse})
cls.catalog.create_database('default', False)

cls.simple_pa_schema = pa.schema([
('f0', pa.int32()),
('f1', pa.string())
])

@classmethod
def tearDownClass(cls):
utils.teardown_class(cls.tempdir)
shutil.rmtree(cls.tempdir, ignore_errors=True)
del os.environ[constants.PYPAIMON4J_TEST_MODE]

def testReadEmptyAppendTable(self):
schema = Schema(self.simple_pa_schema)
Expand Down

0 comments on commit adfe22b

Please sign in to comment.