Skip to content

Conversation

@JingsongLi
Copy link
Contributor

@JingsongLi JingsongLi commented May 24, 2022

The path is easy to bother the user, he/she will misinterpret it as path of table.
Let's change it to root-path, and it will be clearer.

  1. Rename path to root-path.
  2. Extract a AbstractTableStoreFactory.
  3. Use path as table path. Table Path will be generated in enrichOptions.
  4. Topic will be generated in LogStoreTableFactory.enrichOptions.

It is equivalent to solidifying the path and topic when enrichOptions, so that subsequent queries and writes can use them directly.
This allows us to have a richer strategy for path / topic generation, rather than being tied to generating paths based on tableIdentifier.

import static org.apache.flink.table.store.log.LogStoreTableFactory.discoverLogStoreFactory;

/** Abstract table store factory to create table source and table sink. */
public abstract class AbstractTableStoreFactory
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract from TableStoreFactory.

import static org.apache.flink.table.store.log.LogOptions.LOG_PREFIX;

/** Default implementation of {@link ManagedTableFactory}. */
public class TableStoreManagedFactory extends AbstractTableStoreFactory
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename from TableStoreFactory.

}
});

String rootPath = enrichedOptions.remove(ROOT_PATH.key());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enrich path and topic.

Map<String, String> options = new HashMap<>(context.getCatalogTable().getOptions());
Preconditions.checkArgument(
!options.containsKey(TOPIC.key()),
"Managed table can not contains custom topic. "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contain

return map;
}

@Test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: put tests together

Copy link
Contributor

@LadyForest LadyForest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! Looks good in general, and I only left some minor comments.

Copy link
Contributor

@LadyForest LadyForest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, +1 to merge :)

@JingsongLi JingsongLi merged commit 14c26f9 into apache:master May 25, 2022
@JingsongLi JingsongLi deleted the rename_path branch January 3, 2024 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants