Apache Pig: Syntax error with 'DUMP' in macro definition - java

I encountered an interesting problem with macro definition in pig. Here's the code:
DEFINE Func(src) RETURNS dst{
$dst = GROUP $src ALL;
DUMP $dst;
}
raw = LOAD 'data';
grp = Func(raw);
And when execute those codes in grunt shell, there will be an error:
ERROR 1200:... Failed to parse macro 'Func'. Reason:... Syntax error, unexpected symbol at or near 'DUMP'
But, where did I make the mistake? O.O

I found that someone has already reported the bug(if we call that a bug: link) a long time ago, but it seems the Pig developing team is not planing to solve that. :(

Related

Rascal: Undeclared Annotation in std:///lang/java/flow/JavaToObjectFlow.rsc

In the following code snippet, I attempted to use the createOFG from JavaToObjectFlow.rsc:
void run(loc source) {
m = createM3FromEclipseProject(source);
set[Declaration] asts = createAstsFromEclipseProject(source, true);
FlowProgram p = createOFG(asts);
}
Upon executing this method, the following error was received:
|std:///lang/java/flow/JavaToObjectFlow.rsc|(4167,1,<153,26>,<153,27>):
Undeclared annotation: decl on Expression
Advice: |http://tutor.rascal-
mpl.org/Errors/Static/UndeclaredAnnotation/UndeclaredAnnotation.html|
Since the error is coming from std:///lang/java/flow/JavaToObjectFlow.rsc and none of our fellow students receive the same error, I am wondering what is going wrong. The error occurs in both the stable and unstable versions of Rascal.
you should be on unstable, as this message points to a known problem on stable.
are you sure you get exactly the same message on unstable? in that case, please tell me what you see on that line (153 of file /lang/java/flow/JavaToObjectFlow.rsc)
If you don't have a source location to click on to get you there, you can always browse the code from any rascal project:

Error when using xlsx package in write.xlsx

I am trying to save a file using write.xslx (when saving with write.csv some row got shift in more columns so I am trying to save the file as xlsx directly).
If I type this command:
write.xlsx (old.data, file ="Documents/new.xlsx", sheetName="Sheet1",col.names=TRUE, row.names=TRUE, append=FALSE)
or
write.xlsx (old.data, "Documents/new.xlsx", sheetName="Sheet1",col.names=TRUE, row.names=TRUE, append=FALSE)
I get this error:
Error in .jnew("org/apache/poi/xssf/usermodel/XSSFWorkbook") :
Java Exception <no description because toString() failed>.jnew("org/apache/poi/xssf/usermodel/XSSFWorkbook")<S4 object of class "jobjRef">
Can anyone help me sort it out?
I don't think that this question can easily be answered. Is <working_directory>/Documents writeable to you? Can you create the file
write.xlsx ( data.frame( a = 1:10, row.names = letters[ 1:10 ] ), "Documents/new.xlsx", sheetName="Sheet1",col.names=TRUE, row.names=TRUE, append=FALSE)
If this works, but with old.data it doesn't you have to provide a reproducible example.
However, I experienced every here and again weird problems with the xlsx package. From my experience XLConnect is much more robust and bug-free:
library("XLConnect")
writeWorksheetToFile( "Documents/newxlsx", old.data, "Sheet1", header=TRUE, rownames = "rownames.header" )
write_xlsx() from the writexl package works great for me and is way faster! It also works fine with tibbles and does not have the annoying errors or resctrictions from the xlsxpackage. It is also completely written in C so no Java, Perl or Rtools are required.
For more info see https://ropensci.org/technotes/2017/09/08/writexl-release/
I just had this same problem. I think there might be a bug with openXL but I love working with it. So I open and close R and then change the wd, saved the file exactly where the wd was and then I run the exact same code again. It worked.
Today I had that problem after deployment.
At this moment I didn't need to change package and stick to xlsx
I updated dplyr, xlsx, and the one that did the trick was updating rjava.
Since it was a conflict with java and xlsx calls it, I gave it a shot.
Hope this work for you too

RegisterNatives failed for 'android/webkit/BrowserFrame'

Building a ROM from source, but stuck at a point. I have understood the error but have no idea exactly what should the fix be.
ROM stucks on boot and I see this
E/dalvikvm( 353): ERROR: couldn't find native method
E/dalvikvm( 353): Requested: Landroid/webkit/BrowserFrame;.nativeAddJavascriptInterface:(ILjava/lang/Object;Ljava/lang/String;)V
E/dalvikvm( 353): Candidate: Landroid/webkit/BrowserFrame;.nativeAddJavascriptInterface:(ILjava/lang/Object;Ljava/lang/String;Z)V
E/JNIHelp ( 353): RegisterNatives failed for 'android/webkit/BrowserFrame', aborting
From the error, what is requested in that method is (ILjava/lang/Object;Ljava/lang/String;)V but what being provided is (ILjava/lang/Object;Ljava/lang/String;Z)V
Difference lies in that Z
Can anyone think of a solution for that method in BrowserFrame.java ? or any other workaround?
The additional argument was added late last year, in a pair of changes:
https://android.googlesource.com/platform/frameworks/base/+/94740e6c333a109be7516abbd17dd418f23b4f0c
https://android.googlesource.com/platform/external/webkit/+/f2d8c5bed31609d7d6e3ae77f33e90ea7f888eb3
It sounds like you have the change from frameworks/base, but not the corresponding change from external/webkit.

LD_DEBUG and java

When I set LD_DEBUG=files and run my Java program, I found many errors like this:
/linux/depot/java-1.6.0_16_32/jre/lib/i386/libjava.so: error: symbol lookup error: undefined symbol: Java_sun_java2d_loops_MaskBlit_MaskBlit (fatal)
This info is horrifying, but obviously my program runs OK. Can anyone tell me why this happens?
It's not horrifying; it's what happens when you build code to run on a lot of different platforms. It's just the jvm looking for optional symbols. In this case, something to do with 2D and alpha compositing. There is an alternate code path that is taken if the symbol is not found at runtime. You can think of it as a sort of reflection for libraries.
The jvm code goes something like this:
TYPE fptr = CAST_TO_FN_PTR(TYPE, dlsym(RTLD_DEFAULT, symbol));
if (fptr != NULL) {
// Do something different because this platform supports 'symbol'
}

Problem with ImageTools plugin in Grails

i have a grails project with an Image Domain Class and Controller.
I just installed the grails ImageTools 1.0.4 Plugin and i would like to generate thumbnails for images wich will be uploaded.
My Image-Domain-Class:
class Image {
byte[] data
//String name
byte[] thumbnail
static constraints = {
//name()
data()
}
}
The "safe"-action in my Controller:
def save = {
def imageInstance = new Image(params)
def imageTool = new ImageTool()
imageTool.load(imageInstance.data)
imageTool.thumbnail(320)
imageInstance.thumbnail = imageTool.getBytes("JPEG") //Here is my problem!
if(!imageInstance.hasErrors() && imageInstance.save()) {
flash.message = "Image ${imageInstance.id} created"
redirect(action:show,id:imageInstance.id)
}
else {
render(view:'create',model:[imageInstance:imageInstance])
}
}
When I start my Grails-application and uploading an image I'm getting the following error-message:
Error 200: groovy.lang.MissingMethodException: No signature of method: ImageTool.getBytes() is applicable for argument types: (java.lang.String) values: {"JPEG"}
Servlet: grails
URI: /grailsproject/grails/image/save.dispatch
Exception Message: No signature of method: ImageTool.getBytes() is applicable for argument types: (java.lang.String) values: {"JPEG"}
Caused by: groovy.lang.MissingMethodException: No signature of method: ImageTool.getBytes() is applicable for argument types: (java.lang.String) values: {"JPEG"}
Class: GrailsAuthenticationProcessingFilter
At Line: [57]
It says that the Method getBytes() is missing but the method is still available. My IDE intelliJ also recognizes no errors.
So what can I do? Could someone help me please?
Sorry for my bad english. If you are german, please look at http://support-network.info/board/problem-mit-imagetools-getbytes-t3008.html .
I use Grails 1.0.4.
I could fix this error message. I just copied the getBytes() method from the git Repository of Ricardo (the plugin developer) and replaced the old one with the new one. Now everything works! I don't know where the bug was but i'm happy that i solved it.
Thank you both very much!
Looks like that method is a fairly new addition to the class (3/6/2009). If you have verified that that method is in the ./plugins/imagetools/src/groovy/ImageTool.groovy file I'd recommend running:
grails clean
If you had been using this plugin prior it might be a cache problem.
The reply that you received from John sounds about right - if you have installed the new plugin and can see the code, but keep getting this error only outside IntelliJ, you should try cleaning your grails cache - it's very possible that an older copy of the plugin is precompiled on the cache.
Are you using Grails 1.1? I haven't yet tested it with the latest grails, but I understand it keeps the plugins not under the project but in a separate directory. Do let me know and I'll try it out.
I don't know what the plugin is really giving you over using JAI directly, IMHO it isn't doing much.
I use ImageMagick out of process for my image conversion and the results are superior to what can be done with JAI from what I have seen. Of course if your doing as much traffic as Amazon running out of process is not an option, however if you need to get to revenue as quickly as possible then you might want to consider what I've done.
I use apache-commons-exec to have a nice interface around handling opening an external process and reading data from std in and out. The only thing I'm using JAI for is to read the sizes of images.
try this one http://support-network.info/board/gel%C3%B6st-problem-mit-imagetools-getbytes-t3008.html

Categories