Bug introduced in 10.2 and fixed in 10.3
Version 10.2; Win64 Enterprise.
I'm seeing this message...
data::shdw: Symbol data appears in multiple contexts {Streaming`LazyList`Testing`, Global`}; definitions in context Streaming`LazyList`Testing` may shadow or be shadowed by other definitions.
... while executing some transformations on a big Dataset. I'm not convinced that I created the Global`data symbol explicitly; it's certainly the name of local symbols within Modules I have though.
I wonder though if there is a risk of a collision if I actually give data a value now.
Answer
UPDATE The behaviour no longer occurs in version 10.3.
Here are minimal reproduction steps, from a fresh 10.2.0 kernel:
Module[{data = {{1}}}, data // Dataset // Transpose]
(*
data::shdw: Symbol data appears in multiple contexts {Streaming`LazyList`Testing`,Global`};
definitions in context Streaming`LazyList`Testing` may shadow or
be shadowed by other definitions. >>
*)
After executing this, the $ContextPath
looks suspicious:
$ContextPath
(* {"Streaming`LazyList`Testing`", "Streaming`", "StreamingLoader`",
"IconizeLoader`", "CloudObjectLoader`", "PacletManager`",
"System`", "Global`"} *)
Diagnosis
Upon further investigation, the problem appears to involve two causes. First, the streaming framework unconditionally loads and executes its test suite, adding it to the context path. To see this, inspect the following file:
NotebookOpen @ FileNameJoin @
{"SystemFiles","Components","Streaming","StreamingLoader.m"}
... and note the following lines near the top:
Get[FileNameJoin[{DirectoryName[$InputFileName],"TestDSL.m"}]];
Block[{$ContextPath},
Get[FileNameJoin[{DirectoryName[$InputFileName],"Tests.m"}]]
]
The second cause appears to be related to a cyclic dependency between the Streaming`
and Dataset`
packages (and possible between other packages as well). Dataset`$AvailableBackends
contains an implicit reference to Streaming`CachedObject
, triggering a load via Package`ActivateLoad
. The Streaming`
package, in turn, has an explicit dependency upon the Dataset`
package.
Normally, the act of auto-loading a package makes no changes to the $ContextPath
. The presence of cyclic dependencies has historically interfered with the preservation of this path, so I suspect that it is at least part of the problem here.
Partial Workaround
The effects of both problems can be reduced by pre-loading the Streaming`
package as the first action of a new kernel session:
Quiet @ Block[{$ContextPath}, Needs["Streaming`"]]
This preloading action leaves us with a cleaner environment:
Module[{data = {{1}}}, data // Dataset // Transpose]
(* Dataset[...] *)
$ContextPath
(* {"StreamingLoader`", "IconizeLoader`", "CloudObjectLoader`",
"PacletManager`", "System`", "Global`"} *)
The observant reader will have noticed the presence of Quiet
in the preloading step. It is needed to suppress another symbol conflict between System`ToCamelCase
and GeneralUtilities`ToCamelCase
. It would appear that there are similar auto-loading issues elsewhere. Therefore this solution can only really be considered as a partial work-around.
Comments
Post a Comment