Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9157363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:59:47+00:00 2026-06-17T12:59:47+00:00

This wasn’t a problem in 0.9.2, but in 0.10, when I try to access

  • 0

This wasn’t a problem in 0.9.2, but in 0.10, when I try to access a key in a map that has a dollar sign in it, I get hammered with errors that I haven’t defined the variable. Specifically:

blah = FOREACH meh GENERATE source, json_post_id#'$id' AS post_id;

returns

Undefined parameter : id

That’s fine and makes sense, but when I amend it to:

blah = FOREACH meh GENERATE source, json_post_id#'\$id' AS post_id;

I get:

Unexpected character '$'

Ideas?

[Edit] Forgot to mention: have tried with 2 backslashes and 3 backslashes as well. No dice. [/Edit]

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:59:48+00:00Added an answer on June 17, 2026 at 12:59 pm
    1. Based on a response to your Mail Archive Posting, it looks like the behavior will be “different when using Grunt shell and running it as a script.”

      Input file

      cheolsoo@localhost:~/workspace/pig-svn $cat 1.txt $id,a
      

      Grunt shell

      The $ with no backslash works:

      grunt> A = LOAD '1.txt' USING PigStorage(',') AS (k:chararray,
      v:chararray); grunt> B = FOREACH A GENERATE TOMAP(k, v) AS M; grunt> C
      = FOREACH B GENERATE M#'$id'; grunt> DUMP C; (a)
      

      Script

      The $ with a single backslash works:

      cheolsoo@localhost:~/workspace/pig-svn $cat test.pig A = LOAD '1.txt' 
      USING PigStorage(',') AS (k:chararray, v:chararray); B = FOREACH A
      GENERATE TOMAP(k, v) AS M; C = FOREACH B GENERATE M#'\$id'; DUMP C;
      
      cheolsoo@localhost:~/workspace/pig-svn $./bin/pig -x local test.pig
      (a)
      
    2. Also, from Pig problem with split string(STRSPLIT), have you tried either of the following.

      • Correctly escaping the character u0024. Test single using single or double quotes to see if that makes a difference. This answer shows that the single quote makes a difference which you have but it’s worth mentioning.

      • Alternatively, although related, break the loop into a block.

        blah = FOREACH meh {
            GENERATE source, json_post_id#'$id' AS post_id; 
        }
        
    3. It looks like you are concatenating an id. Make sure you are not suppose to be using CONCAT(). http://pig.apache.org/docs/r0.10.0/func.html#concat

    4. According to the Class PigStorage documentation (Pig 0.10.0 API):

      A load function that parses a line of input into fields using a character delimiter. The default delimiter is a tab. You can specify any character as a literal (“a”), a known escape character (“\t”), or a dec or hex value (“\u001”, “\x0A”).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that this might seem like a strange question, but let me try
We have a query that's taking 3 hours to finish. This wasn't a problem
This is a problem i wasn't able to solve despite extensive searches on the
This wasn't the question I was going to ask but I have unexpectedly run
UPDATE: Perhaps this wasn't clear from my original post, but I'm mainly interested in
If this has been asked before, I apologize but this is kinda of a
I just started to get random This IP can't make requests for that application.
hope this wasn't asked already, but I can't find an answer. I got a
EDIT: My sincere apologies! This wasn't an issue with anything but myself - I
Coulda sworn this wasn't how it used to work, but with jquery my click

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.