You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by cwestin <gi...@git.apache.org> on 2015/10/01 15:43:41 UTC

[GitHub] drill pull request: DRILL-3874: flattening large JSON objects uses...

GitHub user cwestin opened a pull request:

    https://github.com/apache/drill/pull/181

    DRILL-3874: flattening large JSON objects uses too much direct memory

    - add getBufferSizeFor() to ValueVector interface
    - add implememtations of getBufferSizeFor() for all ValueVector derivatives
    - add adaptive algorithm for adjusting batch size to flatten operator

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cwestin/incubator-drill flatten-memory

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/drill/pull/181.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #181
    
----
commit ca9bccb8657169849e4965e180cdad75e0652c9e
Author: Chris Westin <cw...@yahoo.com>
Date:   2015-09-29T23:05:00Z

    DRILL-3874: flattening large JSON objects uses too much direct memory
    - add getBufferSizeFor() to ValueVector interface
    - add implememtations of getBufferSizeFor() for all ValueVector derivatives
    - add adaptive algorithm for adjusting batch size to flatten operator

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3874: flattening large JSON objects uses...

Posted by jaltekruse <gi...@git.apache.org>.
Github user jaltekruse commented on the pull request:

    https://github.com/apache/drill/pull/181#issuecomment-145160952
  
    Go for it


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3874: flattening large JSON objects uses...

Posted by cwestin <gi...@git.apache.org>.
Github user cwestin closed the pull request at:

    https://github.com/apache/drill/pull/181


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3874: flattening large JSON objects uses...

Posted by parthchandra <gi...@git.apache.org>.
Github user parthchandra commented on the pull request:

    https://github.com/apache/drill/pull/181#issuecomment-144897173
  
    Looks good. +1.
    Some minor comments in line


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3874: flattening large JSON objects uses...

Posted by jaltekruse <gi...@git.apache.org>.
Github user jaltekruse commented on the pull request:

    https://github.com/apache/drill/pull/181#issuecomment-144846430
  
    Overall, the changes look solid.
    
    I am thinking it may be worth trying to remove the bodies of the existing getBufferSize() methods and replace them with calls into these new methods, passing in the current valueCount that is expected to be set with a call to setValueCount(int) before getBufferSize() is used. It seems weird to have two different ways to compute the same values, although I see the reason for it, previously we were using the writerIndex() for all of the fixed length primitives, which is also set in setValueCount().
    
    I don't consider it a must fix to check in, I just wanted to know if you had thought about this and ruled it out.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3874: flattening large JSON objects uses...

Posted by jaltekruse <gi...@git.apache.org>.
Github user jaltekruse commented on the pull request:

    https://github.com/apache/drill/pull/181#issuecomment-145158691
  
    I'm running the unit tests on the changeset rebased on top of master, will be merging shortly if it passes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3874: flattening large JSON objects uses...

Posted by cwestin <gi...@git.apache.org>.
Github user cwestin commented on a diff in the pull request:

    https://github.com/apache/drill/pull/181#discussion_r40985372
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/BaseRepeatedValueVector.java ---
    @@ -123,6 +123,15 @@ public int getBufferSize() {
       }
     
       @Override
    +  public int getBufferSizeFor(int valueCount) {
    +    if (getAccessor().getValueCount() == 0) {
    +      return 0;
    +    }
    +
    +    return offsets.getBufferSizeFor(valueCount) + vector.getBufferSizeFor(valueCount);
    --- End diff --
    
    Based on setInitialValueCapacity(), I think you're right. Will do. (But I'm not going to go back and patch the EBF for that, because it'll just be off by one offsets value, or 4 bytes, which isn't going to kill the emergency fix.)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3874: flattening large JSON objects uses...

Posted by cwestin <gi...@git.apache.org>.
Github user cwestin commented on the pull request:

    https://github.com/apache/drill/pull/181#issuecomment-145645022
  
    This was merged.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3874: flattening large JSON objects uses...

Posted by jaltekruse <gi...@git.apache.org>.
Github user jaltekruse commented on a diff in the pull request:

    https://github.com/apache/drill/pull/181#discussion_r40963410
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/BaseRepeatedValueVector.java ---
    @@ -123,6 +123,15 @@ public int getBufferSize() {
       }
     
       @Override
    +  public int getBufferSizeFor(int valueCount) {
    +    if (getAccessor().getValueCount() == 0) {
    +      return 0;
    +    }
    +
    +    return offsets.getBufferSizeFor(valueCount) + vector.getBufferSizeFor(valueCount);
    --- End diff --
    
    This first one should be passed valueCount +1 right? As was done in VariableLengthVectors.java



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3874: flattening large JSON objects uses...

Posted by parthchandra <gi...@git.apache.org>.
Github user parthchandra commented on the pull request:

    https://github.com/apache/drill/pull/181#issuecomment-145067195
  
    Re OUTPUT_MEMORY_LIMIT: I'm fine if you leave it the way it is. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3874: flattening large JSON objects uses...

Posted by parthchandra <gi...@git.apache.org>.
Github user parthchandra commented on the pull request:

    https://github.com/apache/drill/pull/181#issuecomment-145160342
  
    Just completed a build and unit test run successfully. I can merging this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3874: flattening large JSON objects uses...

Posted by cwestin <gi...@git.apache.org>.
Github user cwestin commented on the pull request:

    https://github.com/apache/drill/pull/181#issuecomment-144729913
  
    Passes the unit tests, and the regression suite, except for one query in the functional suite that Rahul claimed (in email) is a known problem and that he has a fix for.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3874: flattening large JSON objects uses...

Posted by cwestin <gi...@git.apache.org>.
Github user cwestin commented on the pull request:

    https://github.com/apache/drill/pull/181#issuecomment-145149090
  
    I just squashed and pushed with the valueCount + 1 for the BaseRepeatedValueVector, along with using valueCount in getBufferSizeFor() instead of getAccessor().getValueCount(). I opened https://issues.apache.org/jira/browse/DRILL-3876 for the proper long term solution, and https://issues.apache.org/jira/browse/DRILL-3889 for the getBufferSize()/getBufferSizeFor() improvement. Can one of you please merge this for 1.2 now?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3874: flattening large JSON objects uses...

Posted by jaltekruse <gi...@git.apache.org>.
Github user jaltekruse commented on the pull request:

    https://github.com/apache/drill/pull/181#issuecomment-145117861
  
    I'm okay with merging as is, I think it is worth keeping a JIRA open for this refactoring. The fact that these behave inconsistently pretty much guarantees that one of them has a bug.
    +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3874: flattening large JSON objects uses...

Posted by cwestin <gi...@git.apache.org>.
Github user cwestin commented on the pull request:

    https://github.com/apache/drill/pull/181#issuecomment-144898125
  
    Parth:
    Re ObjectVector: I don't know what that's for. I just followed the pattern: getBufferSize() already throws that exception.
    Re OUTPUT_MEMORY_LIMIT: what do you think? I tend to avoid adding more knobs, but I can easily do that if you like (with the current 512MB as the default). Let me know soon, about to kick off testing on Jason's suggested replacement of getBufferSize() implementations with calls to getBufferSizeFor(). The problem I see here is that it will affect all flatten()s, whether they need it or not. And, this isn't really the long term solution, which is really to add projection capabilities so that we're not passing through the original record like this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3874: flattening large JSON objects uses...

Posted by cwestin <gi...@git.apache.org>.
Github user cwestin commented on the pull request:

    https://github.com/apache/drill/pull/181#issuecomment-145033096
  
    I tried to make the getBufferSize()-calls-getBufferSizeFor() change that you suggested, Jason, but it causes a lot of unit test failures, so there must be something else going on in some places. I want to get this into 1.2, so I've undone that for now. But I've added the valueCount + 1 you spotted, and also changed the check to if (valueCount == 0) in BaseRepeatedValueVector.getBufferSizeFor() -- that was a bug nobody spotted. Testing with those changes now, will push shortly. It'd be great if one of you could merge this after that.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---