congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
TableNameBuilder.getTableTypeFromTableName
Code IndexAdd Tabnine to your IDE (free)

How to use
getTableTypeFromTableName
method
in
org.apache.pinot.common.config.TableNameBuilder

Best Java code snippets using org.apache.pinot.common.config.TableNameBuilder.getTableTypeFromTableName (Showing top 20 results out of 315)

origin: apache/incubator-pinot

@Override
protected void processTable(String tableNameWithType) {
 CommonConstants.Helix.TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableNameWithType);
 if (tableType == CommonConstants.Helix.TableType.REALTIME) {
  runRelocation(tableNameWithType);
 }
}
origin: apache/incubator-pinot

@Override
protected void processTable(String tableNameWithType) {
 CommonConstants.Helix.TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableNameWithType);
 if (tableType == CommonConstants.Helix.TableType.OFFLINE) {
  TableConfig tableConfig = _pinotHelixResourceManager.getTableConfig(tableNameWithType);
  if (tableConfig == null) {
   LOGGER.warn("Failed to find table config for table: {}, skipping validation", tableNameWithType);
   return;
  }
  validateOfflineSegmentPush(tableConfig);
 }
}
origin: apache/incubator-pinot

 @GET
 @Produces(MediaType.APPLICATION_JSON)
 @Path("/timeBoundary/{tableName}")
 @ApiOperation(value = "Debugging time boundary service")
 @ApiResponses(value = {@ApiResponse(code = 200, message = "Time boundary information of a table"), @ApiResponse(code = 500, message = "Internal server error")})
 public String debugTimeBoundaryService(
   @ApiParam(value = "Name of the table") @PathParam("tableName") String tableName) {
  try {
   String response = "{}";
   if (!tableName.isEmpty()) {
    CommonConstants.Helix.TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableName);
    if (tableType == null) {
     tableName = TableNameBuilder.OFFLINE.tableNameWithType(tableName);
    }
    TimeBoundaryService.TimeBoundaryInfo tbInfo = _timeBoundaryService.getTimeBoundaryInfoFor(tableName);
    if (tbInfo != null) {
     response = tbInfo.toJsonString();
    }
   }
   return response;
  } catch (Exception e) {
   LOGGER.error("Caught exception while processing GET request", e);
   _brokerMetrics.addMeteredGlobalValue(BrokerMeter.UNCAUGHT_GET_EXCEPTIONS, 1);
   throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR);
  }
 }
}
origin: apache/incubator-pinot

List<String> tableNamesWithType = new ArrayList<>(2);
CommonConstants.Helix.TableType tableTypeFromTableName = TableNameBuilder.getTableTypeFromTableName(tableName);
if (tableTypeFromTableName != null) {
origin: apache/incubator-pinot

/**
 * Acquire a token from rate limiter based on the table name.
 * @param tableName original table name which could be raw.
 * @return true if there is no query quota specified for the table or a token can be acquired, otherwise return false.
 */
public boolean acquire(String tableName) {
 LOGGER.debug("Trying to acquire token for table: {}", tableName);
 String offlineTableName = null;
 String realtimeTableName = null;
 QueryQuotaConfig offlineTableQueryQuotaConfig = null;
 QueryQuotaConfig realtimeTableQueryQuotaConfig = null;
 CommonConstants.Helix.TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableName);
 if (tableType == CommonConstants.Helix.TableType.OFFLINE) {
  offlineTableName = tableName;
  offlineTableQueryQuotaConfig = _rateLimiterMap.get(tableName);
 } else if (tableType == CommonConstants.Helix.TableType.REALTIME) {
  realtimeTableName = tableName;
  realtimeTableQueryQuotaConfig = _rateLimiterMap.get(tableName);
 } else {
  offlineTableName = TableNameBuilder.OFFLINE.tableNameWithType(tableName);
  realtimeTableName = TableNameBuilder.REALTIME.tableNameWithType(tableName);
  offlineTableQueryQuotaConfig = _rateLimiterMap.get(offlineTableName);
  realtimeTableQueryQuotaConfig = _rateLimiterMap.get(realtimeTableName);
 }
 boolean offlineQuotaOk =
   offlineTableQueryQuotaConfig == null || tryAcquireToken(offlineTableName, offlineTableQueryQuotaConfig);
 boolean realtimeQuotaOk =
   realtimeTableQueryQuotaConfig == null || tryAcquireToken(realtimeTableName, realtimeTableQueryQuotaConfig);
 return offlineQuotaOk && realtimeQuotaOk;
}
origin: apache/incubator-pinot

public static TableDataManagerConfig getDefaultHelixTableDataManagerConfig(
  @Nonnull InstanceDataManagerConfig instanceDataManagerConfig, @Nonnull String tableNameWithType) {
 Configuration defaultConfig = new PropertiesConfiguration();
 defaultConfig.addProperty(TABLE_DATA_MANAGER_NAME, tableNameWithType);
 defaultConfig.addProperty(TABLE_DATA_MANAGER_DATA_DIRECTORY,
   instanceDataManagerConfig.getInstanceDataDir() + "/" + tableNameWithType);
 defaultConfig.addProperty(TABLE_DATA_MANAGER_CONSUMER_DIRECTORY, instanceDataManagerConfig.getConsumerDir());
 TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableNameWithType);
 Preconditions.checkNotNull(tableType);
 defaultConfig.addProperty(TABLE_DATA_MANAGER_TYPE, tableType.name());
 return new TableDataManagerConfig(defaultConfig);
}
origin: apache/incubator-pinot

@Transition(from = "OFFLINE", to = "ONLINE")
public void onBecomeOnlineFromOffline(Message message, NotificationContext context) {
 _logger.info("SegmentOnlineOfflineStateModel.onBecomeOnlineFromOffline() : " + message);
 String tableNameWithType = message.getResourceName();
 String segmentName = message.getPartitionName();
 try {
  TableType tableType = TableNameBuilder.getTableTypeFromTableName(message.getResourceName());
  Preconditions.checkNotNull(tableType);
  if (tableType == TableType.OFFLINE) {
   _fetcherAndLoader.addOrReplaceOfflineSegment(tableNameWithType, segmentName);
  } else {
   _instanceDataManager.addRealtimeSegment(tableNameWithType, segmentName);
  }
 } catch (Exception e) {
  _logger.error("Caught exception in state transition from OFFLINE -> ONLINE for resource: {}, partition: {}",
    tableNameWithType, segmentName, e);
  Utils.rethrowException(e);
 }
}
origin: apache/incubator-pinot

CommonConstants.Helix.TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableName);
origin: apache/incubator-pinot

QueryQuotaConfig queryQuotaConfig = entry.getValue();
String rawTableName = TableNameBuilder.extractRawTableName(tableNameWithType);
TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableNameWithType);
origin: apache/incubator-pinot

 private String getAllCrcMetadataForTable(String tableName) {
  // TODO
  // In the restlet.resource version, we see this code block below
  // seems to be wrong comparing the table name to have the table type, but we copy it here anyway.
  // Realtime table is not supported.
  if (TableNameBuilder.getTableTypeFromTableName(tableName) == CommonConstants.Helix.TableType.REALTIME) {
   throw new ControllerApplicationException(LOGGER, "Realtime table is not supported", Response.Status.FORBIDDEN);
  }

  // Check that the offline table exists.
  String offlineTableName = TableNameBuilder.OFFLINE.tableNameWithType(tableName);
  if (!_pinotHelixResourceManager.getAllTables().contains(offlineTableName)) {
   throw new ControllerApplicationException(LOGGER, "Offline table " + tableName + " does not exist.", BAD_REQUEST);
  }

  Map<String, String> segmentCrcForTable = _pinotHelixResourceManager.getSegmentsCrcForTable(offlineTableName);
  String result;
  try {
   result = JsonUtils.objectToPrettyString(segmentCrcForTable);
  } catch (JsonProcessingException e) {
   throw new ControllerApplicationException(LOGGER,
     String.format("Failed to write segment crc values for table: %s", tableName),
     Response.Status.INTERNAL_SERVER_ERROR);
  }
  return result;
 }
}
origin: apache/incubator-pinot

 @Override
 public Boolean executeTask(@Nonnull PinotTaskConfig pinotTaskConfig) {
  assertTrue(MINION_CONTEXT.getDataDir().exists());
  assertNotNull(MINION_CONTEXT.getMinionMetrics());
  assertNotNull(MINION_CONTEXT.getMinionVersion());
  assertEquals(pinotTaskConfig.getTaskType(), TestTaskGenerator.TASK_TYPE);
  Map<String, String> configs = pinotTaskConfig.getConfigs();
  assertEquals(configs.size(), 2);
  String offlineTableName = configs.get("tableName");
  assertEquals(TableNameBuilder.getTableTypeFromTableName(offlineTableName), TableType.OFFLINE);
  String rawTableName = TableNameBuilder.extractRawTableName(offlineTableName);
  assertTrue(rawTableName.equals(TABLE_NAME_1) || rawTableName.equals(TABLE_NAME_2));
  assertEquals(configs.get("tableType"), TableType.OFFLINE.toString());
  do {
   if (_cancelled) {
    throw new TaskCancelledException("Task has been cancelled");
   }
  } while (HOLD.get());
  return true;
 }
};
origin: apache/incubator-pinot

@Override
protected void processTable(String tableNameWithType) {
 CommonConstants.Helix.TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableNameWithType);
 if (tableType == CommonConstants.Helix.TableType.REALTIME) {
  TableConfig tableConfig = _pinotHelixResourceManager.getTableConfig(tableNameWithType);
  if (tableConfig == null) {
   LOGGER.warn("Failed to find table config for table: {}, skipping validation", tableNameWithType);
   return;
  }
  if (_updateRealtimeDocumentCount) {
   updateRealtimeDocumentCount(tableConfig);
  }
  Map<String, String> streamConfigMap = tableConfig.getIndexingConfig().getStreamConfigs();
  StreamConfig streamConfig = new StreamConfig(streamConfigMap);
  if (streamConfig.hasLowLevelConsumerType()) {
   _llcRealtimeSegmentManager.ensureAllPartitionsConsuming(tableConfig);
  }
 }
}
origin: apache/incubator-pinot

if (TableNameBuilder.getTableTypeFromTableName(tableName) == TableType.REALTIME) {
 return;
origin: apache/incubator-pinot

CommonConstants.Helix.TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableName);
origin: apache/incubator-pinot

 private TableConfig generateTableConfig(String tableName) {
  TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableName);
  Builder builder = new TableConfig.Builder(tableType);
  builder.setTableName(tableName);
  return builder.build();
 }
}
origin: apache/incubator-pinot

private TableConfig generateDefaultTableConfig(String tableName) {
 TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableName);
 TableConfig.Builder builder = new TableConfig.Builder(tableType);
 builder.setTableName(tableName);
 return builder.build();
}
origin: apache/incubator-pinot

 private TableConfig generateTableConfig(String tableName)
   throws Exception {
  TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableName);
  Builder builder = new TableConfig.Builder(tableType);
  builder.setTableName(tableName);
  return builder.build();
 }
}
origin: apache/incubator-pinot

when(mockValidationConfig.getReplicasPerPartitionNumber()).thenReturn(nReplicas);
when(mockTableConfig.getValidationConfig()).thenReturn(mockValidationConfig);
CommonConstants.Helix.TableType tableTypeFromTableName = TableNameBuilder.getTableTypeFromTableName(tableName);
when(mockTableConfig.getTableType()).thenReturn(tableTypeFromTableName);
origin: apache/incubator-pinot

 public static TableConfig getDynamicComputingTableConfig(String tableName) {
  TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableName);
  RoutingConfig routingConfig = new RoutingConfig();
  Map<String, String> routingTableBuilderOptions = new HashMap<>();
  routingTableBuilderOptions.put(RoutingConfig.ENABLE_DYNAMIC_COMPUTING_KEY, "true");
  routingConfig.setRoutingTableBuilderOptions(routingTableBuilderOptions);
  return new TableConfig.Builder(tableType).setTableName(tableName).setRoutingConfig(routingConfig).build();
 }
}
origin: apache/incubator-pinot

try {
 String znRecordId = tableConfigZnRecord.getId();
 if (TableNameBuilder.getTableTypeFromTableName(znRecordId) == TableType.REALTIME) {
  TableConfig tableConfig = TableConfig.fromZnRecord(tableConfigZnRecord);
  StreamConfig metadata = new StreamConfig(tableConfig.getIndexingConfig().getStreamConfigs());
org.apache.pinot.common.configTableNameBuildergetTableTypeFromTableName

Javadoc

Get the table type based on the given table name with type suffix.

Popular methods of TableNameBuilder

  • extractRawTableName
    Extract the raw table name from the given table name with type suffix.
  • tableNameWithType
    Get the table name with type suffix.
  • forType
    Get the table name builder for the given table type.
  • isTableResource
    Return whether the given resource name represents a table resource.
  • tableHasTypeSuffix
    Return Whether the table has type suffix that matches the builder type.

Popular in Java

  • Making http requests using okhttp
  • getContentResolver (Context)
  • compareTo (BigDecimal)
  • runOnUiThread (Activity)
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • BoxLayout (javax.swing)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now