Re: Question about RexLiteral.getValueAs() returning an unscaled long for decimal literals

2021-12-08 Thread Jihoon Son
I see. Thank you for your answers. On Wed, Dec 8, 2021 at 4:41 PM Julian Hyde wrote: > Yes, that might work. > > > On Dec 8, 2021, at 4:35 PM, Jihoon Son wrote: > > > > Julian, thanks for your answer. > > > > The case I'm looking into is a function that accepts a numeric and > returns > > a num

Re: Question about RexLiteral.getValueAs() returning an unscaled long for decimal literals

2021-12-08 Thread Julian Hyde
Yes, that might work. > On Dec 8, 2021, at 4:35 PM, Jihoon Son wrote: > > Julian, thanks for your answer. > > The case I'm looking into is a function that accepts a numeric and returns > a numeric such as 'floor(123.0)'. In this case, the literal is created > using `rexBuilder.makeLiteral(123.0

Re: Question about RexLiteral.getValueAs() returning an unscaled long for decimal literals

2021-12-08 Thread Jihoon Son
Julian, thanks for your answer. The case I'm looking into is a function that accepts a numeric and returns a numeric such as 'floor(123.0)'. In this case, the literal is created using `rexBuilder.makeLiteral(123.0, typeFactory.createSqlType(SqlTypeName.INTEGER), true)`. This creates a literal that

Re: [DISCUSS] Do we need a Avatica release before Calcite 1.29.0 release?

2021-12-08 Thread Julian Hyde
Probably not. * 4cf769f8e - (HEAD -> master, origin/master, origin/HEAD) Disable Travis job that uses Calcite master until [CALCITE-4877] is fixed (4 weeks ago) * 434cf002f - [CALCITE-4877] Make the exception information more explicit for instantiate plugin. (5 weeks ago) * 57c254f24 - [CALCIT

Re: Question about RexLiteral.getValueAs() returning an unscaled long for decimal literals

2021-12-08 Thread Julian Hyde
When Calcite generates enumerable code, it represents each SQL DECIMAL value as a scaled Java Long. (Just as it represents SQL DATE values as Java Integer.) If you want that ‘raw’ value, ask for a BigDecimal. That’s how DECIMAL values are stored at prepare time (i.e. inside the RexLiteral). Jul

Question about RexLiteral.getValueAs() returning an unscaled long for decimal literals

2021-12-08 Thread Jihoon Son
Hi all, I am using the 'RexLiteral.getValueAs()' method to convert a literal to a java object. I recently noticed that this method returns an unscaled value when you convert a decimal literal to a Long object. As a result, this method returns '1230' for the decimal literal of '123.0'. The code pie

[DISCUSS] Do we need a Avatica release before Calcite 1.29.0 release?

2021-12-08 Thread Rui Wang
Hi community, Do you think we need an Avatica release before Calcite 1.29.0? -Rui

Re: [DISCUSS] Calcite 1.29.0 release

2021-12-08 Thread Rui Wang
Can a PMC member help to add my public key[[1] to the Calcite KEYs file[2] ? [1]: https://people.apache.org/keys/committer/amaliujia [2]: https://dist.apache.org/repos/dist/release/calcite/KEYS -Rui On Mon, Dec 6, 2021 at 2:55 PM Julian Hyde wrote: > https://calcite.apache.org/docs/howto.htm

sqlnode design question

2021-12-08 Thread 许伟栋
Hi, All: I'm new to calcite, have some doubts about the SqlNode design: I'm working on a mysql middleware which needs parsing and query optimization. Unfortunately, I'm using C++, so it's not trivial to use Calcite directly. Instead, I'm trying to mimic what Calcite does to see if I can come up

Re: RexNode to Disjunctive Normal Form (DNF)

2021-12-08 Thread Julian Hyde
My first reaction was ‘search for DNF in the tests’ but then I see that RexProgramTest has several testCnf methods [1] but no testDnf methods. There is a RexUtil.toDnf method [2] but unlike RexUtil.toCnf it is not tested. With luck you can call RexUtil.toDnf in the same way that you would call

[jira] [Created] (CALCITE-4927) Remove deprecated RelBuilder#groupKey(ImmutableBitSet, ImmutableList) clashing with new replacement API

2021-12-08 Thread Stamatis Zampetakis (Jira)
Stamatis Zampetakis created CALCITE-4927: Summary: Remove deprecated RelBuilder#groupKey(ImmutableBitSet, ImmutableList) clashing with new replacement API Key: CALCITE-4927 URL: https://issues.apache.org/j

RexNode to Disjunctive Normal Form (DNF)

2021-12-08 Thread Jeremy Dyer
Hello, I'm working on a Python SQL engine and using Calcite for query parsing. I am working on the predicate pushdown portion and I need to convert/expand a Rexnode from the "WHERE" portion of the query into a DNF formatted string that I can pass along to the underlying library I am using (CUDA &

[jira] [Created] (CALCITE-4926) 'ORDER BY' misses alias/table of own 'WITH'

2021-12-08 Thread Vladimir Steshin (Jira)
Vladimir Steshin created CALCITE-4926: - Summary: 'ORDER BY' misses alias/table of own 'WITH' Key: CALCITE-4926 URL: https://issues.apache.org/jira/browse/CALCITE-4926 Project: Calcite Iss