forked from facebookincubator/velox
-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: Extract BaseClpCursor
interface to support upcoming IR integration.
#25
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
Merged
anlowee
merged 13 commits into
y-scope:presto-0.293-clp-connector
from
anlowee:xwei/ir-integration-phase2-part1
Sep 5, 2025
Merged
Changes from 6 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5af7ec3
Extract ClpCursor abstract class and move the original ClpCursor impl…
anlowee fe8a130
Merge the code
anlowee cc82dd7
Rename the extracrted ClpCursor to BaseClpCursor, and add the skeleto…
anlowee d45baf0
Remove the IR related code and add a subpackage to store archive sear…
anlowee 7f40b7e
Address coderabbitai comments
anlowee c0cac3d
Address comments
anlowee 19bad61
Move the current VectorLoader to Archive-specific
anlowee e466f68
Put more archive specific thing into Archive code
anlowee 679d338
Merge branch 'presto-0.293-clp-connector' into xwei/ir-integration-ph…
anlowee 1c091c7
Code clean up
anlowee 7f25210
Address coderabbitai comments
anlowee e71a957
Address comments
anlowee 37231b9
Revert unnecessary clp version changes
anlowee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,78 @@ | ||
/* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* 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. | ||
*/ | ||
|
||
#include <sstream> | ||
|
||
#include "velox/connectors/clp/search_lib/BaseClpCursor.h" | ||
|
||
#include "clp_s/search/ast/ConvertToExists.hpp" | ||
#include "clp_s/search/ast/EmptyExpr.hpp" | ||
#include "clp_s/search/ast/NarrowTypes.hpp" | ||
#include "clp_s/search/ast/OrOfAndForm.hpp" | ||
#include "clp_s/search/kql/kql.hpp" | ||
|
||
using namespace clp_s; | ||
using namespace clp_s::search; | ||
using namespace clp_s::search::ast; | ||
|
||
namespace facebook::velox::connector::clp::search_lib { | ||
|
||
void BaseClpCursor::executeQuery( | ||
const std::string& query, | ||
const std::vector<Field>& outputColumns) { | ||
query_ = query; | ||
outputColumns_ = outputColumns; | ||
errorCode_ = preprocessQuery(); | ||
} | ||
anlowee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
ErrorCode BaseClpCursor::preprocessQuery() { | ||
auto queryStream = std::istringstream(query_); | ||
expr_ = kql::parse_kql_expression(queryStream); | ||
if (nullptr == expr_) { | ||
VLOG(2) << "Failed to parse query '" << query_ << "'"; | ||
return ErrorCode::InvalidQuerySyntax; | ||
} | ||
|
||
if (std::dynamic_pointer_cast<EmptyExpr>(expr_)) { | ||
VLOG(2) << "Query '" << query_ << "' is logically false"; | ||
return ErrorCode::LogicalError; | ||
} | ||
|
||
OrOfAndForm standardizePass; | ||
if (expr_ = standardizePass.run(expr_); | ||
std::dynamic_pointer_cast<EmptyExpr>(expr_)) { | ||
anlowee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
VLOG(2) << "Query '" << query_ << "' is logically false"; | ||
return ErrorCode::LogicalError; | ||
} | ||
|
||
NarrowTypes narrowPass; | ||
if (expr_ = narrowPass.run(expr_); | ||
std::dynamic_pointer_cast<EmptyExpr>(expr_)) { | ||
VLOG(2) << "Query '" << query_ << "' is logically false"; | ||
return ErrorCode::LogicalError; | ||
} | ||
|
||
anlowee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ConvertToExists convertPass; | ||
if (expr_ = convertPass.run(expr_); | ||
std::dynamic_pointer_cast<EmptyExpr>(expr_)) { | ||
VLOG(2) << "Query '" << query_ << "' is logically false"; | ||
return ErrorCode::LogicalError; | ||
} | ||
|
||
return ErrorCode::Success; | ||
} | ||
|
||
} // namespace facebook::velox::connector::clp::search_lib |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.