public static SegmentAssignmentStrategy getSegmentAssignmentStrategy(HelixManager helixManager,
      TableConfig tableConfig, String assignmentType, InstancePartitions instancePartitions) {
    String assignmentStrategy = null;

    TableType currentTableType = tableConfig.getTableType();
    // TODO: Handle segment assignment strategy in future for CONSUMING segments in follow up PR
    // See https://github.com/apache/pinot/issues/9047
    // Accommodate new changes for assignment strategy
    Map<String, SegmentAssignmentConfig> segmentAssignmentConfigMap = tableConfig.getSegmentAssignmentConfigMap();

    if (tableConfig.isDimTable()) {
      // Segment Assignment Strategy for DIM tables
      Preconditions.checkState(currentTableType == TableType.OFFLINE,
          "All Servers Segment assignment Strategy is only applicable to Dim OfflineTables");
      SegmentAssignmentStrategy segmentAssignmentStrategy = new AllServersSegmentAssignmentStrategy();
      segmentAssignmentStrategy.init(helixManager, tableConfig);
      return segmentAssignmentStrategy;
    } else {
      // Try to determine segment assignment strategy from table config
      if (segmentAssignmentConfigMap != null) {
        SegmentAssignmentConfig segmentAssignmentConfig;
        // Use the pre defined segment assignment strategy
        segmentAssignmentConfig = segmentAssignmentConfigMap.get(assignmentType.toUpperCase());
        // Segment assignment config is only applicable to offline tables and completed segments of real time tables
        if (segmentAssignmentConfig != null) {
          assignmentStrategy = segmentAssignmentConfig.getAssignmentStrategy().toLowerCase();
        }
      }
    }

    // Use the existing information to determine segment assignment strategy
    SegmentAssignmentStrategy segmentAssignmentStrategy;
    if (assignmentStrategy == null) {
      // Calculate numReplicaGroups and numPartitions to determine segment assignment strategy
      Preconditions
          .checkState(instancePartitions != null, "Failed to find instance partitions for segment assignment strategy");
      int numReplicaGroups = instancePartitions.getNumReplicaGroups();
      int numPartitions = instancePartitions.getNumPartitions();

      if (numReplicaGroups == 1 && numPartitions == 1) {
        segmentAssignmentStrategy = new BalancedNumSegmentAssignmentStrategy();
      } else {
        segmentAssignmentStrategy = new ReplicaGroupSegmentAssignmentStrategy();
      }
    } else {
      // Set segment assignment strategy depending on strategy set in table config
      switch (assignmentStrategy) {
        case AssignmentStrategy.REPLICA_GROUP_SEGMENT_ASSIGNMENT_STRATEGY:
          segmentAssignmentStrategy = new ReplicaGroupSegmentAssignmentStrategy();
          break;
        case AssignmentStrategy.BALANCE_NUM_SEGMENT_ASSIGNMENT_STRATEGY:
        default:
          segmentAssignmentStrategy = new BalancedNumSegmentAssignmentStrategy();
          break;
      }
    }
    segmentAssignmentStrategy.init(helixManager, tableConfig);
    return segmentAssignmentStrategy;
  }
@Test
  public void testSegmentAssignmentStrategyFromTableConfig() {
    // Set segment assignment config map in table config for balanced num segment assignment strategy
    Map<String, SegmentAssignmentConfig> segmentAssignmentConfigMap = new HashMap<>();
    segmentAssignmentConfigMap.put(InstancePartitionsType.OFFLINE.toString(), new SegmentAssignmentConfig("Balanced"));
    TableConfig tableConfig = new TableConfigBuilder(TableType.OFFLINE).setTableName(RAW_TABLE_NAME)
        .setSegmentAssignmentConfigMap(segmentAssignmentConfigMap).build();

    InstancePartitions instancePartitions = new InstancePartitions(INSTANCE_PARTITIONS_NAME);
    instancePartitions.setInstances(0, 0, INSTANCES);

    SegmentAssignmentStrategy segmentAssignmentStrategy = SegmentAssignmentStrategyFactory
        .getSegmentAssignmentStrategy(null, tableConfig, InstancePartitionsType.OFFLINE.toString(), instancePartitions);
    Assert.assertNotNull(segmentAssignmentStrategy);
    Assert.assertTrue(segmentAssignmentStrategy instanceof BalancedNumSegmentAssignmentStrategy);
  }