-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #330 from alexarchambault/fix-syntax
Fix new syntax helpers issues
- Loading branch information
Showing
6 changed files
with
29 additions
and
11 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
21 changes: 21 additions & 0 deletions
21
modules/almond-spark/src/main/scala/org/apache/spark/sql/almondinternals/Id.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,21 @@ | ||
package org.apache.spark.sql.almondinternals | ||
|
||
import java.util.concurrent.atomic.AtomicInteger | ||
import java.util.{Locale, UUID} | ||
|
||
object Id { | ||
|
||
def generate(): String = | ||
if (useRandomIds) | ||
UUID.randomUUID().toString | ||
else | ||
idCount.incrementAndGet().toString | ||
|
||
private lazy val useRandomIds: Boolean = | ||
Option(System.getenv("ALMOND_USE_RANDOM_IDS")) | ||
.orElse(sys.props.get("almond.ids.random")) | ||
.forall(s => s == "1" || s.toLowerCase(Locale.ROOT) == "true") | ||
|
||
private val idCount = new AtomicInteger(222222) | ||
|
||
} |
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
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