epam/parso

Accessing SasFileConstants from Scala

billstephens opened this issue · 4 comments

I'm leveraging Parso to enable import of sas7bdat file into my Scala-based application.

In order to definitively identify Date columns, it appears that I need to find Columns where type = "java.lang.Number" and format is in either SasFileConstants.DATE_FORMAT_STRINGS or SasFileConstants.DATE_TIME_FORMAT_STRINGS.

Unfortunately, SasFileConstants is not a public class/interface making it inaccessible outside of the com.epam.parso.impl package.

It would be great if you could add public visibility to SasFileConstants or add some public convenience methods to allow users to distinguish numbers from date/datetime.

Thanks,
Bill

Hi Bill, just curious - is it possible for you to use metadata to define dates?
Igor

Igor, I'm using the column metadata from SasFileReader.getColumns() to determine the type and format of the column data. I'm seeing Dates and Datetimes returned as Number class, so I'm attempting to use the format to identify dates.

I read through SasFileReaderUnitTest.java and did not see any example of processing Dates at all.

Is there another way to do this?

OK. It's clear from SasFileParser.processSubheader() that I'm only going to get Number or String types from Parso for column types:
columnsTypesList.add(vars.get(2)[0] == 1 ? Number.class : String.class);

So, back to my original question. My only options are:

  1. add public visibility to SasFileConstants
  2. add public methods to determining if format is a Date or Datetime
  3. I copy DATE_FORMAT_STRINGS and DATE_TIME_FORMAT_STRINGS into my code and write my own methods.

Visibility of SasFileConstants changed to public.