Skip to content

Commit

Permalink
Minor refactoring - Change a few methods' name
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierguihot committed Jan 16, 2018
1 parent b540040 commit a0b5bb1
Show file tree
Hide file tree
Showing 15 changed files with 225 additions and 283 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
## Overview


Version: 1.0.16
Version: 1.0.17

API Scaladoc: [SparkHelper](http://xavierguihot.com/spark_helper/#com.spark_helper.SparkHelper$)

Expand Down Expand Up @@ -48,8 +48,8 @@ import com.spark_helper.HdfsHelper
// A bunch of methods wrapping the FileSystem API, such as:
HdfsHelper.fileExists("my/hdfs/file/path.txt")
assert(HdfsHelper.listFileNamesInFolder("my/folder/path") == List("file_name_1.txt", "file_name_2.csv"))
assert(HdfsHelper.getFileModificationDate("my/hdfs/file/path.txt") == "20170306")
assert(HdfsHelper.getNbrOfDaysSinceFileWasLastModified("my/hdfs/file/path.txt") == 3)
assert(HdfsHelper.fileModificationDate("my/hdfs/file/path.txt") == "20170306")
assert(HdfsHelper.nbrOfDaysSinceFileWasLastModified("my/hdfs/file/path.txt") == 3)
HdfsHelper.deleteFile("my/hdfs/file/path.csv")
HdfsHelper.moveFolder("my/hdfs/folder")
HdfsHelper.compressFile("hdfs/path/to/uncompressed_file.txt", classOf[GzipCodec])
Expand Down Expand Up @@ -131,7 +131,7 @@ With sbt, add these lines to your build.sbt:
```scala
resolvers += "jitpack" at "https://jitpack.io"

libraryDependencies += "com.github.xavierguihot" % "spark_helper" % "v1.0.16"
libraryDependencies += "com.github.xavierguihot" % "spark_helper" % "v1.0.17"
```

With maven, add these lines to your pom.xml:
Expand All @@ -147,7 +147,7 @@ With maven, add these lines to your pom.xml:
<dependency>
<groupId>com.github.xavierguihot</groupId>
<artifactId>spark_helper</artifactId>
<version>v1.0.16</version>
<version>v1.0.17</version>
</dependency>
```

Expand All @@ -161,7 +161,7 @@ allprojects {
}
dependencies {
compile 'com.github.xavierguihot:spark_helper:v1.0.16'
compile 'com.github.xavierguihot:spark_helper:v1.0.17'
}
```

Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name := "spark_helper"

version := "1.0.16"
version := "1.0.17"

scalaVersion := "2.11.8"

Expand Down
74 changes: 37 additions & 37 deletions docs/com/spark_helper/DateHelper$.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,43 @@ <h4 class="signature">
</a>
</span>
<p class="shortcomment cmt">Returns the current UTC timestamp.</p><div class="fullcomment"><div class="comment cmt"><p>Returns the current UTC timestamp.</p><pre>assert(DateHelper.currentUtcTimestamp() == <span class="lit">"1493105229736"</span>)</pre></div><dl class="paramcmts block"><dt>returns</dt><dd class="cmt"><p>the current UTC timestamps (nbr of millis since 1970-01-01).</p></dd></dl></div>
</li><li name="com.spark_helper.DateHelper#dateFromTimestamp" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="dateFromTimestamp(timestamp:Long,format:String):String"></a>
<a id="dateFromTimestamp(Long,String):String"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">dateFromTimestamp</span><span class="params">(<span name="timestamp">timestamp: <span class="extype" name="scala.Long">Long</span></span>, <span name="format">format: <span class="extype" name="scala.Predef.String">String</span> = <span class="symbol">&quot;yyyyMMdd&quot;</span></span>)</span><span class="result">: <span class="extype" name="scala.Predef.String">String</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#com.spark_helper.DateHelper$@dateFromTimestamp(timestamp:Long,format:String):String" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<p class="shortcomment cmt">Returns the date associated to the given UTC timestamp.</p><div class="fullcomment"><div class="comment cmt"><p>Returns the date associated to the given UTC timestamp.</p><pre>assert(DateHelper.dateFromTimestamp(<span class="num">1496074819</span>L) == <span class="lit">"20170529"</span>)
assert(DateHelper.dateFromTimestamp(<span class="num">1496074819</span>L, <span class="lit">"yyMMdd"</span>) == <span class="lit">"170529"</span>)</pre></div><dl class="paramcmts block"><dt class="param">timestamp</dt><dd class="cmt"><p>the UTC timestamps (nbr of millis since 1970-01-01) for
which to get the associated date.</p></dd><dt class="param">format</dt><dd class="cmt"><p>(default = &quot;yyyyMMdd&quot;) the format of the provided dates</p></dd><dt>returns</dt><dd class="cmt"><p>the associated date under the requested format</p></dd></dl></div>
</li><li name="com.spark_helper.DateHelper#dayOfWeek" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="dayOfWeek(date:String,format:String):Int"></a>
<a id="dayOfWeek(String,String):Int"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">dayOfWeek</span><span class="params">(<span name="date">date: <span class="extype" name="scala.Predef.String">String</span></span>, <span name="format">format: <span class="extype" name="scala.Predef.String">String</span> = <span class="symbol">&quot;yyyyMMdd&quot;</span></span>)</span><span class="result">: <span class="extype" name="scala.Int">Int</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#com.spark_helper.DateHelper$@dayOfWeek(date:String,format:String):Int" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<p class="shortcomment cmt">Returns the day of week for a date under the given format.</p><div class="fullcomment"><div class="comment cmt"><p>Returns the day of week for a date under the given format.</p><p>A Monday is 1 and a Sunday is 7.</p><pre>assert(DateHelper.dayOfWeek(<span class="lit">"20160614"</span>) == <span class="num">2</span>)</pre></div><dl class="paramcmts block"><dt class="param">date</dt><dd class="cmt"><p>the date for which to get the day of week</p></dd><dt class="param">format</dt><dd class="cmt"><p>(default = &quot;yyyyMMdd&quot;) the format under which the date is
provided.</p></dd><dt>returns</dt><dd class="cmt"><p>the associated day of week, such as 2 for Tuesday</p></dd></dl></div>
</li><li name="com.spark_helper.DateHelper#daysBetween" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="daysBetween(firstDate:String,lastDate:String,format:String):List[String]"></a>
<a id="daysBetween(String,String,String):List[String]"></a>
Expand Down Expand Up @@ -324,43 +361,6 @@ <h4 class="signature">
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="com.spark_helper.DateHelper#getDateFromTimestamp" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="getDateFromTimestamp(timestamp:Long,format:String):String"></a>
<a id="getDateFromTimestamp(Long,String):String"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">getDateFromTimestamp</span><span class="params">(<span name="timestamp">timestamp: <span class="extype" name="scala.Long">Long</span></span>, <span name="format">format: <span class="extype" name="scala.Predef.String">String</span> = <span class="symbol">&quot;yyyyMMdd&quot;</span></span>)</span><span class="result">: <span class="extype" name="scala.Predef.String">String</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#com.spark_helper.DateHelper$@getDateFromTimestamp(timestamp:Long,format:String):String" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<p class="shortcomment cmt">Returns the date associated to the given UTC timestamp.</p><div class="fullcomment"><div class="comment cmt"><p>Returns the date associated to the given UTC timestamp.</p><pre>assert(DateHelper.getDateFromTimestamp(<span class="num">1496074819</span>L) == <span class="lit">"20170529"</span>)
assert(DateHelper.getDateFromTimestamp(<span class="num">1496074819</span>L, <span class="lit">"yyMMdd"</span>) == <span class="lit">"170529"</span>)</pre></div><dl class="paramcmts block"><dt class="param">timestamp</dt><dd class="cmt"><p>the UTC timestamps (nbr of millis since 1970-01-01) for
which to get the associated date.</p></dd><dt class="param">format</dt><dd class="cmt"><p>(default = &quot;yyyyMMdd&quot;) the format of the provided dates</p></dd><dt>returns</dt><dd class="cmt"><p>the associated date under the requested format</p></dd></dl></div>
</li><li name="com.spark_helper.DateHelper#getDayOfWeek" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="getDayOfWeek(date:String,format:String):Int"></a>
<a id="getDayOfWeek(String,String):Int"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">getDayOfWeek</span><span class="params">(<span name="date">date: <span class="extype" name="scala.Predef.String">String</span></span>, <span name="format">format: <span class="extype" name="scala.Predef.String">String</span> = <span class="symbol">&quot;yyyyMMdd&quot;</span></span>)</span><span class="result">: <span class="extype" name="scala.Int">Int</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#com.spark_helper.DateHelper$@getDayOfWeek(date:String,format:String):Int" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<p class="shortcomment cmt">Returns the day of week for a date under the given format.</p><div class="fullcomment"><div class="comment cmt"><p>Returns the day of week for a date under the given format.</p><p>A Monday is 1 and a Sunday is 7.</p><pre>assert(DateHelper.getDayOfWeek(<span class="lit">"20160614"</span>) == <span class="num">2</span>)</pre></div><dl class="paramcmts block"><dt class="param">date</dt><dd class="cmt"><p>the date for which to get the day of week</p></dd><dt class="param">format</dt><dd class="cmt"><p>(default = &quot;yyyyMMdd&quot;) the format under which the date is
provided.</p></dd><dt>returns</dt><dd class="cmt"><p>the associated day of week, such as 2 for Tuesday</p></dd></dl></div>
</li><li name="scala.AnyRef#hashCode" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="hashCode():Int"></a>
<a id="hashCode():Int"></a>
Expand Down
Loading

0 comments on commit a0b5bb1

Please sign in to comment.