You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Simon Mottram <Si...@cucumber.co.nz> on 2020/08/01 01:10:03 UTC

Re: Unable to use some functions on DECIMAL columns

Hi Josh

Thanks very much for the reply, I did share the error at the top of the email

SQL Error [00000]: Error -1 (00000) : Error while executing SQL "ESELECT PERCENTILE_DISC (0.5) WITHIN GROUP (ORDER BY DECIMALCOLUMN ASC) FROM TEST.TESTEXCEPTIONS": Remote driver error: ArrayIndexOutOfBoundsException: (null exception message)

There's a few SQL statements to reliably reproduce the error, I thought that would be enough but I'm very open to providing any assistance I can.  What further info would be helpful?

Cheers

S
________________________________
From: Josh Elser <el...@apache.org>
Sent: 01 August 2020 2:26 AM
To: user@phoenix.apache.org <us...@phoenix.apache.org>
Subject: Re: Unable to use some functions on DECIMAL columns

Simon,

If you have clear bug report, please open up a Jira issue for it. Keep
in mind that as much information as you can provide to indicate the
problem you see, the better. Assume that whoever might read your Jira
issue is coming from zero-context. Right now, you haven't shared any
error, so you're expecting a bit from someone to both help you by first
reproducing the code you've shared, analyze if an error is expected, and
then fix it.

Ideally, you can submit a patch to try to fix the issues you're seeing ;)

On 7/29/20 10:18 PM, Simon Mottram wrote:
>
> If you try the queries marked with BUG below, you get an exception
>
> SQL Error [00000]: Error -1 (00000) : Error while executing SQL "ESELECT
> PERCENTILE_DISC (0.5) WITHIN GROUP (ORDER BY DECIMALCOLUMN ASC) FROM
> TEST.TESTEXCEPTIONS": Remote driver error:
> ArrayIndexOutOfBoundsException: (null exception message)
>
> As far as I can tell I am using the functions correctly.
>
> Best Regards
>
> Simon
>
> To reproduce:
>
> Using HBase
> HBASE_VERSION=2.0.0
> HBASE_MINOR_VERSION=2.0
> PHOENIX_VERSION=5.0.0
>
> Connecting using thin client: phoenix-5.0.0-HBase-2.0-thin-client.jar
>
> NOTE: We can't use thick client as I haven't resolved issues connecting
> my API which runs inside docker.  That's another story.
>
> CREATE TABLE IF NOT EXISTS TEST.TESTEXCEPTIONS ( KEYCOL VARCHAR NOT NULL
> PRIMARY KEY, INTEGERCOLUMN INTEGER , DECIMALCOLUMN DECIMAL);
>
> UPSERT INTO TEST.TESTEXCEPTIONS(KEYCOL, INTEGERCOLUMN, DECIMALCOLUMN)
> VALUES('A', 1, 1.1);
> UPSERT INTO TEST.TESTEXCEPTIONS(KEYCOL, INTEGERCOLUMN, DECIMALCOLUMN)
> VALUES('B', 2, 2.2);
> UPSERT INTO TEST.TESTEXCEPTIONS(KEYCOL, INTEGERCOLUMN, DECIMALCOLUMN)
> VALUES('C', 3, 3.3);
>
> -- PERCENTILE_DISC
> -- Integer columns works
> SELECT PERCENTILE_DISC (0.5) WITHIN GROUP (ORDER BY INTEGERCOLUMN ASC)
> FROM TEST.TESTEXCEPTIONS;
> -- BUG: Decimal columns throws NPE
> SELECT PERCENTILE_DISC (0.5) WITHIN GROUP (ORDER BY DECIMALCOLUMN ASC)
> FROM TEST.TESTEXCEPTIONS;
>
> -- STDDEV_POP
> -- Integer columns works
> SELECT STDDEV_POP(INTEGERCOLUMN) FROM TEST.TESTEXCEPTIONS;
>
> -- BUG:  Decimal columns throws NPE
> SELECT STDDEV_POP(DECIMALCOLUMN) FROM TEST.TESTEXCEPTIONS;
>
> -- STDDEV_SAMP
> -- Integer columns works
> SELECT STDDEV_SAMP(INTEGERCOLUMN) FROM TEST.TESTEXCEPTIONS;
>
> -- BUG:  Decimal columns throws NPE
> SELECT STDDEV_SAMP(DECIMALCOLUMN) FROM TEST.TESTEXCEPTIONS;
>
>
> -- PERCENTILE_CONT
> -- Integer columns works
> SELECT PERCENTILE_CONT (0.5) WITHIN GROUP (ORDER BY INTEGERCOLUMN ASC)
> FROM TEST.TESTEXCEPTIONS;
> -- Decimal columns works
> SELECT PERCENTILE_CONT (0.5) WITHIN GROUP (ORDER BY DECIMALCOLUMN ASC)
> FROM TEST.TESTEXCEPTIONS;

Re: Unable to use some functions on DECIMAL columns

Posted by Simon Mottram <Si...@cucumber.co.nz>.
Stepping through the code I see that the http response from, presumably the queryserver, is 500.  This response object is created in RemoteProtobufService:

I will create a Jira BUG with all this info.

Cheers

Simon

ErrorResponse[errorCode=-1, sqlState=00000, severity=null, errorMessage=RuntimeException: java.sql.SQLException: java.lang.reflect.InvocationTargetException -> SQLException: java.lang.reflect.InvocationTargetException -> InvocationTargetException: (null exception message) -> NullPointerException: (null exception message), exceptions=[java.lang.RuntimeException: java.sql.SQLException: java.lang.reflect.InvocationTargetException
at org.apache.calcite.avatica.jdbc.JdbcMeta.propagate(JdbcMeta.java:700)
at org.apache.calcite.avatica.jdbc.JdbcMeta.prepareAndExecute(JdbcMeta.java:765)
at org.apache.calcite.avatica.remote.LocalService.apply(LocalService.java:206)
at org.apache.calcite.avatica.remote.Service$PrepareAndExecuteRequest.accept(Service.java:927)
at org.apache.calcite.avatica.remote.Service$PrepareAndExecuteRequest.accept(Service.java:879)
at org.apache.calcite.avatica.remote.AbstractHandler.apply(AbstractHandler.java:94)
at org.apache.calcite.avatica.remote.ProtobufHandler.apply(ProtobufHandler.java:46)
at org.apache.calcite.avatica.server.AvaticaProtobufHandler.handle(AvaticaProtobufHandler.java:127)
at org.apache.phoenix.shaded.org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
at org.apache.phoenix.shaded.org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.apache.phoenix.shaded.org.eclipse.jetty.server.Server.handle(Server.java:499)
at org.apache.phoenix.shaded.org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
at org.apache.phoenix.shaded.org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.apache.phoenix.shaded.org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
at org.apache.phoenix.shaded.org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.apache.phoenix.shaded.org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLException: java.lang.reflect.InvocationTargetException
at org.apache.phoenix.parse.FunctionParseNode.create(FunctionParseNode.java:280)
at org.apache.phoenix.parse.FunctionParseNode.create(FunctionParseNode.java:248)
at org.apache.phoenix.compile.ExpressionCompiler.visitLeave(ExpressionCompiler.java:334)
at org.apache.phoenix.compile.ProjectionCompiler$SelectClauseVisitor.visitLeave(ProjectionCompiler.java:700)
at org.apache.phoenix.compile.ProjectionCompiler$SelectClauseVisitor.visitLeave(ProjectionCompiler.java:585)
at org.apache.phoenix.parse.FunctionParseNode.accept(FunctionParseNode.java:86)
at org.apache.phoenix.compile.ProjectionCompiler.compile(ProjectionCompiler.java:412)
at org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:561)
at org.apache.phoenix.compile.QueryCompiler.compileSingleQuery(QueryCompiler.java:507)
at org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:193)
at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:153)
at org.apache.phoenix.compile.QueryCompiler.compileSubquery(QueryCompiler.java:496)
at org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:219)
at org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:293)
at org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:228)
at org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:191)
at org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:153)
at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:490)
at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:456)
at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:302)
at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:291)
at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:290)
at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:283)
at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1830)
at org.apache.calcite.avatica.jdbc.JdbcMeta.prepareAndExecute(JdbcMeta.java:747)
... 15 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedConstructorAccessor10.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.phoenix.parse.FunctionParseNode.create(FunctionParseNode.java:266)
... 40 more
Caused by: java.lang.NullPointerException
at org.apache.phoenix.expression.aggregator.BaseDecimalStddevAggregator.<init>(BaseDecimalStddevAggregator.java:49)
at org.apache.phoenix.expression.aggregator.DecimalStddevPopAggregator.<init>(DecimalStddevPopAggregator.java:34)
at org.apache.phoenix.expression.function.StddevPopFunction.newClientAggregator(StddevPopFunction.java:63)
at org.apache.phoenix.expression.function.StddevPopFunction.newClientAggregator(StddevPopFunction.java:42)
at org.apache.phoenix.expression.function.SingleAggregateFunction.<init>(SingleAggregateFunction.java:96)
at org.apache.phoenix.expression.function.SingleAggregateFunction.<init>(SingleAggregateFunction.java:90)
at org.apache.phoenix.expression.function.DistinctValueWithCountAggregateFunction.<init>(DistinctValueWithCountAggregateFunction.java:36)
at org.apache.phoenix.expression.function.StddevPopFunction.<init>(StddevPopFunction.java:51)
... 44 more
]
________________________________
From: Simon Mottram <Si...@cucumber.co.nz>
Sent: 04 August 2020 1:12 PM
To: user@phoenix.apache.org <us...@phoenix.apache.org>
Subject: Re: Unable to use some functions on DECIMAL columns

See bottom for the only stacktrace I can get at, once I hit org.apache.calcite.avatica.AvaticaSqlException I can no longer step down the backtrace as it's just a loop.

To do a Unit test I would presumably have to be able to compile hbase,  that's a fairly protracted process and then a fix would have to ripple up all the way to AWS EMR version, which I'm guessing would be months away.

I'm not ducking the work, I would be interested in doing whatever I can to help the fix process. I'm just reading through the build instructions and panicking slightly. This would be my first open source contribution so I'm sure there will be bumps in the road.

Cheers

S


Caused by: org.apache.calcite.avatica.AvaticaSqlException: Error -1 (00000) : Error while executing SQL "
some sql goes here": Remote driver error: RuntimeException: java.sql.SQLException: java.lang.reflect.InvocationTargetException -> SQLException: java.lang.reflect.InvocationTargetException -> InvocationTargetException: (null exception message) -> NullPointerException: (null exception message)
at org.apache.calcite.avatica.Helper.createException(Helper.java:54)
at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163)
at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227)
at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:439)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:376)
... 11 more
________________________________
From: Josh Elser <el...@apache.org>
Sent: 04 August 2020 10:54 AM
To: user@phoenix.apache.org <us...@phoenix.apache.org>
Subject: Re: Unable to use some functions on DECIMAL columns

Any stacktrace? An error message on its own isn't too helpful (as it
could come from any number of places).

We have lots of unit tests in the project. Ideally, a unit test which
illustrates the error is the best way for someone to start poking at the
problem. Figuring out if it's a problem unique to the thin-client or if
it affects both the thin-client and thick-client is important.

On 7/31/20 9:10 PM, Simon Mottram wrote:
> Hi Josh
>
> Thanks very much for the reply, I did share the error at the top of the
> email
>
> SQL Error [00000]: Error -1 (00000) : Error while executing SQL "ESELECT
> PERCENTILE_DISC (0.5) WITHIN GROUP (ORDER BY DECIMALCOLUMN ASC) FROM
> TEST.TESTEXCEPTIONS": Remote driver error:
> ArrayIndexOutOfBoundsException: (null exception message)
>
> There's a few SQL statements to reliably reproduce the error, I thought
> that would be enough but I'm very open to providing any assistance I
> can.  What further info would be helpful?
>
> Cheers
>
> S
> ------------------------------------------------------------------------
> *From:* Josh Elser <el...@apache.org>
> *Sent:* 01 August 2020 2:26 AM
> *To:* user@phoenix.apache.org <us...@phoenix.apache.org>
> *Subject:* Re: Unable to use some functions on DECIMAL columns
> Simon,
>
> If you have clear bug report, please open up a Jira issue for it. Keep
> in mind that as much information as you can provide to indicate the
> problem you see, the better. Assume that whoever might read your Jira
> issue is coming from zero-context. Right now, you haven't shared any
> error, so you're expecting a bit from someone to both help you by first
> reproducing the code you've shared, analyze if an error is expected, and
> then fix it.
>
> Ideally, you can submit a patch to try to fix the issues you're seeing ;)
>
> On 7/29/20 10:18 PM, Simon Mottram wrote:
>>
>> If you try the queries marked with BUG below, you get an exception
>>
>> SQL Error [00000]: Error -1 (00000) : Error while executing SQL "ESELECT
>> PERCENTILE_DISC (0.5) WITHIN GROUP (ORDER BY DECIMALCOLUMN ASC) FROM
>> TEST.TESTEXCEPTIONS": Remote driver error:
>> ArrayIndexOutOfBoundsException: (null exception message)
>>
>> As far as I can tell I am using the functions correctly.
>>
>> Best Regards
>>
>> Simon
>>
>> To reproduce:
>>
>> Using HBase
>> HBASE_VERSION=2.0.0
>> HBASE_MINOR_VERSION=2.0
>> PHOENIX_VERSION=5.0.0
>>
>> Connecting using thin client: phoenix-5.0.0-HBase-2.0-thin-client.jar
>>
>> NOTE: We can't use thick client as I haven't resolved issues connecting
>> my API which runs inside docker.  That's another story.
>>
>> CREATE TABLE IF NOT EXISTS TEST.TESTEXCEPTIONS ( KEYCOL VARCHAR NOT NULL
>> PRIMARY KEY, INTEGERCOLUMN INTEGER , DECIMALCOLUMN DECIMAL);
>>
>> UPSERT INTO TEST.TESTEXCEPTIONS(KEYCOL, INTEGERCOLUMN, DECIMALCOLUMN)
>> VALUES('A', 1, 1.1);
>> UPSERT INTO TEST.TESTEXCEPTIONS(KEYCOL, INTEGERCOLUMN, DECIMALCOLUMN)
>> VALUES('B', 2, 2.2);
>> UPSERT INTO TEST.TESTEXCEPTIONS(KEYCOL, INTEGERCOLUMN, DECIMALCOLUMN)
>> VALUES('C', 3, 3.3);
>>
>> -- PERCENTILE_DISC
>> -- Integer columns works
>> SELECT PERCENTILE_DISC (0.5) WITHIN GROUP (ORDER BY INTEGERCOLUMN ASC)
>> FROM TEST.TESTEXCEPTIONS;
>> -- BUG: Decimal columns throws NPE
>> SELECT PERCENTILE_DISC (0.5) WITHIN GROUP (ORDER BY DECIMALCOLUMN ASC)
>> FROM TEST.TESTEXCEPTIONS;
>>
>> -- STDDEV_POP
>> -- Integer columns works
>> SELECT STDDEV_POP(INTEGERCOLUMN) FROM TEST.TESTEXCEPTIONS;
>>
>> -- BUG:  Decimal columns throws NPE
>> SELECT STDDEV_POP(DECIMALCOLUMN) FROM TEST.TESTEXCEPTIONS;
>>
>> -- STDDEV_SAMP
>> -- Integer columns works
>> SELECT STDDEV_SAMP(INTEGERCOLUMN) FROM TEST.TESTEXCEPTIONS;
>>
>> -- BUG:  Decimal columns throws NPE
>> SELECT STDDEV_SAMP(DECIMALCOLUMN) FROM TEST.TESTEXCEPTIONS;
>>
>>
>> -- PERCENTILE_CONT
>> -- Integer columns works
>> SELECT PERCENTILE_CONT (0.5) WITHIN GROUP (ORDER BY INTEGERCOLUMN ASC)
>> FROM TEST.TESTEXCEPTIONS;
>> -- Decimal columns works
>> SELECT PERCENTILE_CONT (0.5) WITHIN GROUP (ORDER BY DECIMALCOLUMN ASC)
>> FROM TEST.TESTEXCEPTIONS;

Re: Unable to use some functions on DECIMAL columns

Posted by Simon Mottram <Si...@cucumber.co.nz>.
See bottom for the only stacktrace I can get at, once I hit org.apache.calcite.avatica.AvaticaSqlException I can no longer step down the backtrace as it's just a loop.

To do a Unit test I would presumably have to be able to compile hbase,  that's a fairly protracted process and then a fix would have to ripple up all the way to AWS EMR version, which I'm guessing would be months away.

I'm not ducking the work, I would be interested in doing whatever I can to help the fix process. I'm just reading through the build instructions and panicking slightly. This would be my first open source contribution so I'm sure there will be bumps in the road.

Cheers

S


Caused by: org.apache.calcite.avatica.AvaticaSqlException: Error -1 (00000) : Error while executing SQL "
some sql goes here": Remote driver error: RuntimeException: java.sql.SQLException: java.lang.reflect.InvocationTargetException -> SQLException: java.lang.reflect.InvocationTargetException -> InvocationTargetException: (null exception message) -> NullPointerException: (null exception message)
at org.apache.calcite.avatica.Helper.createException(Helper.java:54)
at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163)
at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227)
at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:439)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:376)
... 11 more
________________________________
From: Josh Elser <el...@apache.org>
Sent: 04 August 2020 10:54 AM
To: user@phoenix.apache.org <us...@phoenix.apache.org>
Subject: Re: Unable to use some functions on DECIMAL columns

Any stacktrace? An error message on its own isn't too helpful (as it
could come from any number of places).

We have lots of unit tests in the project. Ideally, a unit test which
illustrates the error is the best way for someone to start poking at the
problem. Figuring out if it's a problem unique to the thin-client or if
it affects both the thin-client and thick-client is important.

On 7/31/20 9:10 PM, Simon Mottram wrote:
> Hi Josh
>
> Thanks very much for the reply, I did share the error at the top of the
> email
>
> SQL Error [00000]: Error -1 (00000) : Error while executing SQL "ESELECT
> PERCENTILE_DISC (0.5) WITHIN GROUP (ORDER BY DECIMALCOLUMN ASC) FROM
> TEST.TESTEXCEPTIONS": Remote driver error:
> ArrayIndexOutOfBoundsException: (null exception message)
>
> There's a few SQL statements to reliably reproduce the error, I thought
> that would be enough but I'm very open to providing any assistance I
> can.  What further info would be helpful?
>
> Cheers
>
> S
> ------------------------------------------------------------------------
> *From:* Josh Elser <el...@apache.org>
> *Sent:* 01 August 2020 2:26 AM
> *To:* user@phoenix.apache.org <us...@phoenix.apache.org>
> *Subject:* Re: Unable to use some functions on DECIMAL columns
> Simon,
>
> If you have clear bug report, please open up a Jira issue for it. Keep
> in mind that as much information as you can provide to indicate the
> problem you see, the better. Assume that whoever might read your Jira
> issue is coming from zero-context. Right now, you haven't shared any
> error, so you're expecting a bit from someone to both help you by first
> reproducing the code you've shared, analyze if an error is expected, and
> then fix it.
>
> Ideally, you can submit a patch to try to fix the issues you're seeing ;)
>
> On 7/29/20 10:18 PM, Simon Mottram wrote:
>>
>> If you try the queries marked with BUG below, you get an exception
>>
>> SQL Error [00000]: Error -1 (00000) : Error while executing SQL "ESELECT
>> PERCENTILE_DISC (0.5) WITHIN GROUP (ORDER BY DECIMALCOLUMN ASC) FROM
>> TEST.TESTEXCEPTIONS": Remote driver error:
>> ArrayIndexOutOfBoundsException: (null exception message)
>>
>> As far as I can tell I am using the functions correctly.
>>
>> Best Regards
>>
>> Simon
>>
>> To reproduce:
>>
>> Using HBase
>> HBASE_VERSION=2.0.0
>> HBASE_MINOR_VERSION=2.0
>> PHOENIX_VERSION=5.0.0
>>
>> Connecting using thin client: phoenix-5.0.0-HBase-2.0-thin-client.jar
>>
>> NOTE: We can't use thick client as I haven't resolved issues connecting
>> my API which runs inside docker.  That's another story.
>>
>> CREATE TABLE IF NOT EXISTS TEST.TESTEXCEPTIONS ( KEYCOL VARCHAR NOT NULL
>> PRIMARY KEY, INTEGERCOLUMN INTEGER , DECIMALCOLUMN DECIMAL);
>>
>> UPSERT INTO TEST.TESTEXCEPTIONS(KEYCOL, INTEGERCOLUMN, DECIMALCOLUMN)
>> VALUES('A', 1, 1.1);
>> UPSERT INTO TEST.TESTEXCEPTIONS(KEYCOL, INTEGERCOLUMN, DECIMALCOLUMN)
>> VALUES('B', 2, 2.2);
>> UPSERT INTO TEST.TESTEXCEPTIONS(KEYCOL, INTEGERCOLUMN, DECIMALCOLUMN)
>> VALUES('C', 3, 3.3);
>>
>> -- PERCENTILE_DISC
>> -- Integer columns works
>> SELECT PERCENTILE_DISC (0.5) WITHIN GROUP (ORDER BY INTEGERCOLUMN ASC)
>> FROM TEST.TESTEXCEPTIONS;
>> -- BUG: Decimal columns throws NPE
>> SELECT PERCENTILE_DISC (0.5) WITHIN GROUP (ORDER BY DECIMALCOLUMN ASC)
>> FROM TEST.TESTEXCEPTIONS;
>>
>> -- STDDEV_POP
>> -- Integer columns works
>> SELECT STDDEV_POP(INTEGERCOLUMN) FROM TEST.TESTEXCEPTIONS;
>>
>> -- BUG:  Decimal columns throws NPE
>> SELECT STDDEV_POP(DECIMALCOLUMN) FROM TEST.TESTEXCEPTIONS;
>>
>> -- STDDEV_SAMP
>> -- Integer columns works
>> SELECT STDDEV_SAMP(INTEGERCOLUMN) FROM TEST.TESTEXCEPTIONS;
>>
>> -- BUG:  Decimal columns throws NPE
>> SELECT STDDEV_SAMP(DECIMALCOLUMN) FROM TEST.TESTEXCEPTIONS;
>>
>>
>> -- PERCENTILE_CONT
>> -- Integer columns works
>> SELECT PERCENTILE_CONT (0.5) WITHIN GROUP (ORDER BY INTEGERCOLUMN ASC)
>> FROM TEST.TESTEXCEPTIONS;
>> -- Decimal columns works
>> SELECT PERCENTILE_CONT (0.5) WITHIN GROUP (ORDER BY DECIMALCOLUMN ASC)
>> FROM TEST.TESTEXCEPTIONS;

Re: Unable to use some functions on DECIMAL columns

Posted by Josh Elser <el...@apache.org>.
Any stacktrace? An error message on its own isn't too helpful (as it 
could come from any number of places).

We have lots of unit tests in the project. Ideally, a unit test which 
illustrates the error is the best way for someone to start poking at the 
problem. Figuring out if it's a problem unique to the thin-client or if 
it affects both the thin-client and thick-client is important.

On 7/31/20 9:10 PM, Simon Mottram wrote:
> Hi Josh
> 
> Thanks very much for the reply, I did share the error at the top of the 
> email
> 
> SQL Error [00000]: Error -1 (00000) : Error while executing SQL "ESELECT 
> PERCENTILE_DISC (0.5) WITHIN GROUP (ORDER BY DECIMALCOLUMN ASC) FROM 
> TEST.TESTEXCEPTIONS": Remote driver error: 
> ArrayIndexOutOfBoundsException: (null exception message)
> 
> There's a few SQL statements to reliably reproduce the error, I thought 
> that would be enough but I'm very open to providing any assistance I 
> can.  What further info would be helpful?
> 
> Cheers
> 
> S
> ------------------------------------------------------------------------
> *From:* Josh Elser <el...@apache.org>
> *Sent:* 01 August 2020 2:26 AM
> *To:* user@phoenix.apache.org <us...@phoenix.apache.org>
> *Subject:* Re: Unable to use some functions on DECIMAL columns
> Simon,
> 
> If you have clear bug report, please open up a Jira issue for it. Keep
> in mind that as much information as you can provide to indicate the
> problem you see, the better. Assume that whoever might read your Jira
> issue is coming from zero-context. Right now, you haven't shared any
> error, so you're expecting a bit from someone to both help you by first
> reproducing the code you've shared, analyze if an error is expected, and
> then fix it.
> 
> Ideally, you can submit a patch to try to fix the issues you're seeing ;)
> 
> On 7/29/20 10:18 PM, Simon Mottram wrote:
>> 
>> If you try the queries marked with BUG below, you get an exception
>> 
>> SQL Error [00000]: Error -1 (00000) : Error while executing SQL "ESELECT 
>> PERCENTILE_DISC (0.5) WITHIN GROUP (ORDER BY DECIMALCOLUMN ASC) FROM 
>> TEST.TESTEXCEPTIONS": Remote driver error: 
>> ArrayIndexOutOfBoundsException: (null exception message)
>> 
>> As far as I can tell I am using the functions correctly.
>> 
>> Best Regards
>> 
>> Simon
>> 
>> To reproduce:
>> 
>> Using HBase
>> HBASE_VERSION=2.0.0
>> HBASE_MINOR_VERSION=2.0
>> PHOENIX_VERSION=5.0.0
>> 
>> Connecting using thin client: phoenix-5.0.0-HBase-2.0-thin-client.jar
>> 
>> NOTE: We can't use thick client as I haven't resolved issues connecting 
>> my API which runs inside docker.  That's another story.
>> 
>> CREATE TABLE IF NOT EXISTS TEST.TESTEXCEPTIONS ( KEYCOL VARCHAR NOT NULL 
>> PRIMARY KEY, INTEGERCOLUMN INTEGER , DECIMALCOLUMN DECIMAL);
>> 
>> UPSERT INTO TEST.TESTEXCEPTIONS(KEYCOL, INTEGERCOLUMN, DECIMALCOLUMN) 
>> VALUES('A', 1, 1.1);
>> UPSERT INTO TEST.TESTEXCEPTIONS(KEYCOL, INTEGERCOLUMN, DECIMALCOLUMN) 
>> VALUES('B', 2, 2.2);
>> UPSERT INTO TEST.TESTEXCEPTIONS(KEYCOL, INTEGERCOLUMN, DECIMALCOLUMN) 
>> VALUES('C', 3, 3.3);
>> 
>> -- PERCENTILE_DISC
>> -- Integer columns works
>> SELECT PERCENTILE_DISC (0.5) WITHIN GROUP (ORDER BY INTEGERCOLUMN ASC) 
>> FROM TEST.TESTEXCEPTIONS;
>> -- BUG: Decimal columns throws NPE
>> SELECT PERCENTILE_DISC (0.5) WITHIN GROUP (ORDER BY DECIMALCOLUMN ASC) 
>> FROM TEST.TESTEXCEPTIONS;
>> 
>> -- STDDEV_POP
>> -- Integer columns works
>> SELECT STDDEV_POP(INTEGERCOLUMN) FROM TEST.TESTEXCEPTIONS;
>> 
>> -- BUG:  Decimal columns throws NPE
>> SELECT STDDEV_POP(DECIMALCOLUMN) FROM TEST.TESTEXCEPTIONS;
>> 
>> -- STDDEV_SAMP
>> -- Integer columns works
>> SELECT STDDEV_SAMP(INTEGERCOLUMN) FROM TEST.TESTEXCEPTIONS;
>> 
>> -- BUG:  Decimal columns throws NPE
>> SELECT STDDEV_SAMP(DECIMALCOLUMN) FROM TEST.TESTEXCEPTIONS;
>> 
>> 
>> -- PERCENTILE_CONT
>> -- Integer columns works
>> SELECT PERCENTILE_CONT (0.5) WITHIN GROUP (ORDER BY INTEGERCOLUMN ASC) 
>> FROM TEST.TESTEXCEPTIONS;
>> -- Decimal columns works
>> SELECT PERCENTILE_CONT (0.5) WITHIN GROUP (ORDER BY DECIMALCOLUMN ASC) 
>> FROM TEST.TESTEXCEPTIONS;