[ 
https://issues.apache.org/jira/browse/CALCITE-5404?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17644525#comment-17644525
 ] 

Julian Hyde commented on CALCITE-5404:
--------------------------------------

You might be running into issues with class initialization order. I'd expect 
SqlStdOperatorTable to load before SqlLibraryOperators but you seem to be 
seeing otherwise.

Try something like this:
{code}
class SqlStdOperatorTable {
  static final Supplier<SqlFunction> POWER_SUPPLIER =
    Suppliers.memoize(() -> SqlBasicFunction.create("POWER",
          ReturnTypes.DOUBLE_NULLABLE,
          OperandTypes.NUMERIC_NUMERIC));

...

  static final SqlBasicFunction POWER = POWER_SUPPLIER.get();
}

class SqlLibraryOperators {
    public static final SqlFunction POW =
      SqlStdOperatorTable.POWER_SUPPLIER.get().withName("POW");
}
{code}
  

> Implement BigQuery's POW() and TRUNC() math functions
> -----------------------------------------------------
>
>                 Key: CALCITE-5404
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5404
>             Project: Calcite
>          Issue Type: New Feature
>            Reporter: Tanner Clary
>            Assignee: Tanner Clary
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Add support for BigQuery's POW() and TRUNC() mathematical functions by 
> mapping them to the existing implementations for POWER() and TRUNCATE() 
> respectively.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to