xiangfu0 commented on code in PR #17167:
URL: https://github.com/apache/pinot/pull/17167#discussion_r3039231857


##########
pinot-connectors/pinot-flink-connector/src/main/java/org/apache/pinot/connector/flink/FlinkQuickStart.java:
##########
@@ -79,10 +77,8 @@ public static void main(String[] args)
     execEnv.setParallelism(2);
     DataStream<Row> srcDs = 
execEnv.fromCollection(data).returns(TEST_TYPE_INFO).keyBy(r -> r.getField(0));
 
-    HttpClient httpClient = HttpClient.getInstance();
-    ControllerRequestClient client = new ControllerRequestClient(
-        ControllerRequestURLBuilder.baseUrl(DEFAULT_CONTROLLER_URL), 
httpClient);
-    Schema schema = PinotConnectionUtils.getSchema(client, "starbucksStores");
+    PinotAdminClient client = new PinotAdminClient("localhost:9000");
+    Schema schema = client.getSchemaClient().getSchema("starbucksStores");

Review Comment:
   Resolved - FlinkQuickStart now uses getSchemaObject() which returns a typed 
Schema.



##########
pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/admin/PinotSchemaAdminClient.java:
##########
@@ -69,17 +71,30 @@ public String getSchemasInfo()
   }
 
   /**
-   * Gets a specific schema by name.
+   * Gets a specific schema string by name.
    *
    * @param schemaName Name of the schema
    * @return Schema configuration as JSON string
    * @throws PinotAdminException If the request fails
    */
-  public String getSchema(String schemaName)
+  public String getSchemaString(String schemaName)

Review Comment:
   Resolved - getSchemaString() has been removed. getSchema() returns JSON 
string, getSchemaObject() returns typed Schema.



##########
pinot-connectors/pinot-flink-connector/src/main/java/org/apache/pinot/connector/flink/http/PinotConnectionUtils.java:
##########
@@ -58,7 +64,7 @@ public static TableConfig 
getTableConfig(ControllerRequestClient client, String
 
     Map<String, String> newBatchConfigMap = new HashMap<>();
     // append the batch config of controller URI
-    String controllerBaseUrl = 
client.getControllerRequestURLBuilder().getBaseUrl();
+    String controllerBaseUrl = "http://"; + client.getControllerAddress();

Review Comment:
   Resolved - PinotConnectionUtils has been removed. The admin client uses 
getControllerBaseUrl() which respects the transport scheme.



##########
pinot-connectors/pinot-flink-connector/src/main/java/org/apache/pinot/connector/flink/FlinkQuickStart.java:
##########
@@ -79,10 +77,8 @@ public static void main(String[] args)
     execEnv.setParallelism(2);
     DataStream<Row> srcDs = 
execEnv.fromCollection(data).returns(TEST_TYPE_INFO).keyBy(r -> r.getField(0));
 
-    HttpClient httpClient = HttpClient.getInstance();
-    ControllerRequestClient client = new ControllerRequestClient(
-        ControllerRequestURLBuilder.baseUrl(DEFAULT_CONTROLLER_URL), 
httpClient);
-    Schema schema = PinotConnectionUtils.getSchema(client, "starbucksStores");
+    PinotAdminClient client = new PinotAdminClient("localhost:9000");
+    Schema schema = client.getSchemaClient().getSchema("starbucksStores");
     TableConfig tableConfig = PinotConnectionUtils.getTableConfig(client, 
"starbucksStores", "OFFLINE");
     srcDs.addSink(new PinotSinkFunction<>(new 
FlinkRowGenericRowConverter(TEST_TYPE_INFO), tableConfig, schema));
     execEnv.execute();

Review Comment:
   Resolved - FlinkQuickStart now uses try-with-resources to properly close 
PinotAdminClient.



##########
pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/admin/PinotLogicalTableAdminClient.java:
##########
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.pinot.client.admin;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * Client for logical table administration operations.
+ */
+public class PinotLogicalTableAdminClient {
+  private final PinotAdminTransport _transport;
+  private final String _controllerAddress;
+  private final java.util.Map<String, String> _headers;
+
+  public PinotLogicalTableAdminClient(PinotAdminTransport transport, String 
controllerAddress,
+      java.util.Map<String, String> headers) {
+    _transport = transport;
+    _controllerAddress = controllerAddress;
+    _headers = headers;
+  }
+
+  public String createLogicalTable(String logicalTableConfigJson)
+      throws PinotAdminException {
+    JsonNode response = _transport.executePost(_controllerAddress, 
"/logicalTables", logicalTableConfigJson, null,
+        _headers);
+    System.out.println("createLogicalTable response: " + response.toString());

Review Comment:
   Resolved - System.out.println removed from PinotLogicalTableAdminClient.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to