hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xiaomeng Huang <armon.hu...@gmail.com>
Subject wrong result with CTAS(create table as select)
Date Wed, 21 Jun 2017 08:26:33 GMT
Hi, I missed a bug when use CTAS.

1.
hive> select 'test' as did from abc_test_old
    > where did = '5FCAFD34-C124-4E13-AF65-27B675C945CC' limit 1;
OK
test


2.
hive> create table abc_test_12345 as
    > select 'test' as did from abc_test_old
    > where did = '5FCAFD34-C124-4E13-AF65-27B675C945CC' limit 1;

hive> select did from abc_test_12345 limit 1;
OK
5FCAFD34-C124-4E13-AF65-27B675C945CC

why result is not 'test'?

3.
hive> explain
    > create table abc_test_12345 as
    > select 'test' as did from abc_test_old
    > where did = '5FCAFD34-C124-4E13-AF65-27B675C945CC' limit 1;
OK
STAGE DEPENDENCIES:
  Stage-1 is a root stage
  Stage-6 depends on stages: Stage-1 , consists of Stage-3, Stage-2, Stage-4
  Stage-3
  Stage-0 depends on stages: Stage-3, Stage-2, Stage-5
  Stage-7 depends on stages: Stage-0
  Stage-2
  Stage-4
  Stage-5 depends on stages: Stage-4

STAGE PLANS:
  Stage: Stage-1
    Map Reduce
      Map Operator Tree:
          TableScan
            alias: abc_test_old
            Statistics: Num rows: 32 Data size: 1152 Basic stats: COMPLETE
Column stats: NONE
            Filter Operator
              predicate: (did = '5FCAFD34-C124-4E13-AF65-27B675C945CC')
(type: boolean)
              Statistics: Num rows: 16 Data size: 576 Basic stats: COMPLETE
Column stats: NONE
              Select Operator
                Statistics: Num rows: 16 Data size: 576 Basic stats:
COMPLETE Column stats: NONE
                Limit
                  Number of rows: 1
                  Statistics: Num rows: 1 Data size: 36 Basic stats:
COMPLETE Column stats: NONE
                  Reduce Output Operator
                    sort order:
                    Statistics: Num rows: 1 Data size: 36 Basic stats:
COMPLETE Column stats: NONE
      Reduce Operator Tree:
        Select Operator
          expressions: '5FCAFD34-C124-4E13-AF65-27B675C945CC' (type: string)
          outputColumnNames: _col0
          Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE
Column stats: NONE
          Limit
            Number of rows: 1
            Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE
Column stats: NONE
            File Output Operator
              compressed: true
              Statistics: Num rows: 1 Data size: 36 Basic stats: COMPLETE
Column stats: NONE
              table:
                  input format:
org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
                  output format:
org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat
                  serde: org.apache.hadoop.hive.ql.io.orc.OrcSerde
                  name: default.abc_test_12345

why expressions is '5FCAFD34-C124-4E13-AF65-27B675C945CC' ?

Mime
View raw message