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

feat: support gcs #278

Merged
merged 4 commits into from
Jun 21, 2023
Merged

feat: support gcs #278

merged 4 commits into from
Jun 21, 2023

Conversation

OldPanda
Copy link
Contributor

@OldPanda OldPanda commented Jun 14, 2023

What type of PR is this?

  • bug
  • feature
  • enhancement

What problem(s) does this PR solve?

Issue(s) number:

#279

Description:

To allow users to import csv files from GCS.

How do you solve it?

Special notes for your reviewer, ex. impact of this fix, design document, etc:

@wey-gu
Copy link
Contributor

wey-gu commented Jun 14, 2023

Wow, thanks @OldPanda for the great contribution :) Long time no see~~

@codecov-commenter
Copy link

codecov-commenter commented Jun 14, 2023

Codecov Report

Patch coverage: 80.00% and project coverage change: -0.14 ⚠️

Comparison is base (dd462b5) 90.89% compared to head (685d0ce) 90.76%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #278      +/-   ##
==========================================
- Coverage   90.89%   90.76%   -0.14%     
==========================================
  Files          77       78       +1     
  Lines        3648     3693      +45     
==========================================
+ Hits         3316     3352      +36     
- Misses        326      332       +6     
- Partials        6        9       +3     
Impacted Files Coverage Δ
pkg/source/config.go 88.00% <0.00%> (-12.00%) ⬇️
pkg/source/gcs.go 85.00% <85.00%> (ø)
pkg/source/source.go 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@OldPanda
Copy link
Contributor Author

Long time no see @wey-gu ! I'm glad to have a chance to contribute to NebulaGraph again!

@veezhang veezhang added the doc affected PR: improvements or additions to documentation label Jun 14, 2023

func (s *gcsSource) Open() error {
if s.c.GCS.Endpoint != "" {
err := os.Setenv("STORAGE_EMULATOR_HOST", s.c.GCS.Endpoint)
Copy link
Contributor

Choose a reason for hiding this comment

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

How about use WithEndpoint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

WithEndpoint looks like a cleaner way to specify an endpoint for a GCS connection. However, their official docs introduces the env var only. Let me see if it's feasible to use WithEndpoint here.

Copy link
Contributor

Choose a reason for hiding this comment

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

@OldPanda Hi, it's WithEndpoint work fine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't bootstrap a separate emulator to test the change, but make test works well. Is it good enough as a http server was ran by the testing?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, our team has tested it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for help!

}
defer client.Close()

obj := client.Bucket(s.c.GCS.Bucket).Object(s.c.GCS.Key)
Copy link
Contributor

Choose a reason for hiding this comment

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

How about .Object(strings.TrimLeft(s.c.GCS.Key, "/")) ?
Maybe someone add / in front?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! I'll update accordingly.

Copy link
Contributor

@veezhang veezhang left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@yixinglu yixinglu left a comment

Choose a reason for hiding this comment

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

LGTM

@yixinglu yixinglu merged commit 61c3b00 into vesoft-inc:master Jun 21, 2023
@OldPanda OldPanda deleted the feat-gcs branch June 22, 2023 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc affected PR: improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants