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

[trino][compute] Add compute support for Trino #3837

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

amitsrivastava
Copy link
Collaborator

With this change, trino compute can be discovered, saved to db and used similar to hive and impala.

Copy link
Collaborator

@Harshg999 Harshg999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added few review comments. Also possible to add unit tests for this change?

apps/beeswax/src/beeswax/common.py Outdated Show resolved Hide resolved
Comment on lines +146 to 149
dialect = 'hive' if t.startswith('hive') else\
'impala' if t.startswith('impala') else\
'trino' if t.startswith('trino') else None

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Is formatting correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pycharm likes it this way and ruff also doesn't complain so I didn't bother much. On a closer look, the L148 is actually part of the if started on L147, so an extra indent might be okay.

@@ -1909,7 +1909,7 @@ def _get_editor(self):
'optimizer': get_optimizer_mode(),
'page': '/editor/?type=%(type)s' % interpreter,
'is_sql': interpreter['is_sql'],
'is_batchable': interpreter['dialect'] in ['hive', 'impala'] or interpreter['interface'] in ['oozie', 'sqlalchemy'],
'is_batchable': interpreter['dialect'] in ['hive', 'impala', 'trino'] or interpreter['interface'] in ['oozie', 'sqlalchemy'],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this required to enable batch queries for Trino?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If hive and impala are batch-able then why not trino? it seems to work fine on the frontend. Is there a reason not to do it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even I was curious if Trino supports batch-querying in Hue OOTB. Good that the frontend is looking good.

@agl29 - Let's validate and test this out when implementing V2?

@Harshg999 Harshg999 changed the title DWX-17085: added compute support for trino [trino][compute] Add compute support for Trino Sep 6, 2024
@amitsrivastava amitsrivastava force-pushed the dev/amit/cdw-hue-trino-master branch 3 times, most recently from 0182d23 to 1fdacf9 Compare September 19, 2024 22:43
Copy link
Collaborator

@Harshg999 Harshg999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Few last comments..
Also UTs possible?

default_ssl_cacerts,
default_ssl_validate,
)
from desktop.lib.conf import Config, ConfigSection, coerce_bool, coerce_csv, coerce_password_from_script

if sys.version_info[0] > 2:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Good to get rid of this py2 related conditional.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel at some point in time, having an API endpoint (or few of them) in Hue for this could be beneficial.

Maybe then we don't need to depend on CDW layer running the command at a set interval and service discovery can be more dynamic and on-demand?

@@ -1909,7 +1909,7 @@ def _get_editor(self):
'optimizer': get_optimizer_mode(),
'page': '/editor/?type=%(type)s' % interpreter,
'is_sql': interpreter['is_sql'],
'is_batchable': interpreter['dialect'] in ['hive', 'impala'] or interpreter['interface'] in ['oozie', 'sqlalchemy'],
'is_batchable': interpreter['dialect'] in ['hive', 'impala', 'trino'] or interpreter['interface'] in ['oozie', 'sqlalchemy'],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even I was curious if Trino supports batch-querying in Hue OOTB. Good that the frontend is looking good.

@agl29 - Let's validate and test this out when implementing V2?

desktop/libs/notebook/src/notebook/connectors/trino.py Outdated Show resolved Hide resolved
With this change, trino compute can be discovered, saved to db and used
similar to hive and impala.
Copy link
Collaborator

@athithyaaselvam athithyaaselvam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@amitsrivastava amitsrivastava merged commit 41fd5de into master Sep 24, 2024
6 checks passed
@amitsrivastava amitsrivastava deleted the dev/amit/cdw-hue-trino-master branch September 24, 2024 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants