Code Monkey home page Code Monkey logo

Comments (10)

cosmincatalin avatar cosmincatalin commented on July 26, 2024 2

Hi,

We’ll take a look after New Year’s.

from spark-dynamodb.

cosmincatalin avatar cosmincatalin commented on July 26, 2024 2

Hi @juanyunism, I've shamelessly taken the code and commit it. It works fine. Do you need a new release now, or can you wait until we get more stuff in?

from spark-dynamodb.

juan-yunis avatar juan-yunis commented on July 26, 2024 1

I wrote this test to reproduce the problem.

import com.amazonaws.services.dynamodbv2.document.Item
import com.amazonaws.services.dynamodbv2.model.{
  AttributeDefinition,
  CreateTableRequest,
  KeySchemaElement,
  ProvisionedThroughput
}
import com.audienceproject.spark.dynamodb.implicits._

class TestNullBoolean extends AbstractInMemoryTest {
  test("Test Null") {
    dynamoDB.createTable(
      new CreateTableRequest()
        .withTableName("TestNullBoolean")
        .withAttributeDefinitions(new AttributeDefinition("Pk", "S"))
        .withKeySchema(new KeySchemaElement("Pk", "HASH"))
        .withProvisionedThroughput(new ProvisionedThroughput(5L, 5L))
    )

    val table = dynamoDB.getTable("TestNullBoolean")

    for ((_pk, _type, _value) <- Seq(
           ("id1", "type1", true),
           ("id2", "type2", null)
         )) {
      if (_type != "type2") {
        table.putItem(
          new Item()
            .withString("Pk", _pk)
            .withString("Type", _type)
            .withBoolean("Value", _value.asInstanceOf[Boolean])
        )
      } else {
        table.putItem(
          new Item()
            .withString("Pk", _pk)
            .withString("Type", _type)
            .withNull("Value")
        )
      }
    }

    val df = spark.read.dynamodbAs[BooleanClass]("TestNullBoolean")

    import spark.implicits._
    df.where($"Type" === "type2").show()
    client.deleteTable("TestNullBoolean")
  }
}
case class BooleanClass(Pk: String, Type: String, Value: Boolean)

from spark-dynamodb.

juan-yunis avatar juan-yunis commented on July 26, 2024 1

I used this in my build.sbt to use the latest changes.

lazy val root = (project in file(".")).dependsOn(depProject)
lazy val depProject = ProjectRef(
  uri("git://github.com/audienceproject/spark-dynamodb.git#master"),
  "spark-dynamodb"
)

from spark-dynamodb.

juan-yunis avatar juan-yunis commented on July 26, 2024

Hi @cosmincatalin, thank you for the quick response :).
Don't worry, release when you get more stuff in. Can you provide me the branch with the fix so I can download and build it to try it locally?

Thanks in advance.

from spark-dynamodb.

juan-yunis avatar juan-yunis commented on July 26, 2024

Nevermind, just found it in master 😃

from spark-dynamodb.

ColmHally avatar ColmHally commented on July 26, 2024

Hi @cosmincatalin, is there any possibility you could cut a release with this fix included?

from spark-dynamodb.

cosmincatalin avatar cosmincatalin commented on July 26, 2024

Sure, I’ll make a release before this weekend.

from spark-dynamodb.

cosmincatalin avatar cosmincatalin commented on July 26, 2024

Released in 1.0.3

from spark-dynamodb.

ColmHally avatar ColmHally commented on July 26, 2024

Thank you @cosmincatalin!

from spark-dynamodb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.