-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.0.0 #83
1.0.0 #83
Conversation
JSON encoder and decoder for new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs further tweaking.
case class InvalidValue(key: String, value: String) extends ParsingError | ||
|
||
/** | ||
* Represents unexpected errors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param expectedNum expected number of columns | ||
* @param gotNum number of given columns | ||
*/ | ||
case class ColumnNumberMismatch(expectedNum: Int, gotNum: Int) extends ParsingError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Num
is a Hungarian notation. We don't need it with static types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How many valid values we have for expectedNum
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only one, however I'd think putting it in there makes sense in order to inform about that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there's only one possible value, why would anyone bother about it at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that the place where this error is got can want to know how many field is expected. If you think it is useless, I can remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that the place where this error is got can want to know how many field is expected. If you think it is useless, I can remove it.
For me it looks like constant provided by Analytics SDK. If we'll get millions of rows with expectedNum: 131
I don't think anyone would benefit from it.
@@ -50,7 +51,7 @@ private[decode] object ValueDecoder { | |||
implicit final val stringColumnDecoder: ValueDecoder[String] = | |||
fromFunc[String] { | |||
case (key, value) => | |||
if (value.isEmpty) (key, s"Field $key cannot be empty").asLeft else value.asRight | |||
if (value.isEmpty) InvalidValue(key.toString, s"Field $key cannot be empty").asLeft else value.asRight |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Second member of InvalidValue
is value
, but we add a human-readable message here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think I missed it, will correct it.
@@ -105,22 +106,22 @@ private[decode] object ValueDecoder { | |||
value.toDouble.some.asRight | |||
} catch { | |||
case _: NumberFormatException => | |||
(key, s"Cannot parse key $key with value $value into double").asLeft | |||
InvalidValue(key.toString, s"Cannot parse key $key with value $value into double").asLeft |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that type argument is another common pattern for InvalidValue
? double
, boolean
etc. On the other hand it is deriveable from key
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore above - just thoughts aloud.
else | ||
try { | ||
UUID.fromString(value).asRight[(Key, String)] | ||
UUID.fromString(value).asRight[InvalidValue] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InvalidValue
is what we call "data constructor" - its better to not have it in a type position. Type is ParsingError
, which is "root" of ADT.
* @param key key of field | ||
* @param value value of the field | ||
*/ | ||
case class InvalidValue(key: String, value: String) extends ParsingError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not to keep key
as Symbol
so far? It seems we're stringifying it everywhere.
@@ -0,0 +1,36 @@ | |||
package com.snowplowanalytics.snowplow.analytics.scalasdk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
License header.
* @param error error message | ||
*/ | ||
case class UnexpectedError(error: String) extends ParsingError | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecs are missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will add them.
* @param expectedNum expected number of columns | ||
* @param gotNum number of given columns | ||
*/ | ||
case class ColumnNumberMismatch(expectedNum: Int, gotNum: Int) extends ParsingError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final
src/main/scala/com.snowplowanalytics.snowplow.analytics.scalasdk/ParsingError.scala
Outdated
Show resolved
Hide resolved
89af657
to
1ba3bd8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "Prepare for release" ticket is missing.
I have a small concern about NonEmptyList
of errors. If I missing something and it is possible to have it then let's go ahead and release it today.
* RowDecoder, getting more or less values than expected is impossible | ||
* due to type check. Therefore 'UnexpectedError' is returned for | ||
* these cases | ||
* @param error error message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we mention that it usually can be ignored as "not possible"
val decoded = decoder(zipped) | ||
decoded.map { decodedValue => generic.from(decodedValue) } | ||
if (values.length == 1) { | ||
Validated.Invalid(NonEmptyList.of(NonTSVPayload)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me it looks that in fact or error type is:
NonTSVPayload | ColumnNumberMismatch | NonEmptyList[InvalidValue]
And not
NonEmptyList[NonTSVPayload] | NonEmptyList[ColumnNumberMismatch] | NonEmptyList[InvalidValue]
I.e. we should never check a case of NonEmptyList.of(NonTSVPayload, ColumnNumberMismatch(_))
Am I missing something?
e02f11f
to
8e27172
Compare
5fcd769
to
ea5d71e
Compare
ea5d71e
to
bd30158
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 @aldemirenes. Could you please also implement fresh tickets I added to 1.0.0 milestone.
* Creates empty event which optional fields of it are None | ||
* Only necessary fields are given as arguments | ||
*/ | ||
def emptyEvent(id: UUID, collectorTstamp: Instant, vCollector: String, vTstamp: String): Event = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is vTstamp
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is v_etl. I think it is better to change its name to vEtl.
6957f7a
to
c110d6d
Compare
e7641e0
to
34cdaa0
Compare
project/ScoverageSettings.scala
Outdated
|
||
object ScoverageSettings { | ||
|
||
val settings = Seq( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move it into BuildSettings.scala
as scoverageSettings
?
project/MimaSettings.scala
Outdated
import sbt.Keys._ | ||
import sbt._ | ||
|
||
object MimaSettings { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it be in BuildSettings
?
project/MimaSettings.scala
Outdated
// clear-out mimaBinaryIssueFilters and mimaPreviousVersions. | ||
// Otherwise, add previous version to set without | ||
// removing other versions. | ||
val mimaPreviousVersions = Set() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, we'll have to add it manually after every release? Is there a way to automate it? Otherwise we'll need to have a standardized place for "Release checklist"? Wiki? Repo itself? (IMO its related to DQA, @dilyand)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought and looked for a way to automate but there is no clear way for this as far as I understand. One of the reason is that these previous versions should be determined by the breaking changes in the current version. So, let's say we bumped from 1.0.0 to 1.0.1 and there is no breaking changes obviously, in that case 1.0.0 should be added to mimaPreviousVersions
. However, in case of bumping from 1.0.1 to 2.0.0 which most probably there will be breaking changes, mimaPreviousVersions
should be cleared-out. So, maybe some scripts can be written for checking current version and place previous versions according to that but I could not be sure about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think we just should have a "Release checklist" wikii page somehwere, because people will keep forgetting about it.
* @param dynamodb AWS DynamoDB client | ||
* @param tableName existing DynamoDB table name with run manifests | ||
*/ | ||
class RunManifests(dynamodb: AmazonDynamoDB, tableName: String) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking more about https://www.scala-lang.org/api/current/scala/deprecated.html rather than deleting it compltely. It just unties our hands about deleting it in 1.x series, i.e. its not something users should rely on anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, should I make it deprecated
or leave it as removed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deprecated
@aldemirenes could you please also rename the branch to |
a03ce7b
to
6afbb62
Compare
6afbb62
to
6818293
Compare
6818293
to
752f4a4
Compare
Closed in favor of #89 |
No description provided.