Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INSERT INTO ... SELECT ... doesn't work using column positions in Lingual 1.1 #24

Open
alexanderdean opened this issue Apr 25, 2014 · 1 comment

Comments

@alexanderdean
Copy link

In SQL, INSERT INTO ... SELECT ... happily works without column aliases, using column positions. This doesn't work in Lingual 1.1:

Lingual 1.1

#!/bin/bash

# Config
hdfs_path=/local/lingual-alias-test/
hbase_table=out
hbase_col_family=fields
export LINGUAL_PLATFORM=hadoop
export HADOOP_USER_NAME=hadoop

# Test data
printf "\n1\ta\n2\tb\n3\tc\n" > /tmp/alias.tsv
hadoop fs -copyFromLocal /tmp/alias.tsv "${hdfs_path}alias.tsv"

# Lingual 1.1
lingual catalog --init
lingual catalog --provider --add cascading:cascading-hbase:2.2.0:provider
lingual catalog --schema IN --add
lingual catalog --schema IN --stereotype TSVFILE -add \
--columns A,B \
--types   string,string
lingual catalog --schema IN --table IN --stereotype TSVFILE -add "${hdfs_path}" --format tsv
lingual catalog --schema OUT --add
lingual catalog --schema OUT --protocol hbase --add --provider hbase
lingual catalog --schema OUT --stereotype HTABLE -add \
--columns C,D \
--types   string,string
lingual catalog --schema OUT --format hbase --add --properties="family=${hbase_col_family}" --provider hbase
lingual catalog --schema OUT --table OUT --stereotype HTABLE -add "${hbase_table}" --protocol hbase --format hbase --provider hbase

# Doesn't work
lingual shell --sql - <<- EOQ
    INSERT INTO "OUT"."OUT"
        select *
        from "IN"."IN";
    SELECT * from "OUT"."OUT";
EOQ

# Doesn't work
lingual shell --sql - <<- EOQ
    INSERT INTO "OUT"."OUT"
        select
            A,
            B
        from "IN"."IN";
EOQ

Error output in both cases:

{utcTimestamp=1398423862581, currentTimestamp=1398423862581, localTimestamp=1398423862581, timeZone=sun.util.calendar.ZoneInfo[id="Etc/UTC",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]}
Warning: exception while executing query: could not build flow from assembly: [[HBaseScheme[['C', 'D' ...][cascading.hbase.HBaseFactory.createScheme(HBaseFactory.java:120)] unable to resolve scheme sink selector: [{1}:'C'], with incoming: [{2}:'A', 'B' | String, String]]: [HBaseScheme[['C', 'D' ...][cascading.hbase.HBaseFactory.createScheme(HBaseFactory.java:120)] unable to resolve scheme sink selector: [{1}:'C'], with incoming: [{2}:'A', 'B' | String, String]: could not select fields: [{1}:'C'], from: [{2}:'A', 'B' | String, String] (state=,code=0)
Error: exception while executing query (state=,code=0)

Postgres

CREATE TABLE int (
a text NOT NULL,
b text NOT NULL
);

CREATE TABLE outt (
c text NOT NULL,
d text NOT NULL
);

insert into int values ('1', 'a'), ('2', 'b');

insert into outt select * from int -- works

insert into outt select a, b from int -- also works
@alexanderdean alexanderdean changed the title INSERT ... SELECT ... doesn't work without aliases in Lingual 1.1 INSERT ... SELECT ... doesn't work using column positions in Lingual 1.1 Apr 25, 2014
@alexanderdean alexanderdean changed the title INSERT ... SELECT ... doesn't work using column positions in Lingual 1.1 INSERT INTO ... SELECT ... doesn't work using column positions in Lingual 1.1 Apr 25, 2014
@alexanderdean
Copy link
Author

Most likely the explanation is the same as #22 so we can close...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant