-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ASTERIXDB-2157] Parsing metadata of UDF with UnorderedList return type
changes from #6 Change-Id: Ie9e7795d9c8c212e9610dcb9bb5d26ec9fbbee8b Reviewed-on: https://asterix-gerrit.ics.uci.edu/2211 Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Contrib: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Reviewed-by: Till Westmann <[email protected]>
- Loading branch information
1 parent
f125348
commit 62feff1
Showing
2 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...src/test/java/org/apache/asterix/metadata/functions/ExternalFunctionCompilerUtilTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.asterix.metadata.functions; | ||
|
||
import java.util.LinkedList; | ||
|
||
import org.apache.asterix.common.transactions.TxnId; | ||
import org.apache.asterix.metadata.MetadataTransactionContext; | ||
import org.apache.asterix.metadata.entities.Function; | ||
import org.apache.asterix.om.types.AUnorderedListType; | ||
import org.apache.asterix.om.types.BuiltinType; | ||
import org.apache.asterix.om.types.IAType; | ||
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
public class ExternalFunctionCompilerUtilTest { | ||
@Test | ||
public void test() throws AlgebricksException { | ||
// given | ||
MetadataTransactionContext txnCtx = new MetadataTransactionContext(new TxnId(1)); | ||
Function function = | ||
new Function("test", "test", 0, new LinkedList<>(), "{{ASTRING}}", "", "JAVA", "SCALAR", null); | ||
|
||
// when | ||
ExternalScalarFunctionInfo info = | ||
(ExternalScalarFunctionInfo) ExternalFunctionCompilerUtil.getExternalFunctionInfo(txnCtx, function); | ||
IAType type = info.getResultTypeComputer().computeType(null, null, null); | ||
|
||
// then | ||
IAType expectedType = new AUnorderedListType(BuiltinType.ASTRING, "AUnorderedList"); | ||
Assert.assertEquals(expectedType, info.getReturnType()); | ||
Assert.assertEquals(expectedType, type); | ||
} | ||
} |