Skip to content

Conversation

@shiro615
Copy link
Contributor

No description provided.

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

Thanks!
Could you check my comments?

auto arrow_numeric_scalar = std::dynamic_pointer_cast<ScalarType>(mean_datum.scalar());
return arrow_numeric_scalar->value;
} else {
return 0;
Copy link
Member

Choose a reason for hiding this comment

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

Could you use 0.0 for gdouble?

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've fixed it.


def test_mean
array = build_double_array([1.1, 2.2, nil])
assert_equal(1.6500000000000001, array.mean)
Copy link
Member

Choose a reason for hiding this comment

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

assert_equal isn't suitable for floating point number. Because floating point number may have an error.
Could you use assert_in_delta https://www.rubydoc.info/gems/test-unit/Test/Unit/Assertions#assert_in_delta-instance_method instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for pointing out. I've fixed it.

auto arrow_numeric_scalar = std::dynamic_pointer_cast<ScalarType>(mean_datum.scalar());
return arrow_numeric_scalar->value;
} else {
return 0.0;
Copy link
Member

Choose a reason for hiding this comment

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

Should it be NaN?

Copy link
Member

Choose a reason for hiding this comment

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

If we use NaN, std::numeric_limits<double>::signaling_NaN() https://en.cppreference.com/w/cpp/types/numeric_limits/signaling_NaN will be better.
But I don't think this is required. Because we indicate whether error is occurred by error argument. Users should check error instead of checking return value for error check.

Copy link
Member

Choose a reason for hiding this comment

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

If @shiro615 changes this before I merge, I'll accept the change. :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Users can check error argument. I want to use 0.0.

Copy link
Member

Choose a reason for hiding this comment

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

OK.

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

+1
I'll merge this when test is passed.

@kou
Copy link
Member

kou commented Mar 14, 2019

CI failure is unrelated. I'll merge this.

https://travis-ci.org/apache/arrow/jobs/506259901 is Plasma related failure:

=================================== FAILURES ===================================
_______________________________ test_plasma_list _______________________________

    @pytest.mark.plasma
    def test_plasma_list():
        import pyarrow.plasma as plasma
    
        with plasma.start_plasma_store(
                plasma_store_memory=DEFAULT_PLASMA_STORE_MEMORY) \
                as (plasma_store_name, p):
            plasma_client = plasma.connect(plasma_store_name)
    
            # Test sizes
            u, _, _ = create_object(plasma_client, 11, metadata_size=7, seal=False)
            l1 = plasma_client.list()
            assert l1[u]["data_size"] == 11
            assert l1[u]["metadata_size"] == 7
    
            # Test ref_count
            v = plasma_client.put(np.zeros(3))
            l2 = plasma_client.list()
            # Ref count has already been released
            assert l2[v]["ref_count"] == 0
            a = plasma_client.get(v)
            l3 = plasma_client.list()
            assert l3[v]["ref_count"] == 1
            del a
    
            # Test state
            w, _, _ = create_object(plasma_client, 3, metadata_size=0, seal=False)
            l4 = plasma_client.list()
            assert l4[w]["state"] == "created"
            plasma_client.seal(w)
            l5 = plasma_client.list()
            assert l5[w]["state"] == "sealed"
    
            # Test timestamps
            t1 = time.time()
            x, _, _ = create_object(plasma_client, 3, metadata_size=0, seal=False)
            t2 = time.time()
            l6 = plasma_client.list()
>           assert math.floor(t1) <= l6[x]["create_time"] <= math.ceil(t2)
E           assert 1552568478 <= 1552568477
E            +  where 1552568478 = <built-in function floor>(1552568478.0022461)
E            +    where <built-in function floor> = math.floor

../../pyarrow-test-3.6/lib/python3.6/site-packages/pyarrow/tests/test_plasma.py:1070: AssertionError
----------------------------- Captured stderr call -----------------------------
I0314 13:01:17.901209 19953 store.cc:1093] Allowing the Plasma store to use up to 0.1GB of memory.
I0314 13:01:17.901417 19953 store.cc:1120] Starting object store with directory /dev/shm and huge page support disabled

@pcmoritz @robertnishihara Could you fix this Plasma failure?

https://ci.appveyor.com/project/ApacheSoftwareFoundation/arrow/builds/23071125/job/s8iwxmf9hddh3q07 will be fixed by #3905.

@kou kou closed this in dcee4ad Mar 14, 2019
@kou
Copy link
Member

kou commented Mar 14, 2019

@shiro615 shiro615 deleted the glib-mean branch March 15, 2019 00:03
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.

3 participants