You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by pm...@apache.org on 2018/07/24 19:28:58 UTC
samza git commit: SAMZA-1782: Making getTableSpecs API in
TableConfigGenerator util class public
Repository: samza
Updated Branches:
refs/heads/master fa56b15dc -> 025f61710
SAMZA-1782: Making getTableSpecs API in TableConfigGenerator util class public
Author: Aditya Toomula <at...@linkedin.com>
Reviewers: Prateek Maheshwari <pm...@apache.org>
Closes #577 from atoomula/table3
Project: http://git-wip-us.apache.org/repos/asf/samza/repo
Commit: http://git-wip-us.apache.org/repos/asf/samza/commit/025f6171
Tree: http://git-wip-us.apache.org/repos/asf/samza/tree/025f6171
Diff: http://git-wip-us.apache.org/repos/asf/samza/diff/025f6171
Branch: refs/heads/master
Commit: 025f617106c75f9807d49172ed98d3b141ced05a
Parents: fa56b15
Author: Aditya Toomula <at...@linkedin.com>
Authored: Tue Jul 24 12:28:55 2018 -0700
Committer: Prateek Maheshwari <pm...@apache.org>
Committed: Tue Jul 24 12:28:55 2018 -0700
----------------------------------------------------------------------
.../samza/table/TableConfigGenerator.java | 35 +++++++++++---------
1 file changed, 20 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/samza/blob/025f6171/samza-core/src/main/java/org/apache/samza/table/TableConfigGenerator.java
----------------------------------------------------------------------
diff --git a/samza-core/src/main/java/org/apache/samza/table/TableConfigGenerator.java b/samza-core/src/main/java/org/apache/samza/table/TableConfigGenerator.java
index ac17c68..3b87eff 100644
--- a/samza-core/src/main/java/org/apache/samza/table/TableConfigGenerator.java
+++ b/samza-core/src/main/java/org/apache/samza/table/TableConfigGenerator.java
@@ -81,6 +81,26 @@ public class TableConfigGenerator {
return tableConfigs;
}
+ /**
+ * Get list of table specs given a list of table descriptors.
+ * @param tableDescs the list of tableDescriptors
+ * @return list of tableSpecs
+ */
+ static public List<TableSpec> getTableSpecs(List<TableDescriptor> tableDescs) {
+ Map<TableSpec, TableImpl> tableSpecs = new LinkedHashMap<>();
+
+ tableDescs.forEach(tableDesc -> {
+ TableSpec tableSpec = ((BaseTableDescriptor) tableDesc).getTableSpec();
+
+ if (tableSpecs.containsKey(tableSpec)) {
+ throw new IllegalStateException(
+ String.format("getTable() invoked multiple times with the same tableId: %s", tableDesc.getTableId()));
+ }
+ tableSpecs.put(tableSpec, new TableImpl(tableSpec));
+ });
+ return new ArrayList<>(tableSpecs.keySet());
+ }
+
static private Map<String, String> generateTableKVSerdeConfigs(List<TableSpec> tableSpecs) {
Map<String, String> serdeConfigs = new HashMap<>();
@@ -120,19 +140,4 @@ public class TableConfigGenerator {
return serdeConfigs;
}
-
- static private List<TableSpec> getTableSpecs(List<TableDescriptor> tableDescs) {
- Map<TableSpec, TableImpl> tableSpecs = new LinkedHashMap<>();
-
- tableDescs.forEach(tableDesc -> {
- TableSpec tableSpec = ((BaseTableDescriptor) tableDesc).getTableSpec();
-
- if (tableSpecs.containsKey(tableSpec)) {
- throw new IllegalStateException(
- String.format("getTable() invoked multiple times with the same tableId: %s", tableDesc.getTableId()));
- }
- tableSpecs.put(tableSpec, new TableImpl(tableSpec));
- });
- return new ArrayList<>(tableSpecs.keySet());
- }
}