-
Notifications
You must be signed in to change notification settings - Fork 256
[query] Expose references via ExecuteContext
#14686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
3518244 to
e0b89a5
Compare
9cff2fc to
d14679d
Compare
92da6f0 to
4576acf
Compare
d14679d to
ed2e8e8
Compare
4576acf to
8a42e93
Compare
ed2e8e8 to
fc06f02
Compare
341e6a7 to
1682964
Compare
fc06f02 to
a101b55
Compare
1682964 to
b1c0d04
Compare
a101b55 to
1682a0f
Compare
b1c0d04 to
84ddcf3
Compare
1682a0f to
6e63e69
Compare
84ddcf3 to
a2ff477
Compare
6e63e69 to
d31f732
Compare
df5c723 to
adc0602
Compare
82e6e7a to
a70aa24
Compare
a33bb7f to
b19073d
Compare
2d4edc1 to
79ecea8
Compare
b19073d to
75f4fd5
Compare
79ecea8 to
1d36659
Compare
75f4fd5 to
5c0308f
Compare
1d36659 to
0f02bdc
Compare
5c0308f to
90a9649
Compare
482d085 to
901fafe
Compare
7c3af40 to
dd052e7
Compare
chrisvittal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Won't change my approval, I just have one question.
bde8755 to
1ed1a39
Compare
patrick-schultz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, just a few questions
| try { | ||
| backend.flags.set("shuffle_cutoff_to_local_sort", "40") | ||
| def testDistributedSortHelper(myTable: TableIR, sortFields: IndexedSeq[SortField]): Unit = | ||
| ctx.local(flags = ctx.flags + ("shuffle_cutoff_to_local_sort" -> "40")) { ctx => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit awkward, and I don't love HailFeatureFlags having both a mutable interface and a + operator that returns a new object. How about if ExecuteContext.local took only the bindings to add/update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see what's awkward, can you ellaborate?
This creates a local context where the flags are updated.
local itself accepts more than flags and takes care of the whole
val whatWasItBefore = get
set newValue
try {
...
} finally {
set whatItWasBefore
}
noise.
If you wanted to modify the flags for the rest of the execution, you could just do
ctx.flags.set("foo", "bar")
...This interface gives a simple way of doing both
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, I could have sworn I replied to this, but my comment seems to have disappeared.
Sorry, I should have been more specific. I just meant that it might be simpler for ExecuteContext.local to take a overrideFlags: Seq[(String, String)] = Seq.empty, so you could call ctx.local(overrideFlags = Seq("shuffle_cutoff_to_local_sort" -> "40")). I.e. local overides individual flags in the scope, rather than the entire flags map.
But this is minor, so I'm happy to approve as is if you don't want to change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I see what you're getting at. But how would I unset flags? By mapping the value to null? yuck!
I think the current thing is simpler and so I'm inclided to keep it.
1ed1a39 to
aca48d3
Compare

This change is split out from a larger refactoring effort on the various Backend
implementations. The goals of this effort are to provide query-level
configuration to the backend that's currently tied to the lifetime of a backend,
reduce code duplication and reduce state duplication.
In this change, I'm restoring references to the execute context [1] and
decoupling them from the backend. In a future change, they'll be lifted out of
the backend implementations altogether. This is to reduce the surface area of
the Backend interface to the details that are actually different.
Both the Local and Spark backend have state that's manipulated from python via
various py methods. These pollute the Backend interface [2] and so have been
extracted into the trait Py4JBackendExtensions. In future changes, this will
become a facade that owns state set in python.
Notes
[1] "Restoring" old behaviour I foolishly removed in fe5ed32
[2] "Pollute" in that they obfuscate what's different about backend query plan
and execution