Closed abhitechdojo closed 8 years ago
Can you give me the definition for sales record.
On 6 February 2016 at 00:27, abhitechdojo notifications@github.com wrote:
Hello,
I wrote the following code
val schema = AvroSchema[SalesRecord] val output = AvroOutputStream[SalesRecord](new File%28outputLocation%29) outputwrite(salesList) outputflush outputclose
But this throws a compile time error
could not find implicit value for parameter builder: shapelessLaxy[comsksamuelavro4sAvroSchema[]]
not enough arguments for method apply: Unspecified value parameter builder
— Reply to this email directly or view it on GitHub https://github.com/sksamuel/avro4s/issues/12.
Here is the definition. I am masking the properties names a little
import com.github.nscalatime.time.Imports. import org.joda.time.DateTime
/**
Created by abhishek.srivastava on 2/5/16. */ class SalesRecord ( val saleId: Int, val sellerId: Int, private val createDateStr: String, val vin: String, val make: String, val model: String, val year: Double, val tL: String, val clr: String, val tr: String, val eg: String, val iT: String, val tML: Option[String], val dO: Double, val sP: Double, val tG: Double, val fEG: Double, val bEG: Double, val cT: Option[String], val sT: Option[String], private val cDStr: String, private val dDStr: String, private val rDStr: String, private val pBID: String, val fN: Option[String], val mN: Option[String], val lN: Option[String], val fuN: Option[String], val ad: Option[String], val ct: Option[String], val st: Option[String], private val pCStr: String, val hPN: Option[String], val bPN: Option[String], val cPN: Option[String], val eA: Option[String], val eT: Option[String], val cN: Option[String], val sBID: Option[String], val sFN: Option[String], val sMN: Option[String], val sLN: Option[String], val sFuMN: Option[String], val sAd: Option[String], val sC: Option[String], val sS: Option[String], val sPC: Option[String], val sHPN: Option[String], val sBPN: Option[String], val sCPN: Option[String], val sEA: Option[String], val sET: Option[String], val sCN: Option[String]) { val createdUTCDate = read[String, DateTime](createDateStr, toDate) val contractDate = read(cDStr, toDate) val deliveryDate = read(dDStr, toDate) val reversalDate = read(rDStr, toDate) val primaryBuyerID = read(pBID, toInt) val postalCode = read(pCStr, toInt)
private def read[T1, T2](x : T1, f : T1 => T2) : Option[T2] = { if (x == null) Option.empty[T2] else Some(f(x)) } private def toDate(x : String) : DateTime = new DateTime(x) private def toInt(x: String) : Int = x.toInt }
On Feb 5, 2016, at 6:55 PM, Stephen Samuel notifications@github.com<mailto:notifications@github.com> wrote:
Can you give me the definition for sales record.
On 6 February 2016 at 00:27, abhitechdojo notifications@github.com<mailto:notifications@github.com> wrote:
Hello,
I wrote the following code
val schema = AvroSchema[SalesRecord] val output = AvroOutputStream[SalesRecord](new File%28outputLocation%29) outputwrite(salesList) outputflush outputclose
But this throws a compile time error
could not find implicit value for parameter builder: shapelessLaxy[comsksamuelavro4sAvroSchema[]]
not enough arguments for method apply: Unspecified value parameter builder
— Reply to this email directly or view it on GitHub https://github.com/sksamuel/avro4s/issues/12.
— Reply to this email directly or view it on GitHubhttps://github.com/sksamuel/avro4s/issues/12#issuecomment-180639526.
It might only work on case classes. I'm not sure if shapeless can find a Generic for a non case class. If you're on scala 2.11 can you try making it a case class. On 6 Feb 2016 04:04, "abhitechdojo" notifications@github.com wrote:
Here is the definition. I am masking the properties names a little
import com.github.nscalatime.time.Imports. import org.joda.time.DateTime
/**
- Created by abhishek.srivastava on 2/5/16. */ class SalesRecord ( val saleId: Int, val sellerId: Int, private val createDateStr: String, val vin: String, val make: String, val model: String, val year: Double, val tL: String, val clr: String, val tr: String, val eg: String, val iT: String, val tML: Option[String], val dO: Double, val sP: Double, val tG: Double, val fEG: Double, val bEG: Double, val cT: Option[String], val sT: Option[String], private val cDStr: String, private val dDStr: String, private val rDStr: String, private val pBID: String, val fN: Option[String], val mN: Option[String], val lN: Option[String], val fuN: Option[String], val ad: Option[String], val ct: Option[String], val st: Option[String], private val pCStr: String, val hPN: Option[String], val bPN: Option[String], val cPN: Option[String], val eA: Option[String], val eT: Option[String], val cN: Option[String], val sBID: Option[String], val sFN: Option[String], val sMN: Option[String], val sLN: Option[String], val sFuMN: Option[String], val sAd: Option[String], val sC: Option[String], val sS: Option[String], val sPC: Option[String], val sHPN: Option[String], val sBPN: Option[String], val sCPN: Option[String], val sEA: Option[String], val sET: Option[String], val sCN: Option[String]) { val createdUTCDate = read[String, DateTime](createDateStr, toDate) val contractDate = read(cDStr, toDate) val deliveryDate = read(dDStr, toDate) val reversalDate = read(rDStr, toDate) val primaryBuyerID = read(pBID, toInt) val postalCode = read(pCStr, toInt)
private def read[T1, T2](x : T1, f : T1 => T2) : Option[T2] = { if (x == null) Option.empty[T2] else Some(f(x)) } private def toDate(x : String) : DateTime = new DateTime(x) private def toInt(x: String) : Int = x.toInt }
On Feb 5, 2016, at 6:55 PM, Stephen Samuel <notifications@github.com mailto:notifications@github.com> wrote:
Can you give me the definition for sales record.
On 6 February 2016 at 00:27, abhitechdojo <notifications@github.com mailto:notifications@github.com> wrote:
Hello,
I wrote the following code
val schema = AvroSchema[SalesRecord] val output = AvroOutputStream[SalesRecord](new File%28outputLocation%29) outputwrite(salesList) outputflush outputclose
But this throws a compile time error
could not find implicit value for parameter builder: shapelessLaxy[comsksamuelavro4sAvroSchema[]]
not enough arguments for method apply: Unspecified value parameter builder
— Reply to this email directly or view it on GitHub https://github.com/sksamuel/avro4s/issues/12.
— Reply to this email directly or view it on GitHub< https://github.com/sksamuel/avro4s/issues/12#issuecomment-180639526>.
— Reply to this email directly or view it on GitHub https://github.com/sksamuel/avro4s/issues/12#issuecomment-180670087.
don’t the case classes have a 22 field limitation? My sales record is much wider than that.
I would try to convert this into a case class and break down the sales record into smaller entities.
On Feb 6, 2016, at 8:17 AM, Stephen Samuel notifications@github.com<mailto:notifications@github.com> wrote:
It might only work on case classes. I'm not sure if shapeless can find a Generic for a non case class. If you're on scala 2.11 can you try making it a case class. On 6 Feb 2016 04:04, "abhitechdojo" notifications@github.com<mailto:notifications@github.com> wrote:
Here is the definition. I am masking the properties names a little
import com.github.nscalatime.time.Imports. import org.joda.time.DateTime
/**
- Created by abhishek.srivastava on 2/5/16. */ class SalesRecord ( val saleId: Int, val sellerId: Int, private val createDateStr: String, val vin: String, val make: String, val model: String, val year: Double, val tL: String, val clr: String, val tr: String, val eg: String, val iT: String, val tML: Option[String], val dO: Double, val sP: Double, val tG: Double, val fEG: Double, val bEG: Double, val cT: Option[String], val sT: Option[String], private val cDStr: String, private val dDStr: String, private val rDStr: String, private val pBID: String, val fN: Option[String], val mN: Option[String], val lN: Option[String], val fuN: Option[String], val ad: Option[String], val ct: Option[String], val st: Option[String], private val pCStr: String, val hPN: Option[String], val bPN: Option[String], val cPN: Option[String], val eA: Option[String], val eT: Option[String], val cN: Option[String], val sBID: Option[String], val sFN: Option[String], val sMN: Option[String], val sLN: Option[String], val sFuMN: Option[String], val sAd: Option[String], val sC: Option[String], val sS: Option[String], val sPC: Option[String], val sHPN: Option[String], val sBPN: Option[String], val sCPN: Option[String], val sEA: Option[String], val sET: Option[String], val sCN: Option[String]) { val createdUTCDate = read[String, DateTime](createDateStr, toDate) val contractDate = read(cDStr, toDate) val deliveryDate = read(dDStr, toDate) val reversalDate = read(rDStr, toDate) val primaryBuyerID = read(pBID, toInt) val postalCode = read(pCStr, toInt)
private def read[T1, T2](x : T1, f : T1 => T2) : Option[T2] = { if (x == null) Option.empty[T2] else Some(f(x)) } private def toDate(x : String) : DateTime = new DateTime(x) private def toInt(x: String) : Int = x.toInt }
On Feb 5, 2016, at 6:55 PM, Stephen Samuel notifications@github.com<mailto:notifications@github.com mailto:notifications@github.com> wrote:
Can you give me the definition for sales record.
On 6 February 2016 at 00:27, abhitechdojo notifications@github.com<mailto:notifications@github.com mailto:notifications@github.com> wrote:
Hello,
I wrote the following code
val schema = AvroSchema[SalesRecord] val output = AvroOutputStream[SalesRecord](new File%28outputLocation%29) outputwrite(salesList) outputflush outputclose
But this throws a compile time error
could not find implicit value for parameter builder: shapelessLaxy[comsksamuelavro4sAvroSchema[]]
not enough arguments for method apply: Unspecified value parameter builder
— Reply to this email directly or view it on GitHub https://github.com/sksamuel/avro4s/issues/12.
— Reply to this email directly or view it on GitHub< https://github.com/sksamuel/avro4s/issues/12#issuecomment-180639526>.
— Reply to this email directly or view it on GitHub https://github.com/sksamuel/avro4s/issues/12#issuecomment-180670087.
— Reply to this email directly or view it on GitHubhttps://github.com/sksamuel/avro4s/issues/12#issuecomment-180772003.
In 2.11 they can have any size, but > 22 won't have unapply method.
On 6 February 2016 at 16:47, abhitechdojo notifications@github.com wrote:
don’t the case classes have a 22 field limitation? My sales record is much wider than that.
I would try to convert this into a case class and break down the sales record into smaller entities.
On Feb 6, 2016, at 8:17 AM, Stephen Samuel <notifications@github.com mailto:notifications@github.com> wrote:
It might only work on case classes. I'm not sure if shapeless can find a Generic for a non case class. If you're on scala 2.11 can you try making it a case class. On 6 Feb 2016 04:04, "abhitechdojo" <notifications@github.com<mailto: notifications@github.com>> wrote:
Here is the definition. I am masking the properties names a little
import com.github.nscalatime.time.Imports. import org.joda.time.DateTime
/**
- Created by abhishek.srivastava on 2/5/16. */ class SalesRecord ( val saleId: Int, val sellerId: Int, private val createDateStr: String, val vin: String, val make: String, val model: String, val year: Double, val tL: String, val clr: String, val tr: String, val eg: String, val iT: String, val tML: Option[String], val dO: Double, val sP: Double, val tG: Double, val fEG: Double, val bEG: Double, val cT: Option[String], val sT: Option[String], private val cDStr: String, private val dDStr: String, private val rDStr: String, private val pBID: String, val fN: Option[String], val mN: Option[String], val lN: Option[String], val fuN: Option[String], val ad: Option[String], val ct: Option[String], val st: Option[String], private val pCStr: String, val hPN: Option[String], val bPN: Option[String], val cPN: Option[String], val eA: Option[String], val eT: Option[String], val cN: Option[String], val sBID: Option[String], val sFN: Option[String], val sMN: Option[String], val sLN: Option[String], val sFuMN: Option[String], val sAd: Option[String], val sC: Option[String], val sS: Option[String], val sPC: Option[String], val sHPN: Option[String], val sBPN: Option[String], val sCPN: Option[String], val sEA: Option[String], val sET: Option[String], val sCN: Option[String]) { val createdUTCDate = read[String, DateTime](createDateStr, toDate) val contractDate = read(cDStr, toDate) val deliveryDate = read(dDStr, toDate) val reversalDate = read(rDStr, toDate) val primaryBuyerID = read(pBID, toInt) val postalCode = read(pCStr, toInt)
private def read[T1, T2](x : T1, f : T1 => T2) : Option[T2] = { if (x == null) Option.empty[T2] else Some(f(x)) } private def toDate(x : String) : DateTime = new DateTime(x) private def toInt(x: String) : Int = x.toInt }
On Feb 5, 2016, at 6:55 PM, Stephen Samuel <notifications@github.com mailto:notifications@github.com mailto:notifications@github.com> wrote:
Can you give me the definition for sales record.
On 6 February 2016 at 00:27, abhitechdojo <notifications@github.com mailto:notifications@github.com mailto:notifications@github.com> wrote:
Hello,
I wrote the following code
val schema = AvroSchema[SalesRecord] val output = AvroOutputStream[SalesRecord](new File%28outputLocation%29) outputwrite(salesList) outputflush outputclose
But this throws a compile time error
could not find implicit value for parameter builder: shapelessLaxy[comsksamuelavro4sAvroSchema[]]
not enough arguments for method apply: Unspecified value parameter builder
— Reply to this email directly or view it on GitHub https://github.com/sksamuel/avro4s/issues/12.
— Reply to this email directly or view it on GitHub< https://github.com/sksamuel/avro4s/issues/12#issuecomment-180639526>.
— Reply to this email directly or view it on GitHub https://github.com/sksamuel/avro4s/issues/12#issuecomment-180670087.
— Reply to this email directly or view it on GitHub< https://github.com/sksamuel/avro4s/issues/12#issuecomment-180772003>.
— Reply to this email directly or view it on GitHub https://github.com/sksamuel/avro4s/issues/12#issuecomment-180808547.
converted my class to a case class … but still the same problem
On Feb 6, 2016, at 10:49 AM, Stephen Samuel notifications@github.com<mailto:notifications@github.com> wrote:
In 2.11 they can have any size, but > 22 won't have unapply method.
On 6 February 2016 at 16:47, abhitechdojo notifications@github.com<mailto:notifications@github.com> wrote:
don’t the case classes have a 22 field limitation? My sales record is much wider than that.
I would try to convert this into a case class and break down the sales record into smaller entities.
On Feb 6, 2016, at 8:17 AM, Stephen Samuel notifications@github.com<mailto:notifications@github.com mailto:notifications@github.com> wrote:
It might only work on case classes. I'm not sure if shapeless can find a Generic for a non case class. If you're on scala 2.11 can you try making it a case class. On 6 Feb 2016 04:04, "abhitechdojo" notifications@github.com<mailto:notifications@github.com<mailto: notifications@github.commailto:notifications@github.com>> wrote:
Here is the definition. I am masking the properties names a little
import com.github.nscalatime.time.Imports. import org.joda.time.DateTime
/**
- Created by abhishek.srivastava on 2/5/16. */ class SalesRecord ( val saleId: Int, val sellerId: Int, private val createDateStr: String, val vin: String, val make: String, val model: String, val year: Double, val tL: String, val clr: String, val tr: String, val eg: String, val iT: String, val tML: Option[String], val dO: Double, val sP: Double, val tG: Double, val fEG: Double, val bEG: Double, val cT: Option[String], val sT: Option[String], private val cDStr: String, private val dDStr: String, private val rDStr: String, private val pBID: String, val fN: Option[String], val mN: Option[String], val lN: Option[String], val fuN: Option[String], val ad: Option[String], val ct: Option[String], val st: Option[String], private val pCStr: String, val hPN: Option[String], val bPN: Option[String], val cPN: Option[String], val eA: Option[String], val eT: Option[String], val cN: Option[String], val sBID: Option[String], val sFN: Option[String], val sMN: Option[String], val sLN: Option[String], val sFuMN: Option[String], val sAd: Option[String], val sC: Option[String], val sS: Option[String], val sPC: Option[String], val sHPN: Option[String], val sBPN: Option[String], val sCPN: Option[String], val sEA: Option[String], val sET: Option[String], val sCN: Option[String]) { val createdUTCDate = read[String, DateTime](createDateStr, toDate) val contractDate = read(cDStr, toDate) val deliveryDate = read(dDStr, toDate) val reversalDate = read(rDStr, toDate) val primaryBuyerID = read(pBID, toInt) val postalCode = read(pCStr, toInt)
private def read[T1, T2](x : T1, f : T1 => T2) : Option[T2] = { if (x == null) Option.empty[T2] else Some(f(x)) } private def toDate(x : String) : DateTime = new DateTime(x) private def toInt(x: String) : Int = x.toInt }
On Feb 5, 2016, at 6:55 PM, Stephen Samuel notifications@github.com<mailto:notifications@github.com mailto:notifications@github.com mailto:notifications@github.com> wrote:
Can you give me the definition for sales record.
On 6 February 2016 at 00:27, abhitechdojo notifications@github.com<mailto:notifications@github.com mailto:notifications@github.com mailto:notifications@github.com> wrote:
Hello,
I wrote the following code
val schema = AvroSchema[SalesRecord] val output = AvroOutputStream[SalesRecord](new File%28outputLocation%29) outputwrite(salesList) outputflush outputclose
But this throws a compile time error
could not find implicit value for parameter builder: shapelessLaxy[comsksamuelavro4sAvroSchema[]]
not enough arguments for method apply: Unspecified value parameter builder
— Reply to this email directly or view it on GitHub https://github.com/sksamuel/avro4s/issues/12.
— Reply to this email directly or view it on GitHub< https://github.com/sksamuel/avro4s/issues/12#issuecomment-180639526>.
— Reply to this email directly or view it on GitHub https://github.com/sksamuel/avro4s/issues/12#issuecomment-180670087.
— Reply to this email directly or view it on GitHub< https://github.com/sksamuel/avro4s/issues/12#issuecomment-180772003>.
— Reply to this email directly or view it on GitHub https://github.com/sksamuel/avro4s/issues/12#issuecomment-180808547.
— Reply to this email directly or view it on GitHubhttps://github.com/sksamuel/avro4s/issues/12#issuecomment-180808867.
Ok I'll figure it out once I'm back tomorrow.
On 6 February 2016 at 16:53, abhitechdojo notifications@github.com wrote:
converted my class to a case class … but still the same problem
On Feb 6, 2016, at 10:49 AM, Stephen Samuel <notifications@github.com mailto:notifications@github.com> wrote:
In 2.11 they can have any size, but > 22 won't have unapply method.
On 6 February 2016 at 16:47, abhitechdojo <notifications@github.com mailto:notifications@github.com> wrote:
don’t the case classes have a 22 field limitation? My sales record is much wider than that.
I would try to convert this into a case class and break down the sales record into smaller entities.
On Feb 6, 2016, at 8:17 AM, Stephen Samuel <notifications@github.com mailto:notifications@github.com mailto:notifications@github.com> wrote:
It might only work on case classes. I'm not sure if shapeless can find a Generic for a non case class. If you're on scala 2.11 can you try making it a case class. On 6 Feb 2016 04:04, "abhitechdojo" <notifications@github.com<mailto: notifications@github.com><mailto: notifications@github.commailto:notifications@github.com>> wrote:
Here is the definition. I am masking the properties names a little
import com.github.nscalatime.time.Imports. import org.joda.time.DateTime
/**
- Created by abhishek.srivastava on 2/5/16. */ class SalesRecord ( val saleId: Int, val sellerId: Int, private val createDateStr: String, val vin: String, val make: String, val model: String, val year: Double, val tL: String, val clr: String, val tr: String, val eg: String, val iT: String, val tML: Option[String], val dO: Double, val sP: Double, val tG: Double, val fEG: Double, val bEG: Double, val cT: Option[String], val sT: Option[String], private val cDStr: String, private val dDStr: String, private val rDStr: String, private val pBID: String, val fN: Option[String], val mN: Option[String], val lN: Option[String], val fuN: Option[String], val ad: Option[String], val ct: Option[String], val st: Option[String], private val pCStr: String, val hPN: Option[String], val bPN: Option[String], val cPN: Option[String], val eA: Option[String], val eT: Option[String], val cN: Option[String], val sBID: Option[String], val sFN: Option[String], val sMN: Option[String], val sLN: Option[String], val sFuMN: Option[String], val sAd: Option[String], val sC: Option[String], val sS: Option[String], val sPC: Option[String], val sHPN: Option[String], val sBPN: Option[String], val sCPN: Option[String], val sEA: Option[String], val sET: Option[String], val sCN: Option[String]) { val createdUTCDate = read[String, DateTime](createDateStr, toDate) val contractDate = read(cDStr, toDate) val deliveryDate = read(dDStr, toDate) val reversalDate = read(rDStr, toDate) val primaryBuyerID = read(pBID, toInt) val postalCode = read(pCStr, toInt)
private def read[T1, T2](x : T1, f : T1 => T2) : Option[T2] = { if (x == null) Option.empty[T2] else Some(f(x)) } private def toDate(x : String) : DateTime = new DateTime(x) private def toInt(x: String) : Int = x.toInt }
On Feb 5, 2016, at 6:55 PM, Stephen Samuel <notifications@github.com mailto:notifications@github.com mailto:notifications@github.com mailto:notifications@github.com> wrote:
Can you give me the definition for sales record.
On 6 February 2016 at 00:27, abhitechdojo <notifications@github.com mailto:notifications@github.com mailto:notifications@github.com mailto:notifications@github.com> wrote:
Hello,
I wrote the following code
val schema = AvroSchema[SalesRecord] val output = AvroOutputStream[SalesRecord](new File%28outputLocation%29) outputwrite(salesList) outputflush outputclose
But this throws a compile time error
could not find implicit value for parameter builder: shapelessLaxy[comsksamuelavro4sAvroSchema[]]
not enough arguments for method apply: Unspecified value parameter builder
— Reply to this email directly or view it on GitHub https://github.com/sksamuel/avro4s/issues/12.
— Reply to this email directly or view it on GitHub< https://github.com/sksamuel/avro4s/issues/12#issuecomment-180639526>.
— Reply to this email directly or view it on GitHub https://github.com/sksamuel/avro4s/issues/12#issuecomment-180670087.
— Reply to this email directly or view it on GitHub< https://github.com/sksamuel/avro4s/issues/12#issuecomment-180772003>.
— Reply to this email directly or view it on GitHub https://github.com/sksamuel/avro4s/issues/12#issuecomment-180808547.
— Reply to this email directly or view it on GitHub< https://github.com/sksamuel/avro4s/issues/12#issuecomment-180808867>.
— Reply to this email directly or view it on GitHub https://github.com/sksamuel/avro4s/issues/12#issuecomment-180809163.
Looks like the private fields are throwing shapeless off. I can get it to work as a normal (non case) class, without the privates. Eg.
class SalesRecord(val saleId: Int, val sellerId: Int, val createDateStr: String, val vin: String, val make: String, val model: String, val year: Double, val tL: String, val clr: String, val tr: String, val eg: String, val iT: String, val tML: Option[String], val dO: Double, val sP: Double, val tG: Double, val fEG: Double, val bEG: Double, val cT: Option[String], val sT: Option[String], val cDStr: String, val dDStr: String, val rDStr: String, val pBID: String, val fN: Option[String], val mN: Option[String], val lN: Option[String], val fuN: Option[String], val ad: Option[String], val ct: Option[String], val st: Option[String], private val pCStr: String, val hPN: Option[String], val bPN: Option[String], val cPN: Option[String], val eA: Option[String], val eT: Option[String], val cN: Option[String], val sBID: Option[String], val sFN: Option[String], val sMN: Option[String], val sLN: Option[String], val sFuMN: Option[String], val sAd: Option[String], val sC: Option[String], val sS: Option[String], val sPC: Option[String], val sHPN: Option[String], val sBPN: Option[String], val sCPN: Option[String], val sEA: Option[String], val sET: Option[String], val sCN: Option[String])
This is fixed in release 1.3.0 if you want to try it.
Hello,
I wrote the following code
But this throws a compile time error
could not find implicit value for parameter builder: shapeless.Laxy[com.sksamuel.avro4s.AvroSchema[...]]
not enough arguments for method apply: .... Unspecified value parameter builder.