Skip to content

Commit ba8cdf6

Browse files
authored
Merge branch 'release-0.293-clp-connector' into xwei/add-k8s-manual-doc
2 parents c82f6eb + 4f7da77 commit ba8cdf6

File tree

8 files changed

+31
-10
lines changed

8 files changed

+31
-10
lines changed

presto-clp/src/main/java/com/facebook/presto/plugin/clp/ClpSplit.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import java.util.List;
2626
import java.util.Map;
27+
import java.util.Optional;
2728

2829
import static com.facebook.presto.spi.schedule.NodeSelectionStrategy.NO_PREFERENCE;
2930
import static java.util.Objects.requireNonNull;
@@ -32,11 +33,15 @@ public class ClpSplit
3233
implements ConnectorSplit
3334
{
3435
private final String path;
36+
private final Optional<String> kqlQuery;
3537

3638
@JsonCreator
37-
public ClpSplit(@JsonProperty("path") String path)
39+
public ClpSplit(
40+
@JsonProperty("path") String path,
41+
@JsonProperty("kqlQuery") Optional<String> kqlQuery)
3842
{
3943
this.path = requireNonNull(path, "Split path is null");
44+
this.kqlQuery = kqlQuery;
4045
}
4146

4247
@JsonProperty
@@ -45,6 +50,12 @@ public String getPath()
4550
return path;
4651
}
4752

53+
@JsonProperty
54+
public Optional<String> getKqlQuery()
55+
{
56+
return kqlQuery;
57+
}
58+
4859
@Override
4960
public NodeSelectionStrategy getNodeSelectionStrategy()
5061
{
@@ -60,6 +71,6 @@ public List<HostAddress> getPreferredNodes(NodeProvider nodeProvider)
6071
@Override
6172
public Map<String, String> getInfo()
6273
{
63-
return ImmutableMap.of("path", path);
74+
return ImmutableMap.of("path", path, "kqlQuery", kqlQuery.orElse("<null>"));
6475
}
6576
}

presto-clp/src/main/java/com/facebook/presto/plugin/clp/split/ClpMySqlSplitProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public List<ClpSplit> listSplits(ClpTableLayoutHandle clpTableLayoutHandle)
8181
while (resultSet.next()) {
8282
final String archiveId = resultSet.getString(ARCHIVES_TABLE_COLUMN_ID);
8383
final String archivePath = tablePath + "/" + archiveId;
84-
splits.add(new ClpSplit(archivePath));
84+
splits.add(new ClpSplit(archivePath, clpTableLayoutHandle.getKqlQuery()));
8585
}
8686
}
8787
}

presto-native-execution/presto_cpp/main/connectors/PrestoToVeloxConnector.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,7 +1564,7 @@ ClpPrestoToVeloxConnector::toVeloxSplit(
15641564
VELOX_CHECK_NOT_NULL(
15651565
clpSplit, "Unexpected split type {}", connectorSplit->_type);
15661566
return std::make_unique<connector::clp::ClpConnectorSplit>(
1567-
catalogId, clpSplit->path);
1567+
catalogId, clpSplit->path, clpSplit->kqlQuery);
15681568
}
15691569

15701570
std::unique_ptr<velox::connector::ColumnHandle>
@@ -1597,9 +1597,7 @@ ClpPrestoToVeloxConnector::toVeloxTableHandle(
15971597
"Unexpected layout type {}",
15981598
tableHandle.connectorTableLayout->_type);
15991599
return std::make_unique<connector::clp::ClpTableHandle>(
1600-
tableHandle.connectorId,
1601-
clpLayout->table.schemaTableName.table,
1602-
clpLayout->kqlQuery);
1600+
tableHandle.connectorId, clpLayout->table.schemaTableName.table);
16031601
}
16041602

16051603
std::unique_ptr<protocol::ConnectorProtocol>

presto-native-execution/presto_cpp/main/connectors/Registration.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ void registerConnectors() {
8181
std::make_unique<IcebergPrestoToVeloxConnector>(kIcebergConnectorName));
8282
registerPrestoToVeloxConnector(std::make_unique<TpchPrestoToVeloxConnector>(
8383
velox::connector::tpch::TpchConnectorFactory::kTpchConnectorName));
84-
registerPrestoToVeloxConnector(std::make_unique<ClpPrestoToVeloxConnector>(
85-
velox::connector::clp::ClpConnectorFactory::kClpConnectorName));
84+
registerPrestoToVeloxConnector(
85+
std::make_unique<ClpPrestoToVeloxConnector>(
86+
velox::connector::clp::ClpConnectorFactory::kClpConnectorName));
8687

8788
// Presto server uses system catalog or system schema in other catalogs
8889
// in different places in the code. All these resolve to the SystemConnector.

presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,13 @@ void to_json(json& j, const ClpSplit& p) {
8181
j = json::object();
8282
j["@type"] = "clp";
8383
to_json_key(j, "path", p.path, "ClpSplit", "String", "path");
84+
to_json_key(j, "kqlQuery", p.kqlQuery, "ClpSplit", "String", "kqlQuery");
8485
}
8586

8687
void from_json(const json& j, ClpSplit& p) {
8788
p._type = j["@type"];
8889
from_json_key(j, "path", p.path, "ClpSplit", "String", "path");
90+
from_json_key(j, "kqlQuery", p.kqlQuery, "ClpSplit", "String", "kqlQuery");
8991
}
9092
} // namespace facebook::presto::protocol::clp
9193
namespace facebook::presto::protocol::clp {

presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ void from_json(const json& j, ClpColumnHandle& p);
5252
namespace facebook::presto::protocol::clp {
5353
struct ClpSplit : public ConnectorSplit {
5454
String path = {};
55+
std::shared_ptr<String> kqlQuery = {};
5556

5657
ClpSplit() noexcept;
5758
};

presto-native-execution/presto_cpp/presto_protocol/connector/clp/presto_protocol_clp.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@
5050
"field_text": "String",
5151
"_N": 1,
5252
"field_local": true
53+
},
54+
{
55+
"field_type": "Optional<String>",
56+
"field_name": "kqlQuery",
57+
"field_text": "String",
58+
"optional": true,
59+
"_N": 2,
60+
"field_local": true
5361
}
5462
],
5563
"subclass": true,

0 commit comments

Comments
 (0)