Support Questions

Find answers, ask questions, and share your expertise

Newline character as delimiter in Phoenix Bulk load


I have a requirement where i need to load all the columns of file in a single column in table. I am thinking to make newline as delimiter to insert all columns of file in a single column of Phoenix.

I tried various options to pass newline character as delimiter but none of it worked so far :

./ -d $'/n' -t POC.SINGLE_LINE /export/home/KBM_HOU/pkumar/test_newdelimiter.csv

./ -d $'//n' -t POC.SINGLE_LINE /export/home/KBM_HOU/pkumar/test_newdelimiter.csv

./ -d '/n' -t POC.SINGLE_LINE /export/home/KBM_HOU/pkumar/test_newdelimiter.csv

./ -d '//n' -t POC.SINGLE_LINE /export/home/KBM_HOU/pkumar/test_newdelimiter.csv

I am getting error of invalid single character.

Exception in thread "main" java.lang.IllegalArgumentException: Invalid single character: '//n' at org.apache.phoenix.util.PhoenixRuntime$ExecutionCommand.getCharacter( at org.apache.phoenix.util.PhoenixRuntime$ExecutionCommand.parseArgs( at org.apache.phoenix.util.PhoenixRuntime.main(

Could you let me know how to pass the newline character as the delimiter for any unix file in Phoenix bulk load process.


Hey @Prashant Kumar!
I'm not a specialist in Phoenix, but i made a search here, and it seems that you need to escape your /n (guess with \), otherwise Phoenix will throw an exception.

        private static char getCharacter(String s) {
            String unescaped = StringEscapeUtils.unescapeJava(s);
            if (unescaped.length() > 1) {
                throw new IllegalArgumentException("Invalid single character: '" + unescaped + "'");
            return unescaped.charAt(0);

Hope this helps! 🙂