Uploaded image for project: 'Apache Trafodion (Retired)'
  1. Apache Trafodion (Retired)
  2. TRAFODION-3307

emptyasempty option in map file not work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.4
    • 2.4
    • db-utility-odb
    • None

    Description

      In odb, user can write a map to determine an empty string should be treated as null or empty. However, this feature not work as expected.

      For example, I have a table, a map file and a data file as below(you can also refer to attached file):
      >>>table:
      create table testemp(id int, c1 char(20) not null, c2 char(20));
      >>>map:
      ID:1
      C1:2:emptyasempty
      C2:3
      >>>data
      1,,abc
      2,,def

      Then run odb cmd to load the data, the expected result is all data should be loaded, the atcual result is as below:

      odb.exe -d 14d4 -u trafodion -p traf123 -l src=testdata.txt:tgt=testemp:map=testmap.txt
      odb [2019-04-18 16:15:17]: starting ODBC connection(s)... 0
      Connected to Trafodion
      [0] odb [Oloadbuff(10212)] - Error loading row 1 (State: 23000, Native 0)
      [TRAF][Trafodion ODBC Driver] General error. Null Value in a non nullable column. Row: 1 Column: 2

      the emptyasempty option does not work as expected:

      odb.exe -d 14d4 -u trafodion -p traf123 -l src=testdata.txt:tgt=testemp:map=testmap.txt:show
      odb [2019-04-18 16:16:18]: starting ODBC connection(s)... 0
      Connected to Trafodion
      Record number 1:
      COL# COLUMN_NAME ODBC_DATA_TYPE DISP_SZ DEC NULL FLD_LEN [FLD_VALUE]
         0 ID SQL_INTEGER 11 0 YES 1 [1]
         1 C1 SQL_CHAR 20 0 NO - [(null)]
         2 C2 SQL_CHAR 20 0 YES 3 [abc]
      Record number 2:
      COL# COLUMN_NAME ODBC_DATA_TYPE DISP_SZ DEC NULL FLD_LEN [FLD_VALUE]
         0 ID SQL_INTEGER 11 0 YES 1 [2]
         1 C1 SQL_CHAR 20 0 NO - [(null)]
         2 C2 SQL_CHAR 20 0 YES 3 [def]
      odb [2019-04-18 16:16:20]: exiting. Session Elapsed time 2.164 seconds (00:00:02.164)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              sujinpei 苏锦佩
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m