Skip to content

Commit 20815bf

Browse files
kyleconroyclaude
andcommitted
Add Location, DataSourceType, PreviousPushDownOption to ALTER EXTERNAL DATA SOURCE
Update AlterExternalDataSourceStatement to output LOCATION as a separate field and include DataSourceType and PreviousPushDownOption defaults. Enables: Baselines130_AlterExternalDataSourceStatementTests130, AlterExternalDataSourceStatementTests130 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 227c7e5 commit 20815bf

5 files changed

Lines changed: 32 additions & 3 deletions

File tree

ast/external_statements.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ type ExternalLibraryOption struct {
140140
// AlterExternalDataSourceStatement represents ALTER EXTERNAL DATA SOURCE statement
141141
type AlterExternalDataSourceStatement struct {
142142
Name *Identifier
143+
Location ScalarExpression
144+
DataSourceType string // HADOOP, etc.
145+
PreviousPushDownOption string // ON, OFF
143146
ExternalDataSourceOptions []*ExternalDataSourceLiteralOrIdentifierOption
144147
}
145148

parser/marshal.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19589,9 +19589,18 @@ func alterExternalDataSourceStatementToJSON(s *ast.AlterExternalDataSourceStatem
1958919589
node := jsonNode{
1959019590
"$type": "AlterExternalDataSourceStatement",
1959119591
}
19592+
if s.PreviousPushDownOption != "" {
19593+
node["PreviousPushDownOption"] = s.PreviousPushDownOption
19594+
}
1959219595
if s.Name != nil {
1959319596
node["Name"] = identifierToJSON(s.Name)
1959419597
}
19598+
if s.DataSourceType != "" {
19599+
node["DataSourceType"] = s.DataSourceType
19600+
}
19601+
if s.Location != nil {
19602+
node["Location"] = scalarExpressionToJSON(s.Location)
19603+
}
1959519604
if len(s.ExternalDataSourceOptions) > 0 {
1959619605
opts := make([]jsonNode, len(s.ExternalDataSourceOptions))
1959719606
for i, o := range s.ExternalDataSourceOptions {

parser/parse_ddl.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9243,7 +9243,10 @@ func (p *Parser) parseAlterExternalDataSourceStatement() (*ast.AlterExternalData
92439243
}
92449244
p.nextToken()
92459245

9246-
stmt := &ast.AlterExternalDataSourceStatement{}
9246+
stmt := &ast.AlterExternalDataSourceStatement{
9247+
DataSourceType: "HADOOP",
9248+
PreviousPushDownOption: "ON",
9249+
}
92479250

92489251
// Parse name
92499252
stmt.Name = p.parseIdentifier()
@@ -9270,6 +9273,20 @@ func (p *Parser) parseAlterExternalDataSourceStatement() (*ast.AlterExternalData
92709273
p.nextToken()
92719274
}
92729275

9276+
// Handle LOCATION as a separate field
9277+
if optName == "LOCATION" {
9278+
if p.curTok.Type == TokenString {
9279+
strLit, _ := p.parseStringLiteral()
9280+
stmt.Location = strLit
9281+
} else {
9282+
p.nextToken()
9283+
}
9284+
if p.curTok.Type == TokenComma {
9285+
p.nextToken()
9286+
}
9287+
continue
9288+
}
9289+
92739290
opt := &ast.ExternalDataSourceLiteralOrIdentifierOption{
92749291
OptionKind: externalDataSourceOptionKindToPascalCase(optName),
92759292
Value: &ast.IdentifierOrValueExpression{},
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"todo": true}
1+
{}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"todo": true}
1+
{}

0 commit comments

Comments
 (0)