Skip to content

Commit f3d1048

Browse files
committed
Add enforceEmbeddedSchemaCorrectness option to TExecuteStatementReq
Add a new optional bool field (0xD19) to TExecuteStatementReq in the thrift contract and expose it as an opt-in configuration parameter. When enabled, the server enforces embedded schema correctness during query execution. - Add field to thrift-generated cli_service.go with full Read/Write/Equals support - Add EnforceEmbeddedSchemaCorrectness to UserConfig (default false) - Add WithEnforceEmbeddedSchemaCorrectness connector option - Add DSN parameter support (enforceEmbeddedSchemaCorrectness=true) - Wire config to TExecuteStatementReq in executeStatement ES-1804970 Co-authored-by: Isaac
1 parent ec57988 commit f3d1048

4 files changed

Lines changed: 76 additions & 2 deletions

File tree

connection.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,11 @@ func (c *conn) executeStatement(ctx context.Context, query string, args []driver
323323
req.Parameters = parameters
324324
}
325325

326+
// Add enforce embedded schema correctness if enabled
327+
if c.cfg.EnforceEmbeddedSchemaCorrectness {
328+
req.EnforceEmbeddedSchemaCorrectness = &c.cfg.EnforceEmbeddedSchemaCorrectness
329+
}
330+
326331
resp, err := c.client.ExecuteStatement(ctx, &req)
327332
var log *logger.DBSQLLogger
328333
log, ctx = client.LoggerAndContext(ctx, resp)

connector.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,15 @@ func WithEnableMetricViewMetadata(enable bool) ConnOption {
291291
}
292292
}
293293

294+
// WithEnforceEmbeddedSchemaCorrectness enables enforcement of embedded schema correctness
295+
// in query execution. When set to true, the server will enforce embedded schema correctness.
296+
// Default is false.
297+
func WithEnforceEmbeddedSchemaCorrectness(enforce bool) ConnOption {
298+
return func(c *config.Config) {
299+
c.EnforceEmbeddedSchemaCorrectness = enforce
300+
}
301+
}
302+
294303
// Setup of Oauth M2m authentication
295304
func WithClientCredentials(clientID, clientSecret string) ConnOption {
296305
return func(c *config.Config) {

internal/cli_service/cli_service.go

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/config/config.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ type UserConfig struct {
9999
RetryWaitMax time.Duration
100100
RetryMax int
101101
Transport http.RoundTripper
102-
UseLz4Compression bool
103-
EnableMetricViewMetadata bool
102+
UseLz4Compression bool
103+
EnableMetricViewMetadata bool
104+
EnforceEmbeddedSchemaCorrectness bool
104105
CloudFetchConfig
105106
}
106107

@@ -282,6 +283,13 @@ func ParseDSN(dsn string) (UserConfig, error) {
282283
ucfg.EnableMetricViewMetadata = enableMetricViewMetadata
283284
}
284285

286+
if enforceEmbeddedSchemaCorrectness, ok, err := params.extractAsBool("enforceEmbeddedSchemaCorrectness"); ok {
287+
if err != nil {
288+
return UserConfig{}, err
289+
}
290+
ucfg.EnforceEmbeddedSchemaCorrectness = enforceEmbeddedSchemaCorrectness
291+
}
292+
285293
// for timezone we do a case insensitive key match.
286294
// We use getNoCase because we want to leave timezone in the params so that it will also
287295
// be used as a session param.

0 commit comments

Comments
 (0)