How to add a UDF with variable number parameter in calcite?How do I limit the number of rows returned by an Oracle query after ordering?how to avoid calcite doing aggregations in memoryHow to use calcite cassandra adapters in applicationHow to add a udf who's parameter is a table nameHow to parse nested SQL statement using calcite?How to serialize and deserialize RelNode in Calcite?How to take advantage of calcite-serverHow to find the primary key constraint for a table in CalciteApache Calcite - How to Integrate CSV and MySQL
A pyramid from a square
Why was hardware diversification an asset for the IBM PC ecosystem?
Is Trump personally blocking people on Twitter?
Is anyone advocating the promotion of homosexuality in UK schools?
Matchmaker, Matchmaker, make me a match
Who has taken "my" Managed package namespace? Can we find out?
Can I call 112 to check a police officer's identity in the Czech Republic?
Is Arc Length always irrational between two rational points?
Can fluent English speakers distinguish “steel”, “still” and “steal”?
Is there a word for a message that is intended to be intercepted by an adversary?
Was I subtly told to resign?
Are randomly-generated passwords starting with "a" less secure?
Why didn't Thanos kill all the Dwarves on Nidavellir?
Is lack of functional requirements agile?
What are the bumps on the Vega rocket
CentOS 7 -> find: missing Argument for "-exec"
If the railway suggests a 5-min connection window for changing trains in the Netherlands, does that mean it's definitely doable?
Why does my script create an extra character?
Why are they 'nude photos'?
Why does my String turn into Integers instead of letters after I add characters with +?
Single word for "refusing to move to next activity unless present one is completed."
How to say "to make my heart sing"
<schwitz>, <zwinker> etc. Does German always use 2nd Person Singular Imperative verbs for emoticons? If so, why?
Is purchasing foreign currency before going abroad a losing proposition?
How to add a UDF with variable number parameter in calcite?
How do I limit the number of rows returned by an Oracle query after ordering?how to avoid calcite doing aggregations in memoryHow to use calcite cassandra adapters in applicationHow to add a udf who's parameter is a table nameHow to parse nested SQL statement using calcite?How to serialize and deserialize RelNode in Calcite?How to take advantage of calcite-serverHow to find the primary key constraint for a table in CalciteApache Calcite - How to Integrate CSV and MySQL
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm using Apache Calcite to validate SQL. I add tables and UDFs dynamically.
The problem is when I add a UDF with variable number parameter, the validator can not find this function.
Version of Calcite is 1.18.0
And this is my code.
TestfuncFunction.java
public class TestfuncFunction
public String testfunc(String... arg0)
return null;
Add UDF
Function schemafunction = ScalarFunctionImpl.create(TestfuncFunction.class),"testfunc");
SchemaPlus schemaPlus = Frameworks.createRootSchema(true);
schemaPlus.add("testfunc", schemafunction);
SQL
select testfunc(field1, field2) from test_table
testfunc is a ScalarFunction with variable number parameter,field1 and field2 are columns of test_table. So this is a legal SQL. But I got this CalciteContextException when validating:
No match found for function signature testfunc(<CHARACTER>, <CHARACTER>)
I tryed to change my sql into one parameter like this:
select testfunc(field1) from test_table
and got this exception
java.lang.AssertionError: No assign rules for OTHER defined
at org.apache.calcite.sql.type.SqlTypeAssignmentRules.canCastFrom(SqlTypeAssignmentRules.java:386)
at org.apache.calcite.sql.type.SqlTypeUtil.canCastFrom(SqlTypeUtil.java:864)
at org.apache.calcite.sql.SqlUtil.lambda$filterRoutinesByParameterType$4(SqlUtil.java:554)
...
It seems that calcite transform java array type into SqlTypeName.OTHER.
I have tryed to override method "createJavaType" in JavaTypeFactoryImpl like this:
private static class CustomJavaTypeFactoryImpl extends JavaTypeFactoryImpl
@Override
public RelDataType createJavaType(Class clazz)
if (clazz.isArray())
return new ArraySqlType(super.createJavaType(clazz.getComponentType()), true);
return super.createJavaType(clazz);
but it did not work.
Do Calcite support UDF with variable number parameter, and what should I do.
sql apache-calcite
add a comment |
I'm using Apache Calcite to validate SQL. I add tables and UDFs dynamically.
The problem is when I add a UDF with variable number parameter, the validator can not find this function.
Version of Calcite is 1.18.0
And this is my code.
TestfuncFunction.java
public class TestfuncFunction
public String testfunc(String... arg0)
return null;
Add UDF
Function schemafunction = ScalarFunctionImpl.create(TestfuncFunction.class),"testfunc");
SchemaPlus schemaPlus = Frameworks.createRootSchema(true);
schemaPlus.add("testfunc", schemafunction);
SQL
select testfunc(field1, field2) from test_table
testfunc is a ScalarFunction with variable number parameter,field1 and field2 are columns of test_table. So this is a legal SQL. But I got this CalciteContextException when validating:
No match found for function signature testfunc(<CHARACTER>, <CHARACTER>)
I tryed to change my sql into one parameter like this:
select testfunc(field1) from test_table
and got this exception
java.lang.AssertionError: No assign rules for OTHER defined
at org.apache.calcite.sql.type.SqlTypeAssignmentRules.canCastFrom(SqlTypeAssignmentRules.java:386)
at org.apache.calcite.sql.type.SqlTypeUtil.canCastFrom(SqlTypeUtil.java:864)
at org.apache.calcite.sql.SqlUtil.lambda$filterRoutinesByParameterType$4(SqlUtil.java:554)
...
It seems that calcite transform java array type into SqlTypeName.OTHER.
I have tryed to override method "createJavaType" in JavaTypeFactoryImpl like this:
private static class CustomJavaTypeFactoryImpl extends JavaTypeFactoryImpl
@Override
public RelDataType createJavaType(Class clazz)
if (clazz.isArray())
return new ArraySqlType(super.createJavaType(clazz.getComponentType()), true);
return super.createJavaType(clazz);
but it did not work.
Do Calcite support UDF with variable number parameter, and what should I do.
sql apache-calcite
When you say your changes tocreateJavaType
"did not work", what happened?
– Michael Mior
Mar 26 at 14:39
Still got "No match found for function signature testfunc", no matter how many parameters there are for testfunc. @MichaelMior
– Grady Yang
Mar 27 at 1:29
add a comment |
I'm using Apache Calcite to validate SQL. I add tables and UDFs dynamically.
The problem is when I add a UDF with variable number parameter, the validator can not find this function.
Version of Calcite is 1.18.0
And this is my code.
TestfuncFunction.java
public class TestfuncFunction
public String testfunc(String... arg0)
return null;
Add UDF
Function schemafunction = ScalarFunctionImpl.create(TestfuncFunction.class),"testfunc");
SchemaPlus schemaPlus = Frameworks.createRootSchema(true);
schemaPlus.add("testfunc", schemafunction);
SQL
select testfunc(field1, field2) from test_table
testfunc is a ScalarFunction with variable number parameter,field1 and field2 are columns of test_table. So this is a legal SQL. But I got this CalciteContextException when validating:
No match found for function signature testfunc(<CHARACTER>, <CHARACTER>)
I tryed to change my sql into one parameter like this:
select testfunc(field1) from test_table
and got this exception
java.lang.AssertionError: No assign rules for OTHER defined
at org.apache.calcite.sql.type.SqlTypeAssignmentRules.canCastFrom(SqlTypeAssignmentRules.java:386)
at org.apache.calcite.sql.type.SqlTypeUtil.canCastFrom(SqlTypeUtil.java:864)
at org.apache.calcite.sql.SqlUtil.lambda$filterRoutinesByParameterType$4(SqlUtil.java:554)
...
It seems that calcite transform java array type into SqlTypeName.OTHER.
I have tryed to override method "createJavaType" in JavaTypeFactoryImpl like this:
private static class CustomJavaTypeFactoryImpl extends JavaTypeFactoryImpl
@Override
public RelDataType createJavaType(Class clazz)
if (clazz.isArray())
return new ArraySqlType(super.createJavaType(clazz.getComponentType()), true);
return super.createJavaType(clazz);
but it did not work.
Do Calcite support UDF with variable number parameter, and what should I do.
sql apache-calcite
I'm using Apache Calcite to validate SQL. I add tables and UDFs dynamically.
The problem is when I add a UDF with variable number parameter, the validator can not find this function.
Version of Calcite is 1.18.0
And this is my code.
TestfuncFunction.java
public class TestfuncFunction
public String testfunc(String... arg0)
return null;
Add UDF
Function schemafunction = ScalarFunctionImpl.create(TestfuncFunction.class),"testfunc");
SchemaPlus schemaPlus = Frameworks.createRootSchema(true);
schemaPlus.add("testfunc", schemafunction);
SQL
select testfunc(field1, field2) from test_table
testfunc is a ScalarFunction with variable number parameter,field1 and field2 are columns of test_table. So this is a legal SQL. But I got this CalciteContextException when validating:
No match found for function signature testfunc(<CHARACTER>, <CHARACTER>)
I tryed to change my sql into one parameter like this:
select testfunc(field1) from test_table
and got this exception
java.lang.AssertionError: No assign rules for OTHER defined
at org.apache.calcite.sql.type.SqlTypeAssignmentRules.canCastFrom(SqlTypeAssignmentRules.java:386)
at org.apache.calcite.sql.type.SqlTypeUtil.canCastFrom(SqlTypeUtil.java:864)
at org.apache.calcite.sql.SqlUtil.lambda$filterRoutinesByParameterType$4(SqlUtil.java:554)
...
It seems that calcite transform java array type into SqlTypeName.OTHER.
I have tryed to override method "createJavaType" in JavaTypeFactoryImpl like this:
private static class CustomJavaTypeFactoryImpl extends JavaTypeFactoryImpl
@Override
public RelDataType createJavaType(Class clazz)
if (clazz.isArray())
return new ArraySqlType(super.createJavaType(clazz.getComponentType()), true);
return super.createJavaType(clazz);
but it did not work.
Do Calcite support UDF with variable number parameter, and what should I do.
sql apache-calcite
sql apache-calcite
asked Mar 26 at 3:28
Grady YangGrady Yang
11 bronze badge
11 bronze badge
When you say your changes tocreateJavaType
"did not work", what happened?
– Michael Mior
Mar 26 at 14:39
Still got "No match found for function signature testfunc", no matter how many parameters there are for testfunc. @MichaelMior
– Grady Yang
Mar 27 at 1:29
add a comment |
When you say your changes tocreateJavaType
"did not work", what happened?
– Michael Mior
Mar 26 at 14:39
Still got "No match found for function signature testfunc", no matter how many parameters there are for testfunc. @MichaelMior
– Grady Yang
Mar 27 at 1:29
When you say your changes to
createJavaType
"did not work", what happened?– Michael Mior
Mar 26 at 14:39
When you say your changes to
createJavaType
"did not work", what happened?– Michael Mior
Mar 26 at 14:39
Still got "No match found for function signature testfunc", no matter how many parameters there are for testfunc. @MichaelMior
– Grady Yang
Mar 27 at 1:29
Still got "No match found for function signature testfunc", no matter how many parameters there are for testfunc. @MichaelMior
– Grady Yang
Mar 27 at 1:29
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55349442%2fhow-to-add-a-udf-with-variable-number-parameter-in-calcite%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55349442%2fhow-to-add-a-udf-with-variable-number-parameter-in-calcite%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
When you say your changes to
createJavaType
"did not work", what happened?– Michael Mior
Mar 26 at 14:39
Still got "No match found for function signature testfunc", no matter how many parameters there are for testfunc. @MichaelMior
– Grady Yang
Mar 27 at 1:29