Open alexanderdean opened 10 years ago
The issue isn't related to aliasing of the columns but the combination of swapping the column orders and having a file that doesn't match the definitions (the first line is blank but the table is defined as strictly delimited)
The following code shows this:
#!/bin/bash
# Config
in_table="/local/in/alias.dat"
out_table="/local/out/results.dat"
export LINGUAL_PLATFORM=hadoop
export HADOOP_USER_NAME=hadoop
# Test data
printf "A:string,B:string\n1,a\n2,b\n3,c\n" > /tmp/alias.dat
hadoop fs -copyFromLocal /tmp/alias.dat "${in_table}"
# Lingual 1.1
lingual catalog --init
lingual catalog --schema IN --add
lingual catalog --schema IN --stereotype MYTABLE -add \
--columns A,B \
--types string,string
lingual catalog --schema IN --table IN --stereotype MYTABLE -add "${in_table}"
lingual catalog --schema OUT --add
lingual catalog --schema OUT --stereotype MYTABLE -add \
--columns A,B \
--types string,string
lingual catalog --schema OUT --table OUT --stereotype MYTABLE -add "${out_table}"
#this works
lingual shell --sql - <<- EOQ
INSERT INTO "OUT"."OUT"
select
A as B,
B as A
from "IN"."IN";
EOQ
#this fails
lingual shell --sql - <<- EOQ
INSERT INTO "OUT"."OUT"
select
B as B,
A as A
from "IN"."IN";
EOQ
#this fails
lingual shell --sql - <<- EOQ
INSERT INTO "OUT"."OUT"
select
B as A,
A as B
from "IN"."IN";
EOQ
Okay, thanks, let's close.
Re-opening since my comment was just to clarify the source of the issue and the test case to reproduce.
Ah okay, thanks
There's an issue with the execution plan that gets created when the order is changed in this INSERT INTO ... SELECT example. This is a bug to resolve but we do not have an ETA for the fix.
np, thanks for letting me know
Test script:
Error is: