Jackie-Jiang commented on code in PR #8713:
URL: https://github.com/apache/pinot/pull/8713#discussion_r877397095


##########
pinot-segment-local/src/test/java/org/apache/pinot/segment/local/utils/TableConfigUtilsTest.java:
##########
@@ -860,12 +862,21 @@ public void testTableName() {
       String tableName = malformedTableName[i];
       TableConfig tableConfig = new 
TableConfigBuilder(TableType.OFFLINE).setTableName(tableName).build();
       try {
-        TableConfigUtils.validateTableName(tableConfig);
+        TableConfigUtils.validateTableName(tableConfig, 
CommonConstants.Helix.DEFAULT_ALLOW_TABLE_NAME_DOTS);
         Assert.fail("Should fail for malformed table name : " + tableName);
       } catch (IllegalStateException e) {
         // expected
       }
     }
+
+    PinotConfiguration configuration = new PinotConfiguration();

Review Comment:
   (minor) Not used



##########
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java:
##########
@@ -765,31 +766,41 @@ private void handleSubquery(Expression expression, long 
requestId, JsonNode json
    * - Case-insensitive cluster
    * - Table name in the format of [database_name].[table_name]
    *
-   * Drop the database part if there is no existing table in the format of 
[database_name].[table_name], but only
-   * [table_name].
+   * If the PinotConfiguration does not allow dots in table name, will do the 
below:
+   * Drop the prefix part for the format of [database_name].[table_name], keep 
only [table_name].
+   * If the PinotConfiguration allows dots in table name, we will not do the 
split
+   * @param tableName the table name in the query
+   * @param tableCache the table case-sensitive cache
+   * @param routingManager the routing mananger for testing whether a route 
exists
+   * @param config the Pinot Configuration
+   * @return
    */
-  private String getActualTableName(String tableName) {
+  @VisibleForTesting
+  static String getActualTableName(String tableName, TableCache tableCache, 
BrokerRoutingManager routingManager,

Review Comment:
   We might not want to change this method. Even if we allow table name with 
database, we should probably still support the case of table name without 
database.



##########
pinot-spi/src/main/java/org/apache/pinot/spi/utils/CommonConstants.java:
##########
@@ -78,6 +78,8 @@ public static class Helix {
     public static final String LEAD_CONTROLLER_RESOURCE_ENABLED_KEY = 
"RESOURCE_ENABLED";
 
     public static final String ENABLE_CASE_INSENSITIVE_KEY = 
"enable.case.insensitive";
+    public static final String CONFIG_OF_ALLOW_TABLE_NAME_DOTS = 
"allow.table.name.dots";

Review Comment:
   Per the discussion, suggest changing it to `ALLOW_TABLE_NAME_WITH_DATABASE`, 
and only allow one dot if enabled



##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/TableConfigUtils.java:
##########
@@ -153,10 +153,13 @@ private static Set<ValidationType> 
parseTypesToSkipString(@Nullable String types
    *   <li>Table name shouldn't contain dot or space in it</li>
    * </ul>
    */
-  public static void validateTableName(TableConfig tableConfig) {
+  public static void validateTableName(TableConfig tableConfig, boolean 
allowDots) {
     String tableName = tableConfig.getTableName();
-    if (tableName.contains(".") || tableName.contains(" ")) {
-      throw new IllegalStateException("Table name: '" + tableName + "' 
containing '.' or space is not allowed");
+    if (tableName.contains(".") && !allowDots) {

Review Comment:
   Let's check that the table name contains at most one dot, and put some 
comments explaining we allow table name with embedded database name



-- 
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