Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-20722

HiveTableSink should copy the record when converting RowData to Row

    XMLWordPrintableJSON

Details

    Description

      Add the following test in TableEnvHiveConnectorITCase to reproduce the issue:

      	@Test
      	public void test() throws Exception {
      		TableEnvironment tableEnv = getTableEnvWithHiveCatalog();
      		tableEnv.executeSql("create table src1(key string, val string)");
      		tableEnv.executeSql("create table src2(key string, val string)");
      		tableEnv.executeSql("create table dest(key string, val string)");
      		HiveTestUtils.createTextTableInserter(hiveCatalog, "default", "src1")
      				.addRow(new Object[]{"1", "val1"})
      				.addRow(new Object[]{"2", "val2"})
      				.addRow(new Object[]{"3", "val3"})
      				.commit();
      		HiveTestUtils.createTextTableInserter(hiveCatalog, "default", "src2")
      				.addRow(new Object[]{"3", "val4"})
      				.addRow(new Object[]{"4", "val4"})
      				.commit();
      		tableEnv.executeSql("INSERT OVERWRITE dest\n" +
      				"SELECT j.*\n" +
      				"FROM (SELECT t1.key, p1.val\n" +
      				"      FROM src2 t1\n" +
      				"      LEFT OUTER JOIN src1 p1\n" +
      				"      ON (t1.key = p1.key)\n" +
      				"      UNION ALL\n" +
      				"      SELECT t2.key, p2.val\n" +
      				"      FROM src2 t2\n" +
      				"      LEFT OUTER JOIN src1 p2\n" +
      				"      ON (t2.key = p2.key)) j").await();
      	}
      

      Attachments

        Activity

          People

            lirui Rui Li
            lirui Rui Li
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: