Skip to content
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

Closed
wants to merge 10 commits into from
Closed

1.0.0 #83

wants to merge 10 commits into from

Conversation

aldemirenes
Copy link
Contributor

No description provided.

@aldemirenes
Copy link
Contributor Author

JSON encoder and decoder for new ParsingError will be added and tests will be updated.

Copy link
Contributor

@chuwy chuwy left a 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
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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...

Copy link
Contributor

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]
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codecs are missing.

Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final

Copy link
Contributor

@chuwy chuwy left a 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
Copy link
Contributor

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))
Copy link
Contributor

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?

@aldemirenes aldemirenes force-pushed the release/0.5.0 branch 2 times, most recently from 5fcd769 to ea5d71e Compare August 13, 2019 10:30
@aldemirenes aldemirenes changed the base branch from event-decoder to master August 13, 2019 10:30
@aldemirenes aldemirenes changed the title 0.5.0 1.0.0 Aug 13, 2019
@chuwy chuwy self-requested a review August 13, 2019 14:10
Copy link
Contributor

@chuwy chuwy left a 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 =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is vTstamp?

Copy link
Contributor Author

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.

@aldemirenes aldemirenes force-pushed the release/0.5.0 branch 2 times, most recently from 6957f7a to c110d6d Compare August 14, 2019 20:12

object ScoverageSettings {

val settings = Seq(
Copy link
Contributor

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?

import sbt.Keys._
import sbt._

object MimaSettings {
Copy link
Contributor

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?

// clear-out mimaBinaryIssueFilters and mimaPreviousVersions.
// Otherwise, add previous version to set without
// removing other versions.
val mimaPreviousVersions = Set()
Copy link
Contributor

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)

Copy link
Contributor Author

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.

Copy link
Contributor

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) {
Copy link
Contributor

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.

Copy link
Contributor Author

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 ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deprecated

@chuwy
Copy link
Contributor

chuwy commented Aug 16, 2019

@aldemirenes could you please also rename the branch to release/1.0.0 (and probably open a new PR)?

@aldemirenes aldemirenes force-pushed the release/0.5.0 branch 2 times, most recently from a03ce7b to 6afbb62 Compare August 17, 2019 20:24
@aldemirenes
Copy link
Contributor Author

Closed in favor of #89

@aldemirenes aldemirenes deleted the release/0.5.0 branch August 19, 2019 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants