[
https://issues.apache.org/jira/browse/TRAFODION-2637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16063966#comment-16063966
]
ASF GitHub Bot commented on TRAFODION-2637:
-------------------------------------------
Github user DaveBirdsall commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/1141#discussion_r124145650
--- Diff:
core/sql/lib_mgmt/src/main/java/org/trafodion/libmgmt/SyncLibUDF.java ---
@@ -0,0 +1,170 @@
+/**
+* @@@ START COPYRIGHT @@@
+*
+* 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.
+*
+* @@@ END COPYRIGHT @@@
+ */
+package org.trafodion.libmgmt;
+
+import java.io.File;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+
+import org.trafodion.sql.udr.UDR;
+import org.trafodion.sql.udr.UDRInvocationInfo;
+import org.trafodion.sql.udr.UDRPlanInfo;
+import org.trafodion.sql.udr.UDRException;
+
+public class SyncLibUDF extends UDR {
+
+ // default constructor
+ public SyncLibUDF()
+ {}
+
+ @Override
+ public void describeParamsAndColumns(UDRInvocationInfo info)
+ throws UDRException
+ {
+ // this TMUDF takes no table-valued inputs, two string
+ // parameters, and generates a table with a single integer
+ // value. It assumes that it was created with the following
+ // DDL, without specifying parameters or return values:
+ //
+ // create table_mapping function SyncLibUDF()
+ // external name 'org.trafodion.libmgmt.SyncLibUDF'
+ // library ...;
+ //
+ // The call is like this: select ... from
udf(synclibudf(<op>,<file>))
+ //
+ // <op> is 'c' to create/copy a file from the HDFS staging area for
+ // the current user into a local file on every node, or
+ // 'd' to delete/drop a local file on every node
+ // <file> is an unqualified file name (no '/' in the name)
+ //
+ // Example:
+ //
+ // select * from udf("_LIBMGR_".synclibudf('c', 'mylib.jar'));
+ //
+ // INSTANCE_NUM
+ // ------------
+ //
+ // 0
+ // 1
+ //
+ // --- 2 row(s) selected.
+ // >>
+
+
+ if (info.par().getNumColumns() != 2)
+ throw new UDRException(38970, "This UDF needs to be called
with two input parameters");
+ if (info.getNumTableInputs() > 0)
+ throw new UDRException(38971, "This UDF needs to be called
without table-valued inputs");
+
+ for (int i=0; i<2; i++)
+ info.addFormalParameter(info.par().getColumn(i));
+ info.out().addIntColumn("INSTANCE_NUM", false);
+ }
+
+ @Override
+ public void describeDesiredDegreeOfParallelism(UDRInvocationInfo info,
+ UDRPlanInfo plan)
+ throws UDRException
+ {
+ boolean usesVirtualNodes = false;
+
+ // check for configurations with virtual nodes. Run the UDF
serially
+ // in those cases, since all the virtual nodes share the same node.
--- End diff --
This is an interesting bit of smarts. Is it universal among our system
UDFs? I wonder too about our optimizer: does it reduce DoP when we run on
virtual nodes?
> Library management in the absence of password-less ssh
> ------------------------------------------------------
>
> Key: TRAFODION-2637
> URL: https://issues.apache.org/jira/browse/TRAFODION-2637
> Project: Apache Trafodion
> Issue Type: Bug
> Components: sql-general
> Affects Versions: 2.1-incubating
> Reporter: Hans Zeller
> Assignee: Hans Zeller
> Fix For: 2.2-incubating
>
>
> We have a set of built-in stored procedures that can be used to deploy
> libraries for UDRs to a Trafodion cluster. Some of these stored procedures
> rely on the pdsh command, which in turn relies on password-less ssh between
> the nodes of a cluster. Some installations, however, don't support
> password-less ssh. We therefore need to find another method to distribute the
> files.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)