Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-38208

'Column' object is not callable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.1.2, 3.2.1
    • 3.1.2
    • Deploy
    • None

    Description

      Hi guys, I have such simple dataframe and am trying to create one new column.

      That its schema:

       

      >>>> df_operation_event_sellers.schema 

      Out[69]: StructType(List(StructField(id,StringType,true),StructField(account_id,StringType,true),StructField(p_tenant_id,StringType,true),StructField(vendor_id,StringType,true),StructField(amount,DecimalType(38,18),true),StructField(operation_type,StringType,true),StructField(reference_id,StringType,true),StructField(date,TimestampType,true),StructField(carrier_id,StringType,true),StructField(account_number,StringType,true),StructField(data_source,StringType,true),StructField(entity,StringType,true),StructField(ingestion_date,DateType,true),StructField(event_type,StringType,false),StructField(amount_new,DecimalType(38,18),true),StructField(date_new,IntegerType,true),StructField(row_num,IntegerType,true)))

       

      >>> command to create the new column

      df_operation_event_sellers= df_operation_event_sellers.withColumn('flag_first_selling',when(col('row_num') == 1,'YES').instead('NO'))

      ISSUE >>>>>>>>>>>> TypeError: 'Column' object is not callable

       

      What is happing?

      ps. I created other columns the same way successfully

       

       

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            joycerecacho Joyce Arruda Recacho
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: