Skip to content

parser: move scan.go to new scanner package #67584

Merged
craig[bot] merged 2 commits intocockroachdb:masterfrom
rafiss:scan-refactor-imports-part2
Jul 14, 2021
Merged

parser: move scan.go to new scanner package #67584
craig[bot] merged 2 commits intocockroachdb:masterfrom
rafiss:scan-refactor-imports-part2

Conversation

@rafiss
Copy link
Copy Markdown
Collaborator

@rafiss rafiss commented Jul 14, 2021

Fixes #64710

See individual commits.

This extracts an interface for sqlSymType so that scan.go can keep using it.

This allows scan.go to live in its own package so that other components can
use its functionality without needing to pull in a large dependency
on sql/sem/tree.

Release note: None

@rafiss rafiss requested review from a team, knz and otan July 14, 2021 04:13
@rafiss rafiss requested a review from a team as a code owner July 14, 2021 04:13
@rafiss rafiss requested review from a team and dt and removed request for a team July 14, 2021 04:13
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Contributor

@otan otan left a comment

Choose a reason for hiding this comment

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

lgtm mod interface function names

return s.id
}

func (s *sqlSymType) SetId(id int32) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we call this SetID?

// sqlSymType is generated by goyacc, and implements the ScanSymType interface.
var _ ScanSymType = &sqlSymType{}

func (s *sqlSymType) Id() int32 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ID?

This will allow us to move scan.go into its own package.

Release note: None
@rafiss rafiss force-pushed the scan-refactor-imports-part2 branch from 3a2c081 to 2da7e1d Compare July 14, 2021 06:07
@blathers-crl blathers-crl bot requested a review from otan July 14, 2021 06:07
@rafiss rafiss force-pushed the scan-refactor-imports-part2 branch from 2da7e1d to 6143d22 Compare July 14, 2021 06:15
Copy link
Copy Markdown
Contributor

@knz knz left a comment

Choose a reason for hiding this comment

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

Change LGTM but I'd like to try to trick git (and reviewable) into recognizing the file rename, so that we don't get a completely fresh new file without any history.

I have checked locally and it appears that you can achieve that by renaming parser/scan.go into parser/scanner.go and amending the 2nd commit. Does that work for you too?

Reviewed 3 of 3 files at r1, 10 of 10 files at r2.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @dt and @rafiss)

@rafiss rafiss force-pushed the scan-refactor-imports-part2 branch from 6143d22 to dc8c1c9 Compare July 14, 2021 13:52
@rafiss
Copy link
Copy Markdown
Collaborator Author

rafiss commented Jul 14, 2021

I have checked locally and it appears that you can achieve that by renaming parser/scan.go into parser/scanner.go and amending the 2nd commit. Does that work for you too?

that worked! thanks

@rafiss rafiss force-pushed the scan-refactor-imports-part2 branch from dc8c1c9 to 216b453 Compare July 14, 2021 14:20
The functionality of scan.go is now available externally, without
needing to pull in a large dependency on sql/sem/tree.

Release note: None
@rafiss rafiss force-pushed the scan-refactor-imports-part2 branch from 216b453 to af67519 Compare July 14, 2021 15:11
@rafiss
Copy link
Copy Markdown
Collaborator Author

rafiss commented Jul 14, 2021

tftr!

bors r=knz,otan

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 14, 2021

Build failed (retrying...):

@knz knz mentioned this pull request Jul 14, 2021
5 tasks
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 14, 2021

Build succeeded:

@craig craig bot merged commit 84f7aa0 into cockroachdb:master Jul 14, 2021
@rafiss rafiss deleted the scan-refactor-imports-part2 branch July 19, 2021 16:38
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.

sql/parser: split scan.go into a separate package with few dependencies

4 participants