forked from opensearch-project/OpenSearch
-
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.
Vamshi's changes for Term Agg using Stream
Signed-off-by: Rishabh Maurya <[email protected]>
- Loading branch information
1 parent
60a3586
commit edabf74
Showing
56 changed files
with
2,030 additions
and
219 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,20 @@ | ||
Apache log4j | ||
Copyright 2007 The Apache Software Foundation | ||
Apache Log4j | ||
Copyright 1999-2024 Apache Software Foundation | ||
|
||
This product includes software developed at | ||
The Apache Software Foundation (http://www.apache.org/). | ||
The Apache Software Foundation (http://www.apache.org/). | ||
|
||
ResolverUtil.java | ||
Copyright 2005-2006 Tim Fennell | ||
|
||
Dumbster SMTP test server | ||
Copyright 2004 Jason Paul Kitchen | ||
|
||
TypeUtil.java | ||
Copyright 2002-2012 Ramnivas Laddad, Juergen Hoeller, Chris Beams | ||
|
||
picocli (http://picocli.info) | ||
Copyright 2017 Remko Popma | ||
|
||
TimeoutBlockingWaitStrategy.java and parts of Util.java | ||
Copyright 2011 LMAX Ltd. |
65 changes: 65 additions & 0 deletions
65
...rrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/api/FlightServerInfoAction.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,65 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
package org.opensearch.arrow.flight.api; | ||
|
||
import org.opensearch.client.node.NodeClient; | ||
import org.opensearch.rest.BaseRestHandler; | ||
import org.opensearch.rest.RestRequest; | ||
import org.opensearch.rest.action.RestToXContentListener; | ||
|
||
import java.util.List; | ||
|
||
import static org.opensearch.rest.RestRequest.Method.GET; | ||
|
||
/** | ||
* It handles GET requests for retrieving Flight server information. | ||
*/ | ||
public class FlightServerInfoAction extends BaseRestHandler { | ||
|
||
/** | ||
* Constructor for FlightServerInfoAction. | ||
*/ | ||
public FlightServerInfoAction() {} | ||
|
||
/** | ||
* Returns the name of the action. | ||
* @return The name of the action. | ||
*/ | ||
@Override | ||
public String getName() { | ||
return "flight_server_info_action"; | ||
} | ||
|
||
/** | ||
* Returns the list of routes for the action. | ||
* @return The list of routes for the action. | ||
*/ | ||
@Override | ||
public List<Route> routes() { | ||
return List.of(new Route(GET, "/_flight/info"), new Route(GET, "/_flight/info/{nodeId}")); | ||
} | ||
|
||
/** | ||
* Prepares the request for the action. | ||
* @param request The REST request. | ||
* @param client The node client. | ||
* @return The rest channel consumer. | ||
*/ | ||
@Override | ||
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) { | ||
String nodeId = request.param("nodeId"); | ||
if (nodeId != null) { | ||
// Query specific node | ||
NodesFlightInfoRequest nodesRequest = new NodesFlightInfoRequest(nodeId); | ||
return channel -> client.execute(NodesFlightInfoAction.INSTANCE, nodesRequest, new RestToXContentListener<>(channel)); | ||
} else { | ||
NodesFlightInfoRequest nodesRequest = new NodesFlightInfoRequest(); | ||
return channel -> client.execute(NodesFlightInfoAction.INSTANCE, nodesRequest, new RestToXContentListener<>(channel)); | ||
} | ||
} | ||
} |
99 changes: 99 additions & 0 deletions
99
plugins/arrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/api/NodeFlightInfo.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,99 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.arrow.flight.api; | ||
|
||
import org.opensearch.action.support.nodes.BaseNodeResponse; | ||
import org.opensearch.cluster.node.DiscoveryNode; | ||
import org.opensearch.core.common.io.stream.StreamInput; | ||
import org.opensearch.core.common.io.stream.StreamOutput; | ||
import org.opensearch.core.common.transport.BoundTransportAddress; | ||
import org.opensearch.core.common.transport.TransportAddress; | ||
import org.opensearch.core.xcontent.ToXContent; | ||
import org.opensearch.core.xcontent.ToXContentObject; | ||
import org.opensearch.core.xcontent.XContentBuilder; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Represents the response for a node's flight information. | ||
*/ | ||
public class NodeFlightInfo extends BaseNodeResponse implements ToXContentObject { | ||
private final BoundTransportAddress boundAddress; | ||
|
||
/** | ||
* Constructor for NodeFlightInfo. | ||
* @param in The stream input to read from. | ||
* @throws IOException If an I/O error occurs. | ||
*/ | ||
public NodeFlightInfo(StreamInput in) throws IOException { | ||
super(in); | ||
boundAddress = new BoundTransportAddress(in); | ||
} | ||
|
||
/** | ||
* Constructor for NodeFlightInfo. | ||
* @param node The discovery node. | ||
* @param boundAddress The bound transport address. | ||
*/ | ||
public NodeFlightInfo(DiscoveryNode node, BoundTransportAddress boundAddress) { | ||
super(node); | ||
this.boundAddress = boundAddress; | ||
} | ||
|
||
/** | ||
* Writes the node flight information to the stream. | ||
* @param out The stream output to write to. | ||
* @throws IOException If an I/O error occurs. | ||
*/ | ||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
super.writeTo(out); | ||
boundAddress.writeTo(out); | ||
} | ||
|
||
/** | ||
* Returns the bound transport address. | ||
* @return The bound transport address. | ||
*/ | ||
public BoundTransportAddress getBoundAddress() { | ||
return boundAddress; | ||
} | ||
|
||
/** | ||
* Converts the node flight information to XContent. | ||
* @param builder The XContent builder. | ||
* @param params The parameters for the XContent conversion. | ||
* @return The XContent builder. | ||
* @throws IOException If an I/O error occurs. | ||
*/ | ||
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException { | ||
builder.startObject(); | ||
builder.startObject("flight_server"); | ||
|
||
builder.startArray("bound_addresses"); | ||
for (TransportAddress address : boundAddress.boundAddresses()) { | ||
builder.startObject(); | ||
builder.field("host", address.address().getHostString()); | ||
builder.field("port", address.address().getPort()); | ||
builder.endObject(); | ||
} | ||
builder.endArray(); | ||
|
||
TransportAddress publishAddress = boundAddress.publishAddress(); | ||
builder.startObject("publish_address"); | ||
builder.field("host", publishAddress.address().getHostString()); | ||
builder.field("port", publishAddress.address().getPort()); | ||
builder.endObject(); | ||
|
||
builder.endObject(); | ||
builder.endObject(); | ||
return builder; | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
...arrow-flight-rpc/src/main/java/org/opensearch/arrow/flight/api/NodesFlightInfoAction.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,29 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.arrow.flight.api; | ||
|
||
import org.opensearch.action.ActionType; | ||
|
||
/** | ||
* Action to retrieve flight info from nodes | ||
*/ | ||
public class NodesFlightInfoAction extends ActionType<NodesFlightInfoResponse> { | ||
/** | ||
* Singleton instance of NodesFlightInfoAction. | ||
*/ | ||
public static final NodesFlightInfoAction INSTANCE = new NodesFlightInfoAction(); | ||
/** | ||
* Name of this action. | ||
*/ | ||
public static final String NAME = "cluster:admin/flight/info"; | ||
|
||
NodesFlightInfoAction() { | ||
super(NAME, NodesFlightInfoResponse::new); | ||
} | ||
} |
Oops, something went wrong.