Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mysql intergration test failed on staging branch. #1097

Closed
1 of 2 tasks
xzdandy opened this issue Sep 12, 2023 · 3 comments · Fixed by #1124
Closed
1 of 2 tasks

Mysql intergration test failed on staging branch. #1097

xzdandy opened this issue Sep 12, 2023 · 3 comments · Fixed by #1124
Assignees
Labels
Bug 🐞 EVA is not working as expected
Milestone

Comments

@xzdandy
Copy link
Collaborator

xzdandy commented Sep 12, 2023

Search before asking

  • I have searched the EvaDB issues and found no similar bug report.

Bug

Circle ci. Looks like the failure can be relevant to the lower case column name change.

=================================== FAILURES ===================================
______________ NativeExecutorTest.test_should_run_query_in_mysql _______________

self = Index(['name', 'Age', 'comment'], dtype='object'), key = 'age'

    def get_loc(self, key):
        """
        Get integer location, slice or boolean mask for requested label.
    
        Parameters
        ----------
        key : label
    
        Returns
        -------
        int if unique index, slice if monotonic index, else mask
    
        Examples
        --------
        >>> unique_index = pd.Index(list('abc'))
        >>> unique_index.get_loc('b')
        1
    
        >>> monotonic_index = pd.Index(list('abbc'))
        >>> monotonic_index.get_loc('b')
        slice(1, 3, None)
    
        >>> non_monotonic_index = pd.Index(list('abcb'))
        >>> non_monotonic_index.get_loc('b')
        array([False,  True, False,  True])
        """
        casted_key = self._maybe_cast_indexer(key)
        try:
>           return self._engine.get_loc(casted_key)

test_evadb/lib/python3.10/site-packages/pandas/core/indexes/base.py:3790: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
index.pyx:152: in pandas._libs.index.IndexEngine.get_loc
    ???
index.pyx:181: in pandas._libs.index.IndexEngine.get_loc
    ???
pandas/_libs/hashtable_class_helper.pxi:7080: in pandas._libs.hashtable.PyObjectHashTable.get_item
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   KeyError: 'age'

pandas/_libs/hashtable_class_helper.pxi:7088: KeyError

The above exception was the direct cause of the following exception:

self = <test_native_executor.NativeExecutorTest testMethod=test_should_run_query_in_mysql>

    def test_should_run_query_in_mysql(self):
        # Create database.
        params = {
            "user": "eva",
            "password": "password",
            "host": "localhost",
            "port": "3306",
            "database": "evadb",
        }
        query = f"""CREATE DATABASE test_data_source
                    WITH ENGINE = "mysql",
                    PARAMETERS = {params};"""
        execute_query_fetch_all(self.evadb, query)
    
        # Test executions.
>       self._execute_native_query()

test/third_party_tests/test_native_executor.py:201: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test/third_party_tests/test_native_executor.py:117: in _execute_native_query
    self.assertEqual(res_batch.frames["age"][0], 1)
test_evadb/lib/python3.10/site-packages/pandas/core/frame.py:3896: in __getitem__
    indexer = self.columns.get_loc(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Index(['name', 'Age', 'comment'], dtype='object'), key = 'age'

    def get_loc(self, key):
        """
        Get integer location, slice or boolean mask for requested label.
    
        Parameters
        ----------
        key : label
    
        Returns
        -------
        int if unique index, slice if monotonic index, else mask
    
        Examples
        --------
        >>> unique_index = pd.Index(list('abc'))
        >>> unique_index.get_loc('b')
        1
    
        >>> monotonic_index = pd.Index(list('abbc'))
        >>> monotonic_index.get_loc('b')
        slice(1, 3, None)
    
        >>> non_monotonic_index = pd.Index(list('abcb'))
        >>> non_monotonic_index.get_loc('b')
        array([False,  True, False,  True])
        """
        casted_key = self._maybe_cast_indexer(key)
        try:
            return self._engine.get_loc(casted_key)
        except KeyError as err:
            if isinstance(casted_key, slice) or (
                isinstance(casted_key, abc.Iterable)
                and any(isinstance(x, slice) for x in casted_key)
            ):
                raise InvalidIndexError(key)
>           raise KeyError(key) from err
E           KeyError: 'age'

test_evadb/lib/python3.10/site-packages/pandas/core/indexes/base.py:3797: KeyError

Environment

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@xzdandy xzdandy added the Bug 🐞 EVA is not working as expected label Sep 12, 2023
@xzdandy xzdandy added this to the v0.3.5 milestone Sep 12, 2023
@gaurav274
Copy link
Member

I'll look into it. Seems like an issue related to binder changes.

@gaurav274 gaurav274 self-assigned this Sep 12, 2023
@jiashenC
Copy link
Member

jiashenC commented Sep 13, 2023

I accidentally created an upper-case column name (https://github.com/georgia-tech-db/evadb/blob/aa8cc0e7486a3392c5c70f50ea215d2349f55b43/test/third_party_tests/test_native_executor.py#L41C29-L41C29).

Postgres columns are not case-sensitive unless it is wrapped in double quotes (https://stackoverflow.com/questions/20878932/are-postgresql-column-names-case-sensitive).

MySQL columns are case-sensitive instead (https://stackoverflow.com/questions/2009005/are-column-and-table-name-case-sensitive-in-mysql).

I think now our binder inherits the case from the underlying database.

@jiashenC jiashenC self-assigned this Sep 14, 2023
@gaurav274 gaurav274 linked a pull request Sep 15, 2023 that will close this issue
@xzdandy
Copy link
Collaborator Author

xzdandy commented Sep 16, 2023

Fixed.

@xzdandy xzdandy closed this as completed Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐞 EVA is not working as expected
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants