Skip to content

Conversation

@kiszk
Copy link
Member

@kiszk kiszk commented Mar 11, 2018

What changes were proposed in this pull request?

This pr added interpreted execution for Invoke.

How was this patch tested?

Added tests in ObjectExpressionsSuite.

@SparkQA
Copy link

SparkQA commented Mar 11, 2018

Test build #88164 has finished for PR 20797 at commit 3dbea12.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Member

Choose a reason for hiding this comment

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

Do we need to do explicitly cast? Doesn't Scala cast it if it's needed?

Copy link
Member Author

@kiszk kiszk Mar 12, 2018

Choose a reason for hiding this comment

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

It would work without this cast in Scala. I tried to do the same check that may throw an exception.
WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

For interpreted execution, I think it is less meaningful to check that. cc @hvanhovell

Copy link
Member Author

@kiszk kiszk Mar 13, 2018

Choose a reason for hiding this comment

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

I think that the point is where we want to cause a cast exception. With this code, an exception will occur at this class. Without this code, an exception will occur anywhere in the code.

Copy link
Member

Choose a reason for hiding this comment

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

We should also check if obj is null too.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@SparkQA
Copy link

SparkQA commented Mar 12, 2018

Test build #88181 has finished for PR 20797 at commit d81c950.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@kiszk
Copy link
Member Author

kiszk commented Mar 19, 2018

ping @hvanhovell

1 similar comment
@kiszk
Copy link
Member Author

kiszk commented Mar 26, 2018

ping @hvanhovell

@SparkQA
Copy link

SparkQA commented Mar 26, 2018

Test build #88583 has finished for PR 20797 at commit 6e2d136.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Mar 26, 2018

Test build #88590 has finished for PR 20797 at commit 38d1af2.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Mar 26, 2018

Test build #88591 has finished for PR 20797 at commit 22cd70c.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@kiszk
Copy link
Member Author

kiszk commented Mar 27, 2018

@hvanhovell sorry for ping again

Copy link
Contributor

Choose a reason for hiding this comment

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

I basically have the same comments here as for StaticInvoke: Why do we need to resolve the method at runtime? Why are you using CodeGenerator.defaultValue(dataType) to determine if something is a primitive?

Copy link
Contributor

Choose a reason for hiding this comment

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

O, btw: We should reuse the method resolution logic in StaticInvoke

Copy link
Member Author

Choose a reason for hiding this comment

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

Since obj should be evaluated at each call of eval, it is hard to reuse method resolution logic in StaticInvoke. On the other hand, we can reuse logic for casting a return value.

Copy link
Member Author

Choose a reason for hiding this comment

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

I refactored the code as possible as the common code is used.

@SparkQA
Copy link

SparkQA commented Mar 27, 2018

Test build #88631 has finished for PR 20797 at commit e32014e.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Mar 28, 2018

Test build #88649 has finished for PR 20797 at commit 4493909.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@kiszk
Copy link
Member Author

kiszk commented Mar 28, 2018

retest this please

@SparkQA
Copy link

SparkQA commented Mar 28, 2018

Test build #88655 has finished for PR 20797 at commit 4493909.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@kiszk
Copy link
Member Author

kiszk commented Mar 29, 2018

retest this please

@SparkQA
Copy link

SparkQA commented Mar 29, 2018

Test build #88686 has finished for PR 20797 at commit 4493909.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@kiszk
Copy link
Member Author

kiszk commented Apr 2, 2018

retest this please

@SparkQA
Copy link

SparkQA commented Apr 2, 2018

Test build #88821 has finished for PR 20797 at commit 4493909.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we resolving during evaluation time? This seems to be expensive?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unlike StaticInvoke, this is because obj is dynamically evaluated with a value in InternalRow. We cannot resolve beforehand when the case class is created.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should know the type before this right? Otherwise whole stage code generation doesn't work either.

Copy link
Member Author

Choose a reason for hiding this comment

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

We can know the base class beforehand. The obj class may be a subclass. I think this is a kind of virtual table lookup based on the literal name?
Since JVM class resolution converts the literal name to a constant offset, the code generation can perform a fast lookup based on the offset.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, this method may be applied to the base class. let me try this optimization.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. I also use method that was already defined for interpreted execution.

@SparkQA
Copy link

SparkQA commented Apr 3, 2018

Test build #88847 has finished for PR 20797 at commit 4185f09.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@hvanhovell
Copy link
Contributor

LGTM @kiszk can you update your branch so we can merge?

@SparkQA
Copy link

SparkQA commented Apr 4, 2018

Test build #88869 has finished for PR 20797 at commit c568944.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@kiszk
Copy link
Member Author

kiszk commented Apr 4, 2018

retest this please

@SparkQA
Copy link

SparkQA commented Apr 4, 2018

Test build #88879 has finished for PR 20797 at commit c568944.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@kiszk
Copy link
Member Author

kiszk commented Apr 4, 2018

retest this please

@SparkQA
Copy link

SparkQA commented Apr 4, 2018

Test build #88886 has finished for PR 20797 at commit c568944.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@hvanhovell
Copy link
Contributor

LGTM - merging to master. Thanks!

@asfgit asfgit closed this in a355236 Apr 4, 2018
case ObjectType(cls) => cls
case _ => typeJavaMapping.getOrElse(dt, classOf[java.lang.Object])
}
}
Copy link
Member

Choose a reason for hiding this comment

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

cc @maropu We can now use this instead of CallMethodViaReflection.typeMapping.

Copy link
Member

Choose a reason for hiding this comment

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

ok

mshtelma pushed a commit to mshtelma/spark that referenced this pull request Apr 5, 2018
## What changes were proposed in this pull request?

This pr added interpreted execution for `Invoke`.

## How was this patch tested?

Added tests in `ObjectExpressionsSuite`.

Author: Kazuaki Ishizaki <[email protected]>

Closes apache#20797 from kiszk/SPARK-28583.
robert3005 pushed a commit to palantir/spark that referenced this pull request Apr 7, 2018
## What changes were proposed in this pull request?

This pr added interpreted execution for `Invoke`.

## How was this patch tested?

Added tests in `ObjectExpressionsSuite`.

Author: Kazuaki Ishizaki <[email protected]>

Closes apache#20797 from kiszk/SPARK-28583.
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.

5 participants