[jira] [Commented] (CASSANDRA-15269) Cassandra fails to process OperationExecutionException which causes ClassCastException
[ https://issues.apache.org/jira/browse/CASSANDRA-15269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17360954#comment-17360954 ] Liudmila Kornilova commented on CASSANDRA-15269: [~bereng], no problem :) > Cassandra fails to process OperationExecutionException which causes > ClassCastException > -- > > Key: CASSANDRA-15269 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15269 > Project: Cassandra > Issue Type: Bug > Components: CQL/Interpreter >Reporter: Liudmila Kornilova >Assignee: Liudmila Kornilova >Priority: Normal > > While working on CASSANDRA-15232 I noticed that OperationExecutionException > is not processed correctly. > How to reproduce the issue: > 1. {{create table d (numerator decimal primary key, denominator decimal);}} > 2. {{insert into d (numerator, denominator) values > (123456789112345678921234567893123456, 2);}} > 3. {{select numerator % denominator from d;}} > What happens: > 1. remainder operation throws ArithmeticException (BigDecimal:1854) > 2. The exception is wrapped in OperationExecutionException > 3. ClassCastException appears (OperationExecutionException cannot be cast to > FunctionExecutionException at ErrorMessage.java:280) > What should happen: > OperationExecutionException with message "the operation 'decimal % decimal' > failed: Division impossible" should be delivered to user > Note that after fixing CASSANDRA-15232 {{select numerator % denominator from > d;}} will produce correct result of remainder operation. > Currently I am not aware of other cases when OperationExecutionException may > be treated as FunctionExecutionException -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Commented] (CASSANDRA-15269) Cassandra fails to process OperationExecutionException which causes ClassCastException
[ https://issues.apache.org/jira/browse/CASSANDRA-15269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16911960#comment-16911960 ] Liudmila Kornilova commented on CASSANDRA-15269: Hi [~andrew.tolbert], Thank you for reviewing my commit! I moved error code description from v4 to v5 How to find out versions of Cassandra and CQL that will use v5? I know that I can execute {{"select release_version, cql_version, native_protocol_version from system.local"}}, but it gives v4 protocol for 4.0-SNAPSHOT Cassandra and 3.4.5 cql > Cassandra fails to process OperationExecutionException which causes > ClassCastException > -- > > Key: CASSANDRA-15269 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15269 > Project: Cassandra > Issue Type: Bug > Components: CQL/Interpreter >Reporter: Liudmila Kornilova >Assignee: Liudmila Kornilova >Priority: Normal > > While working on CASSANDRA-15232 I noticed that OperationExecutionException > is not processed correctly. > How to reproduce the issue: > 1. {{create table d (numerator decimal primary key, denominator decimal);}} > 2. {{insert into d (numerator, denominator) values > (123456789112345678921234567893123456, 2);}} > 3. {{select numerator % denominator from d;}} > What happens: > 1. remainder operation throws ArithmeticException (BigDecimal:1854) > 2. The exception is wrapped in OperationExecutionException > 3. ClassCastException appears (OperationExecutionException cannot be cast to > FunctionExecutionException at ErrorMessage.java:280) > What should happen: > OperationExecutionException with message "the operation 'decimal % decimal' > failed: Division impossible" should be delivered to user > Note that after fixing CASSANDRA-15232 {{select numerator % denominator from > d;}} will produce correct result of remainder operation. > Currently I am not aware of other cases when OperationExecutionException may > be treated as FunctionExecutionException -- This message was sent by Atlassian Jira (v8.3.2#803003) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Updated] (CASSANDRA-15269) Cassandra fails to process OperationExecutionException which causes ClassCastException
[ https://issues.apache.org/jira/browse/CASSANDRA-15269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Liudmila Kornilova updated CASSANDRA-15269: --- Test and Documentation Plan: Documented, not tested (should not affect any tests) Status: Patch Available (was: Open) > Cassandra fails to process OperationExecutionException which causes > ClassCastException > -- > > Key: CASSANDRA-15269 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15269 > Project: Cassandra > Issue Type: Bug > Components: CQL/Interpreter >Reporter: Liudmila Kornilova >Assignee: Liudmila Kornilova >Priority: Normal > > While working on CASSANDRA-15232 I noticed that OperationExecutionException > is not processed correctly. > How to reproduce the issue: > 1. {{create table d (numerator decimal primary key, denominator decimal);}} > 2. {{insert into d (numerator, denominator) values > (123456789112345678921234567893123456, 2);}} > 3. {{select numerator % denominator from d;}} > What happens: > 1. remainder operation throws ArithmeticException (BigDecimal:1854) > 2. The exception is wrapped in OperationExecutionException > 3. ClassCastException appears (OperationExecutionException cannot be cast to > FunctionExecutionException at ErrorMessage.java:280) > What should happen: > OperationExecutionException with message "the operation 'decimal % decimal' > failed: Division impossible" should be delivered to user > Note that after fixing CASSANDRA-15232 {{select numerator % denominator from > d;}} will produce correct result of remainder operation. > Currently I am not aware of other cases when OperationExecutionException may > be treated as FunctionExecutionException -- This message was sent by Atlassian Jira (v8.3.2#803003) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Commented] (CASSANDRA-15269) Cassandra fails to process OperationExecutionException which causes ClassCastException
[ https://issues.apache.org/jira/browse/CASSANDRA-15269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16911178#comment-16911178 ] Liudmila Kornilova commented on CASSANDRA-15269: Each {{ExceptionCode}} correspond to specific exception class. {{OperationExecutionException}} did not have it's own code, instead it used {{FUNCTION_FAILURE}} code. So the exception was treated as {{FunctionExecutionException}} I added {{OPERATION_FAILURE}} code How to test: revert locally d60e7988736ed4358595e9c781b110a5bbb5f812 commit (void result truncate in decimal operations) Or throw {{ArithmeticException}} in {{DecimalType.mod}} {noformat} try (CqlSession session = CqlSession.builder().build()) { session.execute("drop table if exists d"); session.execute("create table d (n decimal primary key, d decimal)"); session.execute("insert into d (n, d) values (123456789112345678921234567893123456, 2)"); session.execute("select n % d from my.d"); } {noformat} What used to be: {noformat} Exception in thread "main" com.datastax.oss.driver.api.core.servererrors.ServerError: java.lang.ClassCastException: org.apache.cassandra.exceptions.OperationExecutionException cannot be cast to org.apache.cassandra.exceptions.FunctionExecutionException at com.datastax.oss.driver.api.core.servererrors.ServerError.copy(ServerError.java:54) {noformat} What is now: {noformat} Exception in thread "main" com.datastax.oss.driver.api.core.DriverExecutionException at com.datastax.oss.driver.internal.core.util.concurrent.CompletableFutures.getUninterruptibly(CompletableFutures.java:150) ... Caused by: java.lang.IllegalArgumentException: Unsupported error code: 5888 {noformat} New error code should be added to Datastax Cassandra Native Protocol in [ProtocolConstants.java|https://github.com/datastax/native-protocol/blob/1.x/src/main/java/com/datastax/oss/protocol/internal/ProtocolConstants.java#L70] If this commit is merged, I'll write a patch to the protocol > Cassandra fails to process OperationExecutionException which causes > ClassCastException > -- > > Key: CASSANDRA-15269 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15269 > Project: Cassandra > Issue Type: Bug > Components: CQL/Interpreter >Reporter: Liudmila Kornilova >Assignee: Liudmila Kornilova >Priority: Normal > > While working on CASSANDRA-15232 I noticed that OperationExecutionException > is not processed correctly. > How to reproduce the issue: > 1. {{create table d (numerator decimal primary key, denominator decimal);}} > 2. {{insert into d (numerator, denominator) values > (123456789112345678921234567893123456, 2);}} > 3. {{select numerator % denominator from d;}} > What happens: > 1. remainder operation throws ArithmeticException (BigDecimal:1854) > 2. The exception is wrapped in OperationExecutionException > 3. ClassCastException appears (OperationExecutionException cannot be cast to > FunctionExecutionException at ErrorMessage.java:280) > What should happen: > OperationExecutionException with message "the operation 'decimal % decimal' > failed: Division impossible" should be delivered to user > Note that after fixing CASSANDRA-15232 {{select numerator % denominator from > d;}} will produce correct result of remainder operation. > Currently I am not aware of other cases when OperationExecutionException may > be treated as FunctionExecutionException -- This message was sent by Atlassian Jira (v8.3.2#803003) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Updated] (CASSANDRA-15269) Cassandra fails to process OperationExecutionException which causes ClassCastException
[ https://issues.apache.org/jira/browse/CASSANDRA-15269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Liudmila Kornilova updated CASSANDRA-15269: --- Bug Category: Parent values: Correctness(12982)Level 1 values: API / Semantic Implementation(12988) Complexity: Low Hanging Fruit Discovered By: Code Inspection Severity: Low Status: Open (was: Triage Needed) > Cassandra fails to process OperationExecutionException which causes > ClassCastException > -- > > Key: CASSANDRA-15269 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15269 > Project: Cassandra > Issue Type: Bug > Components: CQL/Interpreter >Reporter: Liudmila Kornilova >Assignee: Liudmila Kornilova >Priority: Normal > > While working on CASSANDRA-15232 I noticed that OperationExecutionException > is not processed correctly. > How to reproduce the issue: > 1. {{create table d (numerator decimal primary key, denominator decimal);}} > 2. {{insert into d (numerator, denominator) values > (123456789112345678921234567893123456, 2);}} > 3. {{select numerator % denominator from d;}} > What happens: > 1. remainder operation throws ArithmeticException (BigDecimal:1854) > 2. The exception is wrapped in OperationExecutionException > 3. ClassCastException appears (OperationExecutionException cannot be cast to > FunctionExecutionException at ErrorMessage.java:280) > What should happen: > OperationExecutionException with message "the operation 'decimal % decimal' > failed: Division impossible" should be delivered to user > Note that after fixing CASSANDRA-15232 {{select numerator % denominator from > d;}} will produce correct result of remainder operation. > Currently I am not aware of other cases when OperationExecutionException may > be treated as FunctionExecutionException -- This message was sent by Atlassian Jira (v8.3.2#803003) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Assigned] (CASSANDRA-15269) Cassandra fails to process OperationExecutionException which causes ClassCastException
[ https://issues.apache.org/jira/browse/CASSANDRA-15269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Liudmila Kornilova reassigned CASSANDRA-15269: -- Assignee: Liudmila Kornilova > Cassandra fails to process OperationExecutionException which causes > ClassCastException > -- > > Key: CASSANDRA-15269 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15269 > Project: Cassandra > Issue Type: Bug > Components: CQL/Interpreter >Reporter: Liudmila Kornilova >Assignee: Liudmila Kornilova >Priority: Normal > > While working on CASSANDRA-15232 I noticed that OperationExecutionException > is not processed correctly. > How to reproduce the issue: > 1. {{create table d (numerator decimal primary key, denominator decimal);}} > 2. {{insert into d (numerator, denominator) values > (123456789112345678921234567893123456, 2);}} > 3. {{select numerator % denominator from d;}} > What happens: > 1. remainder operation throws ArithmeticException (BigDecimal:1854) > 2. The exception is wrapped in OperationExecutionException > 3. ClassCastException appears (OperationExecutionException cannot be cast to > FunctionExecutionException at ErrorMessage.java:280) > What should happen: > OperationExecutionException with message "the operation 'decimal % decimal' > failed: Division impossible" should be delivered to user > Note that after fixing CASSANDRA-15232 {{select numerator % denominator from > d;}} will produce correct result of remainder operation. > Currently I am not aware of other cases when OperationExecutionException may > be treated as FunctionExecutionException -- This message was sent by Atlassian Jira (v8.3.2#803003) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Commented] (CASSANDRA-15232) Arithmetic operators over decimal truncate results
[ https://issues.apache.org/jira/browse/CASSANDRA-15232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16910955#comment-16910955 ] Liudmila Kornilova commented on CASSANDRA-15232: :) > Arithmetic operators over decimal truncate results > -- > > Key: CASSANDRA-15232 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15232 > Project: Cassandra > Issue Type: Improvement > Components: CQL/Semantics >Reporter: Benedict >Assignee: Liudmila Kornilova >Priority: Normal > Labels: pull-request-available > Fix For: 4.0 > > Time Spent: 1.5h > Remaining Estimate: 0h > > The decimal operators hard-code a 128 bit precision for their computations. > Probably a precision needs to be configured or decided somehow, but it’s not > clear why 128bit was chosen. Particularly for multiplication and addition, > it’s very unclear why we truncate, which is different to our behaviour for > e.g. sum() aggregates. Probably for division we should also ensure that we > do not reduce the precision of the two operands. A minimum of decimal128 > seems reasonable, but a maximum does not. -- This message was sent by Atlassian Jira (v8.3.2#803003) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Updated] (CASSANDRA-15232) Arithmetic operators over decimal truncate results
[ https://issues.apache.org/jira/browse/CASSANDRA-15232?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Liudmila Kornilova updated CASSANDRA-15232: --- Status: Review In Progress (was: Changes Suggested) > Arithmetic operators over decimal truncate results > -- > > Key: CASSANDRA-15232 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15232 > Project: Cassandra > Issue Type: Improvement > Components: CQL/Semantics >Reporter: Benedict >Assignee: Liudmila Kornilova >Priority: Normal > Labels: pull-request-available > Fix For: 4.0 > > Time Spent: 1.5h > Remaining Estimate: 0h > > The decimal operators hard-code a 128 bit precision for their computations. > Probably a precision needs to be configured or decided somehow, but it’s not > clear why 128bit was chosen. Particularly for multiplication and addition, > it’s very unclear why we truncate, which is different to our behaviour for > e.g. sum() aggregates. Probably for division we should also ensure that we > do not reduce the precision of the two operands. A minimum of decimal128 > seems reasonable, but a maximum does not. -- This message was sent by Atlassian JIRA (v7.6.14#76016) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Commented] (CASSANDRA-15232) Arithmetic operators over decimal truncate results
[ https://issues.apache.org/jira/browse/CASSANDRA-15232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16903591#comment-16903591 ] Liudmila Kornilova commented on CASSANDRA-15232: 1. (y) 2. I inlined expressions and added a comment I'll create a ticket about modulo operation for floating point types I'll take a look at CASSANDRA-15269. Even if this commit is merged first, it will be possible to work on the problem by reverting this commit locally > Arithmetic operators over decimal truncate results > -- > > Key: CASSANDRA-15232 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15232 > Project: Cassandra > Issue Type: Improvement > Components: CQL/Semantics >Reporter: Benedict >Assignee: Liudmila Kornilova >Priority: Normal > Labels: pull-request-available > Fix For: 4.0 > > Time Spent: 1.5h > Remaining Estimate: 0h > > The decimal operators hard-code a 128 bit precision for their computations. > Probably a precision needs to be configured or decided somehow, but it’s not > clear why 128bit was chosen. Particularly for multiplication and addition, > it’s very unclear why we truncate, which is different to our behaviour for > e.g. sum() aggregates. Probably for division we should also ensure that we > do not reduce the precision of the two operands. A minimum of decimal128 > seems reasonable, but a maximum does not. -- This message was sent by Atlassian JIRA (v7.6.14#76016) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Updated] (CASSANDRA-15232) Arithmetic operators over decimal truncate results
[ https://issues.apache.org/jira/browse/CASSANDRA-15232?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Liudmila Kornilova updated CASSANDRA-15232: --- Test and Documentation Plan: I did not run tests except OperationFctsTest Status: Patch Available (was: In Progress) > Arithmetic operators over decimal truncate results > -- > > Key: CASSANDRA-15232 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15232 > Project: Cassandra > Issue Type: Improvement > Components: CQL/Semantics >Reporter: Benedict >Assignee: Liudmila Kornilova >Priority: Normal > Labels: pull-request-available > Fix For: 4.0 > > Time Spent: 1.5h > Remaining Estimate: 0h > > The decimal operators hard-code a 128 bit precision for their computations. > Probably a precision needs to be configured or decided somehow, but it’s not > clear why 128bit was chosen. Particularly for multiplication and addition, > it’s very unclear why we truncate, which is different to our behaviour for > e.g. sum() aggregates. Probably for division we should also ensure that we > do not reduce the precision of the two operands. A minimum of decimal128 > seems reasonable, but a maximum does not. -- This message was sent by Atlassian JIRA (v7.6.14#76016) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Commented] (CASSANDRA-15232) Arithmetic operators over decimal truncate results
[ https://issues.apache.org/jira/browse/CASSANDRA-15232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16902870#comment-16902870 ] Liudmila Kornilova commented on CASSANDRA-15232: Hello [~benedict], I removed calculation of first digits. In postgres it makes sense because the operation requires only array element accesses. Also it's a heuristic that does not always lead to better result (in case when first to digits are equal) > Arithmetic operators over decimal truncate results > -- > > Key: CASSANDRA-15232 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15232 > Project: Cassandra > Issue Type: Improvement > Components: CQL/Semantics >Reporter: Benedict >Assignee: Liudmila Kornilova >Priority: Normal > Labels: pull-request-available > Fix For: 4.0 > > Time Spent: 1.5h > Remaining Estimate: 0h > > The decimal operators hard-code a 128 bit precision for their computations. > Probably a precision needs to be configured or decided somehow, but it’s not > clear why 128bit was chosen. Particularly for multiplication and addition, > it’s very unclear why we truncate, which is different to our behaviour for > e.g. sum() aggregates. Probably for division we should also ensure that we > do not reduce the precision of the two operands. A minimum of decimal128 > seems reasonable, but a maximum does not. -- This message was sent by Atlassian JIRA (v7.6.14#76016) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Created] (CASSANDRA-15269) Cassandra fails to process OperationExecutionException which causes ClassCastException
Liudmila Kornilova created CASSANDRA-15269: -- Summary: Cassandra fails to process OperationExecutionException which causes ClassCastException Key: CASSANDRA-15269 URL: https://issues.apache.org/jira/browse/CASSANDRA-15269 Project: Cassandra Issue Type: Bug Components: CQL/Interpreter Reporter: Liudmila Kornilova While working on CASSANDRA-15232 I noticed that OperationExecutionException is not processed correctly. How to reproduce the issue: 1. {{create table d (numerator decimal primary key, denominator decimal);}} 2. {{insert into d (numerator, denominator) values (123456789112345678921234567893123456, 2);}} 3. {{select numerator % denominator from d;}} What happens: 1. remainder operation throws ArithmeticException (BigDecimal:1854) 2. The exception is wrapped in OperationExecutionException 3. ClassCastException appears (OperationExecutionException cannot be cast to FunctionExecutionException at ErrorMessage.java:280) What should happen: OperationExecutionException with message "the operation 'decimal % decimal' failed: Division impossible" should be delivered to user Note that after fixing CASSANDRA-15232 {{select numerator % denominator from d;}} will produce correct result of remainder operation. Currently I am not aware of other cases when OperationExecutionException may be treated as FunctionExecutionException -- This message was sent by Atlassian JIRA (v7.6.14#76016) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Commented] (CASSANDRA-15225) FileUtils.close() does not handle non-IOException
[ https://issues.apache.org/jira/browse/CASSANDRA-15225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16901983#comment-16901983 ] Liudmila Kornilova commented on CASSANDRA-15225: [~benedict], done! > FileUtils.close() does not handle non-IOException > - > > Key: CASSANDRA-15225 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15225 > Project: Cassandra > Issue Type: Bug > Components: Local/SSTable >Reporter: Benedict >Assignee: Liudmila Kornilova >Priority: Normal > Labels: pull-request-available > Fix For: 3.0.x, 3.11.x, 4.0.x > > Time Spent: 10m > Remaining Estimate: 0h > > This can lead to {{close}} not being invoked on remaining items -- This message was sent by Atlassian JIRA (v7.6.14#76016) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Commented] (CASSANDRA-15225) FileUtils.close() does not handle non-IOException
[ https://issues.apache.org/jira/browse/CASSANDRA-15225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16901962#comment-16901962 ] Liudmila Kornilova commented on CASSANDRA-15225: Thank you for reviewing the code, [~benedict] It sounds like a better approach because some {{Throwables}} should not be re-thrown as checked (e.g. {{Error}} is a "serious problems that a reasonable application should not try to catch"). Also no additional wrappers I pushed third commit > FileUtils.close() does not handle non-IOException > - > > Key: CASSANDRA-15225 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15225 > Project: Cassandra > Issue Type: Bug > Components: Local/SSTable >Reporter: Benedict >Assignee: Liudmila Kornilova >Priority: Normal > Labels: pull-request-available > Fix For: 3.0.x, 3.11.x, 4.0.x > > Time Spent: 10m > Remaining Estimate: 0h > > This can lead to {{close}} not being invoked on remaining items -- This message was sent by Atlassian JIRA (v7.6.14#76016) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Commented] (CASSANDRA-15232) Arithmetic operators over decimal truncate results
[ https://issues.apache.org/jira/browse/CASSANDRA-15232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16901242#comment-16901242 ] Liudmila Kornilova commented on CASSANDRA-15232: Hi, [~benedict] I'll go through the code one more time tomorrow and "Submit patch"! > Arithmetic operators over decimal truncate results > -- > > Key: CASSANDRA-15232 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15232 > Project: Cassandra > Issue Type: Improvement > Components: CQL/Semantics >Reporter: Benedict >Assignee: Liudmila Kornilova >Priority: Normal > Labels: pull-request-available > Fix For: 4.0 > > Time Spent: 1h 20m > Remaining Estimate: 0h > > The decimal operators hard-code a 128 bit precision for their computations. > Probably a precision needs to be configured or decided somehow, but it’s not > clear why 128bit was chosen. Particularly for multiplication and addition, > it’s very unclear why we truncate, which is different to our behaviour for > e.g. sum() aggregates. Probably for division we should also ensure that we > do not reduce the precision of the two operands. A minimum of decimal128 > seems reasonable, but a maximum does not. -- This message was sent by Atlassian JIRA (v7.6.14#76016) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Commented] (CASSANDRA-15225) FileUtils.close() does not handle non-IOException
[ https://issues.apache.org/jira/browse/CASSANDRA-15225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16899886#comment-16899886 ] Liudmila Kornilova commented on CASSANDRA-15225: {quote}2) Log statement has only one '{}'. I don't think it will print exception. I prefer caller to handle the logging part. {quote} I checked this. An exception is extracted here ch.qos.logback.classic.spi.LoggingEvent:49 and it is printed {quote}unless you want to make any changes in light of [~n.v.harikrishna]'s feedback? {quote} I decided to change the code such that new exception is created. I see 2 advantages of this version: 1. {{Throwable}} will not be lost if it appears before {{IOException}} or {{IOException}} does not appear at all. {{Throwable}} will be rethrown as IOException with cause. 2. Catch clauses become identical and they can be collapsed to one {{Throwable}} clause I pushed a separate commit so you can see the difference. I can squash commits if you wish > FileUtils.close() does not handle non-IOException > - > > Key: CASSANDRA-15225 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15225 > Project: Cassandra > Issue Type: Bug > Components: Local/SSTable >Reporter: Benedict >Assignee: Liudmila Kornilova >Priority: Normal > Labels: pull-request-available > Fix For: 3.0.x, 3.11.x, 4.0.x > > Time Spent: 10m > Remaining Estimate: 0h > > This can lead to {{close}} not being invoked on remaining items -- This message was sent by Atlassian JIRA (v7.6.14#76016) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Comment Edited] (CASSANDRA-15232) Arithmetic operators over decimal truncate results
[ https://issues.apache.org/jira/browse/CASSANDRA-15232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16890801#comment-16890801 ] Liudmila Kornilova edited comment on CASSANDRA-15232 at 7/24/19 8:10 AM: - Hello [~benedict], This is how postgres calculates scale https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/numeric.c#L7800 I created this work-in-process pull request https://github.com/apache/cassandra/pull/334 Before this commit Cassandra used to limit precision off all operations to 34 (maximum number of significant digits) After this commit: * add, multiply and subtract operations limit precision to 1 digits * division sets minimum scale to 32. So 1000 / 3 produces 333. (32 digits after dot) * division also tries to guess the position of first significant digit in result (this idea is taken from postgres) so 0.1 / 3 will produce 5+32=37 digits after dot, 32 of them will be significant * division sets maximum scale to 1000 (the constant is also taken from postgres) * division will not use scale that is lower that scale of any operands was (Author: override): Hello [~benedict], This is how postgres calculates scale https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/numeric.c#L7800 I created this work-in-process pull request https://github.com/apache/cassandra/pull/334 Before this commit Cassandra used to limit precision off all operations to 34 (maximum number of significant digits) After this commit: * add, multiply and subtract operations limit precision to 1 digits * add, multiply and subtract trim trailing zeros, so operations do not affect scale/precision of next operations * division sets minimum scale to 32. So 1000 / 3 produces 333. (32 digits after dot) * division also tries to guess the position of first significant digit in result (this idea is taken from postgres) so 0.1 / 3 will produce 5+32=37 digits after dot, 32 of them will be significant * division sets maximum scale to 1000 (the constant is also taken from postgres) * division will not use scale that is lower that scale of any operands The PR is not 100% ready because mod operation needs to be implemented > Arithmetic operators over decimal truncate results > -- > > Key: CASSANDRA-15232 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15232 > Project: Cassandra > Issue Type: Improvement > Components: CQL/Semantics >Reporter: Benedict >Assignee: Liudmila Kornilova >Priority: Normal > Labels: pull-request-available > Fix For: 4.0 > > Time Spent: 1h 10m > Remaining Estimate: 0h > > The decimal operators hard-code a 128 bit precision for their computations. > Probably a precision needs to be configured or decided somehow, but it’s not > clear why 128bit was chosen. Particularly for multiplication and addition, > it’s very unclear why we truncate, which is different to our behaviour for > e.g. sum() aggregates. Probably for division we should also ensure that we > do not reduce the precision of the two operands. A minimum of decimal128 > seems reasonable, but a maximum does not. -- This message was sent by Atlassian JIRA (v7.6.14#76016) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Comment Edited] (CASSANDRA-15232) Arithmetic operators over decimal truncate results
[ https://issues.apache.org/jira/browse/CASSANDRA-15232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16890801#comment-16890801 ] Liudmila Kornilova edited comment on CASSANDRA-15232 at 7/23/19 8:58 AM: - Hello [~benedict], This is how postgres calculates scale https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/numeric.c#L7800 I created this work-in-process pull request https://github.com/apache/cassandra/pull/334 Before this commit Cassandra used to limit precision off all operations to 34 (maximum number of significant digits) After this commit: * add, multiply and subtract operations limit precision to 1 digits * add, multiply and subtract trim trailing zeros, so operations do not affect scale/precision of next operations * division sets minimum scale to 32. So 1000 / 3 produces 333. (32 digits after dot) * division also tries to guess the position of first significant digit in result (this idea is taken from postgres) so 0.1 / 3 will produce 5+32=37 digits after dot, 32 of them will be significant * division sets maximum scale to 1000 (the constant is also taken from postgres) * division will not use scale that is lower that scale of any operands The PR is not 100% ready because mod operation needs to be implemented was (Author: override): Hello [~benedict], This is how postgres calculates scale https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/numeric.c#L7800 I created this WIP commit https://github.com/apache/cassandra/pull/334 Before this commit Cassandra used to limit precision off all operations to 34 (maximum number of significant digits) After this commit: * add, multiply and subtract operations limit precision to 1 digits * add, multiply and subtract trim trailing zeros, so operations do not affect scale/precision of next operations * division sets minimum scale to 32. So 1000 / 3 produces 333. (32 digits after dot) * division also tries to guess the position of first significant digit in result (this idea is taken from postgres) so 0.1 / 3 will produce 5+32=37 digits after dot, 32 of them will be significant * division sets maximum scale to 1000 (the constant is also taken from postgres) * division will not use scale that is lower that scale of any operands The PR is not 100% ready because mod operation needs to be implemented > Arithmetic operators over decimal truncate results > -- > > Key: CASSANDRA-15232 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15232 > Project: Cassandra > Issue Type: Improvement > Components: CQL/Semantics >Reporter: Benedict >Assignee: Liudmila Kornilova >Priority: Normal > Labels: pull-request-available > Fix For: 4.0 > > Time Spent: 10m > Remaining Estimate: 0h > > The decimal operators hard-code a 128 bit precision for their computations. > Probably a precision needs to be configured or decided somehow, but it’s not > clear why 128bit was chosen. Particularly for multiplication and addition, > it’s very unclear why we truncate, which is different to our behaviour for > e.g. sum() aggregates. Probably for division we should also ensure that we > do not reduce the precision of the two operands. A minimum of decimal128 > seems reasonable, but a maximum does not. -- This message was sent by Atlassian JIRA (v7.6.14#76016) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Commented] (CASSANDRA-15232) Arithmetic operators over decimal truncate results
[ https://issues.apache.org/jira/browse/CASSANDRA-15232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16890801#comment-16890801 ] Liudmila Kornilova commented on CASSANDRA-15232: This is how postgres calculates scale https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/numeric.c#L7800 Before this commit Cassandra used to limit precision off all operations to 34 (maximum number of significant digits) After this commit: * add, multiply and subtract operations limit precision to 1 digits * add, multiply and subtract trim trailing zeros, so operations do not affect scale/precision of next operations * division sets minimum scale to 32. So 1000 / 3 produces 333. (32 digits after dot) * division also tries to guess the position of first significant digit in result (this idea is taken from postgres) so 0.1 / 3 will produce 5+32=37 digits after dot, 32 of them will be significant * division sets maximum scale to 1000 (the constant is also taken from postgres) * division will not use scale that is lower that scale of any operands The PR is not 100% ready because mod operation needs to be implemented > Arithmetic operators over decimal truncate results > -- > > Key: CASSANDRA-15232 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15232 > Project: Cassandra > Issue Type: Improvement > Components: CQL/Semantics >Reporter: Benedict >Assignee: Liudmila Kornilova >Priority: Normal > Labels: pull-request-available > Fix For: 4.0 > > Time Spent: 10m > Remaining Estimate: 0h > > The decimal operators hard-code a 128 bit precision for their computations. > Probably a precision needs to be configured or decided somehow, but it’s not > clear why 128bit was chosen. Particularly for multiplication and addition, > it’s very unclear why we truncate, which is different to our behaviour for > e.g. sum() aggregates. Probably for division we should also ensure that we > do not reduce the precision of the two operands. A minimum of decimal128 > seems reasonable, but a maximum does not. -- This message was sent by Atlassian JIRA (v7.6.14#76016) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Comment Edited] (CASSANDRA-15232) Arithmetic operators over decimal truncate results
[ https://issues.apache.org/jira/browse/CASSANDRA-15232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16890801#comment-16890801 ] Liudmila Kornilova edited comment on CASSANDRA-15232 at 7/23/19 8:57 AM: - Hello [~benedict], This is how postgres calculates scale https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/numeric.c#L7800 I created this WIP commit https://github.com/apache/cassandra/pull/334 Before this commit Cassandra used to limit precision off all operations to 34 (maximum number of significant digits) After this commit: * add, multiply and subtract operations limit precision to 1 digits * add, multiply and subtract trim trailing zeros, so operations do not affect scale/precision of next operations * division sets minimum scale to 32. So 1000 / 3 produces 333. (32 digits after dot) * division also tries to guess the position of first significant digit in result (this idea is taken from postgres) so 0.1 / 3 will produce 5+32=37 digits after dot, 32 of them will be significant * division sets maximum scale to 1000 (the constant is also taken from postgres) * division will not use scale that is lower that scale of any operands The PR is not 100% ready because mod operation needs to be implemented was (Author: override): Hello [~benedict], This is how postgres calculates scale https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/numeric.c#L7800 Before this commit Cassandra used to limit precision off all operations to 34 (maximum number of significant digits) After this commit: * add, multiply and subtract operations limit precision to 1 digits * add, multiply and subtract trim trailing zeros, so operations do not affect scale/precision of next operations * division sets minimum scale to 32. So 1000 / 3 produces 333. (32 digits after dot) * division also tries to guess the position of first significant digit in result (this idea is taken from postgres) so 0.1 / 3 will produce 5+32=37 digits after dot, 32 of them will be significant * division sets maximum scale to 1000 (the constant is also taken from postgres) * division will not use scale that is lower that scale of any operands The PR is not 100% ready because mod operation needs to be implemented > Arithmetic operators over decimal truncate results > -- > > Key: CASSANDRA-15232 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15232 > Project: Cassandra > Issue Type: Improvement > Components: CQL/Semantics >Reporter: Benedict >Assignee: Liudmila Kornilova >Priority: Normal > Labels: pull-request-available > Fix For: 4.0 > > Time Spent: 10m > Remaining Estimate: 0h > > The decimal operators hard-code a 128 bit precision for their computations. > Probably a precision needs to be configured or decided somehow, but it’s not > clear why 128bit was chosen. Particularly for multiplication and addition, > it’s very unclear why we truncate, which is different to our behaviour for > e.g. sum() aggregates. Probably for division we should also ensure that we > do not reduce the precision of the two operands. A minimum of decimal128 > seems reasonable, but a maximum does not. -- This message was sent by Atlassian JIRA (v7.6.14#76016) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Comment Edited] (CASSANDRA-15232) Arithmetic operators over decimal truncate results
[ https://issues.apache.org/jira/browse/CASSANDRA-15232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16890801#comment-16890801 ] Liudmila Kornilova edited comment on CASSANDRA-15232 at 7/23/19 8:57 AM: - Hello [~benedict], This is how postgres calculates scale https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/numeric.c#L7800 Before this commit Cassandra used to limit precision off all operations to 34 (maximum number of significant digits) After this commit: * add, multiply and subtract operations limit precision to 1 digits * add, multiply and subtract trim trailing zeros, so operations do not affect scale/precision of next operations * division sets minimum scale to 32. So 1000 / 3 produces 333. (32 digits after dot) * division also tries to guess the position of first significant digit in result (this idea is taken from postgres) so 0.1 / 3 will produce 5+32=37 digits after dot, 32 of them will be significant * division sets maximum scale to 1000 (the constant is also taken from postgres) * division will not use scale that is lower that scale of any operands The PR is not 100% ready because mod operation needs to be implemented was (Author: override): This is how postgres calculates scale https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/numeric.c#L7800 Before this commit Cassandra used to limit precision off all operations to 34 (maximum number of significant digits) After this commit: * add, multiply and subtract operations limit precision to 1 digits * add, multiply and subtract trim trailing zeros, so operations do not affect scale/precision of next operations * division sets minimum scale to 32. So 1000 / 3 produces 333. (32 digits after dot) * division also tries to guess the position of first significant digit in result (this idea is taken from postgres) so 0.1 / 3 will produce 5+32=37 digits after dot, 32 of them will be significant * division sets maximum scale to 1000 (the constant is also taken from postgres) * division will not use scale that is lower that scale of any operands The PR is not 100% ready because mod operation needs to be implemented > Arithmetic operators over decimal truncate results > -- > > Key: CASSANDRA-15232 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15232 > Project: Cassandra > Issue Type: Improvement > Components: CQL/Semantics >Reporter: Benedict >Assignee: Liudmila Kornilova >Priority: Normal > Labels: pull-request-available > Fix For: 4.0 > > Time Spent: 10m > Remaining Estimate: 0h > > The decimal operators hard-code a 128 bit precision for their computations. > Probably a precision needs to be configured or decided somehow, but it’s not > clear why 128bit was chosen. Particularly for multiplication and addition, > it’s very unclear why we truncate, which is different to our behaviour for > e.g. sum() aggregates. Probably for division we should also ensure that we > do not reduce the precision of the two operands. A minimum of decimal128 > seems reasonable, but a maximum does not. -- This message was sent by Atlassian JIRA (v7.6.14#76016) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Assigned] (CASSANDRA-15232) Arithmetic operators over decimal truncate results
[ https://issues.apache.org/jira/browse/CASSANDRA-15232?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Liudmila Kornilova reassigned CASSANDRA-15232: -- Assignee: Liudmila Kornilova > Arithmetic operators over decimal truncate results > -- > > Key: CASSANDRA-15232 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15232 > Project: Cassandra > Issue Type: Improvement > Components: CQL/Semantics >Reporter: Benedict >Assignee: Liudmila Kornilova >Priority: Normal > Fix For: 4.0 > > > The decimal operators hard-code a 128 bit precision for their computations. > Probably a precision needs to be configured or decided somehow, but it’s not > clear why 128bit was chosen. Particularly for multiplication and addition, > it’s very unclear why we truncate, which is different to our behaviour for > e.g. sum() aggregates. Probably for division we should also ensure that we > do not reduce the precision of the two operands. A minimum of decimal128 > seems reasonable, but a maximum does not. -- This message was sent by Atlassian JIRA (v7.6.14#76016) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Commented] (CASSANDRA-15225) FileUtils.close() does not handle non-IOException
[ https://issues.apache.org/jira/browse/CASSANDRA-15225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16888607#comment-16888607 ] Liudmila Kornilova commented on CASSANDRA-15225: Hi [~n.v.harikrishna], Done All IOExceptions except first one are also added to suppressed (see [updated commit|https://github.com/apache/cassandra/pull/332/files]) > FileUtils.close() does not handle non-IOException > - > > Key: CASSANDRA-15225 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15225 > Project: Cassandra > Issue Type: Bug > Components: Local/SSTable >Reporter: Benedict >Assignee: Liudmila Kornilova >Priority: Normal > Labels: pull-request-available > Fix For: 3.0.x, 3.11.x, 4.0.x > > Time Spent: 10m > Remaining Estimate: 0h > > This can lead to {{close}} not being invoked on remaining items -- This message was sent by Atlassian JIRA (v7.6.14#76016) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Assigned] (CASSANDRA-15225) FileUtils.close() does not handle non-IOException
[ https://issues.apache.org/jira/browse/CASSANDRA-15225?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Liudmila Kornilova reassigned CASSANDRA-15225: -- Assignee: Liudmila Kornilova > FileUtils.close() does not handle non-IOException > - > > Key: CASSANDRA-15225 > URL: https://issues.apache.org/jira/browse/CASSANDRA-15225 > Project: Cassandra > Issue Type: Bug > Components: Local/SSTable >Reporter: Benedict >Assignee: Liudmila Kornilova >Priority: Normal > Fix For: 3.0.x, 3.11.x, 4.0.x > > > This can lead to {{close}} not being invoked on remaining items -- This message was sent by Atlassian JIRA (v7.6.14#76016) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[jira] [Created] (CASSANDRA-15020) Invalid CQL in documentation
Liudmila Kornilova created CASSANDRA-15020: -- Summary: Invalid CQL in documentation Key: CASSANDRA-15020 URL: https://issues.apache.org/jira/browse/CASSANDRA-15020 Project: Cassandra Issue Type: Improvement Components: Documentation/Website Reporter: Liudmila Kornilova [http://cassandra.apache.org/doc/4.0/cql/security.html] 1. Wrong: CREATE USER *IF EXISTS* alice WITH PASSWORD 'password_a' SUPERUSER; CREATE ROLE *IF EXISTS* alice WITH PASSWORD = 'password_a' AND LOGIN = true AND SUPERUSER = true; Correct: CREATE USER IF *NOT* EXISTS alice WITH PASSWORD 'password_a' SUPERUSER; CREATE ROLE IF *NOT* EXISTS alice WITH PASSWORD = 'password_a' AND LOGIN = true AND SUPERUSER = true; 2. Wrong: CREATE ROLE alice WITH PASSWORD = 'password_a' *WITH* LOGIN = true; CREATE ROLE alice WITH PASSWORD = 'password_a' *WITH* LOGIN = true; Correct: CREATE ROLE alice WITH PASSWORD = 'password_a' *AND* LOGIN = true; CREATE ROLE alice WITH PASSWORD = 'password_a' *AND* LOGIN = true; -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org