-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move class definitions outside packages
- Loading branch information
1 parent
1671db7
commit bf26cf1
Showing
41 changed files
with
1,615 additions
and
1,433 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 0 additions & 40 deletions
40
scio-avro/src/main/scala/com/spotify/scio/avro/types/types.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...andra/cassandra3/src/main/scala/com/spotify/scio/cassandra/syntax/SCollectionSyntax.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright 2023 Spotify AB | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.spotify.scio.cassandra.syntax | ||
|
||
import com.spotify.scio.cassandra.{CassandraIO, CassandraOptions} | ||
import com.spotify.scio.io.ClosedTap | ||
import com.spotify.scio.values.SCollection | ||
|
||
/** | ||
* Enhanced version of [[com.spotify.scio.values.SCollection SCollection]] with Cassandra methods. | ||
*/ | ||
class CassandraSCollection[T](@transient private val self: SCollection[T]) extends AnyVal { | ||
|
||
/** | ||
* Save this SCollection as a Cassandra table. | ||
* | ||
* Cassandra `org.apache.cassandra.hadoop.cql3.CqlBulkRecordWriter` is used to perform bulk writes | ||
* for better throughput. The [[com.spotify.scio.values.SCollection SCollection]] is grouped by | ||
* the table partition key before written to the cluster. Therefore writes only occur at the end | ||
* of each window in streaming mode. The bulk writer writes to all nodes in a cluster so remote | ||
* nodes in a multi-datacenter cluster may become a bottleneck. | ||
* | ||
* '''NOTE: this module is optimized for throughput in batch mode and not recommended for | ||
* streaming mode.''' | ||
* | ||
* @param opts | ||
* Cassandra options | ||
* @param parallelism | ||
* number of concurrent bulk writers, default to number of Cassandra nodes | ||
* @param f | ||
* function to convert input data to values for the CQL statement | ||
*/ | ||
def saveAsCassandra( | ||
opts: CassandraOptions, | ||
parallelism: Int = CassandraIO.WriteParam.DefaultParallelism | ||
)(f: T => Seq[Any]): ClosedTap[Nothing] = | ||
self.write(CassandraIO[T](opts))(CassandraIO.WriteParam(f, parallelism)) | ||
} | ||
|
||
trait SCollectionSyntax { | ||
implicit def cassandraSCollectionOps[T](sc: SCollection[T]): CassandraSCollection[T] = | ||
new CassandraSCollection[T](sc) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
scio-core/src/main/scala/com/spotify/scio/hash/syntax/AllSyntax.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.spotify.scio.hash.syntax | ||
|
||
class AllSyntax extends SCollectionSyntax with IterableSyntax |
Oops, something went wrong.