public String getOption(String key) { return options.get(key); }
public String getOption(String key, String defaultValue) { return options.get(key, defaultValue); }
public String getProperty(String key) { return propertySet.get(key); }
public String getProperty(String key, String defaultValue) { return propertySet.get(key, defaultValue); }
public String getProperty(String key) { return this.properties.get(key); }
public String getProperty(String key) { return this.properties.get(key); }
public String get(String key) { return get(key, null); }
public String get(String key) { return get(key, null); }
public boolean getBool(String key, Boolean defaultVal) { if (containsKey(key)) { String strVal = get(key, null); return strVal != null && strVal.equalsIgnoreCase(TRUE_STR); } else if (defaultVal != null) { return defaultVal; } else { return false; } }
public long getLong(String key, Long defaultVal) { if (containsKey(key)) { String strVal = get(key, null); return Long.parseLong(strVal); } else if (defaultVal != null) { return defaultVal; } else { throw new IllegalArgumentException("No such a config key: " + key); } }
public long getLong(String key, Long defaultVal) { if (containsKey(key)) { String strVal = get(key, null); return Long.parseLong(strVal); } else if (defaultVal != null) { return defaultVal; } else { throw new IllegalArgumentException("No such a config key: " + key); } }
public int getInt(String key, Integer defaultVal) { if (containsKey(key)) { String strVal = get(key, null); return Integer.parseInt(strVal); } else if (defaultVal != null) { return defaultVal; } else { throw new IllegalArgumentException("No such a config key: " + key); } }
public boolean getBool(String key, Boolean defaultVal) { if (containsKey(key)) { String strVal = get(key, null); return strVal != null && strVal.equalsIgnoreCase(TRUE_STR); } else if (defaultVal != null) { return defaultVal; } else { return false; } }
public int getInt(String key, Integer defaultVal) { if (containsKey(key)) { String strVal = get(key, null); return Integer.parseInt(strVal); } else if (defaultVal != null) { return defaultVal; } else { throw new IllegalArgumentException("No such a config key: " + key); } }
public float getFloat(String key, Float defaultVal) { if (containsKey(key)) { String strVal = get(key, null); try { if (Float.MAX_VALUE < Double.parseDouble(strVal)) { throw new IllegalStateException("Parsed value is overflow in float type"); } return Float.parseFloat(strVal); } catch (NumberFormatException nfe) { throw new IllegalArgumentException("No such a config key: " + key); } } else if (defaultVal != null) { return defaultVal; } else { throw new IllegalArgumentException("No such a config key: " + key); } }
public float getFloat(String key, Float defaultVal) { if (containsKey(key)) { String strVal = get(key, null); try { if (Float.MAX_VALUE < Double.parseDouble(strVal)) { throw new IllegalStateException("Parsed value is overflow in float type"); } return Float.parseFloat(strVal); } catch (NumberFormatException nfe) { throw new IllegalArgumentException("No such a config key: " + key); } } else if (defaultVal != null) { return defaultVal; } else { throw new IllegalArgumentException("No such a config key: " + key); } }
public void init() throws MissingTablePropertyException, InvalidTablePropertyException { hbaseTableName = tableProperty.get(HBaseStorageConstants.META_TABLE_KEY); String delim = tableProperty.get(HBaseStorageConstants.META_ROWKEY_DELIMITER, "").trim(); if (delim.length() > 0) { rowKeyDelimiter = delim.charAt(0); String columnMapping = tableProperty.get(HBaseStorageConstants.META_COLUMNS_KEY, ""); if (columnMapping == null || columnMapping.isEmpty()) { throw new MissingTablePropertyException(HBaseStorageConstants.META_COLUMNS_KEY, hbaseTableName);
public void init() throws MissingTablePropertyException, InvalidTablePropertyException { hbaseTableName = tableProperty.get(HBaseStorageConstants.META_TABLE_KEY); String delim = tableProperty.get(HBaseStorageConstants.META_ROWKEY_DELIMITER, "").trim(); if (delim.length() > 0) { rowKeyDelimiter = delim.charAt(0); String columnMapping = tableProperty.get(HBaseStorageConstants.META_COLUMNS_KEY, ""); if (columnMapping == null || columnMapping.isEmpty()) { throw new MissingTablePropertyException(HBaseStorageConstants.META_COLUMNS_KEY, hbaseTableName);
@Test public final void testCtasWithOptions() throws Exception { ResultSet res = executeFile("CtasWithOptions.sql"); res.close(); ResultSet res2 = executeQuery(); resultSetToString(res2); res2.close(); TableDesc desc = client.getTableDesc(IdentifierUtil.normalizeIdentifier(res2.getMetaData().getTableName(1))); assertNotNull(desc); assertTrue("TEXT".equalsIgnoreCase(desc.getMeta().getDataFormat())); KeyValueSet options = desc.getMeta().getPropertySet(); assertNotNull(options); assertEquals(StringEscapeUtils.escapeJava("\u0001"), options.get(StorageConstants.TEXT_DELIMITER)); }
@Test public final void testCreateTableDef() throws TajoException { QueryContext qc = createQueryContext(); Expr expr = sqlAnalyzer.parse(CREATE_TABLE[0]); LogicalNode plan = planner.createPlan(qc, expr).getRootBlock().getRoot(); LogicalRootNode root = (LogicalRootNode) plan; assertEquals(NodeType.CREATE_TABLE, root.getChild().getType()); CreateTableNode createTable = root.getChild(); Schema def = createTable.getTableSchema(); assertEquals("name", def.getColumn(0).getSimpleName()); assertEquals(Type.TEXT, def.getColumn(0).getDataType().getType()); assertEquals("age", def.getColumn(1).getSimpleName()); assertEquals(Type.INT4, def.getColumn(1).getDataType().getType()); assertEquals("earn", def.getColumn(2).getSimpleName()); assertEquals(Type.INT8, def.getColumn(2).getDataType().getType()); assertEquals("score", def.getColumn(3).getSimpleName()); assertEquals(Type.FLOAT4, def.getColumn(3).getDataType().getType()); assertTrue("TEXT".equalsIgnoreCase(createTable.getStorageType())); assertEquals("file://tmp/data", createTable.getUri().toString()); assertTrue(createTable.hasOptions()); assertEquals("\\u007c", createTable.getOptions().get("text.delimiter")); }