@@ -2780,11 +2780,9 @@ func truncateStatementStringForTelemetry(stmt string) string {
2780
2780
// hideNonVirtualTableNameFunc returns a function that can be used with
2781
2781
// FmtCtx.SetReformatTableNames. It hides all table names that are not virtual
2782
2782
// tables.
2783
- func hideNonVirtualTableNameFunc (
2784
- vt VirtualTabler , ns eval.ClientNoticeSender ,
2785
- ) func (ctx * tree.FmtCtx , name * tree.TableName ) {
2783
+ func hideNonVirtualTableNameFunc (vt VirtualTabler ) func (ctx * tree.FmtCtx , name * tree.TableName ) {
2786
2784
reformatFn := func (ctx * tree.FmtCtx , tn * tree.TableName ) {
2787
- virtual , err := vt .getVirtualTableEntry (tn , ns )
2785
+ virtual , err := vt .getVirtualTableEntry (tn )
2788
2786
2789
2787
if err != nil || virtual == nil {
2790
2788
// Current table is non-virtual and therefore needs to be scrubbed (for statement stats) or redacted (for logs).
@@ -2828,16 +2826,14 @@ func hideNonVirtualTableNameFunc(
2828
2826
return reformatFn
2829
2827
}
2830
2828
2831
- func anonymizeStmtAndConstants (
2832
- stmt tree.Statement , vt VirtualTabler , ns eval.ClientNoticeSender ,
2833
- ) string {
2829
+ func anonymizeStmtAndConstants (stmt tree.Statement , vt VirtualTabler ) string {
2834
2830
// Re-format to remove most names.
2835
2831
fmtFlags := tree .FmtAnonymize | tree .FmtHideConstants
2836
2832
var f * tree.FmtCtx
2837
2833
if vt != nil {
2838
2834
f = tree .NewFmtCtx (
2839
2835
fmtFlags ,
2840
- tree .FmtReformatTableNames (hideNonVirtualTableNameFunc (vt , ns )),
2836
+ tree .FmtReformatTableNames (hideNonVirtualTableNameFunc (vt )),
2841
2837
)
2842
2838
} else {
2843
2839
f = tree .NewFmtCtx (fmtFlags )
@@ -2848,10 +2844,8 @@ func anonymizeStmtAndConstants(
2848
2844
2849
2845
// WithAnonymizedStatement attaches the anonymized form of a statement
2850
2846
// to an error object.
2851
- func WithAnonymizedStatement (
2852
- err error , stmt tree.Statement , vt VirtualTabler , ns eval.ClientNoticeSender ,
2853
- ) error {
2854
- anonStmtStr := anonymizeStmtAndConstants (stmt , vt , ns )
2847
+ func WithAnonymizedStatement (err error , stmt tree.Statement , vt VirtualTabler ) error {
2848
+ anonStmtStr := anonymizeStmtAndConstants (stmt , vt )
2855
2849
anonStmtStr = truncateStatementStringForTelemetry (anonStmtStr )
2856
2850
return errors .WithSafeDetails (err ,
2857
2851
"while executing: %s" , errors .Safe (anonStmtStr ))
@@ -4469,7 +4463,7 @@ func quantizeCounts(d *appstatspb.StatementStatistics) {
4469
4463
d .FirstAttemptCount = int64 ((float64 (d .FirstAttemptCount ) / float64 (oldCount )) * float64 (newCount ))
4470
4464
}
4471
4465
4472
- func scrubStmtStatKey (vt VirtualTabler , key string , ns eval. ClientNoticeSender ) (string , bool ) {
4466
+ func scrubStmtStatKey (vt VirtualTabler , key string ) (string , bool ) {
4473
4467
// Re-parse the statement to obtain its AST.
4474
4468
stmt , err := parser .ParseOne (key )
4475
4469
if err != nil {
@@ -4479,7 +4473,7 @@ func scrubStmtStatKey(vt VirtualTabler, key string, ns eval.ClientNoticeSender)
4479
4473
// Re-format to remove most names.
4480
4474
f := tree .NewFmtCtx (
4481
4475
tree .FmtAnonymize ,
4482
- tree .FmtReformatTableNames (hideNonVirtualTableNameFunc (vt , ns )),
4476
+ tree .FmtReformatTableNames (hideNonVirtualTableNameFunc (vt )),
4483
4477
)
4484
4478
f .FormatNode (stmt .AST )
4485
4479
return f .CloseAndGetString (), true
0 commit comments