writing custom functions that use external java classes on Hive - hive

I've been thinking of how to do it in Hive.
For e.g. i've a specific field in a log file that I want to extract (this is already possible in Hive) and then I want to map this field's value to something else. This mapping is determiened by own customic business logic that is coded up in a Java Class.
How can I use this Java class in Hive?

You should follow the instructions here: UDF Information to create a User Defined Function which can be called like substr, count or length.

You will need to use
add jar myjar.jar;
in the hive script, just as you had done with the jar containing the UDF. I would recommend packaging them all up in a single jar.

Related

How to set custom name, suffix for mapper files and interfaces in mybatis generator?

Can you set custom suffix and naming rule mapper xml and interfaces in MyBatis Generator (MBG)?
For example, When generating mapper files for class Book. MBG generates mapper file BookMapper.xml and interface PartnerDao.java. However, I wish to change the suffix to something else, like BookMapperBase.xml or BookDaoBase.xml, and PartnerMapperBase.java or PartnerDaoBase.java.
The reason is, former colleagues were using BookMapper.xml for their hand-written sql statements and using the same name would cause confusion. Moreover, I do not wish to use generated mappers directly, but use custom mapper files that extend BookMapperBase.xml.
I have searched online and found some github projects and hot rod ORM, but is it really not supported by official Mybatis Generator? If not, what is your recommended alternative?
There are a couple of options.
You could use a domain object renaming rule as documented here: http://www.mybatis.org/generator/configreference/domainObjectRenamingRule.html
If that doesn't work the way you want it to, you could write a MyBatis Generator plugin to change the names of the generated artifacts. There is an example here: https://github.com/mybatis/generator/blob/master/core/mybatis-generator-core/src/main/java/org/mybatis/generator/plugins/RenameExampleClassPlugin.java

generate programmatically text-symbols with ABAP

I've created a program with FM: TR_TADIR_POPUP_ENTRY_E071. I am trying to generate at the same time text-symbols for this program.
Any ideas how to do that?
I think there's no standard interface for that. Check the ABAP statement INSERT TEXTPOOL. Documentation is placed here.
Before anything I recommend you to manually create a local program with text-symbols and in another program read the texts with READ TEXTPOOL command to see what's the data structure. In that way you can build up the input data.
SAPLINK uses this technique also.

How can i add custom expression functions for Live templates in Intellij

How can add new custom functions for Live Templates in Idea Intellij.
For example i need a custom function which can convert a live template variable from Camel Case to Spaced.
i.e in Live Template on variable has to be inserted at multiple places with & without space.
Eg. "MyVar" and "My Var". So i want to insert an expression to convert 'MyVar' to 'My Var'.
No expression available by default can be used for this.
Thanks.
There is OpenAPI for providing Live Template functions. One can create IntelliJ IDEA plug-in that will add more functions.
See the Macro abstract class. Plug-in should define extension point, like this one:
<liveTemplateMacro implementation="com.intellij.codeInsight.template.macro.CapitalizeMacro"/>
Search IntelliJ IDEA Community code base for sample implementations.

using external modules in Fortran

I try to use two external Fortran module which are in same name (in this case mod_param). So, when i try to compile my code, the compiler gives the following error,
mod_param.o: In function mod_param._':
mod_param.f90:(.text+0x0): multiple definition ofmod_param._'
mod_param.o:mod_param.F90:(.text+0x0): first defined here
is there any way to solve it without renaming the one of the module file and its name? I don't prefer the renaming because the external modules are maintained by someone else and i don't want to play with them. Is there any special use statement to do that?
No. It is necessary to change the function name in the source code in at least one of the modules.
Since the code is being maintained by someone else, consider automating the renaming: perhaps the project Makefile can run a sed script which changes the function names. So that the dependencies are clear, be sure to make the output of the sed script a new file name which is used to be compiled—the virgin module would have a filename which is not compiled or linked into the project.
Even if it were somehow possible to link them both in with the same name, how would you control which was called with the name?
According to F2003 standard module names are global entities and must be unique in a program, with some exteptions for intrinsic modules.
So, that would be a no (Besides, how would you tell them apart were they of the same name?)

Scala and sbt: Storing SQL in a resource

I'd like to store a database schema in its own file, and have my Scala code retrieve it (and execute it via JDBC).
It seems to me that sbt wants me to store the file as: src/main/resources/packagename/my.sql. Putting it there, I see it's in the jar - but I can't seem to access it from Scala.
Specifically, getClass().getResource("my.sql") returns a null pointer, and so does any other form I can think of.
How should I load the file? Or is there a better way to do it?
I had an almost identical problem.
The only difference is my file is in src/main/resources (without any packages).
This worked for me.
val is:InputStream = Github.getClass().getResourceAsStream( "/repo.json" );
Why don't you generate a file, and store it as "my.sql", and later search for it, where it appears in the filesystem?