forked from prestodb/presto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SPI to support plugin for custom plan checkers
This adds a new SPI to support plugin custom plan checkers to be provided for validating intermediate, final, and fragment stages of a logical plan. The motivation for this is to allow for a native plan checker that will eagerly validate a plan on the native sidecar to quickly fail the query if there are incompatibilities. Add unit test to verify that a queued query can be validated and fail while queued. This is done by using the new custom plan checker SPI to add plugin that will trigger a failure when validating the plan. See also: prestodb#23596 RFC: https://github.com/prestodb/rfcs/blob/main/RFC-0008-plan-checker.md
- Loading branch information
1 parent
5e0f3fe
commit 3d1961e
Showing
32 changed files
with
578 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
.../src/main/java/com/facebook/presto/sql/planner/plan/JsonCodecSimplePlanFragmentSerde.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.facebook.presto.sql.planner.plan; | ||
|
||
import com.facebook.airlift.json.JsonCodec; | ||
import com.facebook.presto.spi.plan.SimplePlanFragment; | ||
import com.facebook.presto.spi.plan.SimplePlanFragmentSerde; | ||
import com.google.inject.Inject; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
public class JsonCodecSimplePlanFragmentSerde | ||
implements SimplePlanFragmentSerde | ||
{ | ||
private final JsonCodec<SimplePlanFragment> codec; | ||
|
||
@Inject | ||
public JsonCodecSimplePlanFragmentSerde(JsonCodec<SimplePlanFragment> codec) | ||
{ | ||
this.codec = requireNonNull(codec, "SimplePlanFragment JSON codec is null"); | ||
} | ||
|
||
@Override | ||
public String serialize(SimplePlanFragment planFragment) | ||
{ | ||
return new String(codec.toBytes(planFragment), StandardCharsets.UTF_8); | ||
} | ||
|
||
@Override | ||
public SimplePlanFragment deserialize(String value) | ||
{ | ||
return codec.fromBytes(value.getBytes(StandardCharsets.UTF_8)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.