@@ -24,7 +24,7 @@ private[spark] class DocumentRDDFunctions extends LoggingTrait {
2424 createTable : Boolean = false ,
2525 bulkInsert : Boolean = false ,
2626 function1 : (Broadcast [SerializableConfiguration ],
27- Boolean ) => Function1 [ Iterator [T ], Unit ] ): Unit = {
27+ Boolean ) => (( Iterator [T ]) => Unit ) ): Unit = {
2828 var isNewAndBulkLoad = (false , false )
2929
3030 val partitioner : Option [Partitioner ] = rdd.partitioner
@@ -67,31 +67,30 @@ private[spark] case class OJAIDocumentRDDFunctions[T](rdd: RDD[T])(
6767
6868 @ transient val sparkContext = rdd.sparkContext
6969
70- def saveToMapRDB (tablename : String ,
70+ def saveToMapRDB (tableName : String ,
7171 createTable : Boolean = false ,
7272 bulkInsert : Boolean = false ,
7373 idFieldPath : String = DocumentConstants .ID_KEY ): Unit = {
7474 logDebug(
75- s " saveToMapRDB in OJAIDocumentRDDFunctions is called for table: $tablename " +
75+ s " saveToMapRDB in OJAIDocumentRDDFunctions is called for table: $tableName " +
7676 s " with bulkinsert flag set: $bulkInsert and createTable: $createTable" )
7777
78- var getID : (Document ) => Value = null
79- if (idFieldPath == DocumentConstants .ID_KEY ) {
80- getID = (doc : Document ) => doc.getId
78+ val getID : Document => Value = if (idFieldPath == DocumentConstants .ID_KEY ) {
79+ (doc : Document ) => doc.getId
8180 } else {
82- getID = (doc : Document ) => doc.getValue(idFieldPath)
81+ (doc : Document ) => doc.getValue(idFieldPath)
8382 }
8483
8584 this .saveToMapRDBInternal(
8685 rdd,
87- tablename ,
86+ tableName ,
8887 createTable,
8988 bulkInsert,
90- (cnf : Broadcast [SerializableConfiguration ], isnewAndBulkLoad : Boolean ) =>
89+ (cnf : Broadcast [SerializableConfiguration ], isNewAndBulkLoad : Boolean ) =>
9190 (iter : Iterator [T ]) => {
9291 if (iter.nonEmpty) {
9392 val writer =
94- Writer .initialize(tablename , cnf.value, isnewAndBulkLoad , true )
93+ Writer .initialize(tableName , cnf.value, isNewAndBulkLoad , true )
9594 while (iter.hasNext) {
9695 val element = iter.next
9796 f.write(f.getValue(element), getID, writer)
@@ -110,8 +109,8 @@ private[spark] case class OJAIDocumentRDDFunctions[T](rdd: RDD[T])(
110109 s " insertToMapRDB in OJAIDocumentRDDFunctions is called for table: $tablename" +
111110 s " with bulkinsert flag set: $bulkInsert and createTable: $createTable" )
112111
113- var getID : (Document ) => Value = if (idFieldPath == DocumentConstants .ID_KEY ) {
114- (doc : Document ) => doc.getId
112+ val getID : (Document ) => Value = if (idFieldPath == DocumentConstants .ID_KEY ) {
113+ (doc : Document ) => doc.getId
115114 } else {
116115 (doc : Document ) => doc.getValue(idFieldPath)
117116 }
@@ -121,11 +120,11 @@ private[spark] case class OJAIDocumentRDDFunctions[T](rdd: RDD[T])(
121120 tablename,
122121 createTable,
123122 bulkInsert,
124- (cnf : Broadcast [SerializableConfiguration ], isnewAndBulkLoad : Boolean ) =>
123+ (cnf : Broadcast [SerializableConfiguration ], isNewAndBulkLoad : Boolean ) =>
125124 (iter : Iterator [T ]) => {
126125 if (iter.nonEmpty) {
127126 val writer =
128- Writer .initialize(tablename, cnf.value, isnewAndBulkLoad , false )
127+ Writer .initialize(tablename, cnf.value, isNewAndBulkLoad , false )
129128 while (iter.hasNext) {
130129 val element = iter.next
131130 f.write(f.getValue(element), getID, writer)
@@ -136,20 +135,20 @@ private[spark] case class OJAIDocumentRDDFunctions[T](rdd: RDD[T])(
136135 )
137136 }
138137
139- def updateToMapRDB (tablename : String ,
138+ def updateToMapRDB (tableName : String ,
140139 mutation : (T ) => DocumentMutation ,
141140 getID : (T ) => Value ): Unit = {
142141 logDebug(
143- " updateToMapRDB in OJAIDocumentRDDFunctions is called for table: " + tablename )
142+ " updateToMapRDB in OJAIDocumentRDDFunctions is called for table: " + tableName )
144143 this .saveToMapRDBInternal(
145144 rdd,
146- tablename ,
145+ tableName ,
147146 false ,
148147 false ,
149148 (cnf : Broadcast [SerializableConfiguration ], isnewAndBulkLoad : Boolean ) =>
150149 (iter : Iterator [T ]) =>
151150 if (iter.nonEmpty) {
152- val writer = TableUpdateWriter (DBClient ().getTable(tablename ))
151+ val writer = TableUpdateWriter (DBClient ().getTable(tableName ))
153152 while (iter.hasNext) {
154153 val element = iter.next
155154 f.update(mutation(element), getID(element), writer)
@@ -159,24 +158,24 @@ private[spark] case class OJAIDocumentRDDFunctions[T](rdd: RDD[T])(
159158 )
160159 }
161160
162- def updateToMapRDB (tablename : String ,
161+ def updateToMapRDB (tableName : String ,
163162 mutation : (T ) => DocumentMutation ,
164163 getID : (T ) => Value ,
165164 condition : Predicate ): Unit = {
166165 logDebug(
167- " updateToMapRDB in OJAIDocumentRDDFunctions is called for table: " + tablename )
166+ " updateToMapRDB in OJAIDocumentRDDFunctions is called for table: " + tableName )
168167 val queryCondition = DBQueryCondition (condition.build.build())
169168
170169 this .saveToMapRDBInternal(
171170 rdd,
172- tablename ,
171+ tableName ,
173172 false ,
174173 false ,
175174 (cnf : Broadcast [SerializableConfiguration ], isnewAndBulkLoad : Boolean ) =>
176175 (iter : Iterator [T ]) =>
177176 if (iter.nonEmpty) {
178177 val writer =
179- TableCheckAndMutateWriter (DBClient ().getTable(tablename ))
178+ TableCheckAndMutateWriter (DBClient ().getTable(tableName ))
180179 while (iter.hasNext) {
181180 val element = iter.next
182181 f.checkAndUpdate(mutation(element),
@@ -196,23 +195,23 @@ private[spark] case class PairedDocumentRDDFunctions[K, V](rdd: RDD[(K, V)])(
196195 extends DocumentRDDFunctions {
197196
198197 @ transient val sparkContext = rdd.sparkContext
199- def saveToMapRDB (tablename : String ,
198+ def saveToMapRDB (tableName : String ,
200199 createTable : Boolean = false ,
201200 bulkInsert : Boolean = false ): Unit = {
202201 logDebug(
203202 " saveToMapRDB in PairedDocumentRDDFunctions is called for table: " +
204- tablename + " with bulkinsert flag set: " + bulkInsert + " and createTable:" + createTable)
203+ tableName + " with bulkinsert flag set: " + bulkInsert + " and createTable:" + createTable)
205204
206205 this .saveToMapRDBInternal[(K , V )](
207206 rdd,
208- tablename ,
207+ tableName ,
209208 createTable,
210209 bulkInsert,
211210 (cnf : Broadcast [SerializableConfiguration ], isnewAndBulkLoad : Boolean ) =>
212211 (iter : Iterator [(K , V )]) =>
213212 if (iter.nonEmpty) {
214213 val writer =
215- Writer .initialize(tablename , cnf.value, isnewAndBulkLoad, true )
214+ Writer .initialize(tableName , cnf.value, isnewAndBulkLoad, true )
216215 while (iter.hasNext) {
217216 val element = iter.next
218217 f.write(v.getValue(element._2), f.getValue(element._1), writer)
0 commit comments